I know the jumpbox layout doesn't always match the real forum structure ... will fix

git-svn-id: file:///svn/phpbb/trunk@3099 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-11-26 00:50:16 +00:00
parent 5f4b283a3e
commit 8f051f1b47
5 changed files with 80 additions and 78 deletions

View file

@ -752,7 +752,7 @@ while ($row = $db->sql_fetchrow($result))
<form method="get" action="admin_forums.<?php echo $phpEx,$SID ?>"><table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td align="right"><?php echo $user->lang['Select_forum']; ?>: <select name="f" onchange="this.form.submit()"><?php echo $forum_box; ?></select> <input class="liteoption" type="submit" value="<?php echo $user->lang['Go']; ?>" /><input type="hidden" name="sid" value="<?php echo $user->session_id; ?>" /></td>
<td align="right"><?php echo $user->lang['Select_forum']; ?>: <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit() }"><?php echo $forum_box; ?></select> <input class="liteoption" type="submit" value="<?php echo $user->lang['Go']; ?>" /><input type="hidden" name="sid" value="<?php echo $user->session_id; ?>" /></td>
</tr>
</table></form>

View file

@ -534,7 +534,7 @@ if (!empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators'
else
{
$select_list = make_forum_select();
$select_list = make_forum_select(false, false, false);
page_header($l_title);

View file

@ -34,52 +34,28 @@ if ( !empty($setmodules) )
}
define('IN_PHPBB', 1);
//
// Include files
//
$phpbb_root_path = '../';
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);
//
// Do we have styles admin permissions?
//
if (!$auth->acl_get('a_general'))
{
message_die(MESSAGE, $user->lang['No_admin']);
trigger_error($user->lang['No_admin']);
}
//
// Set some variables
//
$forum_id = (isset($_REQUEST['f'])) ? intval($_REQUEST['f']) : 0;
$start = (isset($_GET['start'])) ? intval($_GET['start']) : 0;
if ( isset($_POST['mode']) || isset($_GET['mode']) )
{
$mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : $_GET['mode'];
}
else
{
$mode = 'admin';
}
if ( isset($_POST['f']) || isset($_GET['f']) )
{
$forum_id = ( isset($_POST['f']) ) ? $_POST['f'] : $_GET['f'];
}
else
{
$forum_id = 0;
}
$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : 'admin';
// Define some vars depending on which logs we're looking at
$log_table_sql = ($mode == 'admin') ? LOG_ADMIN_TABLE : LOG_MOD_TABLE;
$l_title = ($mode == 'admin') ? $user->lang['Admin_logs'] : $user->lang['Mod_logs'];
$l_title_explain = ($mode == 'admin') ? $user->lang['Admin_logs_explain'] : $user->lang['Mod_logs_explain'];
//
// Delete entries if requested and able
//
if ((isset($_POST['delmarked']) || isset($_POST['delall'])) && $auth->acl_get('a_clearlogs'))
{
$where_sql = '';
@ -99,14 +75,12 @@ if ( ( isset($_POST['delmarked']) || isset($_POST['delall']) ) && $auth->acl_get
add_admin_log('log_' . $mode . '_clear');
}
//
// Sorting ... this could become a function
//
if (isset($_POST['sort']) || $start)
{
if ( !empty($_POST['sort_days']) || !empty($_GET['sort_days']) )
if (!empty($_REQUEST['sort_days']))
{
$sort_days = ( !empty($_POST['sort_days']) ) ? intval($_POST['sort_days']) : intval($_GET['sort_days']);
$sort_days = intval($_REQUEST['sort_days']);
$where_sql = time() - ($sort_days * 86400);
}
else
@ -114,8 +88,8 @@ if ( isset($_POST['sort']) || $start )
$where_sql = 0;
}
$sort_key = ( isset($_POST['sort_key']) ) ? $_POST['sort_key'] : $_GET['sort_key'];
$sort_dir = ( isset($_POST['sort_dir']) ) ? $_POST['sort_dir'] : $_GET['sort_dir'];
$sort_key = (isset($_REQUEST['sort_key'])) ? $_REQUEST['sort_key'] : '';
$sort_dir = (isset($_REQUEST['sort_dir'])) ? $_REQUEST['sort_dir'] : '';
}
else
{
@ -163,13 +137,13 @@ page_header($l_title);
// Define forum list if we're looking @ mod logs
if ($mode == 'mod')
{
include($phpbb_root_path . '/includes/functions_admin.'.$phpEx);
//include($phpbb_root_path . '/includes/functions_admin.'.$phpEx);
$forum_box = make_forum_select($forum_id);
?>
<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
<td align="right"><?php echo $user->lang['Select_forum']; ?>: <select name="f" onchange="this.form.submit()"><?php echo $forum_box; ?></select> <input class="liteoption" type="submit" value="<?php echo $user->lang['Go']; ?>" /></td>
<td align="right"><?php echo $user->lang['Select_forum']; ?>: <select name="f" onChange="if(this.options[this.selectedIndex].value != -1){ this.form.submit() }"><?php echo $forum_box; ?></select> <input class="liteoption" type="submit" value="<?php echo $user->lang['Go']; ?>" /></td>
</tr>
</table>
<?php

View file

@ -186,13 +186,13 @@ function make_jumpbox($action, $forum_id = false)
$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_postable, forum_status, left_id, right_id
$sql = 'SELECT forum_id, forum_name, forum_postable, left_id, right_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);
$right = $cat_right = 0;
$padding = $forum_list = '';
$padding = $forum_list = $holding = '';
while ($row = $db->sql_fetchrow($result))
{
if (!$row['forum_postable'] && ($row['left_id'] + 1 == $row['right_id']))
@ -225,7 +225,7 @@ function make_jumpbox($action, $forum_id = false)
$holding = '';
}
if ($row['forum_status'] == ITEM_CATEGORY)
if ($row['right_id'] - $row['left_id'] > 1)
{
$cat_right = max($cat_right, $row['right_id']);

View file

@ -20,41 +20,69 @@
***************************************************************************/
// Simple version of jumpbox, just lists authed forums
function make_forum_select($default_forum = false, $ignore_forum = false)
function make_forum_select($forum_id = false, $ignore_forum = false, $add_select = true)
{
global $db, $userdata, $auth, $lang;
global $db, $user, $auth;
$sql = "SELECT forum_id, forum_name, left_id, right_id
FROM " . FORUMS_TABLE . "
ORDER BY left_id ASC";
$result = $db->sql_query($sql);
$right = 0;
$subforum = '';
$forum_list = '';
$right = $cat_right = 0;
$forum_list = $padding = $holding = '';
while ($row = $db->sql_fetchrow($result))
{
if (!$auth->acl_gets('f_list', 'm_', 'a_', intval($row['forum_id'])) || $row['forum_id'] == $ignore_forum)
{
// if the user does not have permissions to list this forum skip
continue;
}
if ($row['left_id'] < $right)
{
$subforum .= '&nbsp;&nbsp;&nbsp;';
$padding .= '&nbsp; &nbsp;';
}
else if ($row['left_id'] > $right + 1)
{
$subforum = substr($subforum, 0, -18 * ( $row['left_id'] - $right + 1 ));
$padding = substr($padding, 0, -13 * ($row['left_id'] - $right + 1));
}
$right = $row['right_id'];
if ( ( $auth->acl_get('f_list', $forum_id) || $auth->acl_get('a_') ) && $ignore_forum != $row['forum_id'] )
$selected = ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '';
if ($row['left_id'] > $cat_right)
{
$selected = ( $row['forum_id'] == $default_forum ) ? ' selected="selected"' : '';
$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $subforum . $row['forum_name'] . '</option>';
$holding = '';
}
if ($row['right_id'] - $row['left_id'] > 1)
{
$cat_right = max($cat_right, $row['right_id']);
$holding .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . '+ ' . $row['forum_name'] . '</option>';
}
else
{
$forum_list .= $holding . '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . '- ' . $row['forum_name'] . '</option>';
$holding = '';
}
}
if (!$right)
{
$forum_list .= '<option value="-1">' . $user->lang['No_forums'] . '</option>';
}
else if ($add_select)
{
$forum_list = '<option value="-1">' . $user->lang['Select_forum'] . '</option><option value="-1">-----------------</option>' . $forum_list;
}
$db->sql_freeresult($result);
return ( $forum_list == '' ) ? '<option value="-1">' . $lang['No_forums'] . '</option>' : $forum_list;
return $forum_list;
}
// Synchronise functions for forums/topics