diff --git a/e107_plugins/pm/languages/English.php b/e107_plugins/pm/languages/English.php index cffeae8d9..6baa7deb9 100755 --- a/e107_plugins/pm/languages/English.php +++ b/e107_plugins/pm/languages/English.php @@ -65,6 +65,7 @@ define('LAN_PM_61', "No subject"); define('LAN_PM_62', "File: [{FILENAME}] exceeds size limit - not attached"); define('LAN_PM_63', "class:"); define('LAN_PM_64', 'ERROR: You are not permitted to block messages from site administrators'); +define('LAN_PM_65', 'ERROR: Nothing to send'); define("LAN_PM_100", "New PM from "); define("LAN_PM_101", "You have received a new Private Message from "); diff --git a/e107_plugins/pm/pm_class.php b/e107_plugins/pm/pm_class.php index 210413da8..eb6e8a2d0 100755 --- a/e107_plugins/pm/pm_class.php +++ b/e107_plugins/pm/pm_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/pm/pm_class.php,v $ -| $Revision: 1.3 $ -| $Date: 2007-05-05 20:06:47 $ +| $Revision: 1.4 $ +| $Date: 2007-08-02 20:41:30 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -56,6 +56,8 @@ class private_message return FALSE; } + + // Send a PM function add($vars) { global $pm_prefs, $tp, $sql; @@ -68,7 +70,7 @@ class private_message { foreach($vars['uploaded'] as $u) { - if(!isset($u['error'])) + if (!isset($u['error']) || !$u['error']) { $pmsize += $u['size']; $a_list[] = $u['name']; @@ -78,8 +80,14 @@ class private_message } $pmsize += strlen($vars['pm_message']); - $pm_subject = $tp->toDB($vars['pm_subject']); - $pm_message = $tp->toDB($vars['pm_message']); + $pm_subject = trim($tp->toDB($vars['pm_subject'])); + $pm_message = trim($tp->toDB($vars['pm_message'])); + + if (!$pm_subject && !$pm_message && !$attachlist) + { // Error - no subject, no message body and no uploaded files + return LAN_PM_65; + } + $sendtime = time(); if(isset($vars['to_userclass']) || isset($vars['to_array'])) {