Cache moderator names? Output moderators for all forums in viewforum. Alter a few things in templates

git-svn-id: file:///svn/phpbb/trunk@3061 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-11-18 21:04:45 +00:00
parent ce40939e60
commit 6e910ca116
11 changed files with 287 additions and 212 deletions

View file

@ -104,6 +104,8 @@ if (isset($_POST['update']))
$auth_admin->acl_set($_POST['type'], $forum_id, $id, $_POST['option']); $auth_admin->acl_set($_POST['type'], $forum_id, $id, $_POST['option']);
} }
cache_moderators();
trigger_error('Permissions updated successfully'); trigger_error('Permissions updated successfully');
} }
else if (isset($_POST['delete'])) else if (isset($_POST['delete']))
@ -135,6 +137,8 @@ else if (isset($_POST['delete']))
$auth_admin->acl_delete($_POST['type'], $forum_id, $id, $option_ids); $auth_admin->acl_delete($_POST['type'], $forum_id, $id, $option_ids);
} }
cache_moderators();
trigger_error('Permissions updated successfully'); trigger_error('Permissions updated successfully');
} }

View file

@ -105,44 +105,11 @@ function get_moderators(&$forum_moderators, $forum_id = false)
$forum_moderators[$row['forum_id']][] = (!empty($row['user_id'])) ? '<a href="profile.' . $phpEx . $SID . '&amp;mode=viewprofile&amp;u=' . $row['user_id'] . '">' . $row['username'] . '</a>' : '<a href="groupcp.' . $phpEx . $SID . '&amp;g=' . $row['group_id'] . '">' . $row['groupname'] . '</a>'; $forum_moderators[$row['forum_id']][] = (!empty($row['user_id'])) ? '<a href="profile.' . $phpEx . $SID . '&amp;mode=viewprofile&amp;u=' . $row['user_id'] . '">' . $row['username'] . '</a>' : '<a href="groupcp.' . $phpEx . $SID . '&amp;g=' . $row['group_id'] . '">' . $row['groupname'] . '</a>';
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
/*
$sql = "SELECT a.forum_id, u.user_id, u.username
FROM " . ACL_OPTIONS_TABLE . " o, " . ACL_USERS_TABLE . " a, " . USERS_TABLE . " u
WHERE a.auth_option_id = o.auth_option_id
AND a.user_id = u.user_id
AND o.auth_value = 'm_'
AND a.auth_allow_deny = 1
$forum_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_moderators[$row['forum_id']][] = '<a href="profile.' . $phpEx . $SID . '&amp;mode=viewprofile&amp;u=' . $row['user_id'] . '">' . $row['username'] . '</a>';
}
$db->sql_freeresult($result);
$sql = "SELECT a.forum_id, g.group_name, g.group_id
FROM " . ACL_OPTIONS_TABLE . " o, " . ACL_GROUPS_TABLE . " a, " . GROUPS_TABLE . " g
WHERE a.auth_option_id = o.auth_option_id
AND a.group_id = g.group_id
AND o.auth_value = 'm_'
AND a.auth_allow_deny = 1
AND g.group_type <> " . GROUP_HIDDEN . "
$forum_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_moderators[$row['forum_id']][] = '<a href="groupcp.' . $phpEx . $SID . '&amp;g=' . $row['group_id'] . '">' . $row['group_name'] . '</a>';
}
$db->sql_freeresult($result);
*/
return; return;
} }
//
// User authorisation levels output // User authorisation levels output
//
function get_forum_rules($mode, &$rules, &$forum_id) function get_forum_rules($mode, &$rules, &$forum_id)
{ {
global $SID, $auth, $user; global $SID, $auth, $user;

View file

@ -454,6 +454,110 @@ function config_cache_write($match, $data)
return; return;
} }
// Cache moderators, called whenever permissions are
// changed via admin_permissions. Changes of username
// and group names must be carried through for the
// moderators table
function cache_moderators($forum_id = false)
{
global $db;
if (!empty($forum_id) && is_array($forum_id))
{
$forum_sql = 'AND forum_id IN (' . implode(', ', $forum_id) . ')';
}
else
{
$forum_sql = ($forum_id) ? 'AND forum_id = ' . $forum_id : '';
}
// Clear table
$db->sql_query('TRUNCATE ' . MODERATOR_TABLE);
// Holding array
$m_sql = array();
$user_id_sql = '';
$sql = "SELECT a.forum_id, u.user_id, u.username
FROM " . ACL_OPTIONS_TABLE . " o, " . ACL_USERS_TABLE . " a, " . USERS_TABLE . " u
WHERE o.auth_value = 'm_'
AND a.auth_option_id = o.auth_option_id
AND a.auth_allow_deny = 1
AND u.user_id = a.user_id
$forum_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$m_sql['f_' . $row['forum_id'] . '_u_' . $row['user_id']] = $row['forum_id'] . ', ' . $row['user_id'] . ', \'' . $row['username'] . '\', NULL, NULL';
$user_id_sql .= (($user_id_sql) ? ', ' : '') . $row['user_id'];
}
$db->sql_freeresult($result);
// Remove users who have group memberships with DENY moderator permissions
if ($user_id_sql)
{
$sql = "SELECT a.forum_id, ug.user_id
FROM " . ACL_OPTIONS_TABLE . " o, " . ACL_GROUPS_TABLE . " a, " . USER_GROUP_TABLE . " ug
WHERE o.auth_value = 'm_'
AND a.auth_option_id = o.auth_option_id
AND a.auth_allow_deny = 0
AND a.group_id = ug.group_id
AND ug.user_id IN ($user_id_sql)
$forum_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
unset($m_sql['f_' . $row['forum_id'] . '_u_' . $row['user_id']]);
}
$db->sql_freeresult($result);
}
$sql = "SELECT a.forum_id, g.group_name, g.group_id
FROM " . ACL_OPTIONS_TABLE . " o, " . ACL_GROUPS_TABLE . " a, " . GROUPS_TABLE . " g
WHERE o.auth_value = 'm_'
AND a.auth_option_id = o.auth_option_id
AND a.auth_allow_deny = 1
AND g.group_id = a.group_id
AND g.group_type NOT IN (" . GROUP_HIDDEN . ", " . GROUP_SPECIAL . ")
$forum_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$m_sql['f_' . $row['forum_id'] . '_g_' . $row['group_id']] = $row['forum_id'] . ', NULL, NULL, ' . $row['group_id'] . ', \'' . $row['group_name'] . '\'';
}
$db->sql_freeresult($result);
if (sizeof($m_sql))
{
switch (SQL_LAYER)
{
case 'mysql':
case 'mysql4':
$sql = 'INSERT INTO ' . MODERATOR_TABLE . ' (forum_id, user_id, username, group_id, groupname) VALUES ' . implode(', ', preg_replace('#^(.*)$#', '(\1)', $m_sql));
$result = $db->sql_query($sql);
$db->sql_freeresult($result);
break;
case 'mssql':
$sql = 'INSERT INTO ' . MODERATOR_TABLE . ' (forum_id, user_id, username, group_id, groupname)
VALUES ' . implode(' UNION ALL ', preg_replace('#^(.*)$#', 'SELECT \1', $m_sql));
$result = $db->sql_query($sql);
$db->sql_freeresult($result);
break;
default:
foreach ($m_sql as $k => $sql)
{
$result = $db->sql_query('INSERT INTO ' . MODERATOR_TABLE . " (forum_id, user_id, username, group_id, groupname) VALUES ($sql)");
$db->sql_freeresult($result);
}
}
}
}
// Extension of auth class for changing permissions // Extension of auth class for changing permissions
class auth_admin extends auth class auth_admin extends auth
{ {

View file

@ -21,7 +21,7 @@
function display_forums($root_data=array(), $display_moderators=TRUE) function display_forums($root_data=array(), $display_moderators=TRUE)
{ {
global $db, $template, $auth, $user, $phpEx, $SID; global $db, $template, $auth, $user, $phpEx, $SID, $forum_moderators;
$where_sql = ($root_data['forum_id']) ? ' WHERE left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id'] : ''; $where_sql = ($root_data['forum_id']) ? ' WHERE left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id'] : '';
@ -29,7 +29,8 @@ function display_forums($root_data=array(), $display_moderators=TRUE)
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$branch_root_id = $root_data['forum_id']; $branch_root_id = $root_data['forum_id'];
$forum_rows = $subforums = $forum_ids = $forum_moderators = array(); $forum_rows = $subforums = $forum_moderators = array();
$forum_ids = array($root_data['forum_id']);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
@ -60,27 +61,20 @@ function display_forums($root_data=array(), $display_moderators=TRUE)
// Direct child // Direct child
$forum_rows[] = $row; $forum_rows[] = $row;
$parent_id = $row['forum_id']; $parent_id = $row['forum_id'];
$forum_ids[] = $row['forum_id'];
if (!$row['forum_postable']) if (!$row['forum_postable'])
{ {
$branch_root_id = $row['forum_id']; $branch_root_id = $row['forum_id'];
} }
else
{
$forum_ids[] = $row['forum_id'];
}
} }
elseif ($row['parent_id'] == $branch_root_id) elseif ($row['parent_id'] == $branch_root_id)
{ {
// Forum directly under a category // Forum directly under a category
$forum_rows[] = $row; $forum_rows[] = $row;
$parent_id = $row['forum_id']; $parent_id = $row['forum_id'];
if ($row['forum_postable'])
{
$forum_ids[] = $row['forum_id']; $forum_ids[] = $row['forum_id'];
} }
}
elseif ($row['forum_postable']) elseif ($row['forum_postable'])
{ {
if ($row['display_on_index']) if ($row['display_on_index'])

View file

@ -383,6 +383,12 @@ if (isset($_POST['submit']))
$db->sql_query($sql); $db->sql_query($sql);
} }
// Update moderator cache table as appropriate
$sql = 'UPDATE ' . CONFIG_TABLE . "
SET username = '" . sql_quote($username) . "'
WHERE user_id = $user_id";
$db->sql_query($sql);
if (!$user_active) if (!$user_active)
{ {
// //

View file

@ -621,7 +621,7 @@ switch ($mode)
break; break;
case 'edit': case 'edit':
$page_title = $user->lang['Edit_Post']; $page_title = $user->lang['EDIT_POST'];
$s_action .= '&amp;p=' . intval($post_id); $s_action .= '&amp;p=' . intval($post_id);
break; break;
} }

