Removed separate header/footers and moved into each pages body

git-svn-id: file:///svn/phpbb/trunk@311 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-05-17 14:48:39 +00:00
parent dcf65b486e
commit b621f70cd1
14 changed files with 961 additions and 712 deletions

View file

@ -107,10 +107,20 @@ $l_g_user_s = ($guests_online == 1) ? $l_user : $l_users;
$l_is_are = ($logged_online == 1) ? $l_is : $l_are;
$userlist = ($logged_online > 0) ? "$l_Registered $l_r_user_s: " . $userlist : "$l_Registered $l_r_user_s: $l_None";
//
// The following assigns all _common_
// variables that may be used at any point
// in a template. Note that all URL's should
// be wrapped in append_sid, as should all
// S_x_ACTIONS for forms.
//
$template->assign_vars(array(
"SITENAME" => $board_config['sitename'],
"PHPEX" => $phpEx,
"PHPSELF" => $PHP_SELF,
"PAGE_TITLE" => $page_title,
"LOGIN_STATUS" => $logged_in_status,
"META_INFO" => $meta_tags,
"TOTAL_USERS_ONLINE" => "$l_There $l_is_are $logged_online $l_Registered $l_r_user_s $l_and $guests_online $l_guest $l_g_user_s $l_online",
"LOGGED_IN_USER_LIST" => $userlist,
"L_USERNAME" => $l_username,
"L_PASSWORD" => $l_password,
@ -143,12 +153,10 @@ $template->assign_vars(array(
"L_NEWPOSTS" => $l_newposts,
"L_POSTED" => $l_posted,
"L_JOINED" => $l_joined,
"L_AUTO_LOGIN" => $l_autologin,
"L_AUTHOR" => $l_author,
"L_MESSAGE" => $l_message,
"L_BY" => $l_by,
"L_LOGIN_LOGOUT" => $l_login_logout,
"U_INDEX" => append_sid("index.".$phpEx),
@ -195,165 +203,8 @@ $template->assign_vars(array(
"T_IMG1" => $theme['img1'],
"T_IMG2" => $theme['img2'],
"T_IMG3" => $theme['img3'],
"T_IMG4" => $theme['img4'],
"PAGE_TITLE" => $page_title,
"LOGIN_STATUS" => $logged_in_status,
"META_INFO" => $meta_tags,
"TOTAL_USERS_ONLINE" => "$l_There $l_is_are $logged_online $l_Registered $l_r_user_s $l_and $guests_online $l_guest $l_g_user_s $l_online",
"LOGGED_IN_USER_LIST" => $userlist
));
"T_IMG4" => $theme['img4']));
$template->pparse("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_filenames(array(
"header" => "index_header.tpl",
"body" => "index_body.tpl",
"footer" => "index_footer.tpl")
);
$template->assign_vars(array(
"TOTAL_POSTS" => $total_posts,
"TOTAL_USERS" => $total_users,
"NEWEST_USER" => $newest_user,
"NEWEST_UID" => $newest_uid,
"USERS_BROWSING" => $users_browsing,
"U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=$newest_uid"))
);
$template->pparse("header");
break;
case 'viewforum':
$template->set_filenames(array(
"header" => "viewforum_header.tpl",
"body" => "viewforum_body.tpl",
"jumpbox" => "jumpbox.tpl",
"footer" => "viewforum_footer.tpl")
);
$jumpbox = make_jumpbox();
$template->assign_vars(array(
"JUMPBOX_LIST" => $jumpbox,
"SELECT_NAME" => POST_FORUM_URL)
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array(
"FORUM_ID" => $forum_id,
"FORUM_NAME" => $forum_name,
"MODERATORS" => $forum_moderators,
"USERS_BROWSING" => $users_browsing)
);
$template->pparse("header");
break;
case 'viewtopic':
$template->set_filenames(array(
"header" => "viewtopic_header.tpl",
"body" => "viewtopic_body.tpl",
"jumpbox" => "jumpbox.tpl",
"footer" => "viewtopic_footer.tpl")
);
$jumpbox = make_jumpbox();
$template->assign_vars(array(
"JUMPBOX_LIST" => $jumpbox,
"SELECT_NAME" => POST_FORUM_URL)
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array(
"FORUM_ID" => $forum_id,
"FORUM_NAME" => $forum_name,
"TOPIC_ID" => $topic_id,
"TOPIC_TITLE" => $topic_title,
"POST_FORUM_URL" => POST_FORUM_URL,
"USERS_BROWSING" => $users_browsing)
);
$template->pparse("header");
break;
case 'viewonline':
$template->set_filenames(array(
"header" => "viewonline_header.tpl",
"body" => "viewonline_body.tpl",
"jumpbox" => "jumpbox.tpl",
"footer" => "viewonline_footer.tpl")
);
$jumpbox = make_jumpbox();
$template->assign_vars(array(
"JUMPBOX_LIST" => $jumpbox,
"SELECT_NAME" => POST_FORUM_URL)
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array(
"TOTAL_POSTS" => $total_posts,
"TOTAL_USERS" => $total_users,
"POST_USER_URL" => POST_USERS_URL,
"NEWEST_USER" => $newest_user,
"NEWEST_UID" => $newest_uid,
"U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=$newest_uid"))
);
$template->pparse("header");
break;
case 'newtopic':
$template->set_filenames(array(
"header" => "newtopic_header.tpl",
"jumpbox" => "jumpbox.tpl",
"body" => "posting_body.tpl")
);
$jumpbox = make_jumpbox();
$template->assign_vars(array(
"JUMPBOX_LIST" => $jumpbox,
"SELECT_NAME" => POST_FORUM_URL)
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array(
"L_POSTNEWIN" => $l_postnewin,
"FORUM_ID" => $forum_id,
"FORUM_NAME" => $forum_name,
"U_VIEW_FORUM" => append_sid("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id"))
);
$template->pparse("header");
break;
case 'register':
if(!isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']))
{
$coppa = (!isset($HTTP_POST_VARS['coppa'])) ? FALSE : TRUE;
$template->set_filenames(array(
"body" => "agreement.tpl")
);
$template->assign_vars(array(
"COPPA" => $coppa,
"U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&agreed=true"),
"U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&agreed=true&coppa=true"))
);
}
else
{
$template->set_filenames(array(
"body" => "profile_add_body.tpl")
);
}
break;
case 'profile':
$template->set_filenames(array(
"body" => "profile_view_body.tpl")
);
break;
}
?>

