mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Fix the ability to report/view reports and warn in global announcements
git-svn-id: file:///svn/phpbb/trunk@6030 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
898decd6cc
commit
0cf31f0e2a
5 changed files with 33 additions and 17 deletions
|
@ -213,11 +213,16 @@ class mcp_reports
|
||||||
$forum_list = $forum_id;
|
$forum_list = $forum_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$forum_list .= ', 0';
|
||||||
|
$forum_data = array();
|
||||||
|
|
||||||
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
|
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
|
||||||
foreach ($forum_list_reports as $row)
|
foreach ($forum_list_reports as $row)
|
||||||
{
|
{
|
||||||
$forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . $row['forum_name'] . '</option>';
|
$forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . $row['forum_name'] . '</option>';
|
||||||
|
$forum_data[$row['forum_id']] = $row;
|
||||||
}
|
}
|
||||||
|
unset($forum_list_reports);
|
||||||
|
|
||||||
$sort_days = $total = 0;
|
$sort_days = $total = 0;
|
||||||
$sort_key = $sort_dir = '';
|
$sort_key = $sort_dir = '';
|
||||||
|
@ -259,12 +264,11 @@ class mcp_reports
|
||||||
|
|
||||||
if (sizeof($post_ids))
|
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
|
$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, ' . FORUMS_TABLE . ' f, ' . TOPICS_TABLE . ' t, ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . USERS_TABLE . " ru
|
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . USERS_TABLE . " ru
|
||||||
WHERE p.post_id IN (" . implode(', ', $post_ids) . ")
|
WHERE p.post_id IN (" . implode(', ', $post_ids) . ")
|
||||||
AND t.topic_id = p.topic_id
|
AND t.topic_id = p.topic_id
|
||||||
AND r.post_id = p.post_id
|
AND r.post_id = p.post_id
|
||||||
AND f.forum_id = p.forum_id
|
|
||||||
AND u.user_id = p.poster_id
|
AND u.user_id = p.poster_id
|
||||||
AND ru.user_id = r.user_id";
|
AND ru.user_id = r.user_id";
|
||||||
|
|
||||||
|
@ -302,7 +306,7 @@ class mcp_reports
|
||||||
|
|
||||||
'S_CHECKBOX' => $s_checkbox,
|
'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,
|
'POSTER' => $poster,
|
||||||
'POST_SUBJECT' => $row['post_subject'],
|
'POST_SUBJECT' => $row['post_subject'],
|
||||||
'POST_TIME' => $user->format_date($row['post_time']),
|
'POST_TIME' => $user->format_date($row['post_time']),
|
||||||
|
|
|
@ -82,7 +82,7 @@ if ($post_id)
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$topic_id = (int) $row['topic_id'];
|
$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)
|
if ($topic_id && !$forum_id)
|
||||||
|
@ -269,6 +269,12 @@ function get_topic_data($topic_ids, $acl_list = false)
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
if (!$row['forum_id'])
|
||||||
|
{
|
||||||
|
// Global Announcement?
|
||||||
|
$row['forum_id'] = request_var('f', 0);
|
||||||
|
}
|
||||||
|
|
||||||
$rowset[$row['topic_id']] = $row;
|
$rowset[$row['topic_id']] = $row;
|
||||||
|
|
||||||
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
|
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))
|
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']))
|
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -22,6 +22,7 @@ $user->session_begin();
|
||||||
$auth->acl($user->data);
|
$auth->acl($user->data);
|
||||||
$user->setup('mcp');
|
$user->setup('mcp');
|
||||||
|
|
||||||
|
$forum_id = request_var('f', 0);
|
||||||
$post_id = request_var('p', 0);
|
$post_id = request_var('p', 0);
|
||||||
$reason_id = request_var('reason_id', 0);
|
$reason_id = request_var('reason_id', 0);
|
||||||
$report_text = request_var('report_text', '', true);
|
$report_text = request_var('report_text', '', true);
|
||||||
|
@ -33,7 +34,7 @@ if (!$post_id)
|
||||||
trigger_error('INVALID_MODE');
|
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?
|
// Has the report been cancelled?
|
||||||
if (isset($_POST['cancel']))
|
if (isset($_POST['cancel']))
|
||||||
|
@ -42,11 +43,10 @@ if (isset($_POST['cancel']))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab all relevant data
|
// Grab all relevant data
|
||||||
$sql = 'SELECT f.*, t.*, p.*
|
$sql = 'SELECT t.*, p.*
|
||||||
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
|
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
|
||||||
WHERE p.post_id = $post_id
|
WHERE p.post_id = $post_id
|
||||||
AND p.topic_id = t.topic_id
|
AND p.topic_id = t.topic_id";
|
||||||
AND p.forum_id = f.forum_id";
|
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$report_data = $db->sql_fetchrow($result);
|
$report_data = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -56,8 +56,8 @@ if (!$report_data)
|
||||||
trigger_error('POST_NOT_EXIST');
|
trigger_error('POST_NOT_EXIST');
|
||||||
}
|
}
|
||||||
|
|
||||||
$forum_id = $report_data['forum_id'];
|
$forum_id = (int) ($report_data['forum_id']) ? $report_data['forum_id'] : $forum_id;
|
||||||
$topic_id = $report_data['topic_id'];
|
$topic_id = (int) $report_data['topic_id'];
|
||||||
|
|
||||||
// Check required permissions
|
// Check required permissions
|
||||||
$acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT');
|
$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(
|
$template->assign_vars(array(
|
||||||
'REPORT_TEXT' => $report_text,
|
'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_NOTIFY' => $user_notify,
|
||||||
'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false)
|
'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false)
|
||||||
|
|
|
@ -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' => $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_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_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,
|
'U_MCP_QUEUE' => $u_mcp_queue,
|
||||||
|
|
||||||
'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test)
|
'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test)
|
||||||
|
|
|
@ -1354,14 +1354,14 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
||||||
'U_YIM' => $user_cache[$poster_id]['yim'],
|
'U_YIM' => $user_cache[$poster_id]['yim'],
|
||||||
'U_JABBER' => $user_cache[$poster_id]['jabber'],
|
'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_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&p=' . $row['post_id'], true, $user->session_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_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_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_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_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_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'],
|
'POST_ID' => $row['post_id'],
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue