From 011d6d99eee18d6fc32d986dff4b93505c483c43 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Fri, 20 Jul 2001 19:33:50 +0000 Subject: [PATCH] Flood control, error reporting fixed git-svn-id: file:///svn/phpbb/trunk@715 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/privmsg.php | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php index e78b4f733c..45e388cca2 100644 --- a/phpBB/privmsg.php +++ b/phpBB/privmsg.php @@ -51,12 +51,13 @@ else } $start = (!empty($HTTP_GET_VARS['start'])) ? $HTTP_GET_VARS['start'] : 0; +$error = FALSE; + // // Start main // if($mode == "read") { - if(!empty($HTTP_GET_VARS[POST_POST_URL])) { $privmsgs_id = $HTTP_GET_VARS[POST_POST_URL]; @@ -564,7 +565,7 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit") $error_msg .= $lang['Empty_subject']; } - if(!empty($message)) + if( !empty($message) ) { if(!$error && !$preview) { @@ -584,9 +585,12 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit") } else { - // do stripslashes incase magic_quotes is on. - $message = stripslashes($HTTP_POST_VARS['message']); - $message = preg_replace('##si', '</TEXTAREA>', $message); + if(!$error) + { + // do stripslashes incase magic_quotes is on. + $message = stripslashes($HTTP_POST_VARS['message']); + $message = preg_replace('##si', '</TEXTAREA>', $message); + } } } else @@ -599,7 +603,7 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit") $error_msg .= $lang['Empty_msg']; } - if(!empty($to_username)) + if( !empty($to_username) ) { $sql = "SELECT user_id, username, user_notify_pm, user_email FROM " . USERS_TABLE . " @@ -625,9 +629,9 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit") $error_msg .= $lang['No_to_user']; } - if(!$preview) + if(!$preview && !$error) { - $msg_time = get_gmt_ts(); + $msg_time = time(); if($mode != "edit") { @@ -744,6 +748,23 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit") $template->pparse("preview"); } + // + // Start error handling + // + if($error) + { + $template->set_filenames(array( + "reg_header" => "error_body.tpl") + ); + $template->assign_vars(array( + "ERROR_MESSAGE" => $error_msg) + ); + $template->pparse("reg_header"); + } + // + // End error handling + // + // // Load templates //