View file

@ -22,29 +22,6 @@
*
***************************************************************************/
//
// Load/parse the footer template we need based on pagetype.
//
switch($pagetype)
{
case 'index':
$template->pparse("footer");
break;
case 'viewforum':
$template->pparse("footer");
break;
case 'viewtopic':
$template->pparse("footer");
break;
case 'viewonline':
$template->pparse("footer");
break;
}
//
// Show the overall footer.
//

View file

@ -48,8 +48,28 @@ if(empty($viewcat))
$viewcat = -1;
}
//
// Output page header and
// open the index body template
//
include('includes/page_header.'.$phpEx);
$template->set_filenames(array(
"body" => "index_body.tpl"));
$template->assign_vars(array(
"TOTAL_POSTS" => $total_posts,
"TOTAL_USERS" => $total_users,
"NEWEST_USER" => $newest_user,
"NEWEST_UID" => $newest_uid,
"USERS_BROWSING" => $users_browsing,
"U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=$newest_uid"))
);
//
// Start main
//
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
FROM ".CATEGORIES_TABLE." c, ".FORUMS_TABLE." f
WHERE f.cat_id = c.cat_id
@ -107,7 +127,7 @@ if($total_categories)
default:
// This works on: MySQL, MSSQL and ODBC (Access)
$limit_forums = ($viewcat != -1) ? "WHERE f.cat_id = $viewcat " : "";
echo $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time
$sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time
FROM (( ".FORUMS_TABLE." f
LEFT JOIN ".POSTS_TABLE." p ON f.forum_last_post_id = p.post_id )
LEFT JOIN ".TOPICS_TABLE." t ON p.post_id = t.topic_last_post_id )

View file

