aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php98
1 files changed, 62 insertions, 36 deletions
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 = "<a href=\"profile.$phpEx?mode=viewprofile&user_id=$poster_id\"><img src=\"$image_profile\" alt=\"$l_profileof $poster\" border=\"0\"></a>";
- $email_img = ($postrow[$x]["user_viewemail"] == 1) ? "<a href=\"mailto:".$postrow[$x]["user_email"]."\"><img src=\"$image_email\" alt=\"$l_email $poster\" border=\"0\"></a>" : "";
- $www_img = ($postrow[$x]["user_website"]) ? "<a href=\"".$postrow[$x]["user_website"]."\"><img src=\"$image_www\" alt=\"$l_viewsite\" border=\"0\"></a>" : "";
+ $profile_img = "<a href=\"profile.$phpEx?mode=viewprofile&user_id=$poster_id\"><img src=\"".$images['profile']."\" alt=\"$l_profileof $poster\" border=\"0\"></a>";
+ $email_img = ($postrow[$x]["user_viewemail"] == 1) ? "<a href=\"mailto:".$postrow[$x]["user_email"]."\"><img src=\"".$images['email']."\" alt=\"$l_email $poster\" border=\"0\"></a>" : "";
+ $www_img = ($postrow[$x]["user_website"]) ? "<a href=\"".$postrow[$x]["user_website"]."\"><img src=\"".$images['www']."\" alt=\"$l_viewsite\" border=\"0\"></a>" : "";
if($postrow[$x]["user_icq"])
{
$icq_status_img = "<a href=\"http://wwp.icq.com/".$postrow[$x]["user_icq"]."#pager\"><img src=\"http://online.mirabilis.com/scripts/online.dll?icq=".$postrow[$x]["user_icq"]."&img=5\" alt=\"$l_icqstatus\" border=\"0\"></a>";
- $icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=".$postrow[$x]["user_icq"]."\"><img src=\"$image_icq\" alt=\"$l_icq\" border=\"0\"></a>";
+ $icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=".$postrow[$x]["user_icq"]."\"><img src=\"".$images['icq']."\" alt=\"$l_icq\" border=\"0\"></a>";
}
else
{
@@ -171,30 +195,30 @@ for($x = 0; $x < $total_posts; $x++)
$icq_add_img = "";
}
- $aim_img = ($postrow[$x]["user_aim"]) ? "<a href=\"aim:goim?screenname=".$postrow[$x]["user_aim"]."&message=Hello+Are+you+there?\"><img src=\"$image_aim\" border=\"0\"></a>" : "";
- $msn_img = ($postrow[$x]["user_msnm"]) ? "<a href=\"profile.$phpEx?mode=viewprofile&user_id=$poster_id\"><img src=\"$image_msn\" border=\"0\"></a>" : "";
- $yim_img = ($postrow[$x]["user_yim"]) ? "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=".$postrow[$x]["user_yim"]."&.src=pg\"><img src=\"$image_yim\" border=\"0\"></a>" : "";
+ $aim_img = ($postrow[$x]["user_aim"]) ? "<a href=\"aim:goim?screenname=".$postrow[$x]["user_aim"]."&message=Hello+Are+you+there?\"><img src=\"".$images['aim']."\" border=\"0\"></a>" : "";
+ $msn_img = ($postrow[$x]["user_msnm"]) ? "<a href=\"profile.$phpEx?mode=viewprofile&user_id=$poster_id\"><img src=\"".$images['msn']."\" border=\"0\"></a>" : "";
+ $yim_img = ($postrow[$x]["user_yim"]) ? "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=".$postrow[$x]["user_yim"]."&.src=pg\"><img src=\"".$images['yim']."\" border=\"0\"></a>" : "";
- $edit_img = "<a href=\"posting.$phpEx?mode=editpost&post_id=".$postrow[$x]["post_id"]."&topic_id=$topic_id&forum_id=$forum_id\"><img src=\"$image_edit\" alt=\"$l_editdelete\" border=\"0\"></a>";
- $quote_img = "<a href=\"posting.$phpEx?mode=reply&quote=true&post_id=".$postrow[$x]["post_id"]."&topic_id=$topic_id&forum_id=$forum_id\"><img src=\"$image_quote\" alt=\"$l_replyquote\" border=\"0\"></a>";
- $pmsg_img = "<a href=\"priv_msgs.$phpEx?mode=send\"><img src=\"$image_pmsg\" alt=\"$l_sendpmsg\" border=\"0\"></a>";
+ $edit_img = "<a href=\"posting.$phpEx?mode=editpost&post_id=".$postrow[$x]["post_id"]."&topic_id=$topic_id&forum_id=$forum_id\"><img src=\"".$images['edit']."\" alt=\"$l_editdelete\" border=\"0\"></a>";
+ $quote_img = "<a href=\"posting.$phpEx?mode=reply&quote=true&post_id=".$postrow[$x]["post_id"]."&topic_id=$topic_id&forum_id=$forum_id\"><img src=\"".$images['quote']."\" alt=\"$l_replyquote\" border=\"0\"></a>";
+ $pmsg_img = "<a href=\"priv_msgs.$phpEx?mode=send\"><img src=\"".$images['pmsg']."\" alt=\"$l_sendpmsg\" border=\"0\"></a>";
if($is_moderator)
{
- $ip_img = "<a href=\"topicadmin.$phpEx?mode=viewip&user_id=".$poster_id."\"><img src=\"$image_ip\" alt=\"$l_viewip\" border=\"0\"></a>";
- $delpost_img = "<a href=\"topicadmin.$phpEx?mode=delpost$post_id=".$postrow[$x]["post_id"]."\"><img src=\"$image_delpost\" alt=\"$l_delete\" border=\"0\"></a>";
+ $ip_img = "<a href=\"topicadmin.$phpEx?mode=viewip&user_id=".$poster_id."\"><img src=\"".$images['ip']."\" alt=\"$l_viewip\" border=\"0\"></a>";
+ $delpost_img = "<a href=\"topicadmin.$phpEx?mode=delpost$post_id=".$postrow[$x]["post_id"]."\"><img src=\"".$images['delpost']."\" alt=\"$l_delete\" border=\"0\"></a>";
}
$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]$", "<br />_________________<br />" . 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 .= "<a href=\"$PHP_SELF?".POST_TOPIC_URL."=$topic_id&forum_id=$forum_id&start=$last_page\">$l_prevpage</a> ";
+ $pagination .= "<a href=\"$PHP_SELF?".POST_TOPIC_URL."=$topic_id&start=$last_page\">$l_prevpage</a> ";
}
- 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 .= "<a href=\"$PHP_SELF?".POST_TOPIC_URL."=$topic_id&forum_id=$forum_id&start=$x\">$times</a>";
+ $pagination .= "<a href=\"$PHP_SELF?".POST_TOPIC_URL."=$topic_id&start=$x\">$times</a>";
}
$times++;
}
- if(($start + $posts_per_page) < $total_replies)
+ if(($start + $board_config['posts_per_page']) < $total_replies)
{
- $next_page = $start + $posts_per_page;
- $pagination .= " <a href=\"$PHP_SELF?".POST_TOPIC_URL."=$topic_id&forum_id=$forum_id&start=$next_page\">$l_nextpage</a>";
+ $next_page = $start + $board_config['posts_per_page'];
+ $pagination .= " <a href=\"$PHP_SELF?".POST_TOPIC_URL."=$topic_id&start=$next_page\">$l_nextpage</a>";
}
$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");