* } * * return $message; * } * </hookcode> */ $pm_message = array('subject' => $_POST['subject'], 'message' => $_POST['message'], 'recipients' => $recipients, 'keep' => $_POST['keep'], 'error' => NULL); if (isset($PHORUM['hooks']['pm_before_send'])) { $pm_message = phorum_hook('pm_before_send', $pm_message); if ($pm_message['error']) { $error = $pm_message['error']; } } // Send the private message if no errors occurred. if (empty($error)) { $pm_message_id = phorum_db_pm_send($pm_message["subject"], $pm_message["message"], array_keys($pm_message['recipients']), NULL, $pm_message["keep"]); $pm_message['pm_message_id'] = $pm_message_id; $pm_message['from_username'] = $PHORUM['user']['display_name']; $pm_message['user_id'] = $user_id; // Show an error in case of problems. if (!$pm_message_id) { $error = $PHORUM["DATA"]["LANG"]["PMNotSent"]; // Do e-mail notifications on successful sending. } elseif (!empty($PHORUM['allow_pm_email_notify'])) { include_once "./include/email_functions.php"; // Sort all recipients that want a notify by language. $langrcpts = array(); foreach ($pm_message['recipients'] as $rcpt_id => $rcpt) { if ($rcpt["pm_email_notify"]) { if (!isset($langrcpts[$rcpt["user_language"]])) { $langrcpts[$rcpt["user_language"]] = array($rcpt);
// No limits for admins $current_count = phorum_db_pm_messagecount(PHORUM_PM_ALLFOLDERS, $user["user_id"]); if ($current_count['total'] >= $PHORUM['max_pm_messagecount']) { if ($user['user_id'] == $PHORUM["user"]["user_id"]) { $error = $PHORUM["DATA"]["LANG"]["PMFromMailboxFull"]; } else { $error = $PHORUM["DATA"]["LANG"]["PMToMailboxFull"]; $recipient = empty($PHORUM["custom_display_name"]) ? htmlspecialchars($user["display_name"], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]) : $user["display_name"]; $error = str_replace('%recipient%', $recipient, $error); } } } } // Send the private message if no errors occurred. if (empty($error)) { $pm_message_id = phorum_db_pm_send($_POST["subject"], $_POST["message"], array_keys($recipients), NULL, $_POST["keep"]); // Show an error in case of problems. if (!$pm_message_id) { $error = $PHORUM["DATA"]["LANG"]["PMNotSent"]; // Do e-mail notifications on successful sending. } elseif (!empty($PHORUM['allow_pm_email_notify'])) { include_once "./include/email_functions.php"; $pm_message = array('pm_message_id' => $pm_message_id, 'subject' => $_POST['subject'], 'message' => $_POST['message'], 'from_username' => $PHORUM['user']['display_name'], 'user_id' => $user_id); // Sort all recipients that want a notify by language. $langrcpts = array(); foreach ($recipients as $rcpt_id => $rcpt) { if ($rcpt["pm_email_notify"]) { if (!isset($langrcpts[$rcpt["user_language"]])) { $langrcpts[$rcpt["user_language"]] = array($rcpt); } else { $langrcpts[$rcpt["user_language"]][] = $rcpt;