@ -24,6 +24,18 @@
include('extension.inc');
include('common.'.$phpEx);
//
// Obtain which forum id is required
//
if(!isset($HTTP_GET_VARS['forum']) && !isset($HTTP_POST_VARS['forum'])) // For backward compatibility
{
$forum_id = ($HTTP_GET_VARS[POST_FORUM_URL]) ? $HTTP_GET_VARS[POST_FORUM_URL] : $HTTP_POST_VARS[POST_FORUM_URL];
}
else
{
$forum_id = ($HTTP_GET_VARS['forum']) ? $HTTP_GET_VARS['forum'] : $HTTP_POST_VARS['forum'];
}
//
// Start session management
//
@ -33,6 +45,11 @@ init_userprefs($userdata);
// End session management
//
//
// Nothing in this file is set, lots of things
// will change to meet coding standards and new
// posting code ...
//
if($submit && !$preview)
{
@ -65,14 +82,14 @@ else
$page_title = " $l_postnew";
$sql = "SELECT forum_name, forum_access
FROM ".FORUMS_TABLE."
WHERE forum_id = '$forum_id'";
WHERE forum_id = $forum_id";
if(!$result = $db->sql_query($sql))
{
error_die(SQL_QUERY, "Could not obtain forum/forum access information.", __LINE__, __FILE__);
}
$forum_info = $db->sql_fetchrowset($result);
$forum_name = stripslashes($forum_info[0]["forum_name"]);
$forum_access = $forum_info[0]["forum_access"];
$forum_info = $db->sql_fetchrow($result);
$forum_name = stripslashes($forum_info['forum_name']);
$forum_access = $forum_info['forum_access'];
if($forum_access == ANONALLOWED)
{
@ -88,7 +105,26 @@ else
}
include('includes/page_header.'.$phpEx);
if($user_logged_in)
$template->set_filenames(array(
"body" => "posting_body.tpl",
"jumpbox" => "jumpbox.tpl")
);
$jumpbox = make_jumpbox();
$template->assign_vars(array(
"JUMPBOX_LIST" => $jumpbox,
"SELECT_NAME" => POST_FORUM_URL)
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array(
"L_POSTNEWIN" => $l_postnewin,
"FORUM_ID" => $forum_id,
"FORUM_NAME" => $forum_name,
"U_VIEW_FORUM" => append_sid("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id"))
);
if($userdata['session_logged_in'])
{
$username_input = $userdata["username"];
$password_input = "";

View file

@ -194,16 +194,31 @@ function tz_select($default)
//
//
// Begin page proper
//
switch($mode)
if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
{
$mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
//
// Begin page proper
//
switch($mode)
{
case 'viewprofile':
$pagetype = "profile";
$page_title = "$l_profile";
//
// Output page header and
// profile_view template
//
include('includes/page_header.'.$phpEx);
$template->set_filenames(array(
"body" => "profile_view_body.tpl")
);
//
// End header
//
if(!$HTTP_GET_VARS[POST_USERS_URL])
{
if(DEBUG)
@ -293,7 +308,15 @@ switch($mode)
}
$pagetype = "register";
$page_title = "$l_register";
//
// Output page header and
// profile_add template
//
include('includes/page_header.'.$phpEx);
//
// End header
//
if(isset($HTTP_POST_VARS['submit']))
{
@ -547,10 +570,25 @@ switch($mode)
$page_title = "$l_register";
include('includes/page_header.'.$phpEx);
if(!isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']))
{
//
// Load agreement template
// since user has not yet
// agreed to registration
// conditions/coppa
//
$template->set_filenames(array(
"body" => "agreement.tpl")
);
$template->assign_vars(array(
"COPPA" => $coppa,
"U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&agreed=true"),
"U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&agreed=true&coppa=true"))
);
$template->pparse("body");
include('includes/page_tail.'.$phpEx);
}
else
@ -663,7 +701,6 @@ switch($mode)
$error_msg .= "<br>Query: $sql";
}
}
}
if($error)
@ -686,6 +723,15 @@ switch($mode)
$selected_template = $board_config['default_template'];
}
//
// Load profile_add template
// to allow user to insert
// new user reg details
//
$template->set_filenames(array(
"body" => "profile_add_body.tpl")
);
$template->assign_vars(array(
"MODE" => $mode,
"USERNAME" => $username,
@ -789,6 +835,8 @@ switch($mode)
error_die(SQL_QUERY);
}
break;
}
}
?>

View file

