diff --git a/phpBB/groupcp.php b/phpBB/groupcp.php index 830e851083..a51537b5b5 100644 --- a/phpBB/groupcp.php +++ b/phpBB/groupcp.php @@ -75,7 +75,8 @@ if( isset($HTTP_POST_VARS['groupstatus']) && $group_id ) { if( !$userdata['session_logged_in'] ) { - header('Location: ' . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); } $sql = "SELECT group_moderator @@ -127,7 +128,8 @@ else if( isset($HTTP_POST_VARS['joingroup']) && $group_id ) // if( !$userdata['session_logged_in'] ) { - header("Location: " . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . ppend_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); } $sql = "SELECT ug.user_id, g.group_type @@ -231,12 +233,14 @@ else if( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending' // if( $cancel ) { - header("Location: " . append_sid("groupcp.$phpEx", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . ppend_sid("groupcp.$phpEx", true)); } if( !$userdata['session_logged_in'] ) { - header("Location: " . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); } if( $confirm ) @@ -320,7 +324,8 @@ else if( $group_id ) { if( !$userdata['session_logged_in'] ) { - header("Location: " . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); } } @@ -381,7 +386,8 @@ else if( $group_id ) { if( !$userdata['session_logged_in'] ) { - header("Location: " . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); } if( !$is_moderator ) @@ -1195,14 +1201,14 @@ else ORDER BY g.group_name, ug.user_id"; if ( !($result = $db->sql_query($sql)) ) { - message_die(GENERAL_ERROR, "Error getting group information", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql); } if ( $row = $db->sql_fetchrow($result) ) { $in_group = array(); - $s_member_groups_opt = ""; - $s_pending_groups_opt = ""; + $s_member_groups_opt = ''; + $s_pending_groups_opt = ''; do { @@ -1245,71 +1251,78 @@ else $s_group_list_opt .=''; } } - $s_group_list = '"; + $s_group_list = ''; - // - // Load and process templates - // - include($phpbb_root_path . 'includes/page_header.'.$phpEx); - - $template->set_filenames(array( - 'user' => 'groupcp_user_body.tpl', - 'jumpbox' => 'jumpbox.tpl') - ); - - $jumpbox = make_jumpbox(); - $template->assign_vars(array( - 'L_GO' => $lang['Go'], - 'L_JUMP_TO' => $lang['Jump_to'], - 'L_SELECT_FORUM' => $lang['Select_forum'], - - 'S_JUMPBOX_LIST' => $jumpbox, - 'S_JUMPBOX_ACTION' => append_sid("viewforum.$phpEx")) - ); - $template->assign_var_from_handle('JUMPBOX', 'jumpbox'); - - if ( $s_pending_groups_opt != '' || $s_member_groups_opt != '' ) + if ( $s_group_list_opt != '' || $s_pending_groups_opt != '' || $s_member_groups_opt != '' ) { - $template->assign_block_vars('groups_joined', array() ); - } + // + // Load and process templates + // + include($phpbb_root_path . 'includes/page_header.'.$phpEx); - if ( $s_member_groups_opt != '' ) + $template->set_filenames(array( + 'user' => 'groupcp_user_body.tpl', + 'jumpbox' => 'jumpbox.tpl') + ); + + $jumpbox = make_jumpbox(); + $template->assign_vars(array( + 'L_GO' => $lang['Go'], + 'L_JUMP_TO' => $lang['Jump_to'], + 'L_SELECT_FORUM' => $lang['Select_forum'], + + 'S_JUMPBOX_LIST' => $jumpbox, + 'S_JUMPBOX_ACTION' => append_sid("viewforum.$phpEx")) + ); + $template->assign_var_from_handle('JUMPBOX', 'jumpbox'); + + if ( $s_pending_groups_opt != '' || $s_member_groups_opt != '' ) + { + $template->assign_block_vars('groups_joined', array() ); + } + + if ( $s_member_groups_opt != '' ) + { + $template->assign_block_vars('groups_joined.groups_member', array() ); + } + + if ( $s_pending_groups_opt != '' ) + { + $template->assign_block_vars('groups_joined.groups_pending', array() ); + } + + if ( $s_group_list_opt != '' ) + { + $template->assign_block_vars('groups_remaining', array() ); + } + + $s_hidden_fields = ''; + + $template->assign_vars(array( + 'L_GROUP_MEMBERSHIP_DETAILS' => $lang['Group_member_details'], + 'L_JOIN_A_GROUP' => $lang['Group_member_join'], + 'L_YOU_BELONG_GROUPS' => $lang['Current_memberships'], + 'L_SELECT_A_GROUP' => $lang['Non_member_groups'], + 'L_PENDING_GROUPS' => $lang['Memberships_pending'], + 'L_SUBSCRIBE' => $lang['Subscribe'], + 'L_UNSUBSCRIBE' => $lang['Unsubscribe'], + 'L_VIEW_INFORMATION' => $lang['View_Information'], + + 'S_USERGROUP_ACTION' => append_sid("groupcp.$phpEx"), + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + + 'GROUP_LIST_SELECT' => $s_group_list, + 'GROUP_PENDING_SELECT' => $s_pending_groups, + 'GROUP_MEMBER_SELECT' => $s_member_groups) + ); + + $template->pparse('user'); + } + else { - $template->assign_block_vars('groups_joined.groups_member', array() ); + message_die(GENERAL_MESSAGE, $lang['No_groups_exist']); } - if ( $s_pending_groups_opt != '' ) - { - $template->assign_block_vars('groups_joined.groups_pending', array() ); - } - - if ( $s_group_list_opt != '' ) - { - $template->assign_block_vars('groups_remaining', array() ); - } - - $s_hidden_fields = ''; - - $template->assign_vars(array( - 'L_GROUP_MEMBERSHIP_DETAILS' => $lang['Group_member_details'], - 'L_JOIN_A_GROUP' => $lang['Group_member_join'], - 'L_YOU_BELONG_GROUPS' => $lang['Current_memberships'], - 'L_SELECT_A_GROUP' => $lang['Non_member_groups'], - 'L_PENDING_GROUPS' => $lang['Memberships_pending'], - 'L_SUBSCRIBE' => $lang['Subscribe'], - 'L_UNSUBSCRIBE' => $lang['Unsubscribe'], - 'L_VIEW_INFORMATION' => $lang['View_Information'], - - 'S_USERGROUP_ACTION' => append_sid("groupcp.$phpEx"), - 'S_HIDDEN_FIELDS' => $s_hidden_fields, - - 'GROUP_LIST_SELECT' => $s_group_list, - 'GROUP_PENDING_SELECT' => $s_pending_groups, - 'GROUP_MEMBER_SELECT' => $s_member_groups) - ); - - $template->pparse('user'); - } // diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php index 2edb6edc7c..879f2ae04e 100644 --- a/phpBB/privmsg.php +++ b/phpBB/privmsg.php @@ -38,8 +38,8 @@ if( !empty($board_config['privmsg_disable']) ) // // Var definitions // -$html_entities_match = array("#&#", "#<#", "#>#"); -$html_entities_replace = array("&", "<", ">"); +$html_entities_match = array('#&#', '#<#', '#>#'); +$html_entities_replace = array('&', '<', '>'); // // Parameters @@ -61,14 +61,14 @@ 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"; + $folder = 'inbox'; } } else { - $folder = "inbox"; + $folder = 'inbox'; } // @@ -76,7 +76,7 @@ else // if( $cancel ) { - header("Location: " . append_sid("privmsg.$phpEx?folder=$folder", true)); + header('Location: ' . append_sid("privmsg.$phpEx?folder=$folder", true)); } // @@ -183,7 +183,8 @@ else if( $mode == "read" ) if( !$userdata['session_logged_in'] ) { - header("Location: " . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=$folder&mode=$mode&" . POST_POST_URL . "=$privmsgs_id", true)); + $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 ) @@ -256,7 +257,8 @@ else if( $mode == "read" ) // if( !( $privmsg = $db->sql_fetchrow($pm_status) ) ) { - header("Location: " . append_sid("privmsg.$phpEx?folder=$folder", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("privmsg.$phpEx?folder=$folder", true)); } $privmsg_id = $privmsg['privmsgs_id']; @@ -588,7 +590,8 @@ else if( ( $delete && $mark_list ) || $delete_all ) { if(!$userdata['session_logged_in']) { - header("Location: " . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true)); + $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) ) { @@ -783,7 +786,8 @@ else if( $save && $mark_list && $folder != "savebox" && $folder != "outbox") { if( !$userdata['session_logged_in'] ) { - header("Location: " . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true)); + $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)); } // @@ -875,7 +879,8 @@ else if( $submit || $refresh || $mode != "" ) 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: " . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=$folder&mode=$mode" . $user_id, true)); + $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" . $user_id, true)); } // @@ -1272,13 +1277,12 @@ else if( $submit || $refresh || $mode != "" ) { message_die(GENERAL_ERROR, "Could not obtain private message for editing.", "", __LINE__, __FILE__, $sql); } - if(!$db->sql_numrows($pm_edit_status)) + if ( !($privmsg = $db->sql_fetchrow($pm_edit_status)) ) { - header("Location: " . append_sid("privmsg.$phpEx?folder=$folder", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("privmsg.$phpEx?folder=$folder", true)); } - $privmsg = $db->sql_fetchrow($pm_edit_status); - $privmsg_subject = $privmsg['privmsgs_subject']; $privmsg_message = $privmsg['privmsgs_text']; $privmsg_bbcode_uid = $privmsg['privmsgs_bbcode_uid']; @@ -1312,11 +1316,11 @@ else if( $submit || $refresh || $mode != "" ) message_die(GENERAL_ERROR, "Could not obtain private message for editing.", "", __LINE__, __FILE__, $sql); } - if( !$db->sql_numrows($pm_reply_status) ) + if( !($privmsg = $db->sql_fetchrow($pm_reply_status)) ) { - header("Location: " . append_sid("privmsg.$phpEx?folder=$folder", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("privmsg.$phpEx?folder=$folder", true)); } - $privmsg = $db->sql_fetchrow($pm_reply_status); $privmsg_subject = ( ( !preg_match("/^Re:/", $privmsg['privmsgs_subject']) ) ? "Re: " : "" ) . $privmsg['privmsgs_subject']; @@ -1668,7 +1672,8 @@ else if( $submit || $refresh || $mode != "" ) // if( !$userdata['session_logged_in'] ) { - header("Location: " . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true)); + $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)); } // diff --git a/phpBB/profile.php b/phpBB/profile.php index 25965087de..213807a49f 100644 --- a/phpBB/profile.php +++ b/phpBB/profile.php @@ -83,7 +83,8 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) ) { if ( !$userdata['session_logged_in'] && $mode == 'editprofile' ) { - header("Location: " . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true)); exit; } @@ -108,7 +109,8 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) ) } else { - header("Location: " . append_sid("index.$phpEx", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("index.$phpEx", true)); exit; } diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 6cb2c8bca9..3934984526 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -21,7 +21,7 @@ ***************************************************************************/ define('IN_PHPBB', true); -$phpbb_root_path = "./"; +$phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'includes/bbcode.'.$phpEx); @@ -29,16 +29,16 @@ include($phpbb_root_path . 'includes/bbcode.'.$phpEx); // // Start initial var setup // -if(isset($HTTP_GET_VARS[POST_TOPIC_URL])) +if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) ) { $topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]); } -else if(isset($HTTP_GET_VARS['topic'])) +else if ( isset($HTTP_GET_VARS['topic']) ) { $topic_id = intval($HTTP_GET_VARS['topic']); } -if(isset($HTTP_GET_VARS[POST_POST_URL])) +if ( isset($HTTP_GET_VARS[POST_POST_URL])) { $post_id = intval($HTTP_GET_VARS[POST_POST_URL]); } @@ -104,7 +104,7 @@ if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) ) exit; } } - else if( $HTTP_GET_VARS['view'] == 'next' || $HTTP_GET_VARS['view'] == 'previous' ) + else if ( $HTTP_GET_VARS['view'] == 'next' || $HTTP_GET_VARS['view'] == 'previous' ) { $sql_condition = ( $HTTP_GET_VARS['view'] == 'next' ) ? '>' : '<'; $sql_ordering = ( $HTTP_GET_VARS['view'] == 'next' ) ? 'ASC' : 'DESC'; @@ -121,7 +121,7 @@ if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) ) LIMIT 1"; if ( !($result = $db->sql_query($sql)) ) { - message_die(GENERAL_ERROR, "Couldn't obtain newer/older topic information", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql); } if ( !($row = $db->sql_fetchrow($result)) ) @@ -158,12 +158,12 @@ $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.top WHERE $join_sql AND f.forum_id = t.forum_id $order_sql"; -if( !($result = $db->sql_query($sql)) ) +if ( !($result = $db->sql_query($sql)) ) { - message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql); } -if( !($forum_row = $db->sql_fetchrow($result)) ) +if ( !($forum_row = $db->sql_fetchrow($result)) ) { message_die(GENERAL_MESSAGE, 'Topic_post_not_exist'); } @@ -190,8 +190,9 @@ if( !$is_auth['auth_view'] || !$is_auth['auth_read'] ) if ( !$userdata['session_logged_in'] ) { $redirect = ( isset($post_id) ) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id"; - $redirect .= ( isset($start) ) ? "&start=$start" : ""; - header("Location: " . append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true)); + $redirect .= ( isset($start) ) ? "&start=$start" : ''; + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true)); } $message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']); @@ -225,29 +226,29 @@ if( $userdata['session_logged_in'] ) AND user_id = " . $userdata['user_id']; if( !($result = $db->sql_query($sql)) ) { - message_die(GENERAL_ERROR, "Couldn't obtain topic watch information", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, "Could not obtain topic watch information", '', __LINE__, __FILE__, $sql); } - if( $row = $db->sql_fetchrow($result) ) + if ( $row = $db->sql_fetchrow($result) ) { - if( isset($HTTP_GET_VARS['unwatch']) ) + if ( isset($HTTP_GET_VARS['unwatch']) ) { - if( $HTTP_GET_VARS['unwatch'] == "topic" ) + if ( $HTTP_GET_VARS['unwatch'] == 'topic' ) { $is_watching_topic = 0; - $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; + $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ''; $sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . " WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id']; - if( !$result = $db->sql_query($sql) ) + if ( !($result = $db->sql_query($sql)) ) { - message_die(GENERAL_ERROR, "Couldn't delete topic watch information", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, "Could not delete topic watch information", '', __LINE__, __FILE__, $sql); } } $template->assign_vars(array( - "META" => '') + 'META' => '') ); $message = $lang['No_longer_watching'] . '

' . sprintf($lang['Click_return_topic'], '', ''); @@ -257,39 +258,39 @@ if( $userdata['session_logged_in'] ) { $is_watching_topic = TRUE; - if( $row['notify_status'] ) + if ( $row['notify_status'] ) { - $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; + $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ''; $sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . " SET notify_status = 0 WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id']; - if( !$result = $db->sql_query($sql) ) + if ( !($result = $db->sql_query($sql)) ) { - message_die(GENERAL_ERROR, "Couldn't update topic watch information", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, "Could not update topic watch information", '', __LINE__, __FILE__, $sql); } } } } else { - if( isset($HTTP_GET_VARS['watch']) ) + if ( isset($HTTP_GET_VARS['watch']) ) { - if( $HTTP_GET_VARS['watch'] == "topic" ) + if ( $HTTP_GET_VARS['watch'] == 'topic' ) { $is_watching_topic = TRUE; - $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ""; + $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ''; $sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) VALUES (" . $userdata['user_id'] . ", $topic_id, 0)"; - if( !$result = $db->sql_query($sql) ) + if ( !($result = $db->sql_query($sql)) ) { - message_die(GENERAL_ERROR, "Couldn't insert topic watch information", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, "Could not insert topic watch information", '', __LINE__, __FILE__, $sql); } } $template->assign_vars(array( - "META" => '') + 'META' => '') ); $message = $lang['You_are_watching'] . '

' . sprintf($lang['Click_return_topic'], '', ''); @@ -303,11 +304,12 @@ if( $userdata['session_logged_in'] ) } else { - if( isset($HTTP_GET_VARS['unwatch']) ) + if ( isset($HTTP_GET_VARS['unwatch']) ) { - if( $HTTP_GET_VARS['unwatch'] == "topic" ) + if ( $HTTP_GET_VARS['unwatch'] == 'topic' ) { - header("Location: " . append_sid("login.$phpEx?redirect=viewtopic.$phpEx&" . POST_TOPIC_URL . "=$topic_id&unwatch=topic", true)); + $header_location = ( @preg_match("/Microsoft|WebSTAR/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; + header($header_location . append_sid("login.$phpEx?redirect=viewtopic.$phpEx&" . POST_TOPIC_URL . "=$topic_id&unwatch=topic", true)); } } else @@ -334,16 +336,16 @@ if( !empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays']) ) FROM " . POSTS_TABLE . " WHERE topic_id = $topic_id AND post_time >= $min_post_time"; - if(!$result = $db->sql_query($sql)) + if ( !($result = $db->sql_query($sql)) ) { - message_die(GENERAL_ERROR, "Couldn't obtain limited topics count information", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, "Could not obtain limited topics count information", '', __LINE__, __FILE__, $sql); } $total_replies = ( $row = $db->sql_fetchrow($result) ) ? $row['num_posts'] : 0; $limit_posts_time = "AND p.post_time >= $min_post_time "; - if(!empty($HTTP_POST_VARS['postdays'])) + if ( !empty($HTTP_POST_VARS['postdays'])) { $start = 0; } @@ -352,7 +354,7 @@ else { $total_replies = $forum_row['topic_replies'] + 1; - $limit_posts_time = ""; + $limit_posts_time = ''; $post_days = 0; } @@ -367,19 +369,19 @@ $select_post_days .= ''; // // Decide how to order the post display // -if(!empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder'])) +if ( !empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder']) ) { $post_order = (!empty($HTTP_POST_VARS['postorder'])) ? $HTTP_POST_VARS['postorder'] : $HTTP_GET_VARS['postorder']; $post_time_order = ($post_order == "asc") ? "ASC" : "DESC"; } else { - $post_order = "asc"; - $post_time_order = "ASC"; + $post_order = 'asc'; + $post_time_order = 'ASC'; } $select_post_order = ''; } - if( count($orig_word) ) + if ( count($orig_word) ) { $vote_title = preg_replace($orig_word, $replacement_word, $vote_title); } $template->assign_vars(array( - "POLL_QUESTION" => $vote_title, + 'POLL_QUESTION' => $vote_title, - "S_HIDDEN_FIELDS" => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : "", - "S_VOTE_ACTION" => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id")) + 'S_HIDDEN_FIELDS' => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : '', + 'S_VOTE_ACTION' => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id")) ); - $template->assign_var_from_handle("POLL_DISPLAY", "pollbox"); + $template->assign_var_from_handle('POLL_DISPLAY', 'pollbox'); } } @@ -814,9 +814,9 @@ if( !empty($forum_row['topic_vote']) ) $sql = "UPDATE " . TOPICS_TABLE . " SET topic_views = topic_views + 1 WHERE topic_id = $topic_id"; -if(!$update_result = $db->sql_query($sql)) +if ( !$db->sql_query($sql) ) { - message_die(GENERAL_ERROR, "Couldn't update topic views.", "", __LINE__, __FILE__, $sql); + message_die(GENERAL_ERROR, "Could not update topic views.", '', __LINE__, __FILE__, $sql); } // @@ -830,25 +830,25 @@ for($i = 0; $i < $total_posts; $i++) $post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']); - $poster_posts = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Posts'] . ": " . $postrow[$i]['user_posts'] : ""; + $poster_posts = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Posts'] . ': ' . $postrow[$i]['user_posts'] : ''; - $poster_from = ( $postrow[$i]['user_from'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ": " . $postrow[$i]['user_from'] : ""; + $poster_from = ( $postrow[$i]['user_from'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $postrow[$i]['user_from'] : ''; - $poster_joined = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Joined'] . ": " . create_date($lang['DATE_FORMAT'], $postrow[$i]['user_regdate'], $board_config['board_timezone']) : ""; + $poster_joined = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Joined'] . ': ' . create_date($lang['DATE_FORMAT'], $postrow[$i]['user_regdate'], $board_config['board_timezone']) : ''; - $poster_avatar = ""; - if( $postrow[$i]['user_avatar_type'] && $poster_id != ANONYMOUS && $postrow[$i]['user_allowavatar'] ) + $poster_avatar = ''; + if ( $postrow[$i]['user_avatar_type'] && $poster_id != ANONYMOUS && $postrow[$i]['user_allowavatar'] ) { switch( $postrow[$i]['user_avatar_type'] ) { case USER_AVATAR_UPLOAD: - $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '' : ''; + $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '' : ''; break; case USER_AVATAR_REMOTE: $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '' : ''; break; case USER_AVATAR_GALLERY: - $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '' : ''; + $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '' : ''; break; } } @@ -856,7 +856,7 @@ for($i = 0; $i < $total_posts; $i++) // // Define the little post icon // - if( $userdata['session_logged_in'] && $postrow[$i]['post_time'] > $userdata['user_lastvisit'] && $postrow[$i]['post_time'] > $topic_last_read ) + if ( $userdata['session_logged_in'] && $postrow[$i]['post_time'] > $userdata['user_lastvisit'] && $postrow[$i]['post_time'] > $topic_last_read ) { $mini_post_img = '' . $lang['New_post'] . ''; } @@ -865,7 +865,7 @@ for($i = 0; $i < $total_posts; $i++) $mini_post_img = '' . $lang['Post'] . ''; } - $mini_post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $postrow[$i]['post_id']) ."#".$postrow[$i]['post_id']; + $mini_post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $postrow[$i]['post_id']) . '#' . $postrow[$i]['post_id']; // // Generate ranks @@ -876,7 +876,7 @@ for($i = 0; $i < $total_posts; $i++) // $poster_rank = ''; $rank_image = ''; - if( $postrow[$i]['user_id'] == ANONYMOUS ) + if ( $postrow[$i]['user_id'] == ANONYMOUS ) { // // This is redundant, but some day we might wanna stick in a rank for anon. posts. @@ -884,11 +884,11 @@ for($i = 0; $i < $total_posts; $i++) $poster_rank = ''; $rank_image = ''; } - else if( $postrow[$i]['user_rank'] ) + else if ( $postrow[$i]['user_rank'] ) { for($j = 0; $j < count($ranksrow); $j++) { - if( $postrow[$i]['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] ) + if ( $postrow[$i]['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] ) { $poster_rank = $ranksrow[$j]['rank_title']; $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '' . $poster_rank . '
' : ''; @@ -899,7 +899,7 @@ for($i = 0; $i < $total_posts; $i++) { for($j = 0; $j < count($ranksrow); $j++) { - if( $postrow[$i]['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] ) + if ( $postrow[$i]['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] ) { $poster_rank = $ranksrow[$j]['rank_title']; $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '' . $poster_rank . '
' : ''; @@ -910,21 +910,21 @@ for($i = 0; $i < $total_posts; $i++) // // Handle anon users posting with usernames // - if($poster_id == ANONYMOUS && $postrow[$i]['post_username'] != '') + if ( $poster_id == ANONYMOUS && $postrow[$i]['post_username'] != '' ) { $poster = $postrow[$i]['post_username']; $poster_rank = $lang['Guest']; } - if( $poster_id != ANONYMOUS ) + if ( $poster_id != ANONYMOUS ) { $profile_img = '' . $lang['Read_profile'] . ''; $pm_img = '' . $lang['Send_private_message'] . ''; - if( !empty($postrow[$i]['user_viewemail']) || $is_auth['auth_mod'] ) + if ( !empty($postrow[$i]['user_viewemail']) || $is_auth['auth_mod'] ) { - $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL ."=" . $poster_id) : "mailto:" . $postrow[$i]['user_email']; + $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $poster_id) : 'mailto:' . $postrow[$i]['user_email']; $email_img = '' . $lang['Send_email'] . ''; } @@ -935,7 +935,7 @@ for($i = 0; $i < $total_posts; $i++) $www_img = ($postrow[$i]['user_website']) ? '' . $lang['Visit_website'] . '' : ''; - if( !empty($postrow[$i]['user_icq']) ) + if ( !empty($postrow[$i]['user_icq']) ) { $icq_status_img = ''; $icq_add_img = '' . $lang['ICQ'] . ''; @@ -969,7 +969,7 @@ for($i = 0; $i < $total_posts; $i++) $search_img = ''; - if( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] ) + if ( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] ) { $edit_img = '' . $lang['Edit_delete_post'] . ''; } @@ -978,7 +978,7 @@ for($i = 0; $i < $total_posts; $i++) $edit_img = ''; } - if( $is_auth['auth_mod'] ) + if ( $is_auth['auth_mod'] ) { $ip_img = '' . $lang['View_IP'] . ''; @@ -988,7 +988,7 @@ for($i = 0; $i < $total_posts; $i++) { $ip_img = ''; - if( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $i == $total_replies - 1 ) + if ( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $i == $total_replies - 1 ) { $delpost_img = '' . $lang['Delete_post'] . ''; } @@ -998,12 +998,12 @@ for($i = 0; $i < $total_posts; $i++) } } - $post_subject = ( $postrow[$i]['post_subject'] != "" ) ? $postrow[$i]['post_subject'] : ""; + $post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : ''; $message = $postrow[$i]['post_text']; $bbcode_uid = $postrow[$i]['bbcode_uid']; - $user_sig = ( $postrow[$i]['enable_sig'] && $postrow[$i]['user_sig'] != "" && $board_config['allow_sig'] ) ? $postrow[$i]['user_sig'] : ""; + $user_sig = ( $postrow[$i]['enable_sig'] && $postrow[$i]['user_sig'] != '' && $board_config['allow_sig'] ) ? $postrow[$i]['user_sig'] : ''; $user_sig_bbcode_uid = $postrow[$i]['user_sig_bbcode_uid']; // @@ -1016,36 +1016,36 @@ for($i = 0; $i < $total_posts; $i++) // 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 != "" && $userdata['user_allowhtml'] ) + if ( $user_sig != '' && $userdata['user_allowhtml'] ) { - $user_sig = preg_replace("#(<)([\/]?.*?)(>)#is", "<\\2>", $user_sig); + $user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $user_sig); } - if( $postrow[$i]['enable_html'] ) + if ( $postrow[$i]['enable_html'] ) { - $message = preg_replace("#(<)([\/]?.*?)(>)#is", "<\\2>", $message); + $message = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $message); } } // // Parse message and/or sig for BBCode if reqd // - if( $board_config['allow_bbcode'] ) + if ( $board_config['allow_bbcode'] ) { - if( $user_sig != "" && $user_sig_bbcode_uid != "" ) + if ( $user_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); + $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 != '' ) { - $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace("/\:[0-9a-z\:]+\]/si", "]", $message); + $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); } } - if( $user_sig != "" ) + if ( $user_sig != '' ) { $user_sig = make_clickable($user_sig); } @@ -1054,7 +1054,7 @@ for($i = 0; $i < $total_posts; $i++) // // Highlight active words (primarily for search) // - if( $highlight_active ) + if ( $highlight_active ) { $message = preg_replace($highlight_match, $highlight_replace, $message); } @@ -1062,9 +1062,9 @@ for($i = 0; $i < $total_posts; $i++) // // Replace naughty words // - if( count($orig_word) ) + if ( count($orig_word) ) { - if( $user_sig != "" ) + if ( $user_sig != '' ) { $user_sig = preg_replace($orig_word, $replacement_word, $user_sig); } @@ -1076,14 +1076,14 @@ for($i = 0; $i < $total_posts; $i++) // // Parse smilies // - if( $board_config['allow_smilies'] ) + if ( $board_config['allow_smilies'] ) { - if( $postrow[$i]['user_allowsmile'] && $user_sig != "" ) + if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' ) { $user_sig = smilies_pass($user_sig); } - if( $postrow[$i]['enable_smilies'] ) + if ( $postrow[$i]['enable_smilies'] ) { $message = smilies_pass($message); } @@ -1093,9 +1093,9 @@ for($i = 0; $i < $total_posts; $i++) // Replace newlines (we use this rather than nl2br because // till recently it wasn't XHTML compliant) // - if( $user_sig != "" ) + if ( $user_sig != '' ) { - $user_sig = "
_________________
" . str_replace("\n", "\n
", $user_sig); + $user_sig = '
_________________
' . str_replace("\n", "\n
", $user_sig); } $message = str_replace("\n", "\n
\n", $message); @@ -1103,15 +1103,15 @@ for($i = 0; $i < $total_posts; $i++) // // Editing information // - if( $postrow[$i]['post_edit_count'] ) + if ( $postrow[$i]['post_edit_count'] ) { $l_edit_time_total = ( $postrow[$i]['post_edit_count'] == 1 ) ? $lang['Edited_time_total'] : $lang['Edited_times_total']; - $l_edited_by = "

" . sprintf($l_edit_time_total, $poster, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count']); + $l_edited_by = '

' . sprintf($l_edit_time_total, $poster, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count']); } else { - $l_edited_by = ""; + $l_edited_by = ''; } // @@ -1121,50 +1121,50 @@ for($i = 0; $i < $total_posts; $i++) $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; - $template->assign_block_vars("postrow", array( - "ROW_COLOR" => "#" . $row_color, - "ROW_CLASS" => $row_class, - "MINI_POST_IMG" => $mini_post_img, + $template->assign_block_vars('postrow', array( + 'ROW_COLOR' => '#' . $row_color, + 'ROW_CLASS' => $row_class, + 'MINI_POST_IMG' => $mini_post_img, - "POSTER_NAME" => $poster, - "POSTER_RANK" => $poster_rank, - "RANK_IMAGE" => $rank_image, - "POSTER_JOINED" => $poster_joined, - "POSTER_POSTS" => $poster_posts, - "POSTER_FROM" => $poster_from, - "POSTER_AVATAR" => $poster_avatar, + 'POSTER_NAME' => $poster, + 'POSTER_RANK' => $poster_rank, + 'RANK_IMAGE' => $rank_image, + 'POSTER_JOINED' => $poster_joined, + 'POSTER_POSTS' => $poster_posts, + 'POSTER_FROM' => $poster_from, + 'POSTER_AVATAR' => $poster_avatar, - "POST_DATE" => $post_date, - "POST_SUBJECT" => $post_subject, - "MESSAGE" => $message, - "SIGNATURE" => $user_sig, - "EDITED_MESSAGE" => $l_edited_by, + 'POST_DATE' => $post_date, + 'POST_SUBJECT' => $post_subject, + 'MESSAGE' => $message, + 'SIGNATURE' => $user_sig, + 'EDITED_MESSAGE' => $l_edited_by, - "PROFILE_IMG" => $profile_img, - "SEARCH_IMG" => $search_img, - "PM_IMG" => $pm_img, - "EMAIL_IMG" => $email_img, - "WWW_IMG" => $www_img, - "ICQ" => ( !empty($postrow[$i]['user_icq']) ) ? $postrow[$i]['user_icq'] : " ", - "ICQ_IMG" => ( !empty($postrow[$i]['user_icq']) ) ? $images['icon_icq'] : " ", - "ICQ_STATUS_IMG" => $icq_status_img, - "ICQ_ADD_IMG" => $icq_add_img, - "AIM_IMG" => $aim_img, - "MSN_IMG" => $msn_img, - "YIM_IMG" => $yim_img, + 'PROFILE_IMG' => $profile_img, + 'SEARCH_IMG' => $search_img, + 'PM_IMG' => $pm_img, + 'EMAIL_IMG' => $email_img, + 'WWW_IMG' => $www_img, + 'ICQ' => ( !empty($postrow[$i]['user_icq']) ) ? $postrow[$i]['user_icq'] : ' ', + 'ICQ_IMG' => ( !empty($postrow[$i]['user_icq']) ) ? $images['icon_icq'] : ' ', + 'ICQ_STATUS_IMG' => $icq_status_img, + 'ICQ_ADD_IMG' => $icq_add_img, + 'AIM_IMG' => $aim_img, + 'MSN_IMG' => $msn_img, + 'YIM_IMG' => $yim_img, - "EDIT_IMG" => $edit_img, - "QUOTE_IMG" => $quote_img, - "IP_IMG" => $ip_img, - "DELETE_IMG" => $delpost_img, + 'EDIT_IMG' => $edit_img, + 'QUOTE_IMG' => $quote_img, + 'IP_IMG' => $ip_img, + 'DELETE_IMG' => $delpost_img, - "U_MINI_POST" => $mini_post_url, + 'U_MINI_POST' => $mini_post_url, - "U_POST_ID" => $postrow[$i]['post_id']) + 'U_POST_ID' => $postrow[$i]['post_id']) ); } -$template->pparse("body"); +$template->pparse('body'); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);