|
indvdum@0
|
1 |
<?php
|
|
indvdum@0
|
2 |
/**
|
|
indvdum@0
|
3 |
*
|
|
indvdum@0
|
4 |
* @package mcp
|
|
indvdum@0
|
5 |
* @version $Id$
|
|
indvdum@0
|
6 |
* @copyright (c) 2005 phpBB Group
|
|
indvdum@0
|
7 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
indvdum@0
|
8 |
*
|
|
indvdum@0
|
9 |
*/
|
|
indvdum@0
|
10 |
|
|
indvdum@0
|
11 |
/**
|
|
indvdum@0
|
12 |
* @ignore
|
|
indvdum@0
|
13 |
*/
|
|
indvdum@0
|
14 |
if (!defined('IN_PHPBB'))
|
|
indvdum@0
|
15 |
{
|
|
indvdum@0
|
16 |
exit;
|
|
indvdum@0
|
17 |
}
|
|
indvdum@0
|
18 |
|
|
indvdum@0
|
19 |
/**
|
|
indvdum@0
|
20 |
* mcp_reports
|
|
indvdum@0
|
21 |
* Handling the reports queue
|
|
indvdum@0
|
22 |
* @package mcp
|
|
indvdum@0
|
23 |
*/
|
|
indvdum@0
|
24 |
class mcp_reports
|
|
indvdum@0
|
25 |
{
|
|
indvdum@0
|
26 |
var $p_master;
|
|
indvdum@0
|
27 |
var $u_action;
|
|
indvdum@0
|
28 |
|
|
indvdum@0
|
29 |
function mcp_reports(&$p_master)
|
|
indvdum@0
|
30 |
{
|
|
indvdum@0
|
31 |
$this->p_master = &$p_master;
|
|
indvdum@0
|
32 |
}
|
|
indvdum@0
|
33 |
|
|
indvdum@0
|
34 |
function main($id, $mode)
|
|
indvdum@0
|
35 |
{
|
|
indvdum@0
|
36 |
global $auth, $db, $user, $template, $cache;
|
|
indvdum@0
|
37 |
global $config, $phpbb_root_path, $phpEx, $action;
|
|
indvdum@0
|
38 |
|
|
indvdum@0
|
39 |
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
|
|
indvdum@0
|
40 |
|
|
indvdum@0
|
41 |
$forum_id = request_var('f', 0);
|
|
indvdum@0
|
42 |
$start = request_var('start', 0);
|
|
indvdum@0
|
43 |
|
|
indvdum@0
|
44 |
$this->page_title = 'MCP_REPORTS';
|
|
indvdum@0
|
45 |
|
|
indvdum@0
|
46 |
switch ($action)
|
|
indvdum@0
|
47 |
{
|
|
indvdum@0
|
48 |
case 'close':
|
|
indvdum@0
|
49 |
case 'delete':
|
|
indvdum@0
|
50 |
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
|
indvdum@0
|
51 |
|
|
indvdum@0
|
52 |
$report_id_list = request_var('report_id_list', array(0));
|
|
indvdum@0
|
53 |
|
|
indvdum@0
|
54 |
if (!sizeof($report_id_list))
|
|
indvdum@0
|
55 |
{
|
|
indvdum@0
|
56 |
trigger_error('NO_REPORT_SELECTED');
|
|
indvdum@0
|
57 |
}
|
|
indvdum@0
|
58 |
|
|
indvdum@0
|
59 |
close_report($report_id_list, $mode, $action);
|
|
indvdum@0
|
60 |
|
|
indvdum@0
|
61 |
break;
|
|
indvdum@0
|
62 |
}
|
|
indvdum@0
|
63 |
|
|
indvdum@0
|
64 |
switch ($mode)
|
|
indvdum@0
|
65 |
{
|
|
indvdum@0
|
66 |
case 'report_details':
|
|
indvdum@0
|
67 |
|
|
indvdum@0
|
68 |
$user->add_lang(array('posting', 'viewforum', 'viewtopic'));
|
|
indvdum@0
|
69 |
|
|
indvdum@0
|
70 |
$post_id = request_var('p', 0);
|
|
indvdum@0
|
71 |
|
|
indvdum@0
|
72 |
// closed reports are accessed by report id
|
|
indvdum@0
|
73 |
$report_id = request_var('r', 0);
|
|
indvdum@0
|
74 |
|
|
indvdum@0
|
75 |
$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
|
|
indvdum@0
|
76 |
FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
|
|
indvdum@0
|
77 |
WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
|
|
indvdum@0
|
78 |
AND rr.reason_id = r.reason_id
|
|
indvdum@0
|
79 |
AND r.user_id = u.user_id
|
|
indvdum@0
|
80 |
AND r.pm_id = 0
|
|
indvdum@0
|
81 |
ORDER BY report_closed ASC';
|
|
indvdum@0
|
82 |
$result = $db->sql_query_limit($sql, 1);
|
|
indvdum@0
|
83 |
$report = $db->sql_fetchrow($result);
|
|
indvdum@0
|
84 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
85 |
|
|
indvdum@0
|
86 |
if (!$report)
|
|
indvdum@0
|
87 |
{
|
|
indvdum@0
|
88 |
trigger_error('NO_REPORT');
|
|
indvdum@0
|
89 |
}
|
|
indvdum@0
|
90 |
|
|
indvdum@0
|
91 |
if (!$report_id && $report['report_closed'])
|
|
indvdum@0
|
92 |
{
|
|
indvdum@0
|
93 |
trigger_error('REPORT_CLOSED');
|
|
indvdum@0
|
94 |
}
|
|
indvdum@0
|
95 |
|
|
indvdum@0
|
96 |
$post_id = $report['post_id'];
|
|
indvdum@0
|
97 |
$report_id = $report['report_id'];
|
|
indvdum@0
|
98 |
|
|
indvdum@0
|
99 |
$post_info = get_post_data(array($post_id), 'm_report', true);
|
|
indvdum@0
|
100 |
|
|
indvdum@0
|
101 |
if (!sizeof($post_info))
|
|
indvdum@0
|
102 |
{
|
|
indvdum@0
|
103 |
trigger_error('NO_REPORT_SELECTED');
|
|
indvdum@0
|
104 |
}
|
|
indvdum@0
|
105 |
|
|
indvdum@0
|
106 |
$post_info = $post_info[$post_id];
|
|
indvdum@0
|
107 |
|
|
indvdum@0
|
108 |
$reason = array('title' => $report['reason_title'], 'description' => $report['reason_description']);
|
|
indvdum@0
|
109 |
if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])]))
|
|
indvdum@0
|
110 |
{
|
|
indvdum@0
|
111 |
$reason['description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])];
|
|
indvdum@0
|
112 |
$reason['title'] = $user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])];
|
|
indvdum@0
|
113 |
}
|
|
indvdum@0
|
114 |
|
|
indvdum@0
|
115 |
if (topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false))
|
|
indvdum@0
|
116 |
{
|
|
indvdum@0
|
117 |
$template->assign_vars(array(
|
|
indvdum@0
|
118 |
'S_TOPIC_REVIEW' => true,
|
|
indvdum@0
|
119 |
'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'],
|
|
indvdum@0
|
120 |
'TOPIC_TITLE' => $post_info['topic_title'])
|
|
indvdum@0
|
121 |
);
|
|
indvdum@0
|
122 |
}
|
|
indvdum@0
|
123 |
|
|
indvdum@0
|
124 |
$topic_tracking_info = $extensions = $attachments = array();
|
|
indvdum@0
|
125 |
// Get topic tracking info
|
|
indvdum@0
|
126 |
if ($config['load_db_lastread'])
|
|
indvdum@0
|
127 |
{
|
|
indvdum@0
|
128 |
$tmp_topic_data = array($post_info['topic_id'] => $post_info);
|
|
indvdum@0
|
129 |
$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']));
|
|
indvdum@0
|
130 |
unset($tmp_topic_data);
|
|
indvdum@0
|
131 |
}
|
|
indvdum@0
|
132 |
else
|
|
indvdum@0
|
133 |
{
|
|
indvdum@0
|
134 |
$topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
|
|
indvdum@0
|
135 |
}
|
|
indvdum@0
|
136 |
|
|
indvdum@0
|
137 |
$post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false;
|
|
indvdum@0
|
138 |
|
|
indvdum@0
|
139 |
// Process message, leave it uncensored
|
|
indvdum@0
|
140 |
$message = $post_info['post_text'];
|
|
indvdum@0
|
141 |
|
|
indvdum@0
|
142 |
if ($post_info['bbcode_bitfield'])
|
|
indvdum@0
|
143 |
{
|
|
indvdum@0
|
144 |
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
|
|
indvdum@0
|
145 |
$bbcode = new bbcode($post_info['bbcode_bitfield']);
|
|
indvdum@0
|
146 |
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
|
|
indvdum@0
|
147 |
}
|
|
indvdum@0
|
148 |
|
|
indvdum@0
|
149 |
$message = bbcode_nl2br($message);
|
|
indvdum@0
|
150 |
$message = smiley_text($message);
|
|
indvdum@0
|
151 |
$report['report_text'] = make_clickable(bbcode_nl2br($report['report_text']));
|
|
indvdum@0
|
152 |
|
|
indvdum@0
|
153 |
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
|
|
indvdum@0
|
154 |
{
|
|
indvdum@0
|
155 |
$sql = 'SELECT *
|
|
indvdum@0
|
156 |
FROM ' . ATTACHMENTS_TABLE . '
|
|
indvdum@0
|
157 |
WHERE post_msg_id = ' . $post_id . '
|
|
indvdum@0
|
158 |
AND in_message = 0
|
|
indvdum@0
|
159 |
ORDER BY filetime DESC';
|
|
indvdum@0
|
160 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
161 |
|
|
indvdum@0
|
162 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
163 |
{
|
|
indvdum@0
|
164 |
$attachments[] = $row;
|
|
indvdum@0
|
165 |
}
|
|
indvdum@0
|
166 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
167 |
|
|
indvdum@0
|
168 |
if (sizeof($attachments))
|
|
indvdum@0
|
169 |
{
|
|
indvdum@0
|
170 |
$update_count = array();
|
|
indvdum@0
|
171 |
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
|
|
indvdum@0
|
172 |
}
|
|
indvdum@0
|
173 |
|
|
indvdum@0
|
174 |
// Display not already displayed Attachments for this post, we already parsed them. ;)
|
|
indvdum@0
|
175 |
if (!empty($attachments))
|
|
indvdum@0
|
176 |
{
|
|
indvdum@0
|
177 |
$template->assign_var('S_HAS_ATTACHMENTS', true);
|
|
indvdum@0
|
178 |
|
|
indvdum@0
|
179 |
foreach ($attachments as $attachment)
|
|
indvdum@0
|
180 |
{
|
|
indvdum@0
|
181 |
$template->assign_block_vars('attachment', array(
|
|
indvdum@0
|
182 |
'DISPLAY_ATTACHMENT' => $attachment)
|
|
indvdum@0
|
183 |
);
|
|
indvdum@0
|
184 |
}
|
|
indvdum@0
|
185 |
}
|
|
indvdum@0
|
186 |
}
|
|
indvdum@0
|
187 |
|
|
indvdum@0
|
188 |
$template->assign_vars(array(
|
|
indvdum@0
|
189 |
'S_MCP_REPORT' => true,
|
|
indvdum@0
|
190 |
'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),
|
|
indvdum@0
|
191 |
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
|
|
indvdum@0
|
192 |
'S_POST_REPORTED' => $post_info['post_reported'],
|
|
indvdum@0
|
193 |
'S_POST_UNAPPROVED' => !$post_info['post_approved'],
|
|
indvdum@0
|
194 |
'S_POST_LOCKED' => $post_info['post_edit_locked'],
|
|
indvdum@0
|
195 |
'S_USER_NOTES' => true,
|
|
indvdum@0
|
196 |
|
|
indvdum@0
|
197 |
'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']}") : '',
|
|
indvdum@0
|
198 |
'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),
|
|
indvdum@0
|
199 |
'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),
|
|
indvdum@0
|
200 |
'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $report['user_id']),
|
|
indvdum@0
|
201 |
'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']),
|
|
indvdum@0
|
202 |
'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']) : '',
|
|
indvdum@0
|
203 |
'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']) : '',
|
|
indvdum@0
|
204 |
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $post_info['forum_id']),
|
|
indvdum@0
|
205 |
'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']),
|
|
indvdum@0
|
206 |
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']),
|
|
indvdum@0
|
207 |
|
|
indvdum@0
|
208 |
'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
|
|
indvdum@0
|
209 |
'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'),
|
|
indvdum@0
|
210 |
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
|
|
indvdum@0
|
211 |
|
|
indvdum@0
|
212 |
'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>'),
|
|
indvdum@0
|
213 |
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
|
|
indvdum@0
|
214 |
'REPORT_DATE' => $user->format_date($report['report_time']),
|
|
indvdum@0
|
215 |
'REPORT_ID' => $report_id,
|
|
indvdum@0
|
216 |
'REPORT_REASON_TITLE' => $reason['title'],
|
|
indvdum@0
|
217 |
'REPORT_REASON_DESCRIPTION' => $reason['description'],
|
|
indvdum@0
|
218 |
'REPORT_TEXT' => $report['report_text'],
|
|
indvdum@0
|
219 |
|
|
indvdum@0
|
220 |
'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
indvdum@0
|
221 |
'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
indvdum@0
|
222 |
'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
indvdum@0
|
223 |
'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
indvdum@0
|
224 |
|
|
indvdum@0
|
225 |
'REPORTER_FULL' => get_username_string('full', $report['user_id'], $report['username'], $report['user_colour']),
|
|
indvdum@0
|
226 |
'REPORTER_COLOUR' => get_username_string('colour', $report['user_id'], $report['username'], $report['user_colour']),
|
|
indvdum@0
|
227 |
'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']),
|
|
indvdum@0
|
228 |
'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']),
|
|
indvdum@0
|
229 |
|
|
indvdum@0
|
230 |
'POST_PREVIEW' => $message,
|
|
indvdum@0
|
231 |
'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'],
|
|
indvdum@0
|
232 |
'POST_DATE' => $user->format_date($post_info['post_time']),
|
|
indvdum@0
|
233 |
'POST_IP' => $post_info['poster_ip'],
|
|
indvdum@0
|
234 |
'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
|
|
indvdum@0
|
235 |
'POST_ID' => $post_info['post_id'],
|
|
indvdum@0
|
236 |
|
|
indvdum@0
|
237 |
'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' : '',
|
|
indvdum@0
|
238 |
));
|
|
indvdum@0
|
239 |
|
|
indvdum@0
|
240 |
$this->tpl_name = 'mcp_post';
|
|
indvdum@0
|
241 |
|
|
indvdum@0
|
242 |
break;
|
|
indvdum@0
|
243 |
|
|
indvdum@0
|
244 |
case 'reports':
|
|
indvdum@0
|
245 |
case 'reports_closed':
|
|
indvdum@0
|
246 |
$topic_id = request_var('t', 0);
|
|
indvdum@0
|
247 |
|
|
indvdum@0
|
248 |
$forum_info = array();
|
|
indvdum@0
|
249 |
$forum_list_reports = get_forum_list('m_report', false, true);
|
|
indvdum@0
|
250 |
$forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs
|
|
indvdum@0
|
251 |
|
|
indvdum@0
|
252 |
// Remove forums we cannot read
|
|
indvdum@0
|
253 |
foreach ($forum_list_reports as $k => $forum_data)
|
|
indvdum@0
|
254 |
{
|
|
indvdum@0
|
255 |
if (!isset($forum_list_read[$forum_data['forum_id']]))
|
|
indvdum@0
|
256 |
{
|
|
indvdum@0
|
257 |
unset($forum_list_reports[$k]);
|
|
indvdum@0
|
258 |
}
|
|
indvdum@0
|
259 |
}
|
|
indvdum@0
|
260 |
unset($forum_list_read);
|
|
indvdum@0
|
261 |
|
|
indvdum@0
|
262 |
if ($topic_id)
|
|
indvdum@0
|
263 |
{
|
|
indvdum@0
|
264 |
$topic_info = get_topic_data(array($topic_id));
|
|
indvdum@0
|
265 |
|
|
indvdum@0
|
266 |
if (!sizeof($topic_info))
|
|
indvdum@0
|
267 |
{
|
|
indvdum@0
|
268 |
trigger_error('TOPIC_NOT_EXIST');
|
|
indvdum@0
|
269 |
}
|
|
indvdum@0
|
270 |
|
|
indvdum@0
|
271 |
if ($forum_id != $topic_info[$topic_id]['forum_id'])
|
|
indvdum@0
|
272 |
{
|
|
indvdum@0
|
273 |
$topic_id = 0;
|
|
indvdum@0
|
274 |
}
|
|
indvdum@0
|
275 |
else
|
|
indvdum@0
|
276 |
{
|
|
indvdum@0
|
277 |
$topic_info = $topic_info[$topic_id];
|
|
indvdum@0
|
278 |
$forum_id = (int) $topic_info['forum_id'];
|
|
indvdum@0
|
279 |
}
|
|
indvdum@0
|
280 |
}
|
|
indvdum@0
|
281 |
|
|
indvdum@0
|
282 |
$forum_list = array();
|
|
indvdum@0
|
283 |
|
|
indvdum@0
|
284 |
if (!$forum_id)
|
|
indvdum@0
|
285 |
{
|
|
indvdum@0
|
286 |
foreach ($forum_list_reports as $row)
|
|
indvdum@0
|
287 |
{
|
|
indvdum@0
|
288 |
$forum_list[] = $row['forum_id'];
|
|
indvdum@0
|
289 |
}
|
|
indvdum@0
|
290 |
|
|
indvdum@0
|
291 |
if (!sizeof($forum_list))
|
|
indvdum@0
|
292 |
{
|
|
indvdum@0
|
293 |
trigger_error('NOT_MODERATOR');
|
|
indvdum@0
|
294 |
}
|
|
indvdum@0
|
295 |
|
|
indvdum@0
|
296 |
$global_id = $forum_list[0];
|
|
indvdum@0
|
297 |
|
|
indvdum@0
|
298 |
$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
|
|
indvdum@0
|
299 |
FROM ' . FORUMS_TABLE . '
|
|
indvdum@0
|
300 |
WHERE ' . $db->sql_in_set('forum_id', $forum_list);
|
|
indvdum@0
|
301 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
302 |
$forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
|
|
indvdum@0
|
303 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
304 |
}
|
|
indvdum@0
|
305 |
else
|
|
indvdum@0
|
306 |
{
|
|
indvdum@0
|
307 |
$forum_info = get_forum_data(array($forum_id), 'm_report');
|
|
indvdum@0
|
308 |
|
|
indvdum@0
|
309 |
if (!sizeof($forum_info))
|
|
indvdum@0
|
310 |
{
|
|
indvdum@0
|
311 |
trigger_error('NOT_MODERATOR');
|
|
indvdum@0
|
312 |
}
|
|
indvdum@0
|
313 |
|
|
indvdum@0
|
314 |
$forum_info = $forum_info[$forum_id];
|
|
indvdum@0
|
315 |
$forum_list = array($forum_id);
|
|
indvdum@0
|
316 |
$global_id = $forum_id;
|
|
indvdum@0
|
317 |
}
|
|
indvdum@0
|
318 |
|
|
indvdum@0
|
319 |
$forum_list[] = 0;
|
|
indvdum@0
|
320 |
$forum_data = array();
|
|
indvdum@0
|
321 |
|
|
indvdum@0
|
322 |
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
|
|
indvdum@0
|
323 |
foreach ($forum_list_reports as $row)
|
|
indvdum@0
|
324 |
{
|
|
indvdum@0
|
325 |
$forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat(' ', $row['padding']) . $row['forum_name'] . '</option>';
|
|
indvdum@0
|
326 |
$forum_data[$row['forum_id']] = $row;
|
|
indvdum@0
|
327 |
}
|
|
indvdum@0
|
328 |
unset($forum_list_reports);
|
|
indvdum@0
|
329 |
|
|
indvdum@0
|
330 |
$sort_days = $total = 0;
|
|
indvdum@0
|
331 |
$sort_key = $sort_dir = '';
|
|
indvdum@0
|
332 |
$sort_by_sql = $sort_order_sql = array();
|
|
indvdum@0
|
333 |
mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
|
|
indvdum@0
|
334 |
|
|
indvdum@0
|
335 |
$forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
|
|
indvdum@0
|
336 |
$limit_time_sql = ($sort_days) ? 'AND r.report_time >= ' . (time() - ($sort_days * 86400)) : '';
|
|
indvdum@0
|
337 |
|
|
indvdum@0
|
338 |
if ($mode == 'reports')
|
|
indvdum@0
|
339 |
{
|
|
indvdum@0
|
340 |
$report_state = 'AND p.post_reported = 1 AND r.report_closed = 0';
|
|
indvdum@0
|
341 |
}
|
|
indvdum@0
|
342 |
else
|
|
indvdum@0
|
343 |
{
|
|
indvdum@0
|
344 |
$report_state = 'AND r.report_closed = 1';
|
|
indvdum@0
|
345 |
}
|
|
indvdum@0
|
346 |
|
|
indvdum@0
|
347 |
$sql = 'SELECT r.report_id
|
|
indvdum@0
|
348 |
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' : '') . '
|
|
indvdum@0
|
349 |
WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . "
|
|
indvdum@0
|
350 |
$report_state
|
|
indvdum@0
|
351 |
AND r.post_id = p.post_id
|
|
indvdum@0
|
352 |
" . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
|
|
indvdum@0
|
353 |
' . (($sort_order_sql[0] == 'r') ? 'AND ru.user_id = r.user_id' : '') . '
|
|
indvdum@0
|
354 |
' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
|
|
indvdum@0
|
355 |
AND t.topic_id = p.topic_id
|
|
indvdum@0
|
356 |
AND r.pm_id = 0
|
|
indvdum@0
|
357 |
$limit_time_sql
|
|
indvdum@0
|
358 |
ORDER BY $sort_order_sql";
|
|
indvdum@0
|
359 |
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
|
indvdum@0
|
360 |
|
|
indvdum@0
|
361 |
$i = 0;
|
|
indvdum@0
|
362 |
$report_ids = array();
|
|
indvdum@0
|
363 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
364 |
{
|
|
indvdum@0
|
365 |
$report_ids[] = $row['report_id'];
|
|
indvdum@0
|
366 |
$row_num[$row['report_id']] = $i++;
|
|
indvdum@0
|
367 |
}
|
|
indvdum@0
|
368 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
369 |
|
|
indvdum@0
|
370 |
if (sizeof($report_ids))
|
|
indvdum@0
|
371 |
{
|
|
indvdum@0
|
372 |
$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
|
|
indvdum@0
|
373 |
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru
|
|
indvdum@0
|
374 |
WHERE ' . $db->sql_in_set('r.report_id', $report_ids) . '
|
|
indvdum@0
|
375 |
AND t.topic_id = p.topic_id
|
|
indvdum@0
|
376 |
AND r.post_id = p.post_id
|
|
indvdum@0
|
377 |
AND u.user_id = p.poster_id
|
|
indvdum@0
|
378 |
AND ru.user_id = r.user_id
|
|
indvdum@0
|
379 |
AND r.pm_id = 0
|
|
indvdum@0
|
380 |
ORDER BY ' . $sort_order_sql;
|
|
indvdum@0
|
381 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
382 |
|
|
indvdum@0
|
383 |
$report_data = $rowset = array();
|
|
indvdum@0
|
384 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
385 |
{
|
|
indvdum@0
|
386 |
$global_topic = ($row['forum_id']) ? false : true;
|
|
indvdum@0
|
387 |
if ($global_topic)
|
|
indvdum@0
|
388 |
{
|
|
indvdum@0
|
389 |
$row['forum_id'] = $global_id;
|
|
indvdum@0
|
390 |
}
|
|
indvdum@0
|
391 |
|
|
indvdum@0
|
392 |
$template->assign_block_vars('postrow', array(
|
|
indvdum@0
|
393 |
'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
|
|
indvdum@0
|
394 |
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'],
|
|
indvdum@0
|
395 |
'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']}"),
|
|
indvdum@0
|
396 |
|
|
indvdum@0
|
397 |
'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
indvdum@0
|
398 |
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
indvdum@0
|
399 |
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
indvdum@0
|
400 |
'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
indvdum@0
|
401 |
|
|
indvdum@0
|
402 |
'REPORTER_FULL' => get_username_string('full', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
|
indvdum@0
|
403 |
'REPORTER_COLOUR' => get_username_string('colour', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
|
indvdum@0
|
404 |
'REPORTER' => get_username_string('username', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
|
indvdum@0
|
405 |
'U_REPORTER' => get_username_string('profile', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
|
|
indvdum@0
|
406 |
|
|
indvdum@0
|
407 |
'FORUM_NAME' => (!$global_topic) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'],
|
|
indvdum@0
|
408 |
'POST_ID' => $row['post_id'],
|
|
indvdum@0
|
409 |
'POST_SUBJECT' => ($row['post_subject']) ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
|
|
indvdum@0
|
410 |
'POST_TIME' => $user->format_date($row['post_time']),
|
|
indvdum@0
|
411 |
'REPORT_ID' => $row['report_id'],
|
|
indvdum@0
|
412 |
'REPORT_TIME' => $user->format_date($row['report_time']),
|
|
indvdum@0
|
413 |
'TOPIC_TITLE' => $row['topic_title'])
|
|
indvdum@0
|
414 |
);
|
|
indvdum@0
|
415 |
}
|
|
indvdum@0
|
416 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
417 |
unset($report_ids, $row);
|
|
indvdum@0
|
418 |
}
|
|
indvdum@0
|
419 |
|
|
indvdum@0
|
420 |
// Now display the page
|
|
indvdum@0
|
421 |
$template->assign_vars(array(
|
|
indvdum@0
|
422 |
'L_EXPLAIN' => ($mode == 'reports') ? $user->lang['MCP_REPORTS_OPEN_EXPLAIN'] : $user->lang['MCP_REPORTS_CLOSED_EXPLAIN'],
|
|
indvdum@0
|
423 |
'L_TITLE' => ($mode == 'reports') ? $user->lang['MCP_REPORTS_OPEN'] : $user->lang['MCP_REPORTS_CLOSED'],
|
|
indvdum@0
|
424 |
'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '',
|
|
indvdum@0
|
425 |
|
|
indvdum@0
|
426 |
'S_MCP_ACTION' => $this->u_action,
|
|
indvdum@0
|
427 |
'S_FORUM_OPTIONS' => $forum_options,
|
|
indvdum@0
|
428 |
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
|
|
indvdum@0
|
429 |
|
|
indvdum@0
|
430 |
'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),
|
|
indvdum@0
|
431 |
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
|
|
indvdum@0
|
432 |
'TOPIC_ID' => $topic_id,
|
|
indvdum@0
|
433 |
'TOTAL' => $total,
|
|
indvdum@0
|
434 |
'TOTAL_REPORTS' => ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total),
|
|
indvdum@0
|
435 |
)
|
|
indvdum@0
|
436 |
);
|
|
indvdum@0
|
437 |
|
|
indvdum@0
|
438 |
$this->tpl_name = 'mcp_reports';
|
|
indvdum@0
|
439 |
break;
|
|
indvdum@0
|
440 |
}
|
|
indvdum@0
|
441 |
}
|
|
indvdum@0
|
442 |
}
|
|
indvdum@0
|
443 |
|
|
indvdum@0
|
444 |
/**
|
|
indvdum@0
|
445 |
* Closes a report
|
|
indvdum@0
|
446 |
*/
|
|
indvdum@0
|
447 |
function close_report($report_id_list, $mode, $action, $pm = false)
|
|
indvdum@0
|
448 |
{
|
|
indvdum@0
|
449 |
global $db, $template, $user, $config, $auth;
|
|
indvdum@0
|
450 |
global $phpEx, $phpbb_root_path;
|
|
indvdum@0
|
451 |
|
|
indvdum@0
|
452 |
$pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 ';
|
|
indvdum@0
|
453 |
$id_column = ($pm) ? 'pm_id' : 'post_id';
|
|
indvdum@0
|
454 |
$module = ($pm) ? 'pm_reports' : 'reports';
|
|
indvdum@0
|
455 |
$pm_prefix = ($pm) ? 'PM_' : '';
|
|
indvdum@0
|
456 |
|
|
indvdum@0
|
457 |
$sql = "SELECT r.$id_column
|
|
indvdum@0
|
458 |
FROM " . REPORTS_TABLE . ' r
|
|
indvdum@0
|
459 |
WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . $pm_where;
|
|
indvdum@0
|
460 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
461 |
|
|
indvdum@0
|
462 |
$post_id_list = array();
|
|
indvdum@0
|
463 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
464 |
{
|
|
indvdum@0
|
465 |
$post_id_list[] = $row[$id_column];
|
|
indvdum@0
|
466 |
}
|
|
indvdum@0
|
467 |
$post_id_list = array_unique($post_id_list);
|
|
indvdum@0
|
468 |
|
|
indvdum@0
|
469 |
if ($pm)
|
|
indvdum@0
|
470 |
{
|
|
indvdum@0
|
471 |
if (!$auth->acl_getf_global('m_report'))
|
|
indvdum@0
|
472 |
{
|
|
indvdum@0
|
473 |
trigger_error('NOT_AUTHORISED');
|
|
indvdum@0
|
474 |
}
|
|
indvdum@0
|
475 |
}
|
|
indvdum@0
|
476 |
else
|
|
indvdum@0
|
477 |
{
|
|
indvdum@0
|
478 |
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report')))
|
|
indvdum@0
|
479 |
{
|
|
indvdum@0
|
480 |
trigger_error('NOT_AUTHORISED');
|
|
indvdum@0
|
481 |
}
|
|
indvdum@0
|
482 |
}
|
|
indvdum@0
|
483 |
|
|
indvdum@0
|
484 |
if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false)
|
|
indvdum@0
|
485 |
{
|
|
indvdum@0
|
486 |
$redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=reports');
|
|
indvdum@0
|
487 |
}
|
|
indvdum@0
|
488 |
elseif ($action == 'delete' && strpos($user->data['session_page'], 'mode=pm_report_details') !== false)
|
|
indvdum@0
|
489 |
{
|
|
indvdum@0
|
490 |
$redirect = request_var('redirect', build_url(array('mode', 'r', 'quickmod')) . '&mode=pm_reports');
|
|
indvdum@0
|
491 |
}
|
|
indvdum@0
|
492 |
else if ($action == 'close' && !request_var('r', 0))
|
|
indvdum@0
|
493 |
{
|
|
indvdum@0
|
494 |
$redirect = request_var('redirect', build_url(array('mode', 'p', 'quickmod')) . '&mode=' . $module);
|
|
indvdum@0
|
495 |
}
|
|
indvdum@0
|
496 |
else
|
|
indvdum@0
|
497 |
{
|
|
indvdum@0
|
498 |
$redirect = request_var('redirect', build_url(array('quickmod')));
|
|
indvdum@0
|
499 |
}
|
|
indvdum@0
|
500 |
$success_msg = '';
|
|
indvdum@0
|
501 |
$forum_ids = array();
|
|
indvdum@0
|
502 |
$topic_ids = array();
|
|
indvdum@0
|
503 |
|
|
indvdum@0
|
504 |
$s_hidden_fields = build_hidden_fields(array(
|
|
indvdum@0
|
505 |
'i' => $module,
|
|
indvdum@0
|
506 |
'mode' => $mode,
|
|
indvdum@0
|
507 |
'report_id_list' => $report_id_list,
|
|
indvdum@0
|
508 |
'action' => $action,
|
|
indvdum@0
|
509 |
'redirect' => $redirect)
|
|
indvdum@0
|
510 |
);
|
|
indvdum@0
|
511 |
|
|
indvdum@0
|
512 |
if (confirm_box(true))
|
|
indvdum@0
|
513 |
{
|
|
indvdum@0
|
514 |
$post_info = ($pm) ? get_pm_data($post_id_list) : get_post_data($post_id_list, 'm_report');
|
|
indvdum@0
|
515 |
|
|
indvdum@0
|
516 |
$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
|
|
indvdum@0
|
517 |
FROM " . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u
|
|
indvdum@0
|
518 |
WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . '
|
|
indvdum@0
|
519 |
' . (($action == 'close') ? 'AND r.report_closed = 0' : '') . '
|
|
indvdum@0
|
520 |
AND r.user_id = u.user_id' . $pm_where;
|
|
indvdum@0
|
521 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
522 |
|
|
indvdum@0
|
523 |
$reports = $close_report_posts = $close_report_topics = $notify_reporters = $report_id_list = array();
|
|
indvdum@0
|
524 |
while ($report = $db->sql_fetchrow($result))
|
|
indvdum@0
|
525 |
{
|
|
indvdum@0
|
526 |
$reports[$report['report_id']] = $report;
|
|
indvdum@0
|
527 |
$report_id_list[] = $report['report_id'];
|
|
indvdum@0
|
528 |
|
|
indvdum@0
|
529 |
if (!$report['report_closed'])
|
|
indvdum@0
|
530 |
{
|
|
indvdum@0
|
531 |
$close_report_posts[] = $report[$id_column];
|
|
indvdum@0
|
532 |
|
|
indvdum@0
|
533 |
if (!$pm)
|
|
indvdum@0
|
534 |
{
|
|
indvdum@0
|
535 |
$close_report_topics[] = $post_info[$report['post_id']]['topic_id'];
|
|
indvdum@0
|
536 |
}
|
|
indvdum@0
|
537 |
}
|
|
indvdum@0
|
538 |
|
|
indvdum@0
|
539 |
if ($report['user_notify'] && !$report['report_closed'])
|
|
indvdum@0
|
540 |
{
|
|
indvdum@0
|
541 |
$notify_reporters[$report['report_id']] = &$reports[$report['report_id']];
|
|
indvdum@0
|
542 |
}
|
|
indvdum@0
|
543 |
}
|
|
indvdum@0
|
544 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
545 |
|
|
indvdum@0
|
546 |
if (sizeof($reports))
|
|
indvdum@0
|
547 |
{
|
|
indvdum@0
|
548 |
$close_report_posts = array_unique($close_report_posts);
|
|
indvdum@0
|
549 |
$close_report_topics = array_unique($close_report_topics);
|
|
indvdum@0
|
550 |
|
|
indvdum@0
|
551 |
if (!$pm && sizeof($close_report_posts))
|
|
indvdum@0
|
552 |
{
|
|
indvdum@0
|
553 |
// Get a list of topics that still contain reported posts
|
|
indvdum@0
|
554 |
$sql = 'SELECT DISTINCT topic_id
|
|
indvdum@0
|
555 |
FROM ' . POSTS_TABLE . '
|
|
indvdum@0
|
556 |
WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . '
|
|
indvdum@0
|
557 |
AND post_reported = 1
|
|
indvdum@0
|
558 |
AND ' . $db->sql_in_set('post_id', $close_report_posts, true);
|
|
indvdum@0
|
559 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
560 |
|
|
indvdum@0
|
561 |
$keep_report_topics = array();
|
|
indvdum@0
|
562 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
563 |
{
|
|
indvdum@0
|
564 |
$keep_report_topics[] = $row['topic_id'];
|
|
indvdum@0
|
565 |
}
|
|
indvdum@0
|
566 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
567 |
|
|
indvdum@0
|
568 |
$close_report_topics = array_diff($close_report_topics, $keep_report_topics);
|
|
indvdum@0
|
569 |
unset($keep_report_topics);
|
|
indvdum@0
|
570 |
}
|
|
indvdum@0
|
571 |
|
|
indvdum@0
|
572 |
$db->sql_transaction('begin');
|
|
indvdum@0
|
573 |
|
|
indvdum@0
|
574 |
if ($action == 'close')
|
|
indvdum@0
|
575 |
{
|
|
indvdum@0
|
576 |
$sql = 'UPDATE ' . REPORTS_TABLE . '
|
|
indvdum@0
|
577 |
SET report_closed = 1
|
|
indvdum@0
|
578 |
WHERE ' . $db->sql_in_set('report_id', $report_id_list);
|
|
indvdum@0
|
579 |
}
|
|
indvdum@0
|
580 |
else
|
|
indvdum@0
|
581 |
{
|
|
indvdum@0
|
582 |
$sql = 'DELETE FROM ' . REPORTS_TABLE . '
|
|
indvdum@0
|
583 |
WHERE ' . $db->sql_in_set('report_id', $report_id_list);
|
|
indvdum@0
|
584 |
}
|
|
indvdum@0
|
585 |
$db->sql_query($sql);
|
|
indvdum@0
|
586 |
|
|
indvdum@0
|
587 |
|
|
indvdum@0
|
588 |
if (sizeof($close_report_posts))
|
|
indvdum@0
|
589 |
{
|
|
indvdum@0
|
590 |
if ($pm)
|
|
indvdum@0
|
591 |
{
|
|
indvdum@0
|
592 |
$sql = 'UPDATE ' . PRIVMSGS_TABLE . '
|
|
indvdum@0
|
593 |
SET message_reported = 0
|
|
indvdum@0
|
594 |
WHERE ' . $db->sql_in_set('msg_id', $close_report_posts);
|
|
indvdum@0
|
595 |
$db->sql_query($sql);
|
|
indvdum@0
|
596 |
|
|
indvdum@0
|
597 |
if ($action == 'delete')
|
|
indvdum@0
|
598 |
{
|
|
indvdum@0
|
599 |
delete_pm(ANONYMOUS, $close_report_posts, PRIVMSGS_INBOX);
|
|
indvdum@0
|
600 |
}
|
|
indvdum@0
|
601 |
}
|
|
indvdum@0
|
602 |
else
|
|
indvdum@0
|
603 |
{
|
|
indvdum@0
|
604 |
$sql = 'UPDATE ' . POSTS_TABLE . '
|
|
indvdum@0
|
605 |
SET post_reported = 0
|
|
indvdum@0
|
606 |
WHERE ' . $db->sql_in_set('post_id', $close_report_posts);
|
|
indvdum@0
|
607 |
$db->sql_query($sql);
|
|
indvdum@0
|
608 |
|
|
indvdum@0
|
609 |
if (sizeof($close_report_topics))
|
|
indvdum@0
|
610 |
{
|
|
indvdum@0
|
611 |
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
|
indvdum@0
|
612 |
SET topic_reported = 0
|
|
indvdum@0
|
613 |
WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . '
|
|
indvdum@0
|
614 |
OR ' . $db->sql_in_set('topic_moved_id', $close_report_topics);
|
|
indvdum@0
|
615 |
$db->sql_query($sql);
|
|
indvdum@0
|
616 |
}
|
|
indvdum@0
|
617 |
}
|
|
indvdum@0
|
618 |
}
|
|
indvdum@0
|
619 |
|
|
indvdum@0
|
620 |
$db->sql_transaction('commit');
|
|
indvdum@0
|
621 |
}
|
|
indvdum@0
|
622 |
unset($close_report_posts, $close_report_topics);
|
|
indvdum@0
|
623 |
|
|
indvdum@0
|
624 |
foreach ($reports as $report)
|
|
indvdum@0
|
625 |
{
|
|
indvdum@0
|
626 |
if ($pm)
|
|
indvdum@0
|
627 |
{
|
|
indvdum@0
|
628 |
add_log('mod', 0, 0, 'LOG_PM_REPORT_' . strtoupper($action) . 'D', $post_info[$report['pm_id']]['message_subject']);
|
|
indvdum@0
|
629 |
}
|
|
indvdum@0
|
630 |
else
|
|
indvdum@0
|
631 |
{
|
|
indvdum@0
|
632 |
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']);
|
|
indvdum@0
|
633 |
}
|
|
indvdum@0
|
634 |
}
|
|
indvdum@0
|
635 |
|
|
indvdum@0
|
636 |
$messenger = new messenger();
|
|
indvdum@0
|
637 |
|
|
indvdum@0
|
638 |
// Notify reporters
|
|
indvdum@0
|
639 |
if (sizeof($notify_reporters))
|
|
indvdum@0
|
640 |
{
|
|
indvdum@0
|
641 |
foreach ($notify_reporters as $report_id => $reporter)
|
|
indvdum@0
|
642 |
{
|
|
indvdum@0
|
643 |
if ($reporter['user_id'] == ANONYMOUS)
|
|
indvdum@0
|
644 |
{
|
|
indvdum@0
|
645 |
continue;
|
|
indvdum@0
|
646 |
}
|
|
indvdum@0
|
647 |
|
|
indvdum@0
|
648 |
$post_id = $reporter[$id_column];
|
|
indvdum@0
|
649 |
|
|
indvdum@0
|
650 |
$messenger->template((($pm) ? 'pm_report_' : 'report_') . $action . 'd', $reporter['user_lang']);
|
|
indvdum@0
|
651 |
|
|
indvdum@0
|
652 |
$messenger->to($reporter['user_email'], $reporter['username']);
|
|
indvdum@0
|
653 |
$messenger->im($reporter['user_jabber'], $reporter['username']);
|
|
indvdum@0
|
654 |
|
|
indvdum@0
|
655 |
if ($pm)
|
|
indvdum@0
|
656 |
{
|
|
indvdum@0
|
657 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
658 |
'USERNAME' => htmlspecialchars_decode($reporter['username']),
|
|
indvdum@0
|
659 |
'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']),
|
|
indvdum@0
|
660 |
'PM_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['message_subject'])),
|
|
indvdum@0
|
661 |
));
|
|
indvdum@0
|
662 |
}
|
|
indvdum@0
|
663 |
else
|
|
indvdum@0
|
664 |
{
|
|
indvdum@0
|
665 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
666 |
'USERNAME' => htmlspecialchars_decode($reporter['username']),
|
|
indvdum@0
|
667 |
'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']),
|
|
indvdum@0
|
668 |
'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['post_subject'])),
|
|
indvdum@0
|
669 |
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_info[$post_id]['topic_title'])))
|
|
indvdum@0
|
670 |
);
|
|
indvdum@0
|
671 |
}
|
|
indvdum@0
|
672 |
|
|
indvdum@0
|
673 |
$messenger->send($reporter['user_notify_type']);
|
|
indvdum@0
|
674 |
}
|
|
indvdum@0
|
675 |
}
|
|
indvdum@0
|
676 |
|
|
indvdum@0
|
677 |
if (!$pm)
|
|
indvdum@0
|
678 |
{
|
|
indvdum@0
|
679 |
foreach ($post_info as $post)
|
|
indvdum@0
|
680 |
{
|
|
indvdum@0
|
681 |
$forum_ids[$post['forum_id']] = $post['forum_id'];
|
|
indvdum@0
|
682 |
$topic_ids[$post['topic_id']] = $post['topic_id'];
|
|
indvdum@0
|
683 |
}
|
|
indvdum@0
|
684 |
}
|
|
indvdum@0
|
685 |
|
|
indvdum@0
|
686 |
unset($notify_reporters, $post_info, $reports);
|
|
indvdum@0
|
687 |
|
|
indvdum@0
|
688 |
$messenger->save_queue();
|
|
indvdum@0
|
689 |
|
|
indvdum@0
|
690 |
$success_msg = (sizeof($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS';
|
|
indvdum@0
|
691 |
}
|
|
indvdum@0
|
692 |
else
|
|
indvdum@0
|
693 |
{
|
|
indvdum@0
|
694 |
confirm_box(false, $user->lang[strtoupper($action) . "_{$pm_prefix}REPORT" . ((sizeof($report_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields);
|
|
indvdum@0
|
695 |
}
|
|
indvdum@0
|
696 |
|
|
indvdum@0
|
697 |
$redirect = request_var('redirect', "index.$phpEx");
|
|
indvdum@0
|
698 |
$redirect = reapply_sid($redirect);
|
|
indvdum@0
|
699 |
|
|
indvdum@0
|
700 |
if (!$success_msg)
|
|
indvdum@0
|
701 |
{
|
|
indvdum@0
|
702 |
redirect($redirect);
|
|
indvdum@0
|
703 |
}
|
|
indvdum@0
|
704 |
else
|
|
indvdum@0
|
705 |
{
|
|
indvdum@0
|
706 |
meta_refresh(3, $redirect);
|
|
indvdum@0
|
707 |
|
|
indvdum@0
|
708 |
$return_forum = '';
|
|
indvdum@0
|
709 |
$return_topic = '';
|
|
indvdum@0
|
710 |
|
|
indvdum@0
|
711 |
if (!$pm)
|
|
indvdum@0
|
712 |
{
|
|
indvdum@0
|
713 |
if (sizeof($forum_ids) === 1)
|
|
indvdum@0
|
714 |
{
|
|
indvdum@0
|
715 |
$return_forum = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
|
|
indvdum@0
|
716 |
}
|
|
indvdum@0
|
717 |
|
|
indvdum@0
|
718 |
if (sizeof($topic_ids) === 1)
|
|
indvdum@0
|
719 |
{
|
|
indvdum@0
|
720 |
$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 />';
|
|
indvdum@0
|
721 |
}
|
|
indvdum@0
|
722 |
}
|
|
indvdum@0
|
723 |
|
|
indvdum@0
|
724 |
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
|
|
indvdum@0
|
725 |
}
|
|
indvdum@0
|
726 |
}
|
|
indvdum@0
|
727 |
|
|
indvdum@0
|
728 |
?> |