@ -1,3 +1,22 @@
<tr>
<td>
<table border="0" align="right" width="30%" 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;}">{L_POSTEDTOTAL} -<b>{TOTAL_POSTS}</b>- {L_MESSAGES}.<br>
{L_WEHAVE} <b>{TOTAL_USERS}</b> {L_REGUSERS}.<br>
{L_NEWESTUSER} <b><a href="{U_NEWEST_USER_PROFILE}">{NEWEST_USER}</a></b><br>
{L_ARECURRENTLY} <a href="{U_VIEWONLINE}"><b>{USERS_BROWSING}</b> {L_BROWSING}</a> {L_THEFORUMS}<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#000000" align="center"><table width="100%" cellpadding="0" cellspacing="1" border="0">
<tr>
@ -32,3 +51,14 @@
</tr>
</table></td>
</tr>
<tr>
<td align="center"><table border="0" width="100%" cellpadding="0" cellspacing="1">
<tr>
<td style="{font-size: 8pt;}"><img src="images/folder.gif"> = {L_NEWPOSTS}</td>
<td style="{font-size: 8pt;}" align="right" valign="top"><b>{S_TIMEZONE}</b></td>
</tr>
<tr>
<td style="{font-size: 8pt;}"><img src="images/red_folder.gif"> = {L_NONEWPOSTS}</td>
</tr>
</table></td>
</tr>

View file

@ -1,3 +1,10 @@
<tr>
<td><div align="center"><table width="60%" cellspacing="0" cellpadding="4" border="0">
<tr>
<td align="left" style="{font-size: 8pt; height: 55px;}" nowrap><a href="{U_INDEX}">{SITENAME}&nbsp;{L_INDEX}</a></font></td>
</tr>
</table></div></td>
</tr>
<tr>
<td><br clear="all" /><br />
@ -34,3 +41,8 @@
</td>
</tr>
<tr>
<td><div align="center"><table align="center" border="0" width="60%">
<td style="{font-size: 8pt;}" align="right" valign="top"><b>{S_TIMEZONE}</b></td>
</table></div></td>
</tr>

View file

@ -1,4 +1,19 @@
<tr>
<td>
<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="center" style="{font-size: 8pt;}">{L_POSTNEWIN}<br><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><form action="{S_POST_ACTION}" method="post">
<table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1">
<tr>

View file

@ -1,4 +1,44 @@
<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" style="{font-size: 8pt; height: 55px;}" nowrap>
<div style="{font-size: 10pt; font-weight: bold}">{FORUM_NAME}</div>
Moderated by - {MODERATORS}<br>
<a href="{U_INDEX}">{SITENAME} - Forum Index</a> >> {FORUM_NAME}
</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="{U_POST_NEW_TOPIC}">
<img src="images/newpost.jpg" height="50" width="250" alt="Post New Topic" border="0">
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1">
<tr>
@ -41,3 +81,37 @@
</tr>
</table></td>
</tr>
<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="{U_POST_NEW_TOPIC}"><img src="images/newpost.jpg" height="50" width="250" alt="Post New 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>

View file

@ -1,3 +1,14 @@
<tr>
<td><table border="0" align="right" width="30%" 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;}">{L_POSTEDTOTAL} -<b>{TOTAL_POSTS}</b>- {L_MESSAGES}.<br> {L_WEHAVE} <b>{TOTAL_USERS}</b> {L_REGUSERS}.<br>{L_NEWESTUSER} <b><a href="{U_NEWEST_USER_PROFILE}">{NEWEST_USER}</a></b></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1">
<tr>
@ -6,18 +17,34 @@
<td colspan="4" align="center"><b>There are {ACTIVE_USERS} logged in users and {GUEST_USERS} guest users browsing this board.</b><br />This data is based on users active over the past five minutes.</td>
</tr>
<tr class="catheader">
<td width="35%" align="center">&nbsp;{L_USERNAME}&nbsp;</td>
<td width="25%" align="center">&nbsp;{L_LAST_UPDATE}&nbsp;</td>
<td width="30%" align="center">&nbsp;{L_USERNAME}&nbsp;</td>
<td width="30%" align="center">&nbsp;{L_LASTUPDATE}&nbsp;</td>
<td width="40%" align="center">&nbsp;{L_LOCATION}&nbsp;</td>
</tr>
<!-- BEGIN userrow -->
<tr bgcolor="{userrow.ROW_COLOR}" class="tablebody">
<td width="35%">&nbsp;<a href="{userrow.U_USER_PROFILE}">{userrow.USERNAME}</a>&nbsp;</td>
<td width="25%" align="center">&nbsp;{userrow.LASTUPDATE}&nbsp;</td>
<td width="40%">&nbsp;<a href="{userrow.U_FORUM_LOCATION}">&nbsp;{userrow.LOCATION}</a>&nbsp;</td>
<td width="30%">&nbsp;{userrow.USERNAME}&nbsp;</td>
<td width="30%" align="center">&nbsp;{userrow.LASTUPDATE}&nbsp;</td>
<td width="40%"><a href="{userguestrow.LOCATION_URL}">&nbsp;{userrow.LOCATION}&nbsp;</a></td>
</tr>
<!-- END userrow -->
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><table border="0" width="100%" cellpadding="0" cellspacing="1">
<tr>
<td style="{font-size: 8pt;}" align="left" valign="top"><b>{S_TIMEZONE}</b></td>
<td style="{font-size: 8pt;}" align="right" ><table cellpadding="0" cellspacing="1" border="0" bgcolor="#000000">
<tr>
<td bgcolor="#CCCCCC"><table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td style="{font-size:8pt; height:55px;}" align="right">{JUMPBOX}</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>

