aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2002-10-10 00:35:35 +0000
committerLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2002-10-10 00:35:35 +0000
commitc677640b64e5c3fe8406e47f7eeef2f18c5edf71 (patch)
treecc8713c703e3589e1d9f7cfc7d410064d1f2f479 /phpBB
parent4a2f986943fdf6ccb798b83ec18ac2f7c6649c76 (diff)
downloadforums-c677640b64e5c3fe8406e47f7eeef2f18c5edf71.tar
forums-c677640b64e5c3fe8406e47f7eeef2f18c5edf71.tar.gz
forums-c677640b64e5c3fe8406e47f7eeef2f18c5edf71.tar.bz2
forums-c677640b64e5c3fe8406e47f7eeef2f18c5edf71.tar.xz
forums-c677640b64e5c3fe8406e47f7eeef2f18c5edf71.zip
Bugfix (disappearing forum names) + enabled jumpbox and modified it to allow category jumping.
git-svn-id: file:///svn/phpbb/trunk@2950 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/forums_display.php6
-rw-r--r--phpBB/includes/functions.php73
-rw-r--r--phpBB/includes/page_tail.php13
-rw-r--r--phpBB/viewforum.php15
4 files changed, 77 insertions, 30 deletions
diff --git a/phpBB/includes/forums_display.php b/phpBB/includes/forums_display.php
index e71746bcb7..4cb1755600 100644
--- a/phpBB/includes/forums_display.php
+++ b/phpBB/includes/forums_display.php
@@ -111,16 +111,16 @@ foreach ($forum_rows as $row)
if (isset($subforums[$forum_id]))
{
- foreach ($subforums as $row)
+ foreach ($subforums[$forum_id] as $row)
{
$alist[$row['forum_id']] = $row['forum_name'];
}
asort($alist);
$links = array();
- foreach ($alist as $forum_id => $forum_name)
+ foreach ($alist as $subforum_id => $subforum_name)
{
- $links[] = '<a href="viewforum.' . $phpEx . $SID . '&f=' . $forum_id . '">' . htmlspecialchars($forum_name) . '</a>';
+ $links[] = '<a href="viewforum.' . $phpEx . $SID . '&f=' . $subforum_id . '">' . htmlspecialchars($subforum_name) . '</a>';
}
$subforums_list = implode(', ', $links);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index dda7a3c393..c4e10c1bef 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -187,40 +187,72 @@ function make_jumpbox($action, $forum_id = false)
global $auth, $template, $lang, $db, $nav_links, $phpEx;
$boxstring = '<select name="f" onChange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }">';
-/*
- $sql = "SELECT forum_id, forum_name, left_id, right_id
- FROM " . FORUMS_TABLE . "
- ORDER BY left_id ASC";
+
+ $sql = 'SELECT forum_id, forum_name, forum_status, left_id, right_id
+ FROM ' . FORUMS_TABLE . '
+ ORDER BY left_id ASC';
$result = $db->sql_query($sql);
$right = 0;
- $subforum = '';
+ $padding = '';
+ $forum_list = '';
while ( $row = $db->sql_fetchrow($result) )
{
- if ( $auth->acl_get('f_list', $forum_id) || $auth->acl_get('a_') )
+ if ( $row['left_id'] < $right )
+ {
+ $padding .= '&nbsp; &nbsp;';
+ }
+ else if ( $row['left_id'] > $right + 1 )
+ {
+ $padding = substr($subforum, 0, -18 * ( $row['left_id'] - $right + 1 ));
+ }
+
+ $right = $row['right_id'];
+
+ $linefeed = FALSE;
+ if ( ( $auth->acl_get('f_list', $forum_id) || $auth->acl_get('a_') ))
{
- if ( $row['left_id'] < $right )
+ if ($row['forum_status'] == ITEM_CATEGORY)
{
- $subforum .= '&nbsp; &nbsp;';
+ $linefeed = TRUE;
+ $boxstring .= '<option value="-1">&nbsp;&nbsp;</option>';
}
- else if ( $row['left_id'] > $right + 1 )
+ elseif ($row['parent_id'] == 0)
{
- $subforum = substr($subforum, 0, -13 * ( $row['left_id'] - $right + 1 ));
+ if ($linefeed)
+ {
+ $linefeed = FALSE;
+ $boxstring .= '<option value="-1">&nbsp;&nbsp;</option>';
+ }
+ }
+ else
+ {
+ $linefeed = TRUE;
}
- $right = $row['right_id'];
+ $selected = ( $row['forum_id'] == $forum_id ) ? ' selected="selected"' : '';
+ $boxstring .= '<option value="' . (($row['forum_status'] == ITEM_CATEGORY) ? 'c' : '') . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option>';
- $selected = ( $row['forum_id'] == $forum_id ) ? 'selected="selected"' : '';
- $boxstring .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $subforum . $row['forum_name'] . '</option>';
+ if ($row['forum_status'] == ITEM_CATEGORY)
+ {
+ $boxstring .= '<option value="-1">' . $padding . '----------------</option>';
+ }
$nav_links['chapter forum'][$row['forum_id']] = array (
- 'url' => "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']
);
}
+
}
$db->sql_freeresult($result);
-*/
+
+ if (!$right)
+ {
+ $boxstring .= '<option value="-1">' . $lang['No_forums'] . '</option>';
+ }
+ $boxstring .= '</select>';
+
$template->assign_vars(array(
'L_GO' => $lang['Go'],
'L_JUMP_TO' => $lang['Jump_to'],
@@ -555,7 +587,10 @@ function obtain_word_list(&$orig_word, &$replacement_word)
function redirect($location)
{
global $db;
- $db->sql_close();
+ if (isset($db))
+ {
+ $db->sql_close();
+ }
$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . $location);
@@ -633,9 +668,10 @@ function message_die($msg_code, $msg_text = '', $msg_title = '')
break;
case ERROR:
+ $db->sql_close();
+
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>phpBB 2 :: General Error</title></html>' . "\n";
echo '<body><h1 style="font-family:Verdana,serif;font-size:18pt;font-weight:bold">phpBB2 :: General Error</h1><hr style="height:2px;border-style:dashed;color:black" /><p style="font-family:Verdana,serif;font-size:10pt">' . $msg_text . '</p><hr style="height:2px;border-style:dashed;color:black" /><p style="font-family:Verdana,serif;font-size:10pt">Contact the site administrator to report this failure</p></body></html>';
- $db->sql_close();
break;
}
@@ -658,9 +694,10 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
case E_ERROR:
case E_USER_ERROR:
+ $db->sql_close();
+
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>phpBB 2 :: General Error</title></html>' . "\n";
echo '<body><h1 style="font-family:Verdana,serif;font-size:18pt;font-weight:bold">phpBB2 :: General Error</h1><hr style="height:2px;border-style:dashed;color:black" /><p style="font-family:Verdana,serif;font-size:10pt">' . $msg_text . '</p><hr style="height:2px;border-style:dashed;color:black" /><p style="font-family:Verdana,serif;font-size:10pt">Contact the site administrator to report this failure</p></body></html>';
- $db->sql_close();
break;
case E_USER_NOTICE:
diff --git a/phpBB/includes/page_tail.php b/phpBB/includes/page_tail.php
index 58706a2cc6..5296f41a9c 100644
--- a/phpBB/includes/page_tail.php
+++ b/phpBB/includes/page_tail.php
@@ -32,7 +32,7 @@ if (defined('DEBUG'))
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
- if (!empty($_REQUEST['explain']))
+ if (!empty($_REQUEST['explain']) && $auth->acl_get('a_'))
{
echo $db->sql_report;
echo "<pre><b>Page generated in $totaltime seconds with " . $db->num_queries . " queries,\nspending " . $db->sql_time . ' doing MySQL queries and ' . ($totaltime - $db->sql_time) . ' doing PHP things.</b></pre>';
@@ -40,14 +40,19 @@ if (defined('DEBUG'))
exit;
}
- $debug_output = sprintf('<br /><br />[ Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ( ( $board_config['gzip_compress'] ) ? 'On' : 'Off' ) . ' | Load : ' . ( ( $session->load ) ? $session->load : 'N/A') . ' | <a href="' . $_SERVER['REQUEST_URI'] . '&amp;explain=1">Explain</a> ]', $totaltime);
+ $debug_output = sprintf('<br /><br />[ Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . ( ( $board_config['gzip_compress'] ) ? 'On' : 'Off' ) . ' | Load : ' . (($session->load) ? $session->load : 'N/A'), $totaltime);
+
+ if ($auth->acl_get('a_'))
+ {
+ $debug_output .= ' | <a href="' . $_SERVER['REQUEST_URI'] . '&amp;explain=1">Explain</a> ]';
+ }
}
$template->assign_vars(array(
'PHPBB_VERSION' => $board_config['version'],
'ADMIN_LINK' => ( $auth->acl_get('a_') ) ? '<a href="' . "admin/index.$phpEx$SID" . '">' . $lang['Admin_panel'] . '</a><br /><br />' : '',
- 'DEBUG_OUTPUT' => ( defined('DEBUG') ) ? $debug_output : '')
-);
+ 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : ''
+));
$template->display('body');
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index b84fac6855..1af8946319 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -22,6 +22,14 @@
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
+
+if (preg_match('/^c([0-9]+)$/', $_POST['f'], $m))
+{
+ $header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
+ header($header_location . "index.$phpEx?sid=" . $_GET['sid'] . '&c=' . $m[1]);
+ exit;
+}
+
include($phpbb_root_path . 'common.'.$phpEx);
//
@@ -117,9 +125,7 @@ foreach ($forum_branch as $row)
{
if ($row['parent_id'] == $forum_data['forum_id'])
{
- //
// Root-level forum
- //
$forum_rows[] = $row;
$parent_id = $row['forum_id'];
@@ -130,14 +136,13 @@ foreach ($forum_branch as $row)
}
elseif ($row['parent_id'] == $branch_root_id)
{
- //
// Forum directly under a category
- //
$forum_rows[] = $row;
$parent_id = $row['forum_id'];
}
elseif ($row['forum_status'] != ITEM_CATEGORY)
{
+ // Subforum
if ($auth->acl_get('f_list', $row['forum_id']))
{
$subforums[$parent_id][] = $row;
@@ -578,7 +583,7 @@ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'viewforum_body.html'
));
-make_jumpbox('viewforum.'.$phpEx . $SID);
+make_jumpbox('viewforum.'.$phpEx . $SID, $forum_id);
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);