diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 41526254f0..3920490114 100755
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -213,11 +213,16 @@ class mcp_reports
$forum_list = $forum_id;
}
+ $forum_list .= ', 0';
+ $forum_data = array();
+
$forum_options = '';
foreach ($forum_list_reports as $row)
{
$forum_options .= '';
+ $forum_data[$row['forum_id']] = $row;
}
+ unset($forum_list_reports);
$sort_days = $total = 0;
$sort_key = $sort_dir = '';
@@ -259,12 +264,11 @@ class mcp_reports
if (sizeof($post_ids))
{
- $sql = 'SELECT f.forum_id, f.forum_name, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, r.user_id as reporter_id, ru.username as reporter_name, r.report_time
- FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f, ' . TOPICS_TABLE . ' t, ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . USERS_TABLE . " ru
+ $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, r.user_id as reporter_id, ru.username as reporter_name, r.report_time
+ FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . USERS_TABLE . " ru
WHERE p.post_id IN (" . implode(', ', $post_ids) . ")
AND t.topic_id = p.topic_id
AND r.post_id = p.post_id
- AND f.forum_id = p.forum_id
AND u.user_id = p.poster_id
AND ru.user_id = r.user_id";
@@ -302,7 +306,7 @@ class mcp_reports
'S_CHECKBOX' => $s_checkbox,
- 'FORUM_NAME' => $row['forum_name'],
+ 'FORUM_NAME' => ($row['forum_id']) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['ALL_FORUMS'],
'POSTER' => $poster,
'POST_SUBJECT' => $row['post_subject'],
'POST_TIME' => $user->format_date($row['post_time']),
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index 50b803048c..acff846df7 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -82,7 +82,7 @@ if ($post_id)
$db->sql_freeresult($result);
$topic_id = (int) $row['topic_id'];
- $forum_id = (int) $row['forum_id'];
+ $forum_id = (int) ($row['forum_id']) ? $row['forum_id'] : $forum_id;
}
if ($topic_id && !$forum_id)
@@ -269,6 +269,12 @@ function get_topic_data($topic_ids, $acl_list = false)
while ($row = $db->sql_fetchrow($result))
{
+ if (!$row['forum_id'])
+ {
+ // Global Announcement?
+ $row['forum_id'] = request_var('f', 0);
+ }
+
$rowset[$row['topic_id']] = $row;
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
@@ -330,6 +336,12 @@ function get_post_data($post_ids, $acl_list = false)
while ($row = $db->sql_fetchrow($result))
{
+ if (!$row['forum_id'])
+ {
+ // Global Announcement?
+ $row['forum_id'] = request_var('f', 0);
+ }
+
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
{
continue;
diff --git a/phpBB/report.php b/phpBB/report.php
index 70912d64f1..3a0ad3e82d 100644
--- a/phpBB/report.php
+++ b/phpBB/report.php
@@ -22,6 +22,7 @@ $user->session_begin();
$auth->acl($user->data);
$user->setup('mcp');
+$forum_id = request_var('f', 0);
$post_id = request_var('p', 0);
$reason_id = request_var('reason_id', 0);
$report_text = request_var('report_text', '', true);
@@ -33,7 +34,7 @@ if (!$post_id)
trigger_error('INVALID_MODE');
}
-$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "p=$post_id") . "#p$post_id";
+$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&p=$post_id") . "#p$post_id";
// Has the report been cancelled?
if (isset($_POST['cancel']))
@@ -42,11 +43,10 @@ if (isset($_POST['cancel']))
}
// Grab all relevant data
-$sql = 'SELECT f.*, t.*, p.*
- FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
+$sql = 'SELECT t.*, p.*
+ FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
WHERE p.post_id = $post_id
- AND p.topic_id = t.topic_id
- AND p.forum_id = f.forum_id";
+ AND p.topic_id = t.topic_id";
$result = $db->sql_query($sql);
$report_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -56,8 +56,8 @@ if (!$report_data)
trigger_error('POST_NOT_EXIST');
}
-$forum_id = $report_data['forum_id'];
-$topic_id = $report_data['topic_id'];
+$forum_id = (int) ($report_data['forum_id']) ? $report_data['forum_id'] : $forum_id;
+$topic_id = (int) $report_data['topic_id'];
// Check required permissions
$acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT');
@@ -134,7 +134,7 @@ display_reasons($reason_id);
$template->assign_vars(array(
'REPORT_TEXT' => $report_text,
- 'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'p=' . $post_id),
+ 'S_REPORT_ACTION' => append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $post_id),
'S_NOTIFY' => $user_notify,
'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false)
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index a45f458db4..b2d3a35ba9 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -518,7 +518,7 @@ if (sizeof($topic_list))
'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
'U_LAST_POST_AUTHOR' => ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '',
'U_VIEW_TOPIC' => $view_topic_url,
- 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&t=' . $topic_id, true, $user->session_id),
+ 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $forum_id . '&t=' . $topic_id, true, $user->session_id),
'U_MCP_QUEUE' => $u_mcp_queue,
'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test)
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index b4c76d33ab..17d5346222 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1354,14 +1354,14 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'U_YIM' => $user_cache[$poster_id]['yim'],
'U_JABBER' => $user_cache[$poster_id]['jabber'],
- 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'p=' . $row['post_id']) : '',
- 'U_MCP_REPORT' => ($auth->acl_gets('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&p=' . $row['post_id'], true, $user->session_id) : '',
+ 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '',
+ 'U_MCP_REPORT' => ($auth->acl_gets('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_posts&action=approve&post_id_list[]=' . $row['post_id'], true, $user->session_id) : '',
'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'],
'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '',
'U_PREV_POST_ID' => $prev_post_id,
'U_NOTES' => ($auth->acl_gets('m_', 'a_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $poster_id, true, $user->session_id) : '',
- 'U_WARN' => ($auth->acl_gets('m_', 'a_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post&p=' . $row['post_id'], true, $user->session_id) : '',
+ 'U_WARN' => ($auth->acl_gets('m_', 'a_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
'POST_ID' => $row['post_id'],