From 4bcfafdc64a8a77c67982604fc2f92513b05fa50 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 25 Feb 2006 12:46:31 +0000 Subject: - allow local moderators to properly use the mcp for more than one forum (mcp) - automatically get a forum id for global topics if needed (mcp) - allow linking to unapproved topics via a post id (viewtopic) - use #p[post_id] anchor (mcp_post) - use actions where appropriate (mcp_queue) - added approve_details mode (mcp_queue) - use new post details page (mcp_queue) - adding missing lang keys for (dis)approval of topics/posts (mcp_queue) - return to topic link (mcp_topic) - some changes to follow the coding guidelines git-svn-id: file:///svn/phpbb/trunk@5584 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/mcp.php | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'phpBB/mcp.php') diff --git a/phpBB/mcp.php b/phpBB/mcp.php index f8c10a3709..7cea4384ca 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -99,18 +99,10 @@ if ($topic_id && !$forum_id) $forum_id = (int) $row['forum_id']; } -// 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_')) +// If the user doesn't have any moderator powers (globally or locally) he can't access the mcp +if (!$forum_id && !$auth->acl_get('m_') && !$auth->acl_getf_global('m_')) { - $forum_list = get_forum_list('m_'); - - if (!sizeof($forum_list)) - { - trigger_error('MODULE_NOT_EXIST'); - } - - // We do not check all forums, only the first one should be sufficiant. - $forum_id = $forum_list[0]; + trigger_error('MODULE_NOT_EXIST'); } if($forum_id) @@ -160,7 +152,6 @@ else if (!$post_id) { $module->set_display('main', 'post_details', false); - $module->set_display('queue', 'approve_details', false); $module->set_display('warn', 'warn_post', false); } if (!$topic_id) @@ -168,6 +159,10 @@ if (!$topic_id) $module->set_display('main', 'topic_view', false); $module->set_display('logs', 'topic_logs', false); } +if (!$topic_id && !$post_id) +{ + $module->set_display('queue', 'approve_details', false); +} if (!$forum_id) { $module->set_display('main', 'forum_view', false); @@ -517,6 +512,24 @@ function check_ids(&$ids, $table, $sql_id, $acl_list = false) $forum_id = request_var('f', 0); } + if ($forum_id === 0) + { + // Determine first forum the user is able to read - for global announcements + $forum_ary = array_unique(array_keys($auth->acl_getf('!f_read', true))); + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST; + if (sizeof($forum_ary)) + { + $sql .= ' AND forum_id NOT IN ( ' . implode(', ', $forum_ary) . ')'; + } + + $result = $db->sql_query_limit($sql, 1); + $forum_id = (int) $db->sql_fetchfield('forum_id', 0, $result); + $db->sql_freeresult($result); + } + if ($acl_list && !$auth->acl_get($acl_list, $forum_id)) { trigger_error('NOT_AUTHORIZED'); -- cgit v1.2.1