View file

@ -152,7 +152,7 @@ function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate(); if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
} }
function unixSafeColours() function colorPalette()
{ {
var r = 0, g = 0, b = 0; var r = 0, g = 0, b = 0;
var numberList = new Array(6); var numberList = new Array(6);
@ -171,7 +171,7 @@ function unixSafeColours()
{ {
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
document.write('<td bgcolor="#' + color + '">'); document.write('<td bgcolor="#' + color + '">');
document.write('<a href="javascript:bbfontstyle(\'[color=#' + color + ']\', \'[/color]\');"><img src="images/spacer.gif" width="10" height="6" border="0" alt="#' + color + '" title="#' + color + '" /></a>'); document.write('<a href="javascript:bbfontstyle(\'[color=#' + color + ']\', \'[/color]\');" onmouseover="helpline(\'s\');"><img src="images/spacer.gif" width="10" height="6" border="0" alt="#' + color + '" title="#' + color + '" /></a>');
document.writeln('</td>'); document.writeln('</td>');
} }
document.writeln('</tr>'); document.writeln('</tr>');

View file

@ -38,7 +38,7 @@ function checkForm()
<form action="{S_POST_ACTION}" method="post" name="post" onsubmit="return checkForm(this)"><table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> <form action="{S_POST_ACTION}" method="post" name="post" onsubmit="return checkForm(this)"><table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr> <tr>
<td colspan="2" align="left" valign="bottom"><a class="maintitle" href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- IF TOPIC_TITLE --> :: <a class="maintitle" href="{U_VIEWTOPIC}">{TOPIC_TITLE}</a><!-- ENDIF --><br /><span class="gensmall"> [ <a href="{U_VIEW_MODERATORS}">{L_VIEW_MODERATORS}</a> ]<br /><br /><b>{LOGGED_IN_USER_LIST}</b></span></td> <td colspan="2" align="left" valign="bottom"><a class="maintitle" href="{U_VIEW_FORUM}" title="{FORUM_DESC}">{FORUM_NAME}</a><!-- IF TOPIC_TITLE --> :: <a class="maintitle" href="{U_VIEWTOPIC}">{TOPIC_TITLE}</a><!-- ENDIF --><br /><span class="gensmall">{L_MODERATORS}: <b>{MODERATORS}</b><br /><br /><b>{LOGGED_IN_USER_LIST}</b></span></td>
</tr> </tr>
<tr> <tr>
<td class="nav" width="100%" align="left" valign="middle"><span class="nav"><a class="nav" href="{U_INDEX}">{L_INDEX}</a> <td class="nav" width="100%" align="left" valign="middle"><span class="nav"><a class="nav" href="{U_INDEX}">{L_INDEX}</a>
@ -63,7 +63,7 @@ function checkForm()
<!-- IF S_DELETE_ALLOWED --> <!-- IF S_DELETE_ALLOWED -->
<tr> <tr>
<td class="row1"><span class="gen"><b>{L_DELETE_POST}</b></span></td> <td class="row1"><span class="gen"><b>{L_DELETE_POST}</b></span></td>
<td class="row2"><input type="checkbox" name="delete" /> <span class="gensmall">[ {L_DELETE_WARN} ]</span></td> <td class="row2"><input type="checkbox" name="delete" /> <span class="gensmall">[ {L_DELETE_POST_WARN} ]</span></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF S_DISPLAY_USERNAME --> <!-- IF S_DISPLAY_USERNAME -->
@ -83,7 +83,7 @@ function checkForm()
<td class="row1"><span class="gen"><b>{L_TOPIC_ICON}</b></span></td> <td class="row1"><span class="gen"><b>{L_TOPIC_ICON}</b></span></td>
<td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0"> <td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr> <tr>
<td valign="middle"><span class="gensmall"><input type="radio" name="icon" value="1" checked="checked" /><span class="genmed">{L_NONE}</span>&nbsp;<!-- BEGIN topic_icon --><input type="radio" name="icon" value="{topic_icon.ICON_ID}"{topic_icon.S_ICON_CHECKED} /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" hspace="2" vspace="2" /> <!-- END topic_icon --></td> <td><input type="radio" name="icon" value="1" checked="checked" /><span class="genmed">{L_NONE}</span> <!-- BEGIN topic_icon --><input type="radio" name="icon" value="{topic_icon.ICON_ID}"{topic_icon.S_ICON_CHECKED} /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="" title="" hspace="2" vspace="2" /> <!-- END topic_icon --></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
@ -102,7 +102,7 @@ function checkForm()
</tr> </tr>
<!-- IF S_SHOW_EMOTICON_LINK --> <!-- IF S_SHOW_EMOTICON_LINK -->
<tr> <tr>
<td align="center"><a class="nav" href="{U_MORE_SMILIES}" onclick="window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=350,resizable=yes,scrollbars=yes,WIDTH=300');return false;" target="_phpbbsmilies">{L_MORE_SMILIES}</a></td> <td align="center"><a class="nav" href="{U_MORE_SMILIES}" onclick="window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=350,resizable=yes,scrollbars=yes,WIDTH=300');return false;" target="_phpbbsmilies">{L_MORE_EMOTICONS}</a></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
</table></td> </table></td>
@ -128,27 +128,25 @@ function checkForm()
<option value="18" class="genmed">{L_FONT_LARGE}</option> <option value="18" class="genmed">{L_FONT_LARGE}</option>
<option value="24" class="genmed">{L_FONT_HUGE}</option> <option value="24" class="genmed">{L_FONT_HUGE}</option>
</select></span></td> </select></span></td>
<td nowrap="nowrap" align="right"><span class="gensmall"><a href="javascript:bbstyle(-1)" class="genmed" onmouseover="helpline('a')">{L_BBCODE_CLOSE_TAGS}</a></span></td> <td nowrap="nowrap" align="right"><span class="gensmall"><a href="javascript:bbstyle(-1)" class="genmed" onmouseover="helpline('a')">{L_CLOSE_TAGS}</a></span></td>
</tr>
</table></td>
<td rowspan="3" width="100%" align="center" valign="middle"><table cellspacing="5" cellpadding="0" border="0">
<tr>
<td><span class="genmed">{L_FONT_COLOR}</span></td>
</tr>
<tr>
<td bgcolor="black"><script language="javascript" type="text/javascript"><!--
unixSafeColours()
//--></script></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
<tr> <tr>
<td colspan="9" width="450"><input type="text" name="helpbox" size="45" maxlength="100" style="width:450px; font-size:10px" class="helpline" value="{L_STYLES_TIP}" /></td> <td colspan="9" width="450"><input type="text" name="helpbox" size="45" maxlength="100" style="width:450px; font-size:10px" class="helpline" value="{L_STYLES_TIP}" /></td>
<td align="center"><span class="genmed">{L_FONT_COLOR}</span></td>
</tr> </tr>
<tr> <tr>
<td colspan="9"><textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea></td> <td colspan="9"><textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea></td>
<td width="100%" align="center" valign="top"><table cellspacing="0" cellpadding="0" border="0">
<tr>
<td bgcolor="black"><script language="javascript" type="text/javascript"><!--
colorPalette()
//--></script></td>
</tr>
</table></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
@ -196,13 +194,13 @@ function checkForm()
<!-- IF S_SIG_ALLOWED --> <!-- IF S_SIG_ALLOWED -->
<tr> <tr>
<td><input type="checkbox" name="attach_sig" {S_SIGNATURE_CHECKED} /></td> <td><input type="checkbox" name="attach_sig" {S_SIGNATURE_CHECKED} /></td>
<td><span class="gen">{L_ATTACH_SIGNATURE}</span></td> <td><span class="gen">{L_ATTACH_SIG}</span></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF S_NOTIFY_ALLOWED --> <!-- IF S_NOTIFY_ALLOWED -->
<tr> <tr>
<td><input type="checkbox" name="notify" {S_NOTIFY_CHECKED} /></td> <td><input type="checkbox" name="notify" {S_NOTIFY_CHECKED} /></td>
<td><span class="gen">{L_NOTIFY_ON_REPLY}</span></td> <td><span class="gen">{L_NOTIFY_REPLY}</span></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF S_TYPE_TOGGLE --> <!-- IF S_TYPE_TOGGLE -->
@ -215,7 +213,7 @@ function checkForm()
</tr> </tr>
<!-- IF S_SHOW_POLL_BOX --> <!-- IF S_SHOW_POLL_BOX -->
<tr> <tr>
<th class="thHead" colspan="2">{L_ADD_A_POLL}</th> <th class="thHead" colspan="2">{L_ADD_POLL}</th>
</tr> </tr>
<tr> <tr>
<td class="row1" colspan="2"><span class="gensmall">{L_ADD_POLL_EXPLAIN}</span></td> <td class="row1" colspan="2"><span class="gensmall">{L_ADD_POLL_EXPLAIN}</span></td>
@ -229,8 +227,8 @@ function checkForm()
<td class="row2"><span class="genmed"><textarea name="poll_option_text" rows="5" cols="35" wrap="virtual" style="width:450px" class="post">{POLL_OPTIONS}</textarea></td> <td class="row2"><span class="genmed"><textarea name="poll_option_text" rows="5" cols="35" wrap="virtual" style="width:450px" class="post">{POLL_OPTIONS}</textarea></td>
</tr> </tr>
<tr> <tr>
<td class="row1"><span class="gen"><b>{L_POLL_LENGTH}</b></span></td> <td class="row1"><span class="gen"><b>{L_POLL_FOR}</b></span></td>
<td class="row2"><span class="genmed"><input type="text" name="poll_length" size="3" maxlength="3" class="post" value="{POLL_LENGTH}" /></span>&nbsp;<span class="gen"><b>{L_DAYS}</b></span> <span class="gensmall">{L_POLL_LENGTH_EXPLAIN}</span></td> <td class="row2"><span class="genmed"><input type="text" name="poll_length" size="3" maxlength="3" class="post" value="{POLL_LENGTH}" /></span>&nbsp;<span class="gen"><b>{L_DAYS}</b></span> <span class="gensmall">{L_POLL_FOR_EXPLAIN}</span></td>
</tr> </tr>
<!-- IF S_POLL_DELETE --> <!-- IF S_POLL_DELETE -->
<tr> <tr>
@ -248,7 +246,7 @@ function checkForm()
</tr> </tr>
<tr> <tr>
<td class="row1"><span class="gen"><b>{L_FILE_NAME}</b></span></td> <td class="row1"><span class="gen"><b>{L_FILENAME}</b></span></td>
<td class="row2"><input type="file" name="fileupload" size="50" maxlength="{FILESIZE}" value="{FILENAME}" class="post"></td> <td class="row2"><input type="file" name="fileupload" size="50" maxlength="{FILESIZE}" value="{FILENAME}" class="post"></td>
</tr> </tr>
<tr> <tr>

View file

@ -2,16 +2,11 @@
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr> <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"> <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>
<!-- IF S_IS_POSTABLE -->{MOD_CP}<br /><!-- ENDIF --> <td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><!-- IF S_IS_POSTABLE -->{MOD_CP}<br /><!-- ENDIF --><br /><b>{PAGINATION}</b></span></td>
<br /><b>{LOGGED_IN_USER_LIST}</b></span></td>
<td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>{PAGINATION}</b></span></td>
</tr> </tr>
<!-- IF S_HAS_SUBFORUM --> <!-- IF S_HAS_SUBFORUM --><!-- INCLUDE viewforum_subforum.html --><br /><!-- ENDIF -->
<!-- INCLUDE viewforum_subforum.html -->
<br />
<!-- ENDIF -->
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr> <tr>

View file

@ -139,6 +139,26 @@ $template->assign_vars(array(
'FORUM_DESC' => strip_tags($forum_data['forum_desc']) 'FORUM_DESC' => strip_tags($forum_data['forum_desc'])
)); ));
// Moderators
$forum_moderators = array();
// Do we have subforums? if so, let's include this harmless file
if ($forum_data['left_id'] != $forum_data['right_id'] - 1)
{
$template->assign_vars(array(
'S_HAS_SUBFORUM' => TRUE,
'L_SUBFORUM' => (count($forum_rows) == 1) ? $user->lang['Subforum'] : $user->lang['Subforums']
));
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
display_forums($forum_data);
}
else
{
get_moderators($forum_moderators, $forum_id);
}
// Output forum listing if it is postable
if ($forum_data['forum_postable']) if ($forum_data['forum_postable'])
{ {
// Topic read tracking cookie info // Topic read tracking cookie info
@ -200,9 +220,7 @@ if ($forum_data['forum_postable'])
$sort_days = (!empty($_POST['sort_days'])) ? intval($_POST['sort_days']) : intval($_GET['sort_days']); $sort_days = (!empty($_POST['sort_days'])) ? intval($_POST['sort_days']) : intval($_GET['sort_days']);
$min_topic_time = time() - ( $sort_days * 86400 ); $min_topic_time = time() - ( $sort_days * 86400 );
//
// ref type on as rows as topics ... also not great // ref type on as rows as topics ... also not great
//
$sql = "SELECT COUNT(topic_id) AS forum_topics $sql = "SELECT COUNT(topic_id) AS forum_topics
FROM " . TOPICS_TABLE . " FROM " . TOPICS_TABLE . "
WHERE forum_id = $forum_id WHERE forum_id = $forum_id
@ -255,6 +273,7 @@ if ($forum_data['forum_postable'])
'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&amp;f=$forum_id&amp;topicdays=$topic_days", $topics_count, $config['topics_per_page'], $start), 'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&amp;f=$forum_id&amp;topicdays=$topic_days", $topics_count, $config['topics_per_page'], $start),
'PAGE_NUMBER' => sprintf($user->lang['Page_of'], (floor( $start / $config['topics_per_page'] ) + 1), ceil( $topics_count / $config['topics_per_page'] )), 'PAGE_NUMBER' => sprintf($user->lang['Page_of'], (floor( $start / $config['topics_per_page'] ) + 1), ceil( $topics_count / $config['topics_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>') : '', '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'],
'FOLDER_IMG' => $user->img('folder', 'No_new_posts'), 'FOLDER_IMG' => $user->img('folder', 'No_new_posts'),
'FOLDER_NEW_IMG' => $user->img('folder_new', 'New_posts'), 'FOLDER_NEW_IMG' => $user->img('folder_new', 'New_posts'),
@ -529,18 +548,6 @@ $nav_links['up'] = array(
'title' => sprintf($user->lang['Forum_Index'], $config['sitename']) 'title' => sprintf($user->lang['Forum_Index'], $config['sitename'])
); );
// Do we have subforums? if so, let's include this harmless file
if ($forum_data['left_id'] != $forum_data['right_id'] - 1)
{
$template->assign_vars(array(
'S_HAS_SUBFORUM' => TRUE,
'L_SUBFORUM' => (count($forum_rows) == 1) ? $user->lang['Subforum'] : $user->lang['Subforums']
));
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
display_forums($forum_data);
}
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(