2006-03-04 13:50:52 +00:00
|
|
|
<?php
|
2007-06-09 11:11:20 +00:00
|
|
|
/**
|
2006-03-18 10:54:14 +00:00
|
|
|
*
|
|
|
|
* @package mcp
|
|
|
|
* @version $Id$
|
2007-06-09 11:11:20 +00:00
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
2006-03-18 10:54:14 +00:00
|
|
|
*
|
2006-03-04 13:50:52 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-05 14:36:34 +00:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
if (!defined('IN_PHPBB'))
|
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2006-03-04 13:50:52 +00:00
|
|
|
/**
|
2006-03-18 10:54:14 +00:00
|
|
|
* mcp_reports
|
|
|
|
* Handling the reports queue
|
2006-06-13 21:06:29 +00:00
|
|
|
* @package mcp
|
2006-03-04 13:50:52 +00:00
|
|
|
*/
|
|
|
|
class mcp_reports
|
|
|
|
{
|
|
|
|
var $p_master;
|
2006-06-06 20:53:46 +00:00
|
|
|
var $u_action;
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2007-05-06 15:31:39 +00:00
|
|
|
function mcp_reports(&$p_master)
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
|
|
|
$this->p_master = &$p_master;
|
|
|
|
}
|
|
|
|
|
|
|
|
function main($id, $mode)
|
|
|
|
{
|
2007-05-19 12:04:22 +00:00
|
|
|
global $auth, $db, $user, $template, $cache;
|
2006-06-06 20:53:46 +00:00
|
|
|
global $config, $phpbb_root_path, $phpEx, $action;
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
|
2006-03-04 13:50:52 +00:00
|
|
|
|
|
|
|
$forum_id = request_var('f', 0);
|
|
|
|
$start = request_var('start', 0);
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-06-04 15:01:35 +00:00
|
|
|
$this->page_title = 'MCP_REPORTS';
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
switch ($action)
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2006-03-18 10:54:14 +00:00
|
|
|
case 'close':
|
|
|
|
case 'delete':
|
2006-06-16 16:54:51 +00:00
|
|
|
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
$report_id_list = request_var('report_id_list', array(0));
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
if (!sizeof($report_id_list))
|
2006-03-18 10:54:14 +00:00
|
|
|
{
|
2007-04-15 21:40:25 +00:00
|
|
|
trigger_error('NO_REPORT_SELECTED');
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
close_report($report_id_list, $mode, $action);
|
2006-03-18 10:54:14 +00:00
|
|
|
|
|
|
|
break;
|
2006-03-04 13:50:52 +00:00
|
|
|
}
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
switch ($mode)
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2006-03-18 10:54:14 +00:00
|
|
|
case 'report_details':
|
|
|
|
|
2008-10-10 17:56:59 +00:00
|
|
|
$user->add_lang(array('posting', 'viewforum', 'viewtopic'));
|
2006-03-18 10:54:14 +00:00
|
|
|
|
|
|
|
$post_id = request_var('p', 0);
|
|
|
|
|
2006-07-27 19:02:47 +00:00
|
|
|
// closed reports are accessed by report id
|
|
|
|
$report_id = request_var('r', 0);
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
$sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
|
2006-07-27 19:02:47 +00:00
|
|
|
FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
|
2007-04-29 20:56:46 +00:00
|
|
|
WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
|
2006-03-18 10:54:14 +00:00
|
|
|
AND rr.reason_id = r.reason_id
|
2007-04-29 20:56:46 +00:00
|
|
|
AND r.user_id = u.user_id
|
2009-07-21 20:59:11 +00:00
|
|
|
AND r.pm_id = 0
|
2007-04-29 20:56:46 +00:00
|
|
|
ORDER BY report_closed ASC';
|
|
|
|
$result = $db->sql_query_limit($sql, 1);
|
2006-06-16 16:54:51 +00:00
|
|
|
$report = $db->sql_fetchrow($result);
|
|
|
|
$db->sql_freeresult($result);
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-06-16 16:54:51 +00:00
|
|
|
if (!$report)
|
2006-03-18 10:54:14 +00:00
|
|
|
{
|
#10005, #10003, #10001, #9999, #9945, #9965, #9909, #9906, #9877, #9861, #9831, #9830, #9815, #9665, #9624
prosilver adjustments for important announcements in ucp - #9995
MCP fixes for user notes/warnings - #9981
Preserving imageset values on save/edit
find a member link for Mass PM's - #9925
syndicate window.onload events where necessary - #9878
Duplicate topics in forums with announcements - #9840
Email template for forced re-activation - #9808
Topic pagination adjustment - #9763
Changed compose message layout in UCP - #9706, #9702
Fixed inline attachment font size (hopefully)
git-svn-id: file:///svn/phpbb/trunk@7384 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-04-22 15:27:40 +00:00
|
|
|
trigger_error('NO_REPORT');
|
|
|
|
}
|
|
|
|
|
2007-04-29 20:56:46 +00:00
|
|
|
if (!$report_id && $report['report_closed'])
|
|
|
|
{
|
|
|
|
trigger_error('REPORT_CLOSED');
|
|
|
|
}
|
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
$post_id = $report['post_id'];
|
|
|
|
$report_id = $report['report_id'];
|
2006-07-27 19:02:47 +00:00
|
|
|
|
2007-01-27 16:04:58 +00:00
|
|
|
$post_info = get_post_data(array($post_id), 'm_report', true);
|
2006-07-27 19:02:47 +00:00
|
|
|
|
|
|
|
if (!sizeof($post_info))
|
|
|
|
{
|
2007-04-15 21:40:25 +00:00
|
|
|
trigger_error('NO_REPORT_SELECTED');
|
2006-07-27 19:02:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$post_info = $post_info[$post_id];
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
$reason = array('title' => $report['reason_title'], 'description' => $report['reason_description']);
|
|
|
|
if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])]))
|
|
|
|
{
|
|
|
|
$reason['description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])];
|
|
|
|
$reason['title'] = $user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false))
|
|
|
|
{
|
|
|
|
$template->assign_vars(array(
|
|
|
|
'S_TOPIC_REVIEW' => true,
|
|
|
|
'TOPIC_TITLE' => $post_info['topic_title'])
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2007-05-19 12:04:22 +00:00
|
|
|
$topic_tracking_info = $extensions = $attachments = array();
|
2007-01-27 16:04:58 +00:00
|
|
|
// Get topic tracking info
|
|
|
|
if ($config['load_db_lastread'])
|
|
|
|
{
|
|
|
|
$tmp_topic_data = array($post_info['topic_id'] => $post_info);
|
|
|
|
$topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
|
|
|
|
unset($tmp_topic_data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
$post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false;
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
// Process message, leave it uncensored
|
|
|
|
$message = $post_info['post_text'];
|
2007-08-19 13:40:53 +00:00
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
if ($post_info['bbcode_bitfield'])
|
|
|
|
{
|
2006-06-16 16:54:51 +00:00
|
|
|
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
|
2006-03-18 10:54:14 +00:00
|
|
|
$bbcode = new bbcode($post_info['bbcode_bitfield']);
|
|
|
|
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
|
|
|
|
}
|
2007-08-19 13:40:53 +00:00
|
|
|
|
|
|
|
$message = bbcode_nl2br($message);
|
2006-03-18 10:54:14 +00:00
|
|
|
$message = smiley_text($message);
|
|
|
|
|
2007-05-19 12:04:22 +00:00
|
|
|
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
|
|
|
|
{
|
|
|
|
$sql = 'SELECT *
|
|
|
|
FROM ' . ATTACHMENTS_TABLE . '
|
|
|
|
WHERE post_msg_id = ' . $post_id . '
|
|
|
|
AND in_message = 0
|
2009-07-21 20:59:11 +00:00
|
|
|
ORDER BY filetime DESC';
|
2007-05-19 12:04:22 +00:00
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
|
|
|
$attachments[] = $row;
|
|
|
|
}
|
|
|
|
$db->sql_freeresult($result);
|
|
|
|
|
|
|
|
if (sizeof($attachments))
|
|
|
|
{
|
|
|
|
$update_count = array();
|
|
|
|
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display not already displayed Attachments for this post, we already parsed them. ;)
|
|
|
|
if (!empty($attachments))
|
|
|
|
{
|
|
|
|
$template->assign_var('S_HAS_ATTACHMENTS', true);
|
|
|
|
|
|
|
|
foreach ($attachments as $attachment)
|
|
|
|
{
|
|
|
|
$template->assign_block_vars('attachment', array(
|
|
|
|
'DISPLAY_ATTACHMENT' => $attachment)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
$template->assign_vars(array(
|
|
|
|
'S_MCP_REPORT' => true,
|
2008-03-13 15:22:33 +00:00
|
|
|
'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),
|
2006-04-17 22:36:43 +00:00
|
|
|
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
|
2006-03-18 10:54:14 +00:00
|
|
|
'S_POST_REPORTED' => $post_info['post_reported'],
|
|
|
|
'S_POST_UNAPPROVED' => !$post_info['post_approved'],
|
|
|
|
'S_POST_LOCKED' => $post_info['post_edit_locked'],
|
2006-06-10 23:11:03 +00:00
|
|
|
'S_USER_NOTES' => true,
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-06-16 16:54:51 +00:00
|
|
|
'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '',
|
|
|
|
'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),
|
|
|
|
'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),
|
|
|
|
'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $report['user_id']),
|
|
|
|
'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']),
|
2007-04-15 10:59:26 +00:00
|
|
|
'U_MCP_WARN_REPORTER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '',
|
|
|
|
'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '',
|
2008-09-26 11:25:04 +00:00
|
|
|
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $post_info['forum_id']),
|
2006-07-01 15:00:50 +00:00
|
|
|
'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']),
|
2006-06-29 19:57:06 +00:00
|
|
|
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']),
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-08-05 15:49:28 +00:00
|
|
|
'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
|
2007-01-27 16:04:58 +00:00
|
|
|
'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'),
|
2006-08-05 15:49:28 +00:00
|
|
|
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-11-18 16:27:35 +00:00
|
|
|
'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports' . (($post_info['post_reported']) ? '&mode=reports' : '&mode=reports_closed') . '&start=' . $start . '&f=' . $post_info['forum_id']) . '">', '</a>'),
|
2006-08-05 15:49:28 +00:00
|
|
|
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
|
2007-04-15 21:40:25 +00:00
|
|
|
'REPORT_DATE' => $user->format_date($report['report_time']),
|
|
|
|
'REPORT_ID' => $report_id,
|
2006-06-16 16:54:51 +00:00
|
|
|
'REPORT_REASON_TITLE' => $reason['title'],
|
2006-03-18 10:54:14 +00:00
|
|
|
'REPORT_REASON_DESCRIPTION' => $reason['description'],
|
2006-06-16 16:54:51 +00:00
|
|
|
'REPORT_TEXT' => $report['report_text'],
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-11-16 16:51:19 +00:00
|
|
|
'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
|
|
'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
|
|
'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
|
|
'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
|
|
|
2006-11-24 14:59:26 +00:00
|
|
|
'REPORTER_FULL' => get_username_string('full', $report['user_id'], $report['username'], $report['user_colour']),
|
|
|
|
'REPORTER_COLOUR' => get_username_string('colour', $report['user_id'], $report['username'], $report['user_colour']),
|
|
|
|
'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']),
|
|
|
|
'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']),
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
'POST_PREVIEW' => $message,
|
2007-05-16 14:45:13 +00:00
|
|
|
'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'],
|
2006-03-18 10:54:14 +00:00
|
|
|
'POST_DATE' => $user->format_date($post_info['post_time']),
|
|
|
|
'POST_IP' => $post_info['poster_ip'],
|
2007-05-19 12:04:22 +00:00
|
|
|
'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
|
|
|
|
'POST_ID' => $post_info['post_id'],
|
|
|
|
|
|
|
|
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? $this->u_action . '&r=' . $report_id . '&p=' . $post_id . '&f=' . $forum_id . '&lookup=' . $post_info['poster_ip'] . '#ip' : '',
|
|
|
|
));
|
2006-03-18 10:54:14 +00:00
|
|
|
|
|
|
|
$this->tpl_name = 'mcp_post';
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'reports':
|
|
|
|
case 'reports_closed':
|
|
|
|
$topic_id = request_var('t', 0);
|
|
|
|
|
|
|
|
$forum_info = array();
|
2006-06-10 23:11:03 +00:00
|
|
|
$forum_list_reports = get_forum_list('m_report', false, true);
|
2008-10-14 18:29:50 +00:00
|
|
|
$forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs
|
|
|
|
|
|
|
|
// Remove forums we cannot read
|
|
|
|
foreach ($forum_list_reports as $k => $forum_data)
|
|
|
|
{
|
|
|
|
if (!isset($forum_list_read[$forum_data['forum_id']]))
|
|
|
|
{
|
|
|
|
unset($forum_list_reports[$k]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
unset($forum_list_read);
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2009-07-19 01:00:33 +00:00
|
|
|
if ($topic_id)
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2006-03-18 10:54:14 +00:00
|
|
|
$topic_info = get_topic_data(array($topic_id));
|
|
|
|
|
|
|
|
if (!sizeof($topic_info))
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2007-07-22 14:04:26 +00:00
|
|
|
trigger_error('TOPIC_NOT_EXIST');
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
|
|
|
|
2009-07-19 01:00:33 +00:00
|
|
|
if ($forum_id != $topic_info[$topic_id]['forum_id'])
|
|
|
|
{
|
|
|
|
$topic_id = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$topic_info = $topic_info[$topic_id];
|
|
|
|
$forum_id = (int) $topic_info['forum_id'];
|
|
|
|
}
|
2007-02-06 19:09:43 +00:00
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-08-12 13:14:39 +00:00
|
|
|
$forum_list = array();
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
if (!$forum_id)
|
|
|
|
{
|
|
|
|
foreach ($forum_list_reports as $row)
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2006-03-18 10:54:14 +00:00
|
|
|
$forum_list[] = $row['forum_id'];
|
2006-03-04 13:50:52 +00:00
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-08-12 13:14:39 +00:00
|
|
|
if (!sizeof($forum_list))
|
2006-03-18 10:54:14 +00:00
|
|
|
{
|
|
|
|
trigger_error('NOT_MODERATOR');
|
|
|
|
}
|
|
|
|
|
2006-09-23 11:49:27 +00:00
|
|
|
$global_id = $forum_list[0];
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
|
2006-08-12 13:14:39 +00:00
|
|
|
FROM ' . FORUMS_TABLE . '
|
|
|
|
WHERE ' . $db->sql_in_set('forum_id', $forum_list);
|
2006-03-18 10:54:14 +00:00
|
|
|
$result = $db->sql_query($sql);
|
2006-03-22 17:30:20 +00:00
|
|
|
$forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
|
2006-03-18 10:54:14 +00:00
|
|
|
$db->sql_freeresult($result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$forum_info = get_forum_data(array($forum_id), 'm_report');
|
|
|
|
|
|
|
|
if (!sizeof($forum_info))
|
|
|
|
{
|
|
|
|
trigger_error('NOT_MODERATOR');
|
|
|
|
}
|
|
|
|
|
|
|
|
$forum_info = $forum_info[$forum_id];
|
2006-08-12 13:14:39 +00:00
|
|
|
$forum_list = array($forum_id);
|
2006-07-07 12:36:44 +00:00
|
|
|
$global_id = $forum_id;
|
2006-03-04 13:50:52 +00:00
|
|
|
}
|
|
|
|
|
2006-08-12 13:14:39 +00:00
|
|
|
$forum_list[] = 0;
|
2006-06-09 19:37:47 +00:00
|
|
|
$forum_data = array();
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
|
|
|
|
foreach ($forum_list_reports as $row)
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2007-09-11 20:43:30 +00:00
|
|
|
$forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat(' ', $row['padding']) . $row['forum_name'] . '</option>';
|
2006-06-09 19:37:47 +00:00
|
|
|
$forum_data[$row['forum_id']] = $row;
|
2006-03-04 13:50:52 +00:00
|
|
|
}
|
2006-06-09 19:37:47 +00:00
|
|
|
unset($forum_list_reports);
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2006-03-21 19:23:34 +00:00
|
|
|
$sort_days = $total = 0;
|
|
|
|
$sort_key = $sort_dir = '';
|
|
|
|
$sort_by_sql = $sort_order_sql = array();
|
2006-03-28 18:59:00 +00:00
|
|
|
mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
|
2006-03-21 19:23:34 +00:00
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
$forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
|
2009-07-21 20:59:11 +00:00
|
|
|
$limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : '';
|
2006-03-18 10:54:14 +00:00
|
|
|
|
|
|
|
if ($mode == 'reports')
|
|
|
|
{
|
2006-04-08 14:30:46 +00:00
|
|
|
$report_state = 'AND p.post_reported = 1 AND r.report_closed = 0';
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-04-08 14:30:46 +00:00
|
|
|
$report_state = 'AND r.report_closed = 1';
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
|
|
|
|
2006-07-27 19:02:47 +00:00
|
|
|
$sql = 'SELECT r.report_id
|
2006-08-12 13:14:39 +00:00
|
|
|
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . REPORTS_TABLE . ' r ' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . (($sort_order_sql[0] == 'r') ? ', ' . USERS_TABLE . ' ru' : '') . '
|
|
|
|
WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . "
|
2006-03-18 10:54:14 +00:00
|
|
|
$report_state
|
|
|
|
AND r.post_id = p.post_id
|
2006-05-30 12:24:07 +00:00
|
|
|
" . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
|
2009-07-21 20:59:11 +00:00
|
|
|
' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = r.user_id' : '') . '
|
2006-05-30 12:24:07 +00:00
|
|
|
' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
|
2006-03-18 10:54:14 +00:00
|
|
|
AND t.topic_id = p.topic_id
|
2009-07-21 20:59:11 +00:00
|
|
|
AND r.pm_id = 0
|
2006-03-28 18:59:00 +00:00
|
|
|
$limit_time_sql
|
2006-03-18 10:54:14 +00:00
|
|
|
ORDER BY $sort_order_sql";
|
|
|
|
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
|
|
|
|
|
|
|
$i = 0;
|
2006-07-27 19:02:47 +00:00
|
|
|
$report_ids = array();
|
2006-03-18 10:54:14 +00:00
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
2006-07-27 19:02:47 +00:00
|
|
|
$report_ids[] = $row['report_id'];
|
|
|
|
$row_num[$row['report_id']] = $i++;
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
2006-06-16 16:54:51 +00:00
|
|
|
$db->sql_freeresult($result);
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-07-27 19:02:47 +00:00
|
|
|
if (sizeof($report_ids))
|
2006-03-18 10:54:14 +00:00
|
|
|
{
|
2006-12-02 13:19:40 +00:00
|
|
|
$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, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id
|
2006-08-12 13:14:39 +00:00
|
|
|
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru
|
|
|
|
WHERE ' . $db->sql_in_set('r.report_id', $report_ids) . '
|
2006-03-18 10:54:14 +00:00
|
|
|
AND t.topic_id = p.topic_id
|
|
|
|
AND r.post_id = p.post_id
|
|
|
|
AND u.user_id = p.poster_id
|
2007-04-29 20:56:46 +00:00
|
|
|
AND ru.user_id = r.user_id
|
2009-07-21 20:59:11 +00:00
|
|
|
AND r.pm_id = 0
|
2007-04-29 20:56:46 +00:00
|
|
|
ORDER BY ' . $sort_order_sql;
|
2006-03-18 10:54:14 +00:00
|
|
|
$result = $db->sql_query($sql);
|
2006-06-16 16:54:51 +00:00
|
|
|
|
2006-07-27 19:02:47 +00:00
|
|
|
$report_data = $rowset = array();
|
2006-03-18 10:54:14 +00:00
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
2006-07-07 12:36:44 +00:00
|
|
|
$global_topic = ($row['forum_id']) ? false : true;
|
|
|
|
if ($global_topic)
|
|
|
|
{
|
|
|
|
$row['forum_id'] = $global_id;
|
|
|
|
}
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
$template->assign_block_vars('postrow', array(
|
2006-07-07 12:36:44 +00:00
|
|
|
'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
|
|
|
|
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'],
|
2006-07-27 19:02:47 +00:00
|
|
|
'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&start=$start&mode=report_details&f={$row['forum_id']}&r={$row['report_id']}"),
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-11-16 16:51:19 +00:00
|
|
|
'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
|
|
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
|
|
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
|
|
'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
|
|
|
2006-11-18 16:27:35 +00:00
|
|
|
'REPORTER_FULL' => get_username_string('full', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
|
|
|
'REPORTER_COLOUR' => get_username_string('colour', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
|
|
|
'REPORTER' => get_username_string('username', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
|
|
|
'U_REPORTER' => get_username_string('profile', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
|
|
|
|
2006-07-18 20:34:26 +00:00
|
|
|
'FORUM_NAME' => (!$global_topic) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'],
|
2006-06-16 16:54:51 +00:00
|
|
|
'POST_ID' => $row['post_id'],
|
2007-05-25 17:16:48 +00:00
|
|
|
'POST_SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
|
2006-03-18 10:54:14 +00:00
|
|
|
'POST_TIME' => $user->format_date($row['post_time']),
|
2007-04-15 21:40:25 +00:00
|
|
|
'REPORT_ID' => $row['report_id'],
|
2006-03-18 10:54:14 +00:00
|
|
|
'REPORT_TIME' => $user->format_date($row['report_time']),
|
|
|
|
'TOPIC_TITLE' => $row['topic_title'])
|
|
|
|
);
|
|
|
|
}
|
2006-07-27 19:02:47 +00:00
|
|
|
$db->sql_freeresult($result);
|
|
|
|
unset($report_ids, $row);
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Now display the page
|
|
|
|
$template->assign_vars(array(
|
2006-06-04 18:49:19 +00:00
|
|
|
'L_EXPLAIN' => ($mode == 'reports') ? $user->lang['MCP_REPORTS_OPEN_EXPLAIN'] : $user->lang['MCP_REPORTS_CLOSED_EXPLAIN'],
|
|
|
|
'L_TITLE' => ($mode == 'reports') ? $user->lang['MCP_REPORTS_OPEN'] : $user->lang['MCP_REPORTS_CLOSED'],
|
2006-05-30 12:24:07 +00:00
|
|
|
'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '',
|
|
|
|
|
2006-11-18 16:27:35 +00:00
|
|
|
'S_MCP_ACTION' => $this->u_action,
|
2006-05-30 12:24:07 +00:00
|
|
|
'S_FORUM_OPTIONS' => $forum_options,
|
|
|
|
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
|
|
|
|
|
2007-02-08 22:11:14 +00:00
|
|
|
'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start),
|
2006-03-27 12:48:29 +00:00
|
|
|
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
|
2006-05-30 12:24:07 +00:00
|
|
|
'TOPIC_ID' => $topic_id,
|
2007-01-09 20:46:57 +00:00
|
|
|
'TOTAL' => $total,
|
|
|
|
'TOTAL_REPORTS' => ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total),
|
|
|
|
)
|
2006-03-18 10:54:14 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$this->tpl_name = 'mcp_reports';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Closes a report
|
|
|
|
*/
|
2009-07-21 20:59:11 +00:00
|
|
|
function close_report($report_id_list, $mode, $action, $pm = false)
|
2006-03-18 10:54:14 +00:00
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
global $db, $template, $user, $config, $auth;
|
2006-06-06 20:53:46 +00:00
|
|
|
global $phpEx, $phpbb_root_path;
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2009-07-21 20:59:11 +00:00
|
|
|
$pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 ';
|
|
|
|
$id_column = ($pm) ? 'pm_id' : 'post_id';
|
|
|
|
$module = ($pm) ? 'pm_reports' : 'reports';
|
|
|
|
$pm_prefix = ($pm) ? 'PM_' : '';
|
|
|
|
|
|
|
|
$sql = "SELECT r.$id_column
|
|
|
|
FROM " . REPORTS_TABLE . ' r
|
|
|
|
WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . $pm_where;
|
2007-04-15 21:40:25 +00:00
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
$post_id_list = array();
|
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
$post_id_list[] = $row[$id_column];
|
2007-04-15 21:40:25 +00:00
|
|
|
}
|
|
|
|
$post_id_list = array_unique($post_id_list);
|
|
|
|
|
2009-07-21 20:59:11 +00:00
|
|
|
if ($pm)
|
|
|
|
{
|
|
|
|
if (!$auth->acl_getf_global('m_report'))
|
|
|
|
{
|
|
|
|
trigger_error('NOT_AUTHORISED');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2006-03-18 10:54:14 +00:00
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report')))
|
|
|
|
{
|
|
|
|
trigger_error('NOT_AUTHORISED');
|
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
|
|
|
|
2006-09-23 11:10:37 +00:00
|
|
|
if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false)
|
2006-06-16 18:31:51 +00:00
|
|
|
{
|
2008-04-21 13:17:30 +00:00
|
|
|
$redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=reports');
|
2006-06-16 18:31:51 +00:00
|
|
|
}
|
2009-07-21 20:59:11 +00:00
|
|
|
elseif ($action == 'delete' && strpos($user->data['session_page'], 'mode=pm_report_details') !== false)
|
|
|
|
{
|
|
|
|
$redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=pm_reports');
|
|
|
|
}
|
2006-11-23 16:15:46 +00:00
|
|
|
else if ($action == 'close' && !request_var('r', 0))
|
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
$redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&mode=' . $module);
|
2006-11-23 16:15:46 +00:00
|
|
|
}
|
2006-06-16 18:31:51 +00:00
|
|
|
else
|
|
|
|
{
|
2008-04-21 13:17:30 +00:00
|
|
|
$redirect = request_var('redirect', build_url(array('quickmod')));
|
2006-06-16 18:31:51 +00:00
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
$success_msg = '';
|
2007-07-02 14:05:21 +00:00
|
|
|
$forum_ids = array();
|
|
|
|
$topic_ids = array();
|
2006-03-18 10:54:14 +00:00
|
|
|
|
|
|
|
$s_hidden_fields = build_hidden_fields(array(
|
2009-07-21 20:59:11 +00:00
|
|
|
'i' => $module,
|
2007-04-15 21:40:25 +00:00
|
|
|
'mode' => $mode,
|
|
|
|
'report_id_list' => $report_id_list,
|
|
|
|
'action' => $action,
|
|
|
|
'redirect' => $redirect)
|
2006-03-18 10:54:14 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
if (confirm_box(true))
|
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
$post_info = ($pm) ? get_pm_data($post_id_list) : get_post_data($post_id_list, 'm_report');
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2009-07-21 20:59:11 +00:00
|
|
|
$sql = "SELECT r.report_id, r.$id_column, r.report_closed, r.user_id, r.user_notify, u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type
|
|
|
|
FROM " . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u
|
2007-04-15 21:40:25 +00:00
|
|
|
WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . '
|
2006-03-18 10:54:14 +00:00
|
|
|
' . (($action == 'close') ? 'AND r.report_closed = 0' : '') . '
|
2009-07-21 20:59:11 +00:00
|
|
|
AND r.user_id = u.user_id' . $pm_where;
|
2006-03-18 10:54:14 +00:00
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
$reports = $close_report_posts = $close_report_topics = $notify_reporters = $report_id_list = array();
|
2006-03-18 10:54:14 +00:00
|
|
|
while ($report = $db->sql_fetchrow($result))
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2007-04-15 21:40:25 +00:00
|
|
|
$reports[$report['report_id']] = $report;
|
|
|
|
$report_id_list[] = $report['report_id'];
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
if (!$report['report_closed'])
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
$close_report_posts[] = $report[$id_column];
|
|
|
|
|
|
|
|
if (!$pm)
|
|
|
|
{
|
|
|
|
$close_report_topics[] = $post_info[$report['post_id']]['topic_id'];
|
|
|
|
}
|
2007-04-15 21:40:25 +00:00
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
if ($report['user_notify'] && !$report['report_closed'])
|
|
|
|
{
|
|
|
|
$notify_reporters[$report['report_id']] = &$reports[$report['report_id']];
|
2006-03-04 13:50:52 +00:00
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
2007-04-15 21:40:25 +00:00
|
|
|
$db->sql_freeresult($result);
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
if (sizeof($reports))
|
2006-03-18 10:54:14 +00:00
|
|
|
{
|
2007-04-15 21:40:25 +00:00
|
|
|
$close_report_posts = array_unique($close_report_posts);
|
2006-03-18 10:54:14 +00:00
|
|
|
$close_report_topics = array_unique($close_report_topics);
|
|
|
|
|
2009-07-21 20:59:11 +00:00
|
|
|
if (!$pm && sizeof($close_report_posts))
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2007-04-15 21:40:25 +00:00
|
|
|
// Get a list of topics that still contain reported posts
|
|
|
|
$sql = 'SELECT DISTINCT topic_id
|
|
|
|
FROM ' . POSTS_TABLE . '
|
|
|
|
WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . '
|
|
|
|
AND post_reported = 1
|
|
|
|
AND ' . $db->sql_in_set('post_id', $close_report_posts, true);
|
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
|
|
|
|
$keep_report_topics = array();
|
|
|
|
while ($row = $db->sql_fetchrow($result))
|
|
|
|
{
|
|
|
|
$keep_report_topics[] = $row['topic_id'];
|
|
|
|
}
|
|
|
|
$db->sql_freeresult($result);
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
$close_report_topics = array_diff($close_report_topics, $keep_report_topics);
|
|
|
|
unset($keep_report_topics);
|
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2006-03-04 13:50:52 +00:00
|
|
|
$db->sql_transaction('begin');
|
2006-03-18 10:54:14 +00:00
|
|
|
|
|
|
|
if ($action == 'close')
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2006-03-18 10:54:14 +00:00
|
|
|
$sql = 'UPDATE ' . REPORTS_TABLE . '
|
|
|
|
SET report_closed = 1
|
2007-04-15 21:40:25 +00:00
|
|
|
WHERE ' . $db->sql_in_set('report_id', $report_id_list);
|
2006-03-04 13:50:52 +00:00
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
else
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2006-03-18 10:54:14 +00:00
|
|
|
$sql = 'DELETE FROM ' . REPORTS_TABLE . '
|
2007-04-15 21:40:25 +00:00
|
|
|
WHERE ' . $db->sql_in_set('report_id', $report_id_list);
|
2006-03-04 13:50:52 +00:00
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
$db->sql_query($sql);
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
if (sizeof($close_report_posts))
|
2006-07-27 19:02:47 +00:00
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
if ($pm)
|
|
|
|
{
|
|
|
|
$sql = 'UPDATE ' . PRIVMSGS_TABLE . '
|
|
|
|
SET message_reported = 0
|
|
|
|
WHERE ' . $db->sql_in_set('msg_id', $close_report_posts);
|
|
|
|
$db->sql_query($sql);
|
2007-04-15 21:40:25 +00:00
|
|
|
|
2009-07-21 20:59:11 +00:00
|
|
|
if ($action == 'delete')
|
|
|
|
{echo "aha";
|
|
|
|
delete_pm(ANONYMOUS, $close_report_posts, PRIVMSGS_INBOX);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2007-04-15 21:40:25 +00:00
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
$sql = 'UPDATE ' . POSTS_TABLE . '
|
|
|
|
SET post_reported = 0
|
|
|
|
WHERE ' . $db->sql_in_set('post_id', $close_report_posts);
|
2007-04-15 21:40:25 +00:00
|
|
|
$db->sql_query($sql);
|
2009-07-21 20:59:11 +00:00
|
|
|
|
|
|
|
if (sizeof($close_report_topics))
|
|
|
|
{
|
|
|
|
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
|
|
|
SET topic_reported = 0
|
|
|
|
WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . '
|
|
|
|
OR ' . $db->sql_in_set('topic_moved_id', $close_report_topics);
|
|
|
|
$db->sql_query($sql);
|
|
|
|
}
|
2007-04-15 21:40:25 +00:00
|
|
|
}
|
2006-07-27 19:02:47 +00:00
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
|
|
|
|
$db->sql_transaction('commit');
|
2006-03-04 13:50:52 +00:00
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
unset($close_report_posts, $close_report_topics);
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2007-05-06 23:07:36 +00:00
|
|
|
foreach ($reports as $report)
|
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
if ($pm)
|
|
|
|
{
|
|
|
|
add_log('mod', 0, 0, 'LOG_PM_REPORT_' . strtoupper($action) . 'D', $post_info[$report['pm_id']]['message_subject']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' . strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']);
|
|
|
|
}
|
2007-05-06 23:07:36 +00:00
|
|
|
}
|
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
$messenger = new messenger();
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
// Notify reporters
|
|
|
|
if (sizeof($notify_reporters))
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2007-04-15 21:40:25 +00:00
|
|
|
foreach ($notify_reporters as $report_id => $reporter)
|
2006-03-04 13:50:52 +00:00
|
|
|
{
|
2006-03-18 10:54:14 +00:00
|
|
|
if ($reporter['user_id'] == ANONYMOUS)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2009-07-21 20:59:11 +00:00
|
|
|
$post_id = $reporter[$id_column];
|
2007-04-15 21:40:25 +00:00
|
|
|
|
2009-07-21 20:59:11 +00:00
|
|
|
$messenger->template((($pm) ? 'pm_report_' : 'report_') . $action . 'd', $reporter['user_lang']);
|
2006-03-18 10:54:14 +00:00
|
|
|
|
|
|
|
$messenger->to($reporter['user_email'], $reporter['username']);
|
|
|
|
$messenger->im($reporter['user_jabber'], $reporter['username']);
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2009-07-21 20:59:11 +00:00
|
|
|
if ($pm)
|
|
|
|
{
|
|
|
|
$messenger->assign_vars(array(
|
|
|
|
'USERNAME' => htmlspecialchars_decode($reporter['username']),
|
|
|
|
'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']),
|
|
|
|
'PM_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['message_subject'])),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$messenger->assign_vars(array(
|
|
|
|
'USERNAME' => htmlspecialchars_decode($reporter['username']),
|
|
|
|
'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']),
|
|
|
|
'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['post_subject'])),
|
|
|
|
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_info[$post_id]['topic_title'])))
|
|
|
|
);
|
|
|
|
}
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
$messenger->send($reporter['user_notify_type']);
|
2006-03-04 13:50:52 +00:00
|
|
|
}
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
2007-07-02 14:05:21 +00:00
|
|
|
|
2009-07-21 20:59:11 +00:00
|
|
|
if (!$pm)
|
2007-07-02 14:05:21 +00:00
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
foreach ($post_info as $post)
|
|
|
|
{
|
|
|
|
$forum_ids[$post['forum_id']] = $post['forum_id'];
|
|
|
|
$topic_ids[$post['topic_id']] = $post['topic_id'];
|
|
|
|
}
|
2007-07-02 14:05:21 +00:00
|
|
|
}
|
2009-07-21 20:59:11 +00:00
|
|
|
|
2007-04-15 21:40:25 +00:00
|
|
|
unset($notify_reporters, $post_info, $reports);
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2006-11-26 14:55:18 +00:00
|
|
|
$messenger->save_queue();
|
|
|
|
|
2009-07-21 20:59:11 +00:00
|
|
|
$success_msg = (sizeof($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS';
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields);
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2006-05-18 21:03:56 +00:00
|
|
|
$redirect = request_var('redirect', "index.$phpEx");
|
|
|
|
$redirect = reapply_sid($redirect);
|
2006-03-04 13:50:52 +00:00
|
|
|
|
2006-03-18 10:54:14 +00:00
|
|
|
if (!$success_msg)
|
|
|
|
{
|
|
|
|
redirect($redirect);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-27 18:45:18 +00:00
|
|
|
meta_refresh(3, $redirect);
|
2009-07-21 20:59:11 +00:00
|
|
|
|
2007-07-02 14:05:21 +00:00
|
|
|
$return_forum = '';
|
|
|
|
$return_topic = '';
|
2009-07-21 20:59:11 +00:00
|
|
|
|
|
|
|
if (!$pm)
|
2007-07-02 14:05:21 +00:00
|
|
|
{
|
2009-07-21 20:59:11 +00:00
|
|
|
if (sizeof($forum_ids) === 1)
|
|
|
|
{
|
|
|
|
$return_forum = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sizeof($topic_ids) === 1)
|
|
|
|
{
|
|
|
|
$return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . current($topic_ids) . '&f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
|
|
|
|
}
|
2007-07-02 14:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
|
2006-03-18 10:54:14 +00:00
|
|
|
}
|
|
|
|
}
|
2006-03-04 13:50:52 +00:00
|
|
|
|
|
|
|
?>
|