aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/mcp.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2006-02-05 01:40:45 +0000
committerNils Adermann <naderman@naderman.de>2006-02-05 01:40:45 +0000
commitdb145d79b312ffb2d460c7a0d9f0a51f6f07f9d5 (patch)
treed5ed1f21e67aa1e41661ce497445bb809690a054 /phpBB/mcp.php
parentb09c5f6a2589d8bc6e4855d59aeb5556057ed9db (diff)
downloadforums-db145d79b312ffb2d460c7a0d9f0a51f6f07f9d5.tar
forums-db145d79b312ffb2d460c7a0d9f0a51f6f07f9d5.tar.gz
forums-db145d79b312ffb2d460c7a0d9f0a51f6f07f9d5.tar.bz2
forums-db145d79b312ffb2d460c7a0d9f0a51f6f07f9d5.tar.xz
forums-db145d79b312ffb2d460c7a0d9f0a51f6f07f9d5.zip
- removed unnecessary urlencode of highlight words
various mcp_main updates: - generally make all the tools work again (mode/action changes) - tidy up urls - restructured quickmod code to use actions (we don't want too many module entries) git-svn-id: file:///svn/phpbb/trunk@5526 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/mcp.php')
-rw-r--r--phpBB/mcp.php233
1 files changed, 102 insertions, 131 deletions
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index a89b1c9172..2f00a0ab26 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -31,7 +31,7 @@ $module = new p_master();
// Basic parameter data
$id = request_var('i', '');
-if (is_array($_REQUEST['mode']))
+if (isset($_REQUEST['mode']) && is_array($_REQUEST['mode']))
{
list($mode, ) = each(request_var('mode', array('')));
}
@@ -40,12 +40,6 @@ else
$mode = request_var('mode', '');
}
-if (isset($_REQUEST['quick']))
-{
- $mode = request_var('mode2', '');
- $action = '';
-}
-
// Make sure we are using the correct module
if ($mode == 'approve' || $mode == 'disapprove')
{
@@ -69,161 +63,141 @@ $action_ary = request_var('action', array('' => 0));
if (sizeof($action_ary))
{
- list($action, ) = each($action);
+ list($action, ) = each($action_ary);
}
unset($action_ary);
-if ($action == 'merge_select')
-{
- $mode = 'forum_view';
-}
-
if ($mode == 'topic_logs')
{
$id = 'logs';
$quickmod = false;
}
-// Topic view modes
-if (in_array($mode, array('split', 'split_all', 'split_beyond', 'merge', 'merge_posts')))
+$post_id = request_var('p', 0);
+$topic_id = request_var('t', 0);
+$forum_id = request_var('f', 0);
+$user_id = request_var('u', 0);
+$username = request_var('username', '');
+
+if ($post_id)
{
- $_REQUEST['action'] = $action = $mode;
- $mode = 'topic_view';
- $quickmod = false;
+ // We determine the topic and forum id here, to make sure the moderator really has moderative rights on this post
+ $sql = 'SELECT topic_id, forum_id
+ FROM ' . POSTS_TABLE . "
+ WHERE post_id = $post_id";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ $topic_id = (int) $row['topic_id'];
+ $forum_id = (int) $row['forum_id'];
}
-// Forum view modes
-if (in_array($mode, array('resync')))
+if ($topic_id && !$forum_id)
{
- $_REQUEST['action'] = $action = $mode;
- $mode = 'forum_view';
- $quickmod = false;
+ $sql = 'SELECT forum_id
+ FROM ' . TOPICS_TABLE . "
+ WHERE topic_id = $topic_id";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ $forum_id = (int) $row['forum_id'];
}
-if (!$quickmod)
+// If we do not have a forum id and the user is not a super moderator (global options are set to false, even if the user is able to moderator at least one forum
+if (!$forum_id && !$auth->acl_get('m_'))
{
- $post_id = request_var('p', 0);
- $topic_id = request_var('t', 0);
- $forum_id = request_var('f', 0);
- $user_id = request_var('u', 0);
- $username = request_var('username', '');
+ $forum_list = get_forum_list('m_');
-
- if ($post_id)
+ if (!sizeof($forum_list))
{
- // We determine the topic and forum id here, to make sure the moderator really has moderative rights on this post
- $sql = 'SELECT topic_id, forum_id
- FROM ' . POSTS_TABLE . "
- WHERE post_id = $post_id";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $topic_id = (int) $row['topic_id'];
- $forum_id = (int) $row['forum_id'];
+ trigger_error('MODULE_NOT_EXIST');
}
- if ($topic_id && !$forum_id)
- {
- $sql = 'SELECT forum_id
- FROM ' . TOPICS_TABLE . "
- WHERE topic_id = $topic_id";
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $forum_id = (int) $row['forum_id'];
- }
+ // We do not check all forums, only the first one should be sufficiant.
+ $forum_id = $forum_list[0];
+}
- // If we do not have a forum id and the user is not a super moderator (global options are set to false, even if the user is able to moderator at least one forum
- if (!$forum_id && !$auth->acl_get('m_'))
- {
- $forum_list = get_forum_list('m_');
+if($forum_id)
+{
+ $module->acl_forup_id = $forum_id;
+}
- if (!sizeof($forum_list))
- {
- trigger_error('MODULE_NOT_EXIST');
- }
+// Instantiate module system and generate list of available modules
+$module->list_modules('mcp');
- // We do not check all forums, only the first one should be sufficiant.
- $forum_id = $forum_list[0];
- }
+if ($quickmod)
+{
+ $mode = 'quickmod';
- if($forum_id)
+ switch ($action)
{
- $module->acl_forup_id = $forum_id;
- }
-
- // Instantiate module system and generate list of available modules
- $module->list_modules('mcp');
+ case 'lock':
+ case 'unlock':
+ case 'lock_post':
+ case 'unlock_post':
+ case 'make_sticky':
+ case 'make_announce':
+ case 'make_global':
+ case 'make_normal':
+ case 'fork':
+ case 'move':
+ case 'delete_post':
+ case 'delete_topic':
+ $module->load('mcp', 'main', 'quickmod');
+ exit;
+
+ case 'topic_logs':
+ $module->set_active('logs', 'topic_logs');
+ break;
+ default:
+ trigger_error("$action not allowed as quickmod");
+ }
+}
+else
+{
// Select the active module
$module->set_active($id, $mode);
+}
- // Hide some of the options if we don't have the relevant information to use them
- if (!$post_id)
- {
- $module->set_display('post_details', false);
- $module->set_display('warn_post', false);
- }
- if (!$topic_id)
- {
- $module->set_display('topic_view', false);
- $module->set_display('topic_logs', false);
- }
- if (!$forum_id)
- {
- $module->set_display('forum_view', false);
- $module->set_display('forum_logs', false);
- }
- if (!$user_id && $username == '')
- {
- $module->set_display('user_notes', false);
- $module->set_display('warn_user', false);
- }
-
- // Load and execute the relevant module
- $module->load_active();
-
- // Assign data to the template engine for the list of modules
- $module->assign_tpl_vars("mcp.$phpEx$SID");
+// Hide some of the options if we don't have the relevant information to use them
+if (!$post_id)
+{
+ $module->set_display('post_details', false);
+ $module->set_display('warn_post', false);
+}
+if (!$topic_id)
+{
+ $module->set_display('topic_view', false);
+ $module->set_display('topic_logs', false);
+}
+if (!$forum_id)
+{
+ $module->set_display('forum_view', false);
+ $module->set_display('forum_logs', false);
+}
+if (!$user_id && $username == '')
+{
+ $module->set_display('user_notes', false);
+ $module->set_display('warn_user', false);
+}
- // Generate the page
- page_header($user->lang['MCP_MAIN']);
+// Load and execute the relevant module
+$module->load_active();
- $template->set_filenames(array(
- 'body' => $module->get_tpl_name())
- );
+// Assign data to the template engine for the list of modules
+$module->assign_tpl_vars("mcp.$phpEx$SID");
- page_footer();
+// Generate the page
+page_header($user->lang['MCP_MAIN']);
-}
+$template->set_filenames(array(
+ 'body' => $module->get_tpl_name())
+);
-switch ($mode)
-{
- case 'lock':
- case 'unlock':
- case 'lock_post':
- case 'unlock_post':
- $module->load('mcp', 'main', $mode);
- break;
- case 'make_sticky':
- case 'make_announce':
- case 'make_global':
- case 'make_normal':
- $module->load('mcp', 'main', $mode);
- break;
- case 'fork':
- case 'move':
- $module->load('mcp', 'main', $mode);
- break;
- case 'delete_post':
- case 'delete_topic':
- $module->load('mcp', 'main', $mode);
- break;
- default:
- trigger_error("$mode not allowed as quickmod");
-}
+page_footer();
/**
* Functions used to generate additional URL paramters
@@ -573,7 +547,4 @@ function check_ids(&$ids, $table, $sql_id, $acl_list = false)
return $forum_id;
}
-// LITTLE HELPER
-//
-
?> \ No newline at end of file