Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955)

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9640 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2009-06-21 09:36:13 +00:00
parent 9d56fa5e70
commit 050567483f
5 changed files with 28 additions and 22 deletions

View file

@ -135,6 +135,7 @@
<li>[Change] Changed behaviour of group_create() function to support specifying additional group columns</li>
<li>[Change] Hide avatar when avatar-type is not allowed (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)</li>
<li>[Change] INCLUDEPHP not depending on phpbb_root_path (Bug #45805 - Patch by nickvergessen)</li>
<li>[Change] Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955)</li>
<li>[Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)</li>
<li>[Feature] Backported 3.2 captcha plugins.</li>
<li>[Feature] Introduced new ACM plugins:

View file

@ -663,14 +663,7 @@ function get_moderators(&$forum_moderators, $forum_id = false)
{
global $config, $template, $db, $phpbb_root_path, $phpEx, $user, $auth;
// Have we disabled the display of moderators? If so, then return
// from whence we came ...
if (!$config['load_moderators'])
{
return;
}
$forum_sql = '';
$forum_id_ary = array();
if ($forum_id !== false)
{
@ -679,13 +672,8 @@ function get_moderators(&$forum_moderators, $forum_id = false)
$forum_id = array($forum_id);
}
// If we don't have a forum then we can't have a moderator
if (!sizeof($forum_id))
{
return;
}
$forum_sql = 'AND m.' . $db->sql_in_set('forum_id', $forum_id);
// Exchange key/value pair to be able to faster check for the forum id existence
$forum_id_ary = array_flip($forum_id);
}
$sql_array = array(
@ -706,17 +694,25 @@ function get_moderators(&$forum_moderators, $forum_id = false)
),
),
'WHERE' => "m.display_on_index = 1 $forum_sql",
'WHERE' => 'm.display_on_index = 1',
);
// We query every forum here because for caching we should not have any parameter.
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql, 3600);
while ($row = $db->sql_fetchrow($result))
{
$f_id = (int) $row['forum_id'];
if (!isset($forum_id_ary[$f_id]))
{
continue;
}
if (!empty($row['user_id']))
{
$forum_moderators[$row['forum_id']][] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
$forum_moderators[$f_id][] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
}
else
{
@ -724,11 +720,11 @@ function get_moderators(&$forum_moderators, $forum_id = false)
if ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile'))
{
$forum_moderators[$row['forum_id']][] = '<span' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . '>' . $group_name . '</span>';
$forum_moderators[$f_id][] = '<span' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . '>' . $group_name . '</span>';
}
else
{
$forum_moderators[$row['forum_id']][] = '<a' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
$forum_moderators[$f_id][] = '<a' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . $group_name . '</a>';
}
}
}

View file

@ -1183,7 +1183,10 @@ if (sizeof($post_data['poll_options']) && $post_data['poll_title'])
// Forum moderators?
$moderators = array();
get_moderators($moderators, $forum_id);
if ($config['load_moderators'])
{
get_moderators($moderators, $forum_id);
}
// Generate smiley listing
generate_smilies('inline', $forum_id);

View file

@ -135,7 +135,10 @@ if ($forum_data['left_id'] != $forum_data['right_id'] - 1)
else
{
$template->assign_var('S_HAS_SUBFORUM', false);
get_moderators($moderators, $forum_id);
if ($config['load_moderators'])
{
get_moderators($moderators, $forum_id);
}
}
// Dump out the page header and load viewforum template

View file

@ -550,7 +550,10 @@ generate_forum_rules($topic_data);
// Moderators
$forum_moderators = array();
get_moderators($forum_moderators, $forum_id);
if ($config['load_moderators'])
{
get_moderators($forum_moderators, $forum_id);
}
// This is only used for print view so ...
$server_path = (!$view) ? $phpbb_root_path : generate_board_url() . '/';