Further layout faffing, nav links for viewtopic (code needs merging with viewforum/posting), moderators for viewtopic

git-svn-id: file:///svn/phpbb/trunk@3063 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-11-19 18:55:23 +00:00
parent b468fd6e29
commit c1fc6dce16
8 changed files with 244 additions and 96 deletions

View file

@ -80,6 +80,63 @@ function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $incl
return $rows;
}
// Create forum navigation links for given forum, create parent
// list if currently null, assign basic forum info to template
function generate_forum_nav(&$forum_data)
{
global $db, $user, $template;
// Get forum parents
$forum_parents = array();
if ($forum_data['parent_id'] > 0)
{
if (empty($forum_data['forum_parents']))
{
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE . '
WHERE left_id < ' . $forum_data['left_id'] . '
AND right_id > ' . $forum_data['right_id'] . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_parents[$row['forum_id']] = $row['forum_name'];
}
$sql = 'UPDATE ' . FORUMS_TABLE . "
SET forum_parents = '" . sql_escape(serialize($forum_parents)) . "'
WHERE parent_id = " . $forum_data['parent_id'];
$db->sql_query($sql);
}
else
{
$forum_parents = unserialize($forum_data['forum_parents']);
}
}
// Build navigation links
foreach ($forum_parents as $parent_forum_id => $parent_name)
{
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $parent_name,
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $parent_forum_id
));
}
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $forum_data['forum_name'],
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id
));
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DESC' => strip_tags($forum_data['forum_desc'])
));
return;
}
// Obtain list of moderators of each forum
function get_moderators(&$forum_moderators, $forum_id = false)
{

View file

@ -19,7 +19,7 @@
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
if (!defined('IN_PHPBB'))
{
die('Hacking attempt');
}
@ -27,28 +27,28 @@ if ( !defined('IN_PHPBB') )
define('HEADER_INC', TRUE);
// gzip_compression
if ( $config['gzip_compress'] )
if ($config['gzip_compress'])
{
if ( extension_loaded('zlib') && strstr($HTTP_USER_AGENT,'compatible') && !headers_sent() )
if (extension_loaded('zlib') && strstr($HTTP_USER_AGENT,'compatible') && !headers_sent())
{
ob_start('ob_gzhandler');
}
}
// Generate logged in/logged out status
if ( $user->data['user_id'] )
if ($user->data['user_id'] != ANONYMOUS)
{
$u_login_logout = 'login.'.$phpEx. $SID . '&amp;logout=true';
$l_login_logout = $user->lang['Logout'] . ' [ ' . $user->data['username'] . ' ]';
$l_login_logout = $user->lang['LOGOUT'] . ' [ ' . $user->data['username'] . ' ]';
}
else
{
$u_login_logout = 'login.'.$phpEx . $SID;
$l_login_logout = $user->lang['Login'];
$l_login_logout = $user->lang['LOGIN'];
}
// Last visit date/time
$s_last_visit = ( $user->data['user_id'] ) ? $user->format_date($user->data['session_last_visit']) : '';
$s_last_visit = ($user->data['user_id']) ? $user->format_date($user->data['session_last_visit']) : '';
// Get users online list
$userlist_ary = array();
@ -63,33 +63,33 @@ $prev_user_id = 0;
$prev_user_ip = '';
$reading_sql = '';
if ( !empty($_GET['f']) || !empty($_GET['t']) )
if (!empty($_GET['f']) || !empty($_GET['t']))
{
$reading_sql = "AND s.session_page LIKE '%" . ( ( !empty($_GET['t']) ) ? 't=' . intval($_GET['t']) : 'f=' . intval($_GET['f']) ) . "%'";
$reading_sql = "AND s.session_page LIKE '%" . ((!empty($_GET['t'])) ? 't=' . intval($_GET['t']) : 'f=' . intval($_GET['f'])) . "%'";
}
$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_colour, s.session_ip
FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE ." s
WHERE s.session_time >= ".( time() - 300 ) . "
WHERE s.session_time >= ".(time() - 300) . "
$reading_sql
AND u.user_id = s.session_user_id
ORDER BY u.username ASC, s.session_ip ASC";
$result = $db->sql_query($sql, false);
while( $row = $db->sql_fetchrow($result) )
while ($row = $db->sql_fetchrow($result))
{
// User is logged in and therefor not a guest
if ($row['user_id'] != ANONYMOUS)
{
// Skip multiple sessions for one user
if ( $row['user_id'] != $prev_user_id )
if ($row['user_id'] != $prev_user_id)
{
if ( $row['user_colour'] )
if ($row['user_colour'])
{
$row['username'] = '<b style="color:#' . $row['user_colour'] . '">' . $row['username'] . '</b>';
}
if ( $row['user_allow_viewonline'] )
if ($row['user_allow_viewonline'])
{
$user_online_link = '<a href="' . "profile.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '">' . $row['username'] . '</a>';
$logged_visible_online++;
@ -100,9 +100,9 @@ while( $row = $db->sql_fetchrow($result) )
$logged_hidden_online++;
}
if ( $row['user_allow_viewonline'] || $auth->acl_get('a_') )
if ($row['user_allow_viewonline'] || $auth->acl_get('a_'))
{
$online_userlist .= ( $online_userlist != '' ) ? ', ' . $user_online_link : $user_online_link;
$online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link;
}
}
@ -111,7 +111,7 @@ while( $row = $db->sql_fetchrow($result) )
else
{
// Skip multiple sessions for one user
if ( $row['session_ip'] != $prev_session_ip )
if ($row['session_ip'] != $prev_session_ip)
{
$guests_online++;
}
@ -120,24 +120,24 @@ while( $row = $db->sql_fetchrow($result) )
$prev_session_ip = $row['session_ip'];
}
if ( empty($online_userlist) )
if (empty($online_userlist))
{
$online_userlist = $user->lang['None'];
}
if ( empty($_GET['f']) )
if (empty($_GET['f']))
{
$online_userlist = $user->lang['Registered_users'] . ' ' . $online_userlist;
}
else
{
$l_online = ( $guests_online == 1 ) ? $user->lang['Browsing_forum_guest'] : $user->lang['Browsing_forum_guests'];
$l_online = ($guests_online == 1) ? $user->lang['Browsing_forum_guest'] : $user->lang['Browsing_forum_guests'];
$online_userlist = sprintf($l_online, $online_userlist, $guests_online);
}
$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;
if ( $total_online_users > $config['record_online_users'])
if ($total_online_users > $config['record_online_users'])
{
$config['record_online_users'] = $total_online_users;
$config['record_online_date'] = time();
@ -153,11 +153,11 @@ if ( $total_online_users > $config['record_online_users'])
$db->sql_query($sql);
}
if ( $total_online_users == 0 )
if ($total_online_users == 0)
{
$l_t_user_s = $user->lang['Online_users_zero_total'];
}
else if ( $total_online_users == 1 )
else if ($total_online_users == 1)
{
$l_t_user_s = $user->lang['Online_user_total'];
}
@ -166,11 +166,11 @@ else
$l_t_user_s = $user->lang['Online_users_total'];
}
if ( $logged_visible_online == 0 )
if ($logged_visible_online == 0)
{
$l_r_user_s = $user->lang['Reg_users_zero_total'];
}
else if ( $logged_visible_online == 1 )
else if ($logged_visible_online == 1)
{
$l_r_user_s = $user->lang['Reg_user_total'];
}
@ -179,11 +179,11 @@ else
$l_r_user_s = $user->lang['Reg_users_total'];
}
if ( $logged_hidden_online == 0 )
if ($logged_hidden_online == 0)
{
$l_h_user_s = $user->lang['Hidden_users_zero_total'];
}
else if ( $logged_hidden_online == 1 )
else if ($logged_hidden_online == 1)
{
$l_h_user_s = $user->lang['Hidden_user_total'];
}
@ -192,11 +192,11 @@ else
$l_h_user_s = $user->lang['Hidden_users_total'];
}
if ( $guests_online == 0 )
if ($guests_online == 0)
{
$l_g_user_s = $user->lang['Guest_users_zero_total'];
}
else if ( $guests_online == 1 )
else if ($guests_online == 1)
{
$l_g_user_s = $user->lang['Guest_user_total'];
}
@ -215,10 +215,10 @@ if ($user->data['user_id'] != ANONYMOUS)
{
if ($user->data['user_new_privmsg'])
{
$l_message_new = ( $user->data['user_new_privmsg'] == 1 ) ? $user->lang['New_pm'] : $user->lang['New_pms'];
$l_message_new = ($user->data['user_new_privmsg'] == 1) ? $user->lang['New_pm'] : $user->lang['New_pms'];
$l_privmsgs_text = sprintf($l_message_new, $user->data['user_new_privmsg']);
if ( $user->data['user_last_privmsg'] > $user->data['session_last_visit'] )
if ($user->data['user_last_privmsg'] > $user->data['session_last_visit'])
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_last_privmsg = " . $user->data['session_last_visit'] . "
@ -238,9 +238,9 @@ if ($user->data['user_id'] != ANONYMOUS)
$s_privmsg_new = 0;
}
if ( $user->data['user_unread_privmsg'] )
if ($user->data['user_unread_privmsg'])
{
$l_message_unread = ( $user->data['user_unread_privmsg'] == 1 ) ? $user->lang['Unread_pm'] : $user->lang['Unread_pms'];
$l_message_unread = ($user->data['user_unread_privmsg'] == 1) ? $user->lang['Unread_pm'] : $user->lang['Unread_pms'];
$l_privmsgs_text_unread = sprintf($l_message_unread, $user->data['user_unread_privmsg']);
}
else
@ -248,27 +248,21 @@ if ($user->data['user_id'] != ANONYMOUS)
$l_privmsgs_text_unread = $user->lang['No_unread_pm'];
}
}
else
{
$l_privmsgs_text = $user->lang['Login_check_pm'];
$l_privmsgs_text_unread = '';
$s_privmsg_new = 0;
}
// Generate HTML required for Mozilla Navigation bar
$nav_links_html = '';
/*
$nav_link_proto = '<link rel="%s" href="%s" title="%s" />' . "\n";
foreach ( $nav_links as $nav_item => $nav_array )
foreach ($nav_links as $nav_item => $nav_array)
{
if ( !empty($nav_array['url']) )
if (!empty($nav_array['url']))
{
$nav_links_html .= sprintf($nav_link_proto, $nav_item, $nav_array['url'], $nav_array['title']);
}
else
{
// We have a nested array, used for items like <link rel='chapter'> that can occur more than once.
foreach ( $nav_array as $key => $nested_array )
foreach ($nav_array as $key => $nested_array)
{
$nav_links_html .= sprintf($nav_link_proto, $nav_item, $nested_array['url'], $nested_array['title']);
}
@ -291,12 +285,7 @@ $template->assign_vars(array(
'PRIVATE_MESSAGE_NEW_FLAG' => $s_privmsg_new,
'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
'L_USERNAME' => $user->lang['Username'],
'L_PASSWORD' => $user->lang['Password'],
'L_LOGIN_LOGOUT' => $l_login_logout,
'L_LOGIN' => $user->lang['Login'],
'L_LOG_ME_IN' => $user->lang['Log_me_in'],
'L_AUTO_LOGIN' => $user->lang['Log_me_in'],
'L_INDEX' => $user->lang['Forum_Index'],
'L_FAQ' => $user->lang['FAQ'],
'L_REGISTER' => $user->lang['Register'],
@ -305,10 +294,7 @@ $template->assign_vars(array(
'L_PRIVATEMSGS' => $user->lang['Private_Messages'],
'L_MEMBERLIST' => $user->lang['Memberlist'],
'L_USERGROUPS' => $user->lang['Usergroups'],
'L_SEARCH_NEW' => $user->lang['Search_new'],
'L_SEARCH_SELF' => $user->lang['Search_your_posts'],
'L_WHO_IS_ONLINE' => $user->lang['Who_is_Online'],
'L_SEARCH_UNANSWERED' => $user->lang['Search_unanswered'],
'U_PRIVATEMSGS' => 'privmsg.'.$phpEx.$SID.'&amp;folder=inbox',
'U_MEMBERLIST' => 'memberlist.'.$phpEx.$SID,
@ -327,15 +313,15 @@ $template->assign_vars(array(
'U_PRIVATEMSGS_POPUP' => 'privmsg.'.$phpEx.$SID.'&amp;mode=newpm',
'U_SEARCH_UNANSWERED' => 'search.'.$phpEx.$SID.'&amp;search_id=unanswered',
'S_USER_LOGGED_IN' => ( $user->data['user_id'] ) ? true : false,
'S_USER_PM_POPUP' => ( !empty($user->data['user_popup_pm']) ) ? true : false,
'S_USER_LOGGED_IN' => ($user->data['user_id']) ? true : false,
'S_USER_PM_POPUP' => (!empty($user->data['user_popup_pm'])) ? true : false,
'S_USER_BROWSER' => $user->data['session_browser'],
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'],
'S_CONTENT_ENCODING' => $user->lang['ENCODING'],
'S_CONTENT_DIR_LEFT' => $user->lang['LEFT'],
'S_CONTENT_DIR_RIGHT' => $user->lang['RIGHT'],
'S_LOGIN_ACTION' => 'login.'.$phpEx.$SID,
'S_TIMEZONE' => ( $user->data['user_dst'] ) ? sprintf($user->lang['All_times'], $user->lang[doubleval($config['board_timezone'])], $user->lang['tz']['dst']) : sprintf($user->lang['All_times'], $user->lang[doubleval($config['board_timezone'])], ''),
'S_TIMEZONE' => ($user->data['user_dst']) ? sprintf($user->lang['All_times'], $user->lang[doubleval($config['board_timezone'])], $user->lang['tz']['dst']) : sprintf($user->lang['All_times'], $user->lang[doubleval($config['board_timezone'])], ''),
'T_STYLESHEET_DATA' => $user->theme['css_data'],
'T_STYLESHEET_LINK' => 'templates/' . $user->theme['css_external'],
@ -343,7 +329,7 @@ $template->assign_vars(array(
'NAV_LINKS' => $nav_links_html)
);
/*if ( $config['send_encoding'] )
/*if ($config['send_encoding'])
{
header ('Content-type: text/html; charset: ' . $user->lang['ENCODING']);
}*/