View file

@ -1,5 +1,41 @@
<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="{U_INDEX}">{SITENAME} - Forum Index</a> >> <a href="{U_VIEW_FORUM}">{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="{U_POST_NEW_TOPIC}"><img src="images/newpost.jpg" height="50" width="125" alt="Post New Topic" border="0"></a>&nbsp;<a href="{U_POST_REPLY_TOPIC}"><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>
<tr>
<td>
<table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1">
<tr>
<td>
@ -68,3 +104,43 @@
</tr>
</table></td>
</tr>
<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="{U_POST_NEW_TOPIC}">
<img src="images/newpost.jpg" height="50" width="125" alt="Post New Topic" border="0"></a>&nbsp;
<a href="{U_POST_REPLY_TOPIC}">
<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>

View file

@ -191,10 +191,31 @@ $template->assign_vars(array(
"S_POST_DAYS_ACTION" => append_sid("viewforum.$phpEx?".POST_FORUM_URL."=".$forum_id."&start=$start")));
//
// Dump out the page header
// Dump out the page header and
// load viewforum template
//
include('includes/page_header.'.$phpEx);
$template->set_filenames(array(
"body" => "viewforum_body.tpl",
"jumpbox" => "jumpbox.tpl")
);
$jumpbox = make_jumpbox();
$template->assign_vars(array(
"JUMPBOX_LIST" => $jumpbox,
"SELECT_NAME" => POST_FORUM_URL)
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array(
"FORUM_ID" => $forum_id,
"FORUM_NAME" => $forum_name,
"MODERATORS" => $forum_moderators,
"USERS_BROWSING" => $users_browsing)
);
//
// End header
//
//
// Okay, lets dump out the page ...
//
@ -270,6 +291,7 @@ if($total_topics)
$template->assign_vars(array(
"PAGINATION" => generate_pagination("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id", $topics_count, $board_config['topics_per_page'], $start))
);
$template->pparse("body");
}
else

View file

@ -42,8 +42,35 @@ $newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata["username"];
$newest_uid = $newest_userdata["user_id"];
//
// Output page header and load
// viewonline template
//
include('includes/page_header.'.$phpEx);
$template->set_filenames(array(
"body" => "viewonline_body.tpl",
"jumpbox" => "jumpbox.tpl")
);
$jumpbox = make_jumpbox();
$template->assign_vars(array(
"JUMPBOX_LIST" => $jumpbox,
"SELECT_NAME" => POST_FORUM_URL)
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array(
"TOTAL_POSTS" => $total_posts,
"TOTAL_USERS" => $total_users,
"POST_USER_URL" => POST_USERS_URL,
"NEWEST_USER" => $newest_user,
"NEWEST_UID" => $newest_uid,
"U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=$newest_uid"))
);
//
// End header
//
$sql = "SELECT u.username, u.user_id, s.session_page, s.session_logged_in, s.session_time
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
WHERE u.user_id = s.session_user_id

View file

