From aa8a051a981954b1d15d116fd2192d1e4778c8f6 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Thu, 3 May 2001 22:10:23 +0000 Subject: Moved config, images vars to arrays and various other fixes git-svn-id: file:///svn/phpbb/trunk@237 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 98 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 36 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 07d321d87b..6892f3eadb 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -24,6 +24,9 @@ include('extension.inc'); include('common.'.$phpEx); include('includes/bbcode.'.$phpEx); +$page_title = "View Topic - $topic_title"; +$pagetype = "viewtopic"; + if(!isset($HTTP_GET_VARS['topic'])) // For backward compatibility { $topic_id = $HTTP_GET_VARS[POST_TOPIC_URL]; @@ -84,11 +87,9 @@ for($x = 0; $x < $total_rows; $x++) // Add checking for private forums here // -$total_replies = $forum_row[0]["topic_replies"] + 1; -$page_title = "View Topic - $topic_title"; -$pagetype = "viewtopic"; -include('includes/page_header.'.$phpEx); + +$total_replies = $forum_row[0]["topic_replies"] + 1; if(!isset($start)) { @@ -103,7 +104,7 @@ $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, AND (r.rank_special = 1) WHERE p.topic_id = '$topic_id' ORDER BY p.post_time ASC - LIMIT $start, $posts_per_page"; + LIMIT $start, ".$board_config['posts_per_page']; if(!$result = $db->sql_query($sql)) { error_die(SQL_QUERY, "Couldn't obtain post/user information.", __LINE__, __FILE__); @@ -122,14 +123,39 @@ if(!$ranks_result = $db->sql_query($sql)) $postrow = $db->sql_fetchrowset($result); $ranksrow = $db->sql_fetchrowset($ranksresult); +// +// Post, reply and other URL generation for +// templating vars +// +$new_topic_url = "posting.".$phpEx."?mode=newtopic&".POST_FORUM_URL."=$forum_id"; +$reply_topic_url = "posting.".$phpEx."?mode=reply&".POST_TOPIC_URL."=$topic_id"; +$view_forum_url = "viewforum.".$phpEx."?".POST_FORUM_URL."=$forum_id"; +$view_older_topic_url = "viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id."&view=older"; +$view_newer_topic_url = "viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id."&view=newer"; +$template->assign_vars(array( + "U_POST_NEW_TOPIC" => $new_topic_url, + "U_VIEW_FORUM" => $view_forum_url, + "U_VIEW_OLDER_TOPIC" => $view_older_topic_url, + "U_VIEW_NEWER_TOPIC" => $view_newer_topic_url, + "U_POST_REPLY_TOPIC" => $reply_topic_url)); + +// +// Dump out the page header +// +include('includes/page_header.'.$phpEx); + +// +// Okay, let's do the loop, yeah come on baby let's do the loop +// and it goes like this ... +// for($x = 0; $x < $total_posts; $x++) { $poster = stripslashes($postrow[$x]["username"]); $poster_id = $postrow[$x]["user_id"]; - $post_date = create_date($date_format, $postrow[$x]["post_time"], $sys_timezone); + $post_date = create_date($board_config['default_dateformat'], $postrow[$x]["post_time"], $board_config['default_timezone']); $poster_posts = $postrow[$x]["user_posts"]; $poster_from = ($postrow[$x]["user_from"]) ? "$l_from: ".$postrow[$x]["user_from"] : ""; - $poster_joined = create_date($date_format, $postrow[$x]["user_regdate"], $sys_timezone); + $poster_joined = create_date($board_config['default_dateformat'], $postrow[$x]["user_regdate"], $board_config['default_timezone']); if($poster_id != ANONYMOUS && $poster_id != DELETED) { if(!$postrow[$x]["rank_title"]) @@ -154,16 +180,14 @@ for($x = 0; $x < $total_posts; $x++) $poster_rank = ""; } - - - $profile_img = "\"$l_profileof"; - $email_img = ($postrow[$x]["user_viewemail"] == 1) ? "\"$l_email" : ""; - $www_img = ($postrow[$x]["user_website"]) ? "\"$l_viewsite\"" : ""; + $profile_img = "\"$l_profileof"; + $email_img = ($postrow[$x]["user_viewemail"] == 1) ? "\"$l_email" : ""; + $www_img = ($postrow[$x]["user_website"]) ? "\"$l_viewsite\"" : ""; if($postrow[$x]["user_icq"]) { $icq_status_img = "\"$l_icqstatus\""; - $icq_add_img = "\"$l_icq\""; + $icq_add_img = "\"$l_icq\""; } else { @@ -171,30 +195,30 @@ for($x = 0; $x < $total_posts; $x++) $icq_add_img = ""; } - $aim_img = ($postrow[$x]["user_aim"]) ? "" : ""; - $msn_img = ($postrow[$x]["user_msnm"]) ? "" : ""; - $yim_img = ($postrow[$x]["user_yim"]) ? "" : ""; + $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\""; + $edit_img = "\"$l_editdelete\""; + $quote_img = "\"$l_replyquote\""; + $pmsg_img = "\"$l_sendpmsg\""; if($is_moderator) { - $ip_img = "\"$l_viewip\""; - $delpost_img = "\"$l_delete\""; + $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']); - if(!$allow_html) + if(!$board_config['allow_html']) { $user_sig = strip_tags($user_sig); $message = strip_tags($message); } - if($allow_bbcode) + if($board_config['allow_bbcode']) { // do bbcode stuff here $sig_uid = make_bbcode_uid(); @@ -233,7 +257,8 @@ for($x = 0; $x < $total_posts; $x++) $message = eregi_replace("\[addsig]$", "
_________________
" . nl2br($user_sig), $message); - $template->assign_block_vars("postrow", array("TOPIC_TITLE" => $topic_title, + $template->assign_block_vars("postrow", array( + "TOPIC_TITLE" => $topic_title, "POSTER_NAME" => $poster, "POSTER_RANK" => $poster_rank, "RANK_IMAGE" => $rank_image, @@ -258,25 +283,25 @@ for($x = 0; $x < $total_posts; $x++) "DELPOST_IMG" => $delpost_img)); } -if($total_replies > $posts_per_page) +if($total_replies > $board_config['posts_per_page']) { $times = 0; - for($x = 0; $x < $total_replies; $x += $posts_per_page) + for($x = 0; $x < $total_replies; $x += $board_config['posts_per_page']) { $times++; } - $pages = $times . " pages"; + $pages = $times . " $l_pages"; $times = 1; $pagination = "$l_gotopage ("; - $last_page = $start - $posts_per_page; + $last_page = $start - $board_config['posts_per_page']; if($start > 0) { - $pagination .= "$l_prevpage "; + $pagination .= "$l_prevpage "; } - for($x = 0; $x < $total_replies; $x += $posts_per_page) + for($x = 0; $x < $total_replies; $x += $board_config['posts_per_page']) { if($times != 1) { @@ -292,24 +317,25 @@ if($total_replies > $posts_per_page) } else { - $pagination .= "$times"; + $pagination .= "$times"; } $times++; } - if(($start + $posts_per_page) < $total_replies) + if(($start + $board_config['posts_per_page']) < $total_replies) { - $next_page = $start + $posts_per_page; - $pagination .= " $l_nextpage"; + $next_page = $start + $board_config['posts_per_page']; + $pagination .= " $l_nextpage"; } $pagination .= " )"; } else { - $pages = "1 page"; + $pages = "1 $l_page"; } -$template->assign_vars(array("PAGES" => $pages, +$template->assign_vars(array( + "PAGES" => $pages, "PAGINATION" => $pagination)); $template->pparse("body"); -- cgit v1.2.1