View file

@ -47,7 +47,7 @@ if (defined('DEBUG'))
$template->assign_vars(array(
'PHPBB_VERSION' => $config['version'],
'ADMIN_LINK' => ($auth->acl_get('a_')) ? '<a href="' . "admin/index.$phpEx?sid=" . $user->data['session_id'] . '">' . $user->lang['Admin_panel'] . '</a><br /><br />' : '',
'ADMIN_LINK' => ($auth->acl_get('a_')) ? sprintf($user->lang['ACP'], '<a href="' . "admin/index.$phpEx?sid=" . $user->data['session_id'] . '">', '</a>') . '<br /><br />' : '',
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : ''
));

View file

@ -207,6 +207,7 @@ $lang = array_merge($lang, array(
'Rules_delete_cannot' => 'You <b>cannot</b> delete your posts in this forum',
'Rules_vote_can' => 'You <b>can</b> vote in polls in this forum',
'Rules_vote_cannot' => 'You <b>cannot</b> vote in polls in this forum',
'ACP' => '[ %sAdministration Control Panel%s ]',
'MCP' => '[ %sModerator Control Panel%s ]',
'No_topics_post_one' => 'There are no posts in this forum<br />Click on the <b>Post New Topic</b> link on this page to post one',
'Stop_watching_forum' => 'Stop watching this forum',

View file

@ -2,12 +2,31 @@
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td colspan="2" align="left" valign="bottom"><a class="maintitle" href="{U_VIEW_FORUM}" title="{FORUM_DESC}">{FORUM_NAME}</a> <br /><span class="gensmall"><!-- IF S_IS_POSTABLE --><b>{L_MODERATORS}: {MODERATORS}</b><!-- ENDIF --><br /><br /><b>{LOGGED_IN_USER_LIST}</b></span></td>
<td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><!-- IF S_IS_POSTABLE -->{MOD_CP}<br /><br /><!-- ENDIF --><br /><b>{PAGINATION}</b></span></td>
<td align="left" valign="bottom"><a class="maintitle" href="{U_VIEW_FORUM}" title="{FORUM_DESC}">{FORUM_NAME}</a><br /><!-- IF S_IS_POSTABLE --><span class="gensmall"><b>{L_MODERATORS}: {MODERATORS}</b></span><!-- ENDIF --></td>
<td align="right" valign="bottom"><!-- IF S_IS_POSTABLE --><span class="gensmall">{MOD_CP}</span><!-- ENDIF --></td>
</tr>
<tr>
<td valign="bottom"><span class="gensmall"><b>{LOGGED_IN_USER_LIST}</b></span></td>
<td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>{PAGINATION}</b></span></td>
</tr>
</table>
<!-- IF S_HAS_SUBFORUM --><!-- INCLUDE viewforum_subforum.html --><br /><!-- ENDIF -->
<!-- if we have subforums output navigational links (for ease of use) and then include the subforum listing, else output the new post image and associated nav links -->
<!-- IF S_HAS_SUBFORUM -->
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td class="nav" width="100%" align="left" valign="middle"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a>
<!-- BEGIN navlinks -->
-> <a class="nav" href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a>
<!-- END navlinks -->
</span></td>
</tr>
</table>
<!-- INCLUDE viewforum_subforum.html -->
<!-- ELSE -->
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td width="50" align="left" valign="middle"><a href="{U_POST_NEW_TOPIC}"><a href="{U_POST_NEW_TOPIC}">{POST_IMG}</a></a></td>
@ -16,10 +35,12 @@
-> <a class="nav" href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a>
<!-- END navlinks -->
</span></td>
<td class="nav" align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a></span></td>
<td class="nav" align="right" valign="bottom" nowrap="nowrap"><!-- IF S_IS_POSTABLE --><span class="gensmall"><a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a></span><!-- ENDIF --></td>
</tr>
</table>
<!-- ENDIF -->
<!-- if the forum is postable output the viewforum listing -->
<!-- IF S_IS_POSTABLE -->
<table class="forumline" width="100%" cellspacing="1" cellpadding="4" border="0">
<tr>
@ -46,9 +67,9 @@
<td class="row1" colspan="8" height="30" align="center" valign="middle"><span class="gen">{L_NO_TOPICS}</span></td>
</tr>
<!-- END topicrow -->
<tr>
<form method="post" action="{S_FORUM_ACTION}"><td class="catBottom" colspan="8" height="28" align="center" valign="middle"><span class="genmed">{L_DISPLAY_TOPICS}:&nbsp;{S_SELECT_SORT_DAYS}&nbsp;{L_SORT_BY} {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}&nbsp;<input type="submit" class="liteoption" value="{L_GO}" name="sort" /></span></td></form>
</tr>
<tr><form method="post" action="{S_FORUM_ACTION}">
<td class="catBottom" colspan="8" height="28" align="center" valign="middle"><span class="genmed">{L_DISPLAY_TOPICS}:&nbsp;{S_SELECT_SORT_DAYS}&nbsp;{L_SORT_BY} {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}&nbsp;<input type="submit" class="liteoption" value="{L_GO}" name="sort" /></span></td>
</form></tr>
</table>
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
@ -68,6 +89,7 @@
<td colspan="2"><span class="gensmall">{S_WATCH_FORUM}</span></td>
</tr>
</table>
<!-- ENDIF -->
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
@ -75,6 +97,7 @@
</tr>
</table>
<!-- IF S_IS_POSTABLE -->
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td align="left" valign="top"><table cellspacing="3" cellpadding="0" border="0">

View file

@ -13,7 +13,7 @@
<!-- ELSE -->
<tr>
<td class="row1" width="50" height="50" align="center" valign="middle">{forumrow.FORUM_FOLDER_IMG}</td>
<td class="row1" width="100%" height="50"><span class="gen"><a href="{forumrow.U_VIEWFORUM}" class="forumlink">{forumrow.FORUM_NAME}</a></span><br /><table cellspacing="5" cellpadding="0" border="0"><tr><td><span class="gensmall">{forumrow.FORUM_DESC}</span></td></tr></table><span class="gensmall"><!-- IF forumrow.MODERATORS --><b>{L_MODERATORS}:</b> {forumrow.MODERATORS}<br /><!-- ENDIF --><!-- IF forumrow.SUBFORUMS --><b>{forumrow.L_SUBFORUM}</b> {forumrow.SUBFORUMS}<!-- ENDIF --></span></td>
<td class="row1" width="100%" height="50" valign="top"><span class="gen"><a href="{forumrow.U_VIEWFORUM}" class="forumlink">{forumrow.FORUM_NAME}</a></span><br /><table cellspacing="5" cellpadding="0" border="0"><tr><td><span class="gensmall">{forumrow.FORUM_DESC}</span></td></tr></table><span class="gensmall"><!-- IF forumrow.MODERATORS --><b>{L_MODERATORS}:</b> {forumrow.MODERATORS}<br /><!-- ENDIF --><!-- IF forumrow.SUBFORUMS --><br /><b>{forumrow.L_SUBFORUM}</b> {forumrow.SUBFORUMS}<!-- ENDIF --></span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{forumrow.POSTS}</span></td>
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{forumrow.LAST_POST}</span></td>
@ -21,3 +21,24 @@
<!-- ENDIF -->
<!-- END forumrow -->
</table>
<!-- if the forum is postable then output the post img and associated text, else add a break so the jumpbox isn't squashed right below the forum listing -->
<!-- IF S_IS_POSTABLE -->
<br />
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td width="50" align="left" valign="middle"><a href="{U_POST_NEW_TOPIC}"><a href="{U_POST_NEW_TOPIC}">{POST_IMG}</a></td>
<td class="nav" width="100%" align="left" valign="middle"><span class="nav">&nbsp; &nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a>
<!-- BEGIN navlinks -->
-> <a class="nav" href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a>
<!-- END navlinks -->
</span></td>
<td class="nav" align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a></span></td>
</tr>
</table>
<!-- ELSE -->
<br />
<!-- ENDIF -->

View file

@ -1,15 +1,19 @@
<!-- INCLUDE overall_header.html -->
<table width="100%" cellspacing="2" cellpadding="2" border="0">
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left" valign="bottom" colspan="2"><a class="maintitle" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></span><br /><span class="gensmall">{MOD_CP}</span><br /><br /></td>
<td align="left" valign="bottom"><a class="maintitle" href="{U_VIEW_TOPIC}">{TOPIC_TITLE}</a></span><br /><span class="gensmall"><b>{L_MODERATORS}: {MODERATORS}</b></span></td>
<td align="right" valign="bottom"><span class="gensmall">{MOD_CP}</span></td>
</tr>
<tr>
<td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>{PAGINATION}</b></span></td>
</tr>
</table>
<table width="100%" cellspacing="2" cellpadding="2" border="0">
<tr>
<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}">{POST_IMG}</a>&nbsp; &nbsp;<a href="{U_POST_REPLY_TOPIC}">{REPLY_IMG}</a></span></td>
<td align="left" valign="middle" width="100%"><span class="nav">&nbsp; &nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
<td align="left" valign="middle" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}">{POST_IMG}</a>&nbsp; &nbsp;<a href="{U_POST_REPLY_TOPIC}">{REPLY_IMG}</a></span></td>
<td class="nav" width="100%" align="left" valign="middle"><span class="nav">&nbsp; &nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a><!-- BEGIN navlinks --> -> <a class="nav" href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks --></span></td>
</tr>
</table>
@ -130,7 +134,7 @@
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left" valign="middle" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}">{POST_IMG}</a>&nbsp; &nbsp;<a href="{U_POST_REPLY_TOPIC}">{REPLY_IMG}</a></span></td>
<td align="left" valign="middle" width="100%"><span class="nav">&nbsp; &nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
<td class="nav" width="100%" align="left" valign="middle"><span class="nav">&nbsp; &nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a><!-- BEGIN navlinks --> -> <a class="nav" href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks --></span></td>
<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td>
</tr>
<tr>

