diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 8be6990bcb..d28e9b5e0b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -43,7 +43,7 @@ if(!isset($topic_id)) error_die(GENERAL_ERROR, "You have reached this page in error, please go back and try again"); } -// +// // Start: 'Next newest topic' & 'Next oldest topic' functionality // if(isset($HTTP_GET_VARS['view'])) @@ -60,15 +60,6 @@ if(isset($HTTP_GET_VARS['view'])) switch($dbms) { case 'oracle': - $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, - f.forum_type, f.forum_name, f.forum_id, u.username, u.user_id - FROM ".TOPICS_TABLE." t, ".FORUMS_TABLE." f, ".FORUM_MODS_TABLE." fm, ".USERS_TABLE." u - WHERE t.topic_id = - (select topic_id from ".TOPICS_TABLE." WHERE topic_time ".$operator." (select topic_time from ".TOPICS_TABLE." where topic_id = $topic_id) AND ROWNUM < 2 ORDER BY topic_time DESC) - AND f.forum_id = t.forum_id - AND fm.forum_id = t.forum_id - AND u.user_id = fm.user_id"; - break; case 'mssql': case 'odbc': case 'postgres': @@ -190,8 +181,8 @@ if(!isset($start)) $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, p.post_time, p.post_id, p.bbcode_uid, pt.post_text FROM ".POSTS_TABLE." p, ".USERS_TABLE." u, ".POSTS_TEXT_TABLE." pt WHERE p.topic_id = $topic_id - AND p.poster_id = u.user_id - AND p.post_id = pt.post_id + AND p.poster_id = u.user_id + AND p.post_id = pt.post_id ORDER BY p.post_time ASC LIMIT $start, ".$board_config['posts_per_page']; if(!$result = $db->sql_query($sql)) @@ -213,7 +204,7 @@ $postrow = $db->sql_fetchrowset($result); $ranksrow = $db->sql_fetchrowset($ranksresult); // -// Post, reply and other URL generation for +// Post, reply and other URL generation for // templating vars // $new_topic_url = append_sid("posting.".$phpEx."?mode=newtopic&".POST_FORUM_URL."=$forum_id"); @@ -289,21 +280,21 @@ for($x = 0; $x < $total_posts; $x++) $icq_status_img = ""; $icq_add_img = ""; } - + $aim_img = ($postrow[$x]['user_aim']) ? "" : ""; $msn_img = ($postrow[$x]['user_msnm']) ? "" : ""; $yim_img = ($postrow[$x]['user_yim']) ? "" : ""; - + $edit_img = "\"$l_editdelete\""; $quote_img = "\"$l_replyquote\""; $pmsg_img = "\"$l_sendpmsg\""; - + if($is_moderator) { $ip_img = "\"$l_viewip\""; $delpost_img = "\"$l_delete\""; } - + $message = stripslashes($postrow[$x]['post_text']); $bbcode_uid = $postrow[$x]['bbcode_uid']; $user_sig = stripslashes($postrow[$x]['user_sig']); @@ -319,14 +310,14 @@ for($x = 0; $x < $total_posts; $x++) $sig_uid = make_bbcode_uid(); $user_sig = bbencode_first_pass($user_sig, $sig_uid); $user_sig = bbencode_second_pass($user_sig, $sig_uid); - + $message = bbencode_second_pass($message, $bbcode_uid); } - + $message = make_clickable($message); - + $message = str_replace("\n", "
", $message); - + if(!($x % 2)) { $color = "#".$theme['td_color1']; @@ -335,9 +326,9 @@ for($x = 0; $x < $total_posts; $x++) { $color = "#".$theme['td_color2']; } - + $message = eregi_replace("\[addsig]$", "
_________________
" . nl2br($user_sig), $message); - + $template->assign_block_vars("postrow", array( "TOPIC_TITLE" => $topic_title, "POSTER_NAME" => $poster, @@ -362,7 +353,7 @@ for($x = 0; $x < $total_posts; $x++) "PMSG_IMG" => $pmsg_img, "IP_IMG" => $ip_img, "DELPOST_IMG" => $delpost_img, - + "U_POST_ID" => "#".$postrow[$x]['post_id'])); }