mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-20 07:42:09 +02:00
Viewtopic mostly done. Need private forum stuff, pagination, and some SQL tweaks
git-svn-id: file:///svn/phpbb/trunk@81 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
9411996f45
commit
476718aa43
@ -99,4 +99,18 @@ define('USERS_TABLE', $table_prefix.'users');
|
||||
define('WHOSONLINE_TABLE', $table_prefix.'whosonline');
|
||||
define('WORDS_TABLE', $table_prefix.'words');
|
||||
|
||||
$url_images = "images";
|
||||
$image_quote = "$url_images/quote.gif";
|
||||
|
||||
$image_edit = "$url_images/edit.gif";
|
||||
$image_profile = "$url_images/profile.gif";
|
||||
$image_email = "$url_images/email.gif";
|
||||
|
||||
$image_ip = "$url_images/ip_logged.gif";
|
||||
|
||||
$image_www = "$url_images/www_icon.gif";
|
||||
$image_icq = "$url_images/icq_add.gif";
|
||||
$image_aim = "$url_images/aim.gif";
|
||||
$image_yim = "$url_images/yim.gif";
|
||||
$image_msnm = "$url_images/msnm.gif";
|
||||
?>
|
||||
|
@ -72,38 +72,56 @@ $template->pparse("output", "overall_header");
|
||||
// Do a switch on page type, this way we only load the templates that we need at the time
|
||||
switch($pagetype)
|
||||
{
|
||||
case 'index':
|
||||
$template->set_file(array("header" => "index_header.tpl",
|
||||
"body" => "index_body.tpl",
|
||||
"footer" => "index_footer.tpl"));
|
||||
|
||||
$template->set_var(array("TOTAL_POSTS" => $total_posts,
|
||||
"TOTAL_USERS" => $total_users,
|
||||
"NEWEST_USER" => $newest_user,
|
||||
"NEWEST_UID" => $newest_uid,
|
||||
"USERS_BROWSING" => $users_browsing));
|
||||
|
||||
$template->pparse("output", "header");
|
||||
break;
|
||||
|
||||
case 'viewforum':
|
||||
$template->set_file(array("header" => "viewforum_header.tpl",
|
||||
"body" => "viewforum_body.tpl",
|
||||
"jumpbox" => "jumpbox.tpl",
|
||||
"footer" => "viewforum_footer.tpl"));
|
||||
|
||||
$jumpbox = make_jumpbox($db);
|
||||
$template->set_var(array("JUMPBOX_LIST" => $jumpbox,
|
||||
"JUMPBOX_ACTION" => "viewforum.".$phpEx,
|
||||
"SELECT_NAME" => "forum_id"));
|
||||
$template->parse("JUMPBOX","jumpbox");
|
||||
|
||||
$template->set_var(array("FORUM_ID" => $forum_id,
|
||||
"FORUM_NAME" => $forum_name,
|
||||
"MODERATORS" => $forum_moderators));
|
||||
|
||||
$template->pparse("output", "header");
|
||||
break;
|
||||
case 'index':
|
||||
$template->set_file(array("header" => "index_header.tpl",
|
||||
"body" => "index_body.tpl",
|
||||
"footer" => "index_footer.tpl"));
|
||||
|
||||
$template->set_var(array("TOTAL_POSTS" => $total_posts,
|
||||
"TOTAL_USERS" => $total_users,
|
||||
"NEWEST_USER" => $newest_user,
|
||||
"NEWEST_UID" => $newest_uid,
|
||||
"USERS_BROWSING" => $users_browsing));
|
||||
|
||||
$template->pparse("output", "header");
|
||||
break;
|
||||
|
||||
case 'viewforum':
|
||||
$template->set_file(array("header" => "viewforum_header.tpl",
|
||||
"body" => "viewforum_body.tpl",
|
||||
"jumpbox" => "jumpbox.tpl",
|
||||
"footer" => "viewforum_footer.tpl"));
|
||||
|
||||
$jumpbox = make_jumpbox($db);
|
||||
$template->set_var(array("JUMPBOX_LIST" => $jumpbox,
|
||||
"JUMPBOX_ACTION" => "viewforum.".$phpEx,
|
||||
"SELECT_NAME" => "forum_id"));
|
||||
$template->parse("JUMPBOX","jumpbox");
|
||||
|
||||
$template->set_var(array("FORUM_ID" => $forum_id,
|
||||
"FORUM_NAME" => $forum_name,
|
||||
"MODERATORS" => $forum_moderators));
|
||||
|
||||
$template->pparse("output", "header");
|
||||
break;
|
||||
case 'viewtopic':
|
||||
$template->set_file(array("header" => "viewtopic_header.tpl",
|
||||
"body" => "viewtopic_body.tpl",
|
||||
"jumpbox" => "jumpbox.tpl",
|
||||
"footer" => "viewtopic_footer.tpl"));
|
||||
$jumpbox = make_jumpbox($db);
|
||||
$template->set_var(array("JUMPBOX_LIST" => $jumpbox,
|
||||
"JUMPBOX_ACTION" => "viewforum.".$phpEx,
|
||||
"SELECT_NAME" => "forum_id"));
|
||||
$template->parse("JUMPBOX","jumpbox");
|
||||
|
||||
$template->set_var(array("FORUM_ID" => $forum_id,
|
||||
"FORUM_NAME" => $forum_name,
|
||||
"TOPIC_ID" => $topic_id,
|
||||
"TOPIC_TITLE" => $topic_title));
|
||||
$template->pparse("output", "header");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -25,16 +25,19 @@
|
||||
// Load/parse the footer template we need based on pagetype.
|
||||
switch($pagetype)
|
||||
{
|
||||
case 'index':
|
||||
$template->pparse("output", "footer");
|
||||
break;
|
||||
|
||||
case 'viewforum':
|
||||
|
||||
$template->set_var(array("PHPEX" => $phpEx,
|
||||
"FORUM_ID" => $forum_id));
|
||||
$template->pparse("output", "footer");
|
||||
break;
|
||||
case 'index':
|
||||
$template->pparse("output", "footer");
|
||||
break;
|
||||
|
||||
case 'viewforum':
|
||||
|
||||
$template->set_var(array("PHPEX" => $phpEx,
|
||||
"FORUM_ID" => $forum_id));
|
||||
$template->pparse("output", "footer");
|
||||
break;
|
||||
case 'viewtopic':
|
||||
$template->pparse("output", "footer");
|
||||
break;
|
||||
}
|
||||
|
||||
// Show the overall footer.
|
||||
|
32
phpBB/templates/Default/viewtopic_body.tpl
Normal file
32
phpBB/templates/Default/viewtopic_body.tpl
Normal file
@ -0,0 +1,32 @@
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1">
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" width="100%" cellpadding="3" cellspacing="1">
|
||||
<tr class="tableheader">
|
||||
<td width="15%">Author</td>
|
||||
<td>{TOPIC_TITLE}</td>
|
||||
</tr>
|
||||
<!-- BEGIN postrow -->
|
||||
<tr bgcolor="{ROW_COLOR}" class="tablebody">
|
||||
<td width="15%" align="left" valign="top">
|
||||
<font style="{font-size: 10pt; font-weight: bold;}">{POSTER_NAME}</font><br>
|
||||
{POSTER_RANK}<br>
|
||||
<br>
|
||||
<font style="{font-size: 8pt;}">
|
||||
{L_JOINED}: {POSTER_JOINED}<br>{L_POSTS}: {POSTER_POSTS}<br>{POSTER_FROM}</font>
|
||||
</td>
|
||||
<td>
|
||||
<img src="images/posticon.gif"><font style="{font-size: 8pt;}">{L_POSTED}: {POST_DATE}</font><hr>
|
||||
{MESSAGE}<hr>
|
||||
{PROFILE_IMG} {EMAIL_IMG} {WWW_IMG} {ICQ_STATUS_IMG} {ICQ_ADD_IMG} {AIM_IMG} {YIM_IMG} {MSN_IMG} | {EDIT_IMG} {QUOTE_IMG} {PMSG_IMG} | {IP_IMG} {DELPOST_IMG}
|
||||
</td>
|
||||
</tr>
|
||||
<!-- END postrow -->
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
40
phpBB/templates/Default/viewtopic_footer.tpl
Normal file
40
phpBB/templates/Default/viewtopic_footer.tpl
Normal file
@ -0,0 +1,40 @@
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" width="100%" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" align="left" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1">
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1">
|
||||
<tr>
|
||||
<td align="left" style="{font-size: 8pt;}">
|
||||
<a href="posting.{PHPEX}?mode=newtopic&forum_id={FORUM_ID}">
|
||||
<img src="images/newpost.jpg" height="50" width="125" alt="Post New Topic" border="0"></a>
|
||||
<a href="posting.{PHPEX}?mode=reply&forum_id={FORUM_ID}&topic_id={TOPIC_ID}">
|
||||
<img src="images/reply.jpg" height="50" width="125" alt="Reply to this topic" border="0">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table border="0" align="right" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1">
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1">
|
||||
<tr>
|
||||
<td align="right" style="{font-size: 8pt; height: 55px;}">{JUMPBOX}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
40
phpBB/templates/Default/viewtopic_header.tpl
Normal file
40
phpBB/templates/Default/viewtopic_header.tpl
Normal file
@ -0,0 +1,40 @@
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" align="left" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1">
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1">
|
||||
<tr>
|
||||
<td align="left" valign="bottom" style="{font-size: 8pt; height: 55px;}" nowrap>
|
||||
<a href="index.{PHPEX}">{SITENAME} - Forum Index</a> >> <a href="viewforum.{PHPEX}?forum_id={FORUM_ID}">{FORUM_NAME}</a> >> {TOPIC_TITLE}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" align="right" width="20%" bgcolor="#000000" cellpadding="0" cellspacing="1">
|
||||
<tr>
|
||||
<td>
|
||||
<table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1">
|
||||
<tr>
|
||||
<td align="right" style="{font-size: 8pt;}">
|
||||
<a href="posting.{PHPEX}?mode=newtopic&forum_id={FORUM_ID}">
|
||||
<img src="images/newpost.jpg" height="50" width="125" alt="Post New Topic" border="0"></a>
|
||||
<a href="posting.{PHPEX}?mode=reply&forum_id={FORUM_ID}&topic_id={TOPIC_ID}">
|
||||
<img src="images/reply.jpg" height="50" width="125" alt="Reply to this topic" border="0">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/***************************************************************************
|
||||
*
|
||||
* viewtopic.php
|
||||
* -------------------
|
||||
* begin : Saturday, Feb 13, 2001
|
||||
* copyright : (C) 2001 The phpBB Group
|
||||
@ -11,7 +11,6 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -21,7 +20,181 @@
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
include('extension.inc');
|
||||
include('common.'.$phpEx);
|
||||
|
||||
$is_moderator = 0;
|
||||
|
||||
if(!isset($forum_id) || !isset($topic_id))
|
||||
{
|
||||
error_die($db, GENERAL_ERROR, "You have reached this page in error, please go back and try again");
|
||||
}
|
||||
$sql = "SELECT f.forum_type, u.username, u.user_id
|
||||
FROM ".FORUMS_TABLE." f, ".FORUM_MODS_TABLE." fm, ".USERS_TABLE." u
|
||||
WHERE f.forum_id = '$forum_id'
|
||||
AND fm.forum_id = '$forum_id'
|
||||
AND u.user_id = fm.user_id";
|
||||
|
||||
if(!$result = $db->sql_query($sql))
|
||||
{
|
||||
error_die($db, QUERY_ERROR);
|
||||
}
|
||||
|
||||
//
|
||||
// Add checking for private forums here
|
||||
//
|
||||
|
||||
if(!$total_rows = $db->sql_numrows($result))
|
||||
{
|
||||
error_die($db, GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again.");
|
||||
}
|
||||
|
||||
$forum_row = $db->sql_fetchrowset($result);
|
||||
for($x = 0; $x < $total_rows; $x++)
|
||||
{
|
||||
$moderators[] = array("user_id" => $forum_row[$x]["user_id"],
|
||||
"username" => $forum_row[$x]["username"]);
|
||||
if($userdata["user_id"] == $forum_row[$x]["user_id"])
|
||||
{
|
||||
$is_moderator = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($start))
|
||||
{
|
||||
$start = 0;
|
||||
}
|
||||
$sql = "SELECT t.topic_title, t.topic_status, f.forum_name
|
||||
FROM ".TOPICS_TABLE." t, ".FORUMS_TABLE." f
|
||||
WHERE t.topic_id = '$topic_id' AND f.forum_id = t.forum_id";
|
||||
|
||||
if(!$result = $db->sql_query($sql))
|
||||
{
|
||||
error_die($db, QUERY_ERROR);
|
||||
}
|
||||
if(!$topic_info = $db->sql_fetchrowset($result))
|
||||
{
|
||||
error_die($db, GENERAL_ERROR, "Could not get topic data<br>$sql");
|
||||
}
|
||||
$forum_name = stripslashes($topic_info[0]["forum_name"]);
|
||||
$topic_title = stripslashes($topic_info[0]["topic_title"]);
|
||||
$pagetype = "viewtopic";
|
||||
$page_title = "View Topic - $topic_title";
|
||||
include('page_header.'.$phpEx);
|
||||
|
||||
$sql = "SELECT u.*, r.rank_title, r.rank_image,
|
||||
p.post_time, p.post_id, pt.post_text
|
||||
FROM ".POSTS_TABLE." p
|
||||
LEFT JOIN ".USERS_TABLE." u ON p.poster_id = u.user_id
|
||||
LEFT JOIN ".RANKS_TABLE." r ON (u.user_rank = r.rank_id OR (u.user_posts > r.rank_min AND u.user_posts < r.rank_max))
|
||||
LEFT JOIN ".POSTS_TEXT_TABLE." pt ON p.post_id = pt.post_id
|
||||
WHERE p.topic_id = '$topic_id'
|
||||
ORDER BY p.post_time ASC LIMIT $start, $posts_per_page";
|
||||
|
||||
if(!$result = $db->sql_query($sql))
|
||||
{
|
||||
error_die($db, QUERY_ERROR);
|
||||
}
|
||||
if(!$total_posts = $db->sql_numrows($result))
|
||||
{
|
||||
error_die($db, GENERAL_ERROR, "Error getting post data.");
|
||||
}
|
||||
$postrow = $db->sql_fetchrowset($result);
|
||||
|
||||
$template->set_block("body", "postrow", "posts");
|
||||
|
||||
for($x = 0; $x < $total_posts; $x++)
|
||||
{
|
||||
$poster = stripslashes($postrow[$x]["username"]);
|
||||
$poster_id = $postrow[$x]["user_id"];
|
||||
$poster_rank = stripslashes($postrow[$x]["rank_title"]);
|
||||
$rank_image = ($postrow[$x]["rank_image"]) ? "<img src=\"".$postrow[$x]["rank_image"]."\">" : "";
|
||||
$post_date = date($date_format, $postrow[$x]["post_time"]);
|
||||
|
||||
$poster_posts = $postrow[$x]["user_posts"];
|
||||
$poster_from = ($postrow[$x]["user_from"]) ? "$l_from: ".$postrow[$x]["user_from"] : "";
|
||||
$poster_joined = $postrow[$x]["user_regdate"];
|
||||
|
||||
$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>" : "";
|
||||
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>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$icq_status_img = "";
|
||||
$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_msn"]) ? "<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>" : "";
|
||||
|
||||
$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"e=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_sendpsmg\" 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>";
|
||||
}
|
||||
|
||||
$message = stripslashes($postrow[$x]["post_text"]);
|
||||
if(!$allow_html)
|
||||
{
|
||||
$message = strip_tags($message);
|
||||
}
|
||||
if($allow_bbcode)
|
||||
{
|
||||
// do bbcode stuff here
|
||||
}
|
||||
|
||||
if(!($x % 2))
|
||||
{
|
||||
$color = "#DDDDDD";
|
||||
}
|
||||
else
|
||||
{
|
||||
$color = "#CCCCCC";
|
||||
}
|
||||
|
||||
$message = eregi_replace("\[addsig]$", "<BR>_________________<BR>" . stripslashes($postrow[$x]["user_sig"]), $message);
|
||||
|
||||
$template->set_var(array("TOPIC_TITLE" => $topic_title,
|
||||
"L_POSTED" => $l_posted,
|
||||
"L_JOINED" => $l_joined,
|
||||
"POSTER_NAME" => $poster,
|
||||
"POSTER_RANK" => $poster_rank,
|
||||
"RANK_IMAGE" => $rank_image,
|
||||
"ROW_COLOR" => $color,
|
||||
"POSTER_JOINED" => $poster_joined,
|
||||
"POSTER_POSTS" => $poster_posts,
|
||||
"POSTER_FROM" => $poster_from,
|
||||
"POST_DATE" => $post_date,
|
||||
"MESSAGE" => $message,
|
||||
"PROFILE_IMG" => $profile_img,
|
||||
"EMAIL_IMG" => $email_img,
|
||||
"WWW_IMG" => $www_img,
|
||||
"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,
|
||||
"PMSG_IMG" => $pmsg_img,
|
||||
"IP_IMG" => $ip_img,
|
||||
"DELPOST_IMG" => $delpost_img));
|
||||
$template->parse("posts", "postrow", true);
|
||||
}
|
||||
$template->pparse("output", array("posts", "body"));
|
||||
|
||||
include('page_tail.'.$phpEx);
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user