@ -27,6 +27,8 @@ include('includes/bbcode.'.$phpEx);
$page_title = "View Topic - $topic_title";
$pagetype = "viewtopic";
$is_moderator = 0;
if(!isset($HTTP_GET_VARS['topic'])) // For backward compatibility
{
$topic_id = $HTTP_GET_VARS[POST_TOPIC_URL];
@ -36,8 +38,6 @@ else
$topic_id = $HTTP_GET_VARS['topic'];
}
$is_moderator = 0;
if(!isset($topic_id))
{
error_die(GENERAL_ERROR, "You have reached this page in error, please go back and try again");
@ -57,34 +57,29 @@ if(isset($HTTP_GET_VARS['view']))
$operator = "<";
}
switch($dbms)
switch(SQL_LAYER)
{
case 'oracle':
case 'mssql':
case 'odbc':
case 'postgres':
$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 in
(select min(topic_id) from ".TOPICS_TABLE." WHERE topic_time ".$operator." (select topic_time as t_time from ".TOPICS_TABLE." where topic_id = $topic_id))
AND f.forum_id = t.forum_id
AND fm.forum_id = t.forum_id
AND u.user_id = fm.user_id";
break;
default:
// And now the stupid MySQL case...I wish they would get around to implementing subselectes...
$sub_query = "SELECT topic_time FROM ".TOPICS_TABLE." WHERE topic_id = $topic_id";
case 'mysql':
//
// Now the stupid MySQL case...I wish they would get around
// to implementing subselectes...
//
$sub_query = "SELECT topic_time
FROM ".TOPICS_TABLE."
WHERE topic_id = $topic_id";
if($sub_result = $db->sql_query($sub_query))
{
$resultset = $db->sql_fetchrowset($sub_result);
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies,
$result = $db->sql_fetchrow($sub_result);
echo $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_time ".$operator." ".$resultset[0]['topic_time']."
FROM ".TOPICS_TABLE." t, ".TOPICS_TABLE." t2, ".FORUMS_TABLE." f, ".FORUM_MODS_TABLE." fm, ".USERS_TABLE." u
WHERE t.topic_time ".$operator." ".$result['topic_time']."
AND t2.topic_id = $topic_id
AND t.forum_id = t2.forum_id
AND f.forum_id = t.forum_id
AND fm.forum_id = t.forum_id
AND u.user_id = fm.user_id";
AND u.user_id = fm.user_id
ORDER BY t.topic_time DESC";
$db->sql_freeresult($sub_result);
}
else
@ -100,6 +95,21 @@ if(isset($HTTP_GET_VARS['view']))
}
}
break;
default:
//
// The default query handles all the other supported
// DB's; PostgreSQL, MSSQL, ODBC and of course Oracle
//
echo $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 in
(select min(topic_id) from ".TOPICS_TABLE." WHERE topic_time ".$operator." (select topic_time as t_time from ".TOPICS_TABLE." where topic_id = $topic_id))
AND f.forum_id = t.forum_id
AND fm.forum_id = t.forum_id
AND u.user_id = fm.user_id";
break;
}
}
//
@ -107,6 +117,7 @@ if(isset($HTTP_GET_VARS['view']))
//
else
{
$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
@ -114,6 +125,7 @@ else
AND f.forum_id = t.forum_id
AND fm.forum_id = t.forum_id
AND u.user_id = fm.user_id";
}
if(!$result = $db->sql_query($sql))
@ -203,6 +215,33 @@ if(!$ranks_result = $db->sql_query($sql))
$postrow = $db->sql_fetchrowset($result);
$ranksrow = $db->sql_fetchrowset($ranksresult);
//
// Dump out the page header
//
include('includes/page_header.'.$phpEx);
$template->set_filenames(array(
"body" => "viewtopic_body.tpl",
"jumpbox" => "jumpbox.tpl")
);
$jumpbox = make_jumpbox();
$template->assign_vars(array(
"JUMPBOX_LIST" => $jumpbox,
"SELECT_NAME" => POST_FORUM_URL)
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_vars(array(
"FORUM_ID" => $forum_id,
"FORUM_NAME" => $forum_name,
"TOPIC_ID" => $topic_id,
"TOPIC_TITLE" => $topic_title,
"POST_FORUM_URL" => POST_FORUM_URL,
"USERS_BROWSING" => $users_browsing)
);
//
// End header
//
//
// Post, reply and other URL generation for
// templating vars
@ -219,11 +258,6 @@ $template->assign_vars(array(
"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 ...