From 8ae487932d6225e81ab81ffbd0a28c95b7a6ff52 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Tue, 19 Nov 2002 23:12:11 +0000 Subject: Update jumpbox for subforum changes git-svn-id: file:///svn/phpbb/trunk@3064 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 83 +++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 48 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5154681472..250fe067f0 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -184,20 +184,30 @@ function make_jumpbox($action, $forum_id = false) { global $auth, $template, $user, $db, $nav_links, $phpEx; - $boxstring = ''; - $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 . ' ORDER BY left_id ASC'; $result = $db->sql_query($sql); - $right = 0; - $cat_right = 0; - $padding = ''; - $forum_list = ''; + $right = $cat_right = 0; + $padding = $forum_list = ''; 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 .= '   '; } @@ -208,52 +218,29 @@ function make_jumpbox($action, $forum_id = false) $right = $row['right_id']; - $linefeed = FALSE; - if ($auth->acl_gets('f_list', 'm_', 'a_', $forum_id)) - { - $selected = ($row['forum_id'] == $forum_id) ? ' selected="selected"' : ''; - - if ($row['left_id'] > $cat_right) - { - $holding = ''; - } - if ($row['parent_id'] == 0) - { - if ($row['forum_status'] == ITEM_CATEGORY) - { - $linefeed = TRUE; - $holding = ''; - } - elseif (!empty($linefeed)) - { - $linefeed = FALSE; - $boxstring .= ''; - } - } - else - { - $linefeed = TRUE; - } + $selected = ($row['forum_id'] == $forum_id) ? ' selected="selected"' : ''; - if ($row['forum_status'] == ITEM_CATEGORY) - { - $cat_right = max($cat_right, $row['right_id']); + if ($row['left_id'] > $cat_right) + { + $holding = ''; + } - $holding .= ''; - } - else - { - $boxstring .= $holding . ''; - $holding = ''; - } + if ($row['forum_status'] == ITEM_CATEGORY) + { + $cat_right = max($cat_right, $row['right_id']); - // TODO: do not add empty categories to nav links - $nav_links['chapter forum'][$row['forum_id']] = array ( - 'url' => ($row['forum_status'] == ITEM_CATEGORY) ? "index.$phpEx$SIDc=" : "viewforum.$phpEx$SID&f=" . $row['forum_id'], - 'title' => $row['forum_name'] - ); + $holding .= ''; + } + else + { + $boxstring .= $holding . ''; + $holding = ''; } + $nav_links['chapter forum'][$row['forum_id']] = array ( + 'url' => ($row['forum_status'] == ITEM_CATEGORY) ? "index.$phpEx$SIDc=" : "viewforum.$phpEx$SID&f=" . $row['forum_id'], + 'title' => $row['forum_name'] + ); } $db->sql_freeresult($result); -- cgit v1.2.1