diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php
index 3ac33748ba..6e2300454e 100644
--- a/phpBB/privmsg.php
+++ b/phpBB/privmsg.php
@@ -30,7 +30,7 @@ include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
//
// Is PM disabled?
//
-if( !empty($board_config['privmsg_disable']) )
+if ( !empty($board_config['privmsg_disable']) )
{
message_die(GENERAL_MESSAGE, 'PM_disabled');
}
@@ -57,11 +57,11 @@ $refresh = $preview || $submit_search;
$mark_list = ( !empty($HTTP_POST_VARS['mark']) ) ? $HTTP_POST_VARS['mark'] : 0;
-if( isset($HTTP_POST_VARS['folder']) || isset($HTTP_GET_VARS['folder']) )
+if ( isset($HTTP_POST_VARS['folder']) || isset($HTTP_GET_VARS['folder']) )
{
$folder = ( isset($HTTP_POST_VARS['folder']) ) ? $HTTP_POST_VARS['folder'] : $HTTP_GET_VARS['folder'];
- if( $folder != 'inbox' && $folder != 'outbox' && $folder != 'sentbox' && $folder != 'savebox' )
+ if ( $folder != 'inbox' && $folder != 'outbox' && $folder != 'sentbox' && $folder != 'savebox' )
{
$folder = 'inbox';
}
@@ -74,7 +74,7 @@ else
//
// Cancel
//
-if( $cancel )
+if ( $cancel )
{
header('Location: ' . append_sid("privmsg.$phpEx?folder=$folder", true));
}
@@ -91,7 +91,7 @@ init_userprefs($userdata);
//
// Var definitions
//
-if( !empty($HTTP_POST_VARS['mode']) || !empty($HTTP_GET_VARS['mode']) )
+if ( !empty($HTTP_POST_VARS['mode']) || !empty($HTTP_GET_VARS['mode']) )
{
$mode = ( !empty($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
}
@@ -102,7 +102,7 @@ else
$start = ( !empty($HTTP_GET_VARS['start']) ) ? $HTTP_GET_VARS['start'] : 0;
-if( isset($HTTP_POST_VARS[POST_POST_URL]) || isset($HTTP_GET_VARS[POST_POST_URL]) )
+if ( isset($HTTP_POST_VARS[POST_POST_URL]) || isset($HTTP_GET_VARS[POST_POST_URL]) )
{
$privmsg_id = ( isset($HTTP_POST_VARS[POST_POST_URL]) ) ? $HTTP_POST_VARS[POST_POST_URL] : $HTTP_GET_VARS[POST_POST_URL];
}
@@ -131,7 +131,7 @@ $savebox_url = ($folder != "savebox" || $mode != "") ? ' "privmsgs_popup.tpl")
);
- if( $userdata['session_logged_in'] )
+ if ( $userdata['session_logged_in'] )
{
- if( $userdata['user_new_privmsg'] )
+ if ( $userdata['user_new_privmsg'] )
{
$l_new_message = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['You_new_pm'] : $lang['You_new_pms'];
}
@@ -170,9 +170,9 @@ if( $mode == "newpm" )
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
-else if( $mode == "read" )
+else if ( $mode == "read" )
{
- if( !empty($HTTP_GET_VARS[POST_POST_URL]) )
+ if ( !empty($HTTP_GET_VARS[POST_POST_URL]) )
{
$privmsgs_id = $HTTP_GET_VARS[POST_POST_URL];
}
@@ -181,19 +181,19 @@ else if( $mode == "read" )
message_die(GENERAL_ERROR, $lang['No_post_id']);
}
- if( !$userdata['session_logged_in'] )
+ if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=$folder&mode=$mode&" . POST_POST_URL . "=$privmsgs_id", true));
}
- if( $folder )
+ if ( $folder )
{
//
// SQL to pull appropriate message, prevents nosey people
// reading other peoples messages ... hopefully!
//
- if($folder == "inbox")
+ if ($folder == "inbox")
{
$l_box_name = $lang['Inbox'];
@@ -202,7 +202,7 @@ else if( $mode == "read" )
OR pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )";
}
- else if($folder == "outbox")
+ else if ($folder == "outbox")
{
$l_box_name = $lang['Outbox'];
@@ -210,14 +210,14 @@ else if( $mode == "read" )
AND ( pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) ";
}
- else if($folder == "sentbox")
+ else if ($folder == "sentbox")
{
$l_box_name = $lang['Sentbox'];
$pm_sql_user = "AND pm.privmsgs_from_userid = " . $userdata['user_id'] . "
AND pm.privmsgs_type = " . PRIVMSGS_SENT_MAIL;
}
- else if($folder == "savebox")
+ else if ($folder == "savebox")
{
$l_box_name = $lang['Savebox'];
@@ -247,7 +247,7 @@ else if( $mode == "read" )
$pm_sql_user
AND u.user_id = pm.privmsgs_from_userid
AND u2.user_id = pm.privmsgs_to_userid";
- if( !$pm_status = $db->sql_query($sql) )
+ if ( !$pm_status = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not query private message post information.", "", __LINE__, __FILE__, $sql);
}
@@ -255,7 +255,7 @@ else if( $mode == "read" )
//
// Did the query return any data?
//
- if( !( $privmsg = $db->sql_fetchrow($pm_status) ) )
+ if ( !( $privmsg = $db->sql_fetchrow($pm_status) ) )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("privmsg.$phpEx?folder=$folder", true));
@@ -267,12 +267,12 @@ else if( $mode == "read" )
// Is this a new message in the inbox? If it is then save
// a copy in the posters sent box
//
- if( ( $privmsg['privmsgs_type'] == PRIVMSGS_NEW_MAIL || $privmsg['privmsgs_type'] == PRIVMSGS_UNREAD_MAIL ) && $folder == "inbox" )
+ if ( ( $privmsg['privmsgs_type'] == PRIVMSGS_NEW_MAIL || $privmsg['privmsgs_type'] == PRIVMSGS_UNREAD_MAIL ) && $folder == "inbox" )
{
$sql = "UPDATE " . PRIVMSGS_TABLE . "
SET privmsgs_type = " . PRIVMSGS_READ_MAIL . "
WHERE privmsgs_id = " . $privmsg['privmsgs_id'];
- if( !$pm_upd_status = $db->sql_query($sql) )
+ if ( !$pm_upd_status = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not update private message read status.", "", __LINE__, __FILE__, $sql);
}
@@ -280,7 +280,7 @@ else if( $mode == "read" )
$sql = "UPDATE " . USERS_TABLE . "
SET user_unread_privmsg = user_unread_privmsg - 1
WHERE user_id = " . $userdata['user_id'];
- if( !$user_upd_status = $db->sql_query($sql) )
+ if ( !$user_upd_status = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not update private message read status for user.", "", __LINE__, __FILE__, $sql);
}
@@ -292,24 +292,24 @@ else if( $mode == "read" )
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . "
AND privmsgs_from_userid = " . $privmsg['privmsgs_from_userid'];
- if( !$result = $db->sql_query($sql) )
+ if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain sent message info for sendee.", "", __LINE__, __FILE__, $sql);
}
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : "";
- if( $db->sql_numrows($result) )
+ if ( $db->sql_numrows($result) )
{
$sent_info = $db->sql_fetchrow($result);
- if( $sent_info['sent_items'] >= $board_config['max_sentbox_privmsgs'] )
+ if ( $sent_info['sent_items'] >= $board_config['max_sentbox_privmsgs'] )
{
$sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . "
AND privmsgs_date = " . $sent_info['oldest_post_time'] . "
AND privmsgs_from_userid = " . $privmsg['privmsgs_from_userid'];
- if( !$result = $db->sql_query($sql) )
+ if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not delete oldest privmsgs.", "", __LINE__, __FILE__, $sql);
}
@@ -326,7 +326,7 @@ else if( $mode == "read" )
//
$sql = "INSERT $sql_priority INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)
VALUES (" . PRIVMSGS_SENT_MAIL . ", '" . str_replace("\'", "''", addslashes($privmsg['privmsgs_subject'])) . "', " . $privmsg['privmsgs_from_userid'] . ", " . $privmsg['privmsgs_to_userid'] . ", " . $privmsg['privmsgs_date'] . ", '" . $privmsg['privmsgs_ip'] . "', " . $privmsg['privmsgs_enable_html'] . ", " . $privmsg['privmsgs_enable_bbcode'] . ", " . $privmsg['privmsgs_enable_smilies'] . ", " . $privmsg['privmsgs_attach_sig'] . ")";
- if( !$pm_sent_status = $db->sql_query($sql) )
+ if ( !$pm_sent_status = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not insert private message sent info.", "", __LINE__, __FILE__, $sql);
}
@@ -336,7 +336,7 @@ else if( $mode == "read" )
$sql = "INSERT $sql_priority INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
VALUES ($privmsg_sent_id, '" . $privmsg['privmsgs_bbcode_uid'] . "', '" . str_replace("\'", "''", addslashes($privmsg['privmsgs_text'])) . "')";
- if(!$pm_sent_text_status = $db->sql_query($sql))
+ if (!$pm_sent_text_status = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not insert private message sent text.
$sql", "", __LINE__, __FILE__, $sql);
}
@@ -347,7 +347,7 @@ else if( $mode == "read" )
// Pick a folder, any folder, so long as it's one
// below ...
//
- if( $folder == "inbox" )
+ if ( $folder == "inbox" )
{
$post_pm_img = "
";
$reply_pm_img = "
";
@@ -355,7 +355,7 @@ else if( $mode == "read" )
$edit_pm_img = "";
$l_box_name = $lang['Inbox'];
}
- else if( $folder == "outbox" )
+ else if ( $folder == "outbox" )
{
$post_pm_img = "
";
$reply_pm_img = "";
@@ -363,9 +363,9 @@ else if( $mode == "read" )
$edit_pm_img = "
";
$l_box_name = $lang['Outbox'];
}
- else if( $folder == "savebox" )
+ else if ( $folder == "savebox" )
{
- if( $privmsg['privmsgs_type'] == PRIVMSGS_SAVED_IN_MAIL )
+ if ( $privmsg['privmsgs_type'] == PRIVMSGS_SAVED_IN_MAIL )
{
$post_pm_img = "
";
$reply_pm_img = "
";
@@ -381,7 +381,7 @@ else if( $mode == "read" )
}
$l_box_name = $lang['Saved'];
}
- else if( $folder == "sentbox" )
+ else if ( $folder == "sentbox" )
{
$post_pm_img = "
";
$reply_pm_img = "";
@@ -470,7 +470,7 @@ else if( $mode == "read" )
$www_img = ( $privmsg['user_website']) ? '
' : '';
- if( !empty($privmsg['user_icq']) )
+ if ( !empty($privmsg['user_icq']) )
{
$icq_status_img = '
';
$icq_add_img = '
';
@@ -497,7 +497,7 @@ else if( $mode == "read" )
$private_message = $privmsg['privmsgs_text'];
$bbcode_uid = $privmsg['privmsgs_bbcode_uid'];
- if( $board_config['allow_sig'] )
+ if ( $board_config['allow_sig'] )
{
$user_sig = ( $privmsg['privmsgs_from_userid'] == $userdata['user_id'] ) ? $userdata['user_sig'] : $privmsg['user_sig'];
}
@@ -511,43 +511,43 @@ else if( $mode == "read" )
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
//
- if( !$board_config['allow_html'] )
+ if ( !$board_config['allow_html'] )
{
- if( $user_sig != "" && $privmsg['privmsgs_enable_sig'] && $userdata['user_allowhtml'] )
+ if ( $user_sig != "" && $privmsg['privmsgs_enable_sig'] && $userdata['user_allowhtml'] )
{
$user_sig = preg_replace("#(<)([\/]?.*?)(>)#is", "<\\2>", $user_sig);
}
- if( $privmsg['privmsgs_enable_html'] )
+ if ( $privmsg['privmsgs_enable_html'] )
{
$private_message = preg_replace("#(<)([\/]?.*?)(>)#is", "<\\2>", $private_message);
}
}
- if( $user_sig != "" && $privmsg['privmsgs_attach_sig'] && $user_sig_bbcode_uid != "" )
+ if ( $user_sig != "" && $privmsg['privmsgs_attach_sig'] && $user_sig_bbcode_uid != "" )
{
$user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace("/\:[0-9a-z\:]+\]/si", "]", $user_sig);
}
- if( $bbcode_uid != "" )
+ if ( $bbcode_uid != "" )
{
$private_message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($private_message, $bbcode_uid) : preg_replace("/\:[0-9a-z\:]+\]/si", "]", $private_message);
}
$private_message = make_clickable($private_message);
- if( $privmsg['privmsgs_attach_sig'] && $user_sig != "" )
+ if ( $privmsg['privmsgs_attach_sig'] && $user_sig != "" )
{
$private_message .= "
_________________
" . make_clickable($user_sig);
}
- if( count($orig_word) )
+ if ( count($orig_word) )
{
$post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
$private_message = preg_replace($orig_word, $replacement_word, $private_message);
}
- if( $board_config['allow_smilies'] && $privmsg['privmsgs_enable_smilies'] )
+ if ( $board_config['allow_smilies'] && $privmsg['privmsgs_enable_smilies'] )
{
$private_message = smilies_pass($private_message);
}
@@ -586,20 +586,20 @@ else if( $mode == "read" )
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
-else if( ( $delete && $mark_list ) || $delete_all )
+else if ( ( $delete && $mark_list ) || $delete_all )
{
- if(!$userdata['session_logged_in'])
+ if (!$userdata['session_logged_in'])
{
$header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
}
- if( isset($mark_list) && !is_array($mark_list) )
+ if ( isset($mark_list) && !is_array($mark_list) )
{
// Set to empty array instead of '0' if nothing is selected.
$mark_list = array();
}
- if( !$confirm )
+ if ( !$confirm )
{
$s_hidden_fields = '';
$s_hidden_fields .= (isset($HTTP_POST_VARS['delete'])) ? '' : '';
@@ -632,9 +632,9 @@ else if( ( $delete && $mark_list ) || $delete_all )
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
- else if( $confirm )
+ else if ( $confirm )
{
- if( $delete_all )
+ if ( $delete_all )
{
switch($folder)
{
@@ -771,21 +771,21 @@ else if( ( $delete && $mark_list ) || $delete_all )
break;
}
- if( !$db->sql_query($delete_sql, BEGIN_TRANSACTION) )
+ if ( !$db->sql_query($delete_sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not delete private message info.", "", __LINE__, __FILE__, $delete_sql);
}
- if( !$db->sql_query($delete_text_sql, END_TRANSACTION) )
+ if ( !$db->sql_query($delete_text_sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not delete private message text.", "", __LINE__, __FILE__, $delete_text_sql);
}
}
}
}
-else if( $save && $mark_list && $folder != "savebox" && $folder != "outbox")
+else if ( $save && $mark_list && $folder != "savebox" && $folder != "outbox")
{
- if( !$userdata['session_logged_in'] )
+ if ( !$userdata['session_logged_in'] )
{
$header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
header($header_location . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
@@ -800,16 +800,16 @@ else if( $save && $mark_list && $folder != "savebox" && $folder != "outbox")
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " )
OR ( privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . ") )";
- if( !$result = $db->sql_query($sql) )
+ if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain sent message info for sendee.", "", __LINE__, __FILE__, $sql);
}
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : "";
- if( $saved_info = $db->sql_fetchrow($result) )
+ if ( $saved_info = $db->sql_fetchrow($result) )
{
- if( $saved_info['savebox_items'] >= $board_config['max_savebox_privmsgs'] )
+ if ( $saved_info['savebox_items'] >= $board_config['max_savebox_privmsgs'] )
{
$sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "
WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . "
@@ -817,7 +817,7 @@ else if( $save && $mark_list && $folder != "savebox" && $folder != "outbox")
OR ( privmsgs_from_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . ") )
AND privmsgs_date = " . $saved_info['oldest_post_time'];
- if( !$result = $db->sql_query($sql) )
+ if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not delete oldest privmsgs.", "", __LINE__, __FILE__, $sql);
}
@@ -858,7 +858,7 @@ else if( $save && $mark_list && $folder != "savebox" && $folder != "outbox")
$saved_sql_id = "";
for($i = 0; $i < count($mark_list); $i++)
{
- if( $saved_sql_id != "" )
+ if ( $saved_sql_id != "" )
{
$saved_sql_id .= ", ";
}
@@ -867,17 +867,17 @@ else if( $save && $mark_list && $folder != "savebox" && $folder != "outbox")
$saved_sql .= " AND privmsgs_id IN ($saved_sql_id)";
- if( !$save_status = $db->sql_query($saved_sql) )
+ if ( !$save_status = $db->sql_query($saved_sql) )
{
message_die(GENERAL_ERROR, "Could not save private messages.", "", __LINE__, __FILE__, $saved_sql);
}
}
}
-else if( $submit || $refresh || $mode != "" )
+else if ( $submit || $refresh || $mode != "" )
{
- if(!$userdata['session_logged_in'])
+ if (!$userdata['session_logged_in'])
{
$user_id = ( isset($HTTP_GET_VARS[POST_USERS_URL]) ) ? "&" . POST_USERS_URL . "=" . $HTTP_GET_VARS[POST_USERS_URL] : "";
$header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
@@ -887,7 +887,7 @@ else if( $submit || $refresh || $mode != "" )
//
// Toggles
//
- if( !$board_config['allow_html'] )
+ if ( !$board_config['allow_html'] )
{
$html_on = 0;
}
@@ -896,7 +896,7 @@ else if( $submit || $refresh || $mode != "" )
$html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : $userdata['user_allowhtml'];
}
- if( !$board_config['allow_bbcode'] )
+ if ( !$board_config['allow_bbcode'] )
{
$bbcode_on = 0;
}
@@ -905,7 +905,7 @@ else if( $submit || $refresh || $mode != "" )
$bbcode_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : $userdata['user_allowbbcode'];
}
- if( !$board_config['allow_smilies'] )
+ if ( !$board_config['allow_smilies'] )
{
$smilies_on = 0;
}
@@ -917,7 +917,7 @@ else if( $submit || $refresh || $mode != "" )
$attach_sig = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : $userdata['user_attachsig'];
$user_sig = ( $userdata['user_sig'] != "" && $board_config['allow_sig'] ) ? $userdata['user_sig'] : "";
- if( $submit && $mode != "edit" )
+ if ( $submit && $mode != "edit" )
{
//
// Flood control
@@ -925,14 +925,14 @@ else if( $submit || $refresh || $mode != "" )
$sql = "SELECT MAX(privmsgs_date) AS last_post_time
FROM " . PRIVMSGS_TABLE . "
WHERE privmsgs_from_userid = " . $userdata['user_id'];
- if( $result = $db->sql_query($sql) )
+ if ( $result = $db->sql_query($sql) )
{
$db_row = $db->sql_fetchrow($result);
$last_post_time = $db_row['last_post_time'];
$current_time = time();
- if( ( $current_time - $last_post_time ) < $board_config['flood_interval'])
+ if ( ( $current_time - $last_post_time ) < $board_config['flood_interval'])
{
message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
}
@@ -942,17 +942,17 @@ else if( $submit || $refresh || $mode != "" )
//
}
- if( $submit )
+ if ( $submit )
{
- if( !empty($HTTP_POST_VARS['username']) )
+ if ( !empty($HTTP_POST_VARS['username']) )
{
$to_username = $HTTP_POST_VARS['username'];
- $sql = "SELECT user_id, user_notify_pm, user_email, user_lang
+ $sql = "SELECT user_id, user_notify_pm, user_email, user_lang, user_active
FROM " . USERS_TABLE . "
WHERE username = '" . str_replace("\'", "''", $to_username) . "'
AND user_id <> " . ANONYMOUS;
- if(!$result = $db->sql_query($sql))
+ if (!($result = $db->sql_query($sql)))
{
$error = TRUE;
$error_msg = $lang['No_such_user'];
@@ -965,29 +965,21 @@ else if( $submit || $refresh || $mode != "" )
else
{
$error = TRUE;
- if(isset($error_msg))
- {
- $error_msg .= "
";
- }
- $error_msg .= $lang['No_to_user'];
+ $error_msg .= ( ( !empty($error_msg) ) ? '
' : '' ) . $lang['No_to_user'];
}
$privmsg_subject = trim(strip_tags($HTTP_POST_VARS['subject']));
- if( empty($privmsg_subject) )
+ if ( empty($privmsg_subject) )
{
$error = TRUE;
- if( !empty($error_msg) )
- {
- $error_msg .= "
";
- }
- $error_msg .= $lang['Empty_subject'];
+ $error_msg .= ( ( !empty($error_msg) ) ? '
' : '' ) . $lang['Empty_subject'];
}
- if( !empty($HTTP_POST_VARS['message']) )
+ if ( !empty($HTTP_POST_VARS['message']) )
{
- if( !$error )
+ if ( !$error )
{
- if( $bbcode_on )
+ if ( $bbcode_on )
{
$bbcode_uid = make_bbcode_uid();
}
@@ -999,20 +991,16 @@ else if( $submit || $refresh || $mode != "" )
else
{
$error = TRUE;
- if(!empty($error_msg))
- {
- $error_msg .= "
";
- }
- $error_msg .= $lang['Empty_message'];
+ $error_msg .= ( ( !empty($error_msg) ) ? '
' : '' ) . $lang['Empty_message'];
}
}
- if( $submit && !$error )
+ if ( $submit && !$error )
{
//
// Has admin prevented user from sending PM's?
//
- if( !$userdata['user_allow_pm'] )
+ if ( !$userdata['user_allow_pm'] )
{
$message = $lang['Cannot_send_privmsg'];
message_die(GENERAL_MESSAGE, $message);
@@ -1020,7 +1008,7 @@ else if( $submit || $refresh || $mode != "" )
$msg_time = time();
- if( $mode != "edit" )
+ if ( $mode != "edit" )
{
//
// See if recipient is at their inbox limit
@@ -1031,18 +1019,16 @@ else if( $submit || $refresh || $mode != "" )
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )
AND privmsgs_to_userid = " . $to_userdata['user_id'];
- if( !$result = $db->sql_query($sql) )
+ if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_MESSAGE, $lang['No_such_user']);
}
$sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : "";
- if( $db->sql_numrows($result) )
+ if ( $inbox_info = $db->sql_fetchrow($result) )
{
- $inbox_info = $db->sql_fetchrow($result);
-
- if( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] )
+ if ( $inbox_info['inbox_items'] >= $board_config['max_inbox_privmsgs'] )
{
$sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
@@ -1050,7 +1036,7 @@ else if( $submit || $refresh || $mode != "" )
OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )
AND privmsgs_date = " . $inbox_info['oldest_post_time'] . "
AND privmsgs_to_userid = " . $to_userdata['user_id'];
- if( !$result = $db->sql_query($sql) )
+ if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not delete oldest privmsgs.", "", __LINE__, __FILE__, $sql);
}
@@ -1075,13 +1061,13 @@ else if( $submit || $refresh || $mode != "" )
WHERE privmsgs_id = $privmsg_id";
}
- if( !$pm_sent_status = $db->sql_query($sql_info, BEGIN_TRANSACTION) )
+ if ( !$pm_sent_status = $db->sql_query($sql_info, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not insert/update private message sent info.", "", __LINE__, __FILE__, $sql_info);
}
else
{
- if( $mode != "edit" )
+ if ( $mode != "edit" )
{
$privmsg_sent_id = $db->sql_nextid();
@@ -1095,25 +1081,24 @@ else if( $submit || $refresh || $mode != "" )
WHERE privmsgs_text_id = $privmsg_id";
}
- if( !$pm_sent_text_status = $db->sql_query($sql, END_TRANSACTION) )
+ if ( !($pm_sent_text_status = $db->sql_query($sql, END_TRANSACTION)) )
{
message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql_info);
}
- else if( $mode != "edit" )
+ else if ( $mode != "edit" )
{
-
//
// Add to the users new pm counter
//
$sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "
WHERE user_id = " . $to_userdata['user_id'];
- if( !$status = $db->sql_query($sql) )
+ if ( !$status = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Could not update private message new/read status for user.", "", __LINE__, __FILE__, $sql);
}
- if( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active'] == 1)
+ if ( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active'] )
{
$email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\r\n";
@@ -1156,7 +1141,7 @@ else if( $submit || $refresh || $mode != "" )
message_die(GENERAL_MESSAGE, $msg);
}
}
- else if( $preview || $refresh || $error )
+ else if ( $preview || $refresh || $error )
{
//
@@ -1168,7 +1153,7 @@ else if( $submit || $refresh || $mode != "" )
$privmsg_subject = ( isset($HTTP_POST_VARS['subject']) ) ? trim(strip_tags(stripslashes($HTTP_POST_VARS['subject']))) : "";
$privmsg_message = ( isset($HTTP_POST_VARS['message']) ) ? trim($HTTP_POST_VARS['message']) : "";
$privmsg_message = preg_replace('#