aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-01-22 17:05:23 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-01-22 17:05:23 +0000
commit60d817416bd2367e3a234837f559f6e0ffb150c0 (patch)
treea6a650b941f5411a0dad4f878298303771a1387f
parent41d0347eb40594d3d90e30c4fcaf05ee5ad3228a (diff)
downloadforums-60d817416bd2367e3a234837f559f6e0ffb150c0.tar
forums-60d817416bd2367e3a234837f559f6e0ffb150c0.tar.gz
forums-60d817416bd2367e3a234837f559f6e0ffb150c0.tar.bz2
forums-60d817416bd2367e3a234837f559f6e0ffb150c0.tar.xz
forums-60d817416bd2367e3a234837f559f6e0ffb150c0.zip
fixing mcp bugs by introducing a new feature to check for loaded/accessible modules/modes. If the MCP module "logs" get disabled the quick mod tools on viewtopic still show a link to the logs, this will then lead to an error message. This is not fixable. The logs should be accessible to all moderators by default.
git-svn-id: file:///svn/phpbb/trunk@6920 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/includes/functions_module.php58
-rw-r--r--phpBB/includes/mcp/mcp_forum.php5
-rw-r--r--phpBB/includes/mcp/mcp_front.php377
-rwxr-xr-xphpBB/includes/mcp/mcp_warn.php2
-rw-r--r--phpBB/language/en/mcp.php1
-rw-r--r--phpBB/mcp.php1
-rw-r--r--phpBB/styles/subSilver/template/mcp_forum.html3
7 files changed, 259 insertions, 188 deletions
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index ca47ef2f89..1ad543c298 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -21,6 +21,7 @@ class p_master
var $p_parent;
var $active_module = false;
+ var $active_module_row_id = false;
var $acl_forum_id = false;
var $module_ary = array();
@@ -217,6 +218,50 @@ class p_master
}
/**
+ * Check if a certain main module is accessible/loaded
+ * By giving the module mode you are able to additionally check for only one mode within the main module
+ *
+ * @param string $module_basename The module base name, for example logs, reports, main (for the mcp).
+ * @param mixed $module_mode The module mode to check. If provided the mode will be checked in addition for presence.
+ *
+ * @return bool Returns true if module is loaded and accessible, else returns false
+ */
+ function loaded($module_basename, $module_mode = false)
+ {
+ if (empty($this->loaded_cache))
+ {
+ $this->loaded_cache = array();
+
+ foreach ($this->module_ary as $row)
+ {
+ if (!$row['name'])
+ {
+ continue;
+ }
+
+ if (!isset($this->loaded_cache[$row['name']]))
+ {
+ $this->loaded_cache[$row['name']] = array();
+ }
+
+ if (!$row['mode'])
+ {
+ continue;
+ }
+
+ $this->loaded_cache[$row['name']][$row['mode']] = true;
+ }
+ }
+
+ if ($module_mode === false)
+ {
+ return (isset($this->loaded_cache[$module_basename])) ? true : false;
+ }
+
+ return (!empty($this->loaded_cache[$module_basename][$module_mode])) ? true : false;
+ }
+
+ /**
* Check module authorisation
*/
function module_auth($module_auth, $forum_id = false)
@@ -319,6 +364,7 @@ class p_master
$this->module_cache['parents'] = $this->module_cache['parents'][$this->p_id];
$this->active_module = $item_ary['id'];
+ $this->active_module_row_id = $row_id;
break;
}
@@ -374,6 +420,12 @@ class p_master
// We pre-define the action parameter we are using all over the place
if (defined('IN_ADMIN'))
{
+ // Is first module automatically enabled a duplicate and the category not passed yet?
+ if (!$icat && $this->module_ary[$this->active_module_row_id]['is_duplicate'])
+ {
+ $icat = $this->module_ary[$this->active_module_row_id]['parent'];
+ }
+
// Not being able to overwrite ;)
$this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_name}") . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
@@ -392,6 +444,12 @@ class p_master
$this->module->u_action = append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
+ // Add url_extra parameter to u_action url
+ if ($this->module_ary[$this->active_module_row_id]['url_extra'])
+ {
+ $this->module->u_action .= $this->module_ary[$this->active_module_row_id]['url_extra'];
+ }
+
// Assign the module path for re-usage
$this->module->module_path = $module_path . '/';
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index 9d0d15b917..4b8961bf38 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -13,7 +13,7 @@
*/
function mcp_forum_view($id, $mode, $action, $forum_info)
{
- global $template, $db, $user, $auth, $cache;
+ global $template, $db, $user, $auth, $cache, $module;
global $phpEx, $phpbb_root_path, $config;
$user->add_lang('viewtopic');
@@ -85,7 +85,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'S_CAN_MAKE_ANNOUNCE' => $auth->acl_get('f_announce', $forum_id),
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
- 'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&amp;mode=forum_logs&amp;f=' . $forum_id) : '',
+ 'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id) && $module->loaded('logs')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&amp;mode=forum_logs&amp;f=' . $forum_id) : '',
'S_MCP_ACTION' => $url . "&amp;i=$id&amp;mode=$mode&amp;start=$start" . (($action == 'merge_select') ? $selected_ids : ''),
@@ -165,6 +165,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
{
$topic_row = array_merge($topic_row, array(
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_moved_id']}"),
+ 'U_DELETE_TOPIC' => ($auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;f=$forum_id&amp;topic_id_list[]={$row['topic_id']}&amp;mode=forum_view&amp;action=delete_topic") : '',
'S_MOVED_TOPIC' => true,
'TOPIC_ID' => $row['topic_moved_id'],
));
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index 3411369d79..69a7082286 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -14,232 +14,241 @@
function mcp_front_view($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;
- global $template, $db, $user, $auth;
+ global $template, $db, $user, $auth, $module;
// Latest 5 unapproved
- $forum_list = get_forum_list('m_approve');
- $post_list = array();
- $forum_names = array();
+ if ($module->loaded('queue'))
+ {
+ $forum_list = get_forum_list('m_approve');
+ $post_list = array();
+ $forum_names = array();
- $forum_id = request_var('f', 0);
+ $forum_id = request_var('f', 0);
- $template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false);
-
- if (!empty($forum_list))
- {
- $sql = 'SELECT COUNT(post_id) AS total
- FROM ' . POSTS_TABLE . '
- WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
- AND post_approved = 0';
- $result = $db->sql_query($sql);
- $total = (int) $db->sql_fetchfield('total');
- $db->sql_freeresult($result);
-
- if ($total)
+ $template->assign_var('S_SHOW_UNAPPROVED', (!empty($forum_list)) ? true : false);
+
+ if (!empty($forum_list))
{
- $global_id = $forum_list[0];
-
- $sql = 'SELECT forum_id, forum_name
- FROM ' . FORUMS_TABLE . '
- WHERE ' . $db->sql_in_set('forum_id', $forum_list);
+ $sql = 'SELECT COUNT(post_id) AS total
+ FROM ' . POSTS_TABLE . '
+ WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
+ AND post_approved = 0';
$result = $db->sql_query($sql);
+ $total = (int) $db->sql_fetchfield('total');
+ $db->sql_freeresult($result);
- while ($row = $db->sql_fetchrow($result))
+ if ($total)
{
- $forum_names[$row['forum_id']] = $row['forum_name'];
- }
- $db->sql_freeresult($result);
+ $global_id = $forum_list[0];
- $sql = 'SELECT post_id
- FROM ' . POSTS_TABLE . '
- WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
- AND post_approved = 0
- ORDER BY post_time DESC';
- $result = $db->sql_query_limit($sql, 5);
+ $sql = 'SELECT forum_id, forum_name
+ FROM ' . FORUMS_TABLE . '
+ WHERE ' . $db->sql_in_set('forum_id', $forum_list);
+ $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- $post_list[] = $row['post_id'];
- }
- $db->sql_freeresult($result);
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $forum_names[$row['forum_id']] = $row['forum_name'];
+ }
+ $db->sql_freeresult($result);
- $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
- FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
- WHERE ' . $db->sql_in_set('p.post_id', $post_list) . '
- AND t.topic_id = p.topic_id
- AND p.poster_id = u.user_id
- ORDER BY p.post_time DESC';
- $result = $db->sql_query($sql);
+ $sql = 'SELECT post_id
+ FROM ' . POSTS_TABLE . '
+ WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ')
+ AND post_approved = 0
+ ORDER BY post_time DESC';
+ $result = $db->sql_query_limit($sql, 5);
- while ($row = $db->sql_fetchrow($result))
- {
- $global_topic = ($row['forum_id']) ? false : true;
- if ($global_topic)
+ while ($row = $db->sql_fetchrow($result))
{
- $row['forum_id'] = $global_id;
+ $post_list[] = $row['post_id'];
}
+ $db->sql_freeresult($result);
- $template->assign_block_vars('unapproved', array(
- 'U_POST_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']),
- 'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=forum_view&amp;f=' . $row['forum_id']) : '',
- 'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
- 'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
- 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
- 'U_AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u=' . $row['poster_id']),
-
- 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'],
- 'POST_ID' => $row['post_id'],
- 'TOPIC_TITLE' => $row['topic_title'],
- 'AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? (($row['post_username']) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'],
- 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
- 'POST_TIME' => $user->format_date($row['post_time']))
- );
- }
- $db->sql_freeresult($result);
- }
+ $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
+ FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
+ WHERE ' . $db->sql_in_set('p.post_id', $post_list) . '
+ AND t.topic_id = p.topic_id
+ AND p.poster_id = u.user_id
+ ORDER BY p.post_time DESC';
+ $result = $db->sql_query($sql);
- $template->assign_vars(array(
- 'S_MCP_QUEUE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue"),
- ));
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $global_topic = ($row['forum_id']) ? false : true;
+ if ($global_topic)
+ {
+ $row['forum_id'] = $global_id;
+ }
+
+ $template->assign_block_vars('unapproved', array(
+ 'U_POST_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=approve_details&amp;f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']),
+ 'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=forum_view&amp;f=' . $row['forum_id']) : '',
+ 'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=topic_view&amp;f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
+ 'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
+ 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
+ 'U_AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u=' . $row['poster_id']),
+
+ 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'],
+ 'POST_ID' => $row['post_id'],
+ 'TOPIC_TITLE' => $row['topic_title'],
+ 'AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? (($row['post_username']) ? $row['post_username'] : $user->lang['GUEST']) : $row['username'],
+ 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
+ 'POST_TIME' => $user->format_date($row['post_time']))
+ );
+ }
+ $db->sql_freeresult($result);
+ }
- if ($total == 0)
- {
- $template->assign_vars(array(
- 'L_UNAPPROVED_TOTAL' => $user->lang['UNAPPROVED_POSTS_ZERO_TOTAL'],
- 'S_HAS_UNAPPROVED_POSTS' => false)
- );
- }
- else
- {
$template->assign_vars(array(
- 'L_UNAPPROVED_TOTAL' => ($total == 1) ? $user->lang['UNAPPROVED_POST_TOTAL'] : sprintf($user->lang['UNAPPROVED_POSTS_TOTAL'], $total),
- 'S_HAS_UNAPPROVED_POSTS' => true)
- );
+ 'S_MCP_QUEUE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue"),
+ ));
+
+ if ($total == 0)
+ {
+ $template->assign_vars(array(
+ 'L_UNAPPROVED_TOTAL' => $user->lang['UNAPPROVED_POSTS_ZERO_TOTAL'],
+ 'S_HAS_UNAPPROVED_POSTS' => false)
+ );
+ }
+ else
+ {
+ $template->assign_vars(array(
+ 'L_UNAPPROVED_TOTAL' => ($total == 1) ? $user->lang['UNAPPROVED_POST_TOTAL'] : sprintf($user->lang['UNAPPROVED_POSTS_TOTAL'], $total),
+ 'S_HAS_UNAPPROVED_POSTS' => true)
+ );
+ }
}
}
// Latest 5 reported
- $forum_list = get_forum_list('m_report');
+ if ($module->loaded('reports'))
+ {
+ $forum_list = get_forum_list('m_report');
- $template->assign_var('S_SHOW_REPORTS', (!empty($forum_list)) ? true : false);
+ $template->assign_var('S_SHOW_REPORTS', (!empty($forum_list)) ? true : false);
- if (!empty($forum_list))
- {
- $sql = 'SELECT COUNT(r.report_id) AS total
- FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
- WHERE r.post_id = p.post_id
- AND r.report_closed = 0
- AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')';
- $result = $db->sql_query($sql);
- $total = (int) $db->sql_fetchfield('total');
- $db->sql_freeresult($result);
-
- if ($total)
+ if (!empty($forum_list))
{
- $global_id = $forum_list[0];
-
- $sql = $db->sql_build_query('SELECT', array(
- 'SELECT' => 'r.report_time, p.post_id, p.post_subject, u.username, u.username_clean, u.user_colour, u.user_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name',
-
- 'FROM' => array(
- REPORTS_TABLE => 'r',
- REPORTS_REASONS_TABLE => 'rr',
- TOPICS_TABLE => 't',
- USERS_TABLE => 'u',
- POSTS_TABLE => 'p'
- ),
-
- 'LEFT_JOIN' => array(
- array(
- 'FROM' => array(FORUMS_TABLE => 'f'),
- 'ON' => 'f.forum_id = p.forum_id'
- )
- ),
-
- 'WHERE' => 'r.post_id = p.post_id
+ $sql = 'SELECT COUNT(r.report_id) AS total
+ FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
+ WHERE r.post_id = p.post_id
AND r.report_closed = 0
- AND r.reason_id = rr.reason_id
- AND p.topic_id = t.topic_id
- AND r.user_id = u.user_id
- AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')',
-
- 'ORDER_BY' => 'p.post_time DESC'
- ));
- $result = $db->sql_query_limit($sql, 5);
+ AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')';
+ $result = $db->sql_query($sql);
+ $total = (int) $db->sql_fetchfield('total');
+ $db->sql_freeresult($result);
- while ($row = $db->sql_fetchrow($result))
+ if ($total)
{
- $global_topic = ($row['forum_id']) ? false : true;
- if ($global_topic)
+ $global_id = $forum_list[0];
+
+ $sql = $db->sql_build_query('SELECT', array(
+ 'SELECT' => 'r.report_time, p.post_id, p.post_subject, u.username, u.username_clean, u.user_colour, u.user_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name',
+
+ 'FROM' => array(
+ REPORTS_TABLE => 'r',
+ REPORTS_REASONS_TABLE => 'rr',
+ TOPICS_TABLE => 't',
+ USERS_TABLE => 'u',
+ POSTS_TABLE => 'p'
+ ),
+
+ 'LEFT_JOIN' => array(
+ array(
+ 'FROM' => array(FORUMS_TABLE => 'f'),
+ 'ON' => 'f.forum_id = p.forum_id'
+ )
+ ),
+
+ 'WHERE' => 'r.post_id = p.post_id
+ AND r.report_closed = 0
+ AND r.reason_id = rr.reason_id
+ AND p.topic_id = t.topic_id
+ AND r.user_id = u.user_id
+ AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')',
+
+ 'ORDER_BY' => 'p.post_time DESC'
+ ));
+ $result = $db->sql_query_limit($sql, 5);
+
+ while ($row = $db->sql_fetchrow($result))
{
- $row['forum_id'] = $global_id;
+ $global_topic = ($row['forum_id']) ? false : true;
+ if ($global_topic)
+ {
+ $row['forum_id'] = $global_id;
+ }
+
+ $template->assign_block_vars('report', array(
+ 'U_POST_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id'] . "&amp;i=reports&amp;mode=report_details"),
+ 'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&amp;i=$id&amp;mode=forum_view") : '',
+ 'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id'] . "&amp;i=$id&amp;mode=topic_view"),
+ 'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
+ 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
+
+ 'REPORTER_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
+ 'REPORTER' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
+ 'REPORTER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
+ 'U_REPORTER' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
+
+ 'FORUM_NAME' => (!$global_topic) ? $row['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'],
+ 'TOPIC_TITLE' => $row['topic_title'],
+ 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
+ 'REPORT_TIME' => $user->format_date($row['report_time']))
+ );
}
+ }
- $template->assign_block_vars('report', array(
- 'U_POST_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id'] . "&amp;i=reports&amp;mode=report_details"),
- 'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&amp;i=$id&amp;mode=forum_view") : '',
- 'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id'] . "&amp;i=$id&amp;mode=topic_view"),
- 'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
- 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
-
- 'REPORTER_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
- 'REPORTER' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
- 'REPORTER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
- 'U_REPORTER' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
-
- 'FORUM_NAME' => (!$global_topic) ? $row['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'],
- 'TOPIC_TITLE' => $row['topic_title'],
- 'SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
- 'REPORT_TIME' => $user->format_date($row['report_time']))
+ if ($total == 0)
+ {
+ $template->assign_vars(array(
+ 'L_REPORTS_TOTAL' => $user->lang['REPORTS_ZERO_TOTAL'],
+ 'S_HAS_REPORTS' => false)
+ );
+ }
+ else
+ {
+ $template->assign_vars(array(
+ 'L_REPORTS_TOTAL' => ($total == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total),
+ 'S_HAS_REPORTS' => true)
);
}
- }
-
- if ($total == 0)
- {
- $template->assign_vars(array(
- 'L_REPORTS_TOTAL' => $user->lang['REPORTS_ZERO_TOTAL'],
- 'S_HAS_REPORTS' => false)
- );
- }
- else
- {
- $template->assign_vars(array(
- 'L_REPORTS_TOTAL' => ($total == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total),
- 'S_HAS_REPORTS' => true)
- );
}
}
// Latest 5 logs
- $forum_list = get_forum_list(array('m_', 'a_'));
-
- if (!empty($forum_list))
+ if ($module->loaded('logs'))
{
- // Add forum_id 0 for global announcements
- $forum_list[] = 0;
-
- $log_count = 0;
- $log = array();
- view_log('mod', $log, $log_count, 5, 0, $forum_list);
+ $forum_list = get_forum_list(array('m_', 'a_'));
- foreach ($log as $row)
+ if (!empty($forum_list))
{
- $template->assign_block_vars('log', array(
- 'USERNAME' => $row['username_full'],
- 'IP' => $row['ip'],
- 'TIME' => $user->format_date($row['time']),
- 'ACTION' => $row['action'],
- 'U_VIEW_TOPIC' => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '',
- 'U_VIEWLOGS' => (!empty($row['viewlogs'])) ? $row['viewlogs'] : '')
- );
+ // Add forum_id 0 for global announcements
+ $forum_list[] = 0;
+
+ $log_count = 0;
+ $log = array();
+ view_log('mod', $log, $log_count, 5, 0, $forum_list);
+
+ foreach ($log as $row)
+ {
+ $template->assign_block_vars('log', array(
+ 'USERNAME' => $row['username_full'],
+ 'IP' => $row['ip'],
+ 'TIME' => $user->format_date($row['time']),
+ 'ACTION' => $row['action'],
+ 'U_VIEW_TOPIC' => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '',
+ 'U_VIEWLOGS' => (!empty($row['viewlogs'])) ? $row['viewlogs'] : '')
+ );
+ }
}
- }
- $template->assign_vars(array(
- 'S_SHOW_LOGS' => (!empty($forum_list)) ? true : false,
- 'S_HAS_LOGS' => (!empty($log)) ? true : false)
- );
+ $template->assign_vars(array(
+ 'S_SHOW_LOGS' => (!empty($forum_list)) ? true : false,
+ 'S_HAS_LOGS' => (!empty($log)) ? true : false)
+ );
+ }
$template->assign_var('S_MCP_ACTION', append_sid("{$phpbb_root_path}mcp.$phpEx"));
make_jumpbox(append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=forum_view'), 0, false, 'm_');
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index a0a61110e1..ea414d2bfd 100755
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -317,7 +317,7 @@ function mcp_warn_post_view($id, $mode, $action)
*/
function mcp_warn_user_view($id, $mode, $action)
{
- global $phpEx, $phpbb_root_path, $config;
+ global $phpEx, $phpbb_root_path, $config, $module;
global $template, $db, $user, $auth;
$user_id = request_var('u', 0);
diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php
index 883d95603b..837ae6f9b1 100644
--- a/phpBB/language/en/mcp.php
+++ b/phpBB/language/en/mcp.php
@@ -64,6 +64,7 @@ $lang = array_merge($lang, array(
'DELETE_REPORT_CONFIRM' => 'Are you sure you want to delete the selected report?',
'DELETE_REPORTS' => 'Delete reports',
'DELETE_REPORTS_CONFIRM' => 'Are you sure you want to delete the selected reports?',
+ 'DELETE_SHADOW_TOPIC' => 'Delete shadow topic',
'DELETE_TOPICS' => 'Delete selected topics',
'DELETE_TOPICS_CONFIRM' => 'Are you sure you want to delete these topics?',
'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?',
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index 6ec68d6c82..f7af4c5206 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -223,7 +223,6 @@ $module->assign_tpl_vars(append_sid("{$phpbb_root_path}mcp.$phpEx"));
// Generate the page, do not display/query online list
$module->display($module->get_page_title(), false);
-
/**
* Functions used to generate additional URL paramters
*/
diff --git a/phpBB/styles/subSilver/template/mcp_forum.html b/phpBB/styles/subSilver/template/mcp_forum.html
index 4fad6e7269..8dc7e4d5b3 100644
--- a/phpBB/styles/subSilver/template/mcp_forum.html
+++ b/phpBB/styles/subSilver/template/mcp_forum.html
@@ -36,6 +36,9 @@
<!-- IF topicrow.S_TOPIC_REPORTED and topicrow.U_MCP_REPORT -->
<a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a>&nbsp;
<!-- ENDIF -->
+ <!-- IF topicrow.S_MOVED_TOPIC and S_CAN_DELETE -->
+ [ <a href="{topicrow.U_DELETE_TOPIC}">{L_DELETE_SHADOW_TOPIC}</a> ]&nbsp;
+ <!-- ENDIF -->
</p>
</td>
<td class="row1" width="50" align="center"><p class="topicdetails">{topicrow.REPLIES}</p></td>