View file

@ -44,15 +44,11 @@ if (isset($_GET['view']) && empty($post_id))
{
if ($_GET['view'] == 'newest')
{
if (!empty($_COOKIE[$config['cookie_name'] . '_sid']) || !empty($_GET['sid']))
{
$session_id = (!empty($_COOKIE[$config['cookie_name'] . '_sid'])) ? $_COOKIE[$config['cookie_name'] . '_sid'] : $_GET['sid'];
if ($session_id)
if ($user->session_id)
{
$sql = "SELECT p.post_id
FROM " . POSTS_TABLE . " p, " . SESSIONS_TABLE . " s, " . USERS_TABLE . " u
WHERE s.session_id = '$session_id'
WHERE s.session_id = '$user->session_id'
AND u.user_id = s.session_user_id
AND p.topic_id = $topic_id
AND p.post_approved = 1
@ -70,7 +66,6 @@ if (isset($_GET['view']) && empty($post_id))
$newest_post_id = $post_id;
// redirect("viewtopic.$phpEx$SID&p=$post_id#$post_id");
}
}
// redirect("index.$phpEx");
}
@ -131,13 +126,18 @@ if ($user->data['user_id'] != ANONYMOUS)
}
}
// Look at this query ... perhaps a re-think? Perhaps store topic ids rather
// than last/first post ids and have a redirect at the top of this page
// for latest post, newest post for a given topic_id?
// This rather complex gaggle of code handles querying for topics but
// also allows for direct linking to a post (and the calculation of which
// page the post is on and the correct display of viewtopic)
$join_sql_table = (!$post_id) ? '' : ', ' . POSTS_TABLE . ' p, ' . POSTS_TABLE . ' p2 ';
$join_sql = (!$post_id) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND p.post_approved = " . TRUE . " AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_approved = " . TRUE . " AND p2.post_id <= $post_id";
$extra_fields = (!$post_id) ? '' : ", COUNT(p2.post_id) AS prev_posts";
$order_sql = (!$post_id) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, f.forum_name, f.forum_status, f.forum_id, f.forum_style ORDER BY p.post_id ASC";
$order_sql = (!$post_id) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style ORDER BY p.post_id ASC";
if ($user->data['user_id'] != ANONYMOUS)
{
@ -153,7 +153,7 @@ if ($user->data['user_id'] != ANONYMOUS)
}
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_status, f.forum_id, f.forum_style" . $extra_fields . "
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style" . $extra_fields . "
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
@ -165,6 +165,9 @@ if (!extract($db->sql_fetchrow($result)))
trigger_error('Topic_post_not_exist');
}
// Configure style, language, etc.
$user->setup(false, intval($forum_style));
$auth->acl($user->data, intval($forum_id));
@ -184,6 +187,9 @@ if (!$auth->acl_gets('f_read', 'm_', 'a_', intval($forum_id)))
}
// End auth check
if (!empty($post_id))
{
$start = floor(($prev_posts - 1) / $config['posts_per_page']) * $config['posts_per_page'];
@ -297,9 +303,7 @@ if ($user->data['user_id'] != ANONYMOUS)
$rating = '<select name="rating">' . $rating . '</select>';
}
// Was a highlight request part of the URI? Yes, this idea was
// taken from vB but we did already have a highlighter in place
// in search itself ... it's just been extended a bit!
// Was a highlight request part of the URI?
$highlight_match = '';
if (isset($_GET['highlight']))
{
@ -361,15 +365,67 @@ if (count($orig_word))
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
}
// Navigation links ... common to several scripts so we need
// to look at centralising this ... major issue is variable naming
// complicated particularly by viewtopic ...
if ($parent_id > 0)
{
if (empty($forum_parents))
{
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE . '
WHERE left_id < ' . $left_id . '
AND right_id > ' . $right_id . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_parents[$row['forum_id']] = $row['forum_name'];
}
$sql = 'UPDATE ' . FORUMS_TABLE . "
SET forum_parents = '" . sql_escape(serialize($forum_parents)) . "'
WHERE parent_id = " . $parent_id;
$db->sql_query($sql);
}
else
{
$forum_parents = unserialize($forum_parents);
}
}
// Build navigation links
foreach ($forum_parents as $parent_forum_id => $parent_name)
{
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $parent_name,
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $parent_forum_id
));
}
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $forum_name,
'U_VIEW_FORUM' => 'viewforum.' . $phpEx . $SID . '&amp;f=' . $forum_id
));
// Moderators
$forum_moderators = array();
get_moderators($forum_moderators, $forum_id);
// Send vars to template
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_name,
'FORUM_DESC' => strip_tags($forum_desc),
'TOPIC_ID' => $topic_id,
'TOPIC_TITLE' => $topic_title,
'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($user->lang['Page_of'], (floor($start / $config['posts_per_page']) + 1), ceil($topic_replies / $config['posts_per_page'])),
'MOD_CP' => ($auth->acl_gets('m_', 'a_', $forum_id)) ? sprintf($user->lang['MCP'], '<a href="modcp.' . $phpEx . $SID . '&amp;f=' . $forum_id . '">', '</a>') : '',
'MODERATORS' => (sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : $user->lang['None'],
'POST_IMG' => $post_img,
'REPLY_IMG' => $reply_img,