aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-11-19 23:12:11 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-11-19 23:12:11 +0000
commit8ae487932d6225e81ab81ffbd0a28c95b7a6ff52 (patch)
treea8984435afafb79f12f263b94494e55d0ec683b9 /phpBB/includes/functions.php
parentc1fc6dce16cf70a690bd02fd6bbb501527c6b7c4 (diff)
downloadforums-8ae487932d6225e81ab81ffbd0a28c95b7a6ff52.tar
forums-8ae487932d6225e81ab81ffbd0a28c95b7a6ff52.tar.gz
forums-8ae487932d6225e81ab81ffbd0a28c95b7a6ff52.tar.bz2
forums-8ae487932d6225e81ab81ffbd0a28c95b7a6ff52.tar.xz
forums-8ae487932d6225e81ab81ffbd0a28c95b7a6ff52.zip
Update jumpbox for subforum changes
git-svn-id: file:///svn/phpbb/trunk@3064 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php83
1 files changed, 35 insertions, 48 deletions
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 = '<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">&nbsp;</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 . '
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 .= '&nbsp; &nbsp;';
}
@@ -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 = '<option value="-1">&nbsp;</option>';
- }
- elseif (!empty($linefeed))
- {
- $linefeed = FALSE;
- $boxstring .= '<option value="-1">&nbsp;</option>';
- }
- }
- 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 .= '<option value="c' . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option><option value="-1">' . $padding . '----------------</option>';
- }
- else
- {
- $boxstring .= $holding . '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option>';
- $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 .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . '+ ' . $row['forum_name'] . '</option>';
+ }
+ else
+ {
+ $boxstring .= $holding . '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . '- ' . $row['forum_name'] . '</option>';
+ $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);