mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Update jumpbox for subforum changes
git-svn-id: file:///svn/phpbb/trunk@3064 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
c1fc6dce16
commit
8ae487932d
2 changed files with 41 additions and 66 deletions
|
@ -184,20 +184,30 @@ function make_jumpbox($action, $forum_id = false)
|
||||||
{
|
{
|
||||||
global $auth, $template, $user, $db, $nav_links, $phpEx;
|
global $auth, $template, $user, $db, $nav_links, $phpEx;
|
||||||
|
|
||||||
$boxstring = '<select name="f" onChange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"><option value="-1">' . $user->lang['Select_forum'] . '</option><option value="-1"> </option>';
|
$boxstring = '<select name="f" onChange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"><option value="-1">' . $user->lang['Select_forum'] . '</option><option value="-1">-----------------</option>';
|
||||||
|
|
||||||
$sql = 'SELECT forum_id, forum_name, forum_status, left_id, right_id
|
$sql = 'SELECT forum_id, forum_name, forum_postable, forum_status, left_id, right_id
|
||||||
FROM ' . FORUMS_TABLE . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
ORDER BY left_id ASC';
|
ORDER BY left_id ASC';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$right = 0;
|
$right = $cat_right = 0;
|
||||||
$cat_right = 0;
|
$padding = $forum_list = '';
|
||||||
$padding = '';
|
|
||||||
$forum_list = '';
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['left_id'] < $right )
|
if (!$row['forum_postable'] && ($row['left_id'] + 1 == $row['right_id']))
|
||||||
|
{
|
||||||
|
// Non-postable forum with no subforums, don't display
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$auth->acl_gets('f_list', 'm_', 'a_', intval($row['forum_id'])))
|
||||||
|
{
|
||||||
|
// if the user does not have permissions to list this forum skip
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($row['left_id'] < $right)
|
||||||
{
|
{
|
||||||
$padding .= ' ';
|
$padding .= ' ';
|
||||||
}
|
}
|
||||||
|
@ -208,53 +218,30 @@ function make_jumpbox($action, $forum_id = false)
|
||||||
|
|
||||||
$right = $row['right_id'];
|
$right = $row['right_id'];
|
||||||
|
|
||||||
$linefeed = FALSE;
|
|
||||||
if ($auth->acl_gets('f_list', 'm_', 'a_', $forum_id))
|
|
||||||
{
|
|
||||||
$selected = ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '';
|
$selected = ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '';
|
||||||
|
|
||||||
if ($row['left_id'] > $cat_right)
|
if ($row['left_id'] > $cat_right)
|
||||||
{
|
{
|
||||||
$holding = '';
|
$holding = '';
|
||||||
}
|
}
|
||||||
if ($row['parent_id'] == 0)
|
|
||||||
{
|
|
||||||
if ($row['forum_status'] == ITEM_CATEGORY)
|
|
||||||
{
|
|
||||||
$linefeed = TRUE;
|
|
||||||
$holding = '<option value="-1"> </option>';
|
|
||||||
}
|
|
||||||
elseif (!empty($linefeed))
|
|
||||||
{
|
|
||||||
$linefeed = FALSE;
|
|
||||||
$boxstring .= '<option value="-1"> </option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$linefeed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($row['forum_status'] == ITEM_CATEGORY)
|
if ($row['forum_status'] == ITEM_CATEGORY)
|
||||||
{
|
{
|
||||||
$cat_right = max($cat_right, $row['right_id']);
|
$cat_right = max($cat_right, $row['right_id']);
|
||||||
|
|
||||||
$holding .= '<option value="c' . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option><option value="-1">' . $padding . '----------------</option>';
|
$holding .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . '+ ' . $row['forum_name'] . '</option>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$boxstring .= $holding . '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option>';
|
$boxstring .= $holding . '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . '- ' . $row['forum_name'] . '</option>';
|
||||||
$holding = '';
|
$holding = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: do not add empty categories to nav links
|
|
||||||
$nav_links['chapter forum'][$row['forum_id']] = array (
|
$nav_links['chapter forum'][$row['forum_id']] = array (
|
||||||
'url' => ($row['forum_status'] == ITEM_CATEGORY) ? "index.$phpEx$SIDc=" : "viewforum.$phpEx$SID&f=" . $row['forum_id'],
|
'url' => ($row['forum_status'] == ITEM_CATEGORY) ? "index.$phpEx$SIDc=" : "viewforum.$phpEx$SID&f=" . $row['forum_id'],
|
||||||
'title' => $row['forum_name']
|
'title' => $row['forum_name']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$right)
|
if (!$right)
|
||||||
|
|
|
@ -458,19 +458,10 @@ function config_cache_write($match, $data)
|
||||||
// changed via admin_permissions. Changes of username
|
// changed via admin_permissions. Changes of username
|
||||||
// and group names must be carried through for the
|
// and group names must be carried through for the
|
||||||
// moderators table
|
// moderators table
|
||||||
function cache_moderators($forum_id = false)
|
function cache_moderators()
|
||||||
{
|
{
|
||||||
global $db;
|
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
|
// Clear table
|
||||||
$db->sql_query('TRUNCATE ' . MODERATOR_TABLE);
|
$db->sql_query('TRUNCATE ' . MODERATOR_TABLE);
|
||||||
|
|
||||||
|
@ -483,8 +474,7 @@ function cache_moderators($forum_id = false)
|
||||||
WHERE o.auth_value = 'm_'
|
WHERE o.auth_value = 'm_'
|
||||||
AND a.auth_option_id = o.auth_option_id
|
AND a.auth_option_id = o.auth_option_id
|
||||||
AND a.auth_allow_deny = 1
|
AND a.auth_allow_deny = 1
|
||||||
AND u.user_id = a.user_id
|
AND u.user_id = a.user_id";
|
||||||
$forum_sql";
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
@ -503,8 +493,7 @@ function cache_moderators($forum_id = false)
|
||||||
AND a.auth_option_id = o.auth_option_id
|
AND a.auth_option_id = o.auth_option_id
|
||||||
AND a.auth_allow_deny = 0
|
AND a.auth_allow_deny = 0
|
||||||
AND a.group_id = ug.group_id
|
AND a.group_id = ug.group_id
|
||||||
AND ug.user_id IN ($user_id_sql)
|
AND ug.user_id IN ($user_id_sql)";
|
||||||
$forum_sql";
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
@ -520,8 +509,7 @@ function cache_moderators($forum_id = false)
|
||||||
AND a.auth_option_id = o.auth_option_id
|
AND a.auth_option_id = o.auth_option_id
|
||||||
AND a.auth_allow_deny = 1
|
AND a.auth_allow_deny = 1
|
||||||
AND g.group_id = a.group_id
|
AND g.group_id = a.group_id
|
||||||
AND g.group_type NOT IN (" . GROUP_HIDDEN . ", " . GROUP_SPECIAL . ")
|
AND g.group_type NOT IN (" . GROUP_HIDDEN . ", " . GROUP_SPECIAL . ")";
|
||||||
$forum_sql";
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
|
Loading…
Add table
Reference in a new issue