|
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_queue
|
|
indvdum@0
|
21 |
* Handling the moderation queue
|
|
indvdum@0
|
22 |
* @package mcp
|
|
indvdum@0
|
23 |
*/
|
|
indvdum@0
|
24 |
class mcp_queue
|
|
indvdum@0
|
25 |
{
|
|
indvdum@0
|
26 |
var $p_master;
|
|
indvdum@0
|
27 |
var $u_action;
|
|
indvdum@0
|
28 |
|
|
indvdum@0
|
29 |
function mcp_queue(&$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_QUEUE';
|
|
indvdum@0
|
45 |
|
|
indvdum@0
|
46 |
switch ($action)
|
|
indvdum@0
|
47 |
{
|
|
indvdum@0
|
48 |
case 'approve':
|
|
indvdum@0
|
49 |
case 'disapprove':
|
|
indvdum@0
|
50 |
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
|
indvdum@0
|
51 |
|
|
indvdum@0
|
52 |
$post_id_list = request_var('post_id_list', array(0));
|
|
indvdum@0
|
53 |
|
|
indvdum@0
|
54 |
if (!sizeof($post_id_list))
|
|
indvdum@0
|
55 |
{
|
|
indvdum@0
|
56 |
trigger_error('NO_POST_SELECTED');
|
|
indvdum@0
|
57 |
}
|
|
indvdum@0
|
58 |
|
|
indvdum@0
|
59 |
if ($action == 'approve')
|
|
indvdum@0
|
60 |
{
|
|
indvdum@0
|
61 |
approve_post($post_id_list, 'queue', $mode);
|
|
indvdum@0
|
62 |
}
|
|
indvdum@0
|
63 |
else
|
|
indvdum@0
|
64 |
{
|
|
indvdum@0
|
65 |
disapprove_post($post_id_list, 'queue', $mode);
|
|
indvdum@0
|
66 |
}
|
|
indvdum@0
|
67 |
|
|
indvdum@0
|
68 |
break;
|
|
indvdum@0
|
69 |
}
|
|
indvdum@0
|
70 |
|
|
indvdum@0
|
71 |
switch ($mode)
|
|
indvdum@0
|
72 |
{
|
|
indvdum@0
|
73 |
case 'approve_details':
|
|
indvdum@0
|
74 |
|
|
indvdum@0
|
75 |
$this->tpl_name = 'mcp_post';
|
|
indvdum@0
|
76 |
|
|
indvdum@0
|
77 |
$user->add_lang(array('posting', 'viewtopic'));
|
|
indvdum@0
|
78 |
|
|
indvdum@0
|
79 |
$post_id = request_var('p', 0);
|
|
indvdum@0
|
80 |
$topic_id = request_var('t', 0);
|
|
indvdum@0
|
81 |
|
|
indvdum@0
|
82 |
if ($topic_id)
|
|
indvdum@0
|
83 |
{
|
|
indvdum@0
|
84 |
$topic_info = get_topic_data(array($topic_id), 'm_approve');
|
|
indvdum@0
|
85 |
if (isset($topic_info[$topic_id]['topic_first_post_id']))
|
|
indvdum@0
|
86 |
{
|
|
indvdum@0
|
87 |
$post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
|
|
indvdum@0
|
88 |
}
|
|
indvdum@0
|
89 |
else
|
|
indvdum@0
|
90 |
{
|
|
indvdum@0
|
91 |
$topic_id = 0;
|
|
indvdum@0
|
92 |
}
|
|
indvdum@0
|
93 |
}
|
|
indvdum@0
|
94 |
|
|
indvdum@0
|
95 |
$post_info = get_post_data(array($post_id), 'm_approve', true);
|
|
indvdum@0
|
96 |
|
|
indvdum@0
|
97 |
if (!sizeof($post_info))
|
|
indvdum@0
|
98 |
{
|
|
indvdum@0
|
99 |
trigger_error('NO_POST_SELECTED');
|
|
indvdum@0
|
100 |
}
|
|
indvdum@0
|
101 |
|
|
indvdum@0
|
102 |
$post_info = $post_info[$post_id];
|
|
indvdum@0
|
103 |
|
|
indvdum@0
|
104 |
if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false))
|
|
indvdum@0
|
105 |
{
|
|
indvdum@0
|
106 |
$template->assign_vars(array(
|
|
indvdum@0
|
107 |
'S_TOPIC_REVIEW' => true,
|
|
indvdum@0
|
108 |
'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'],
|
|
indvdum@0
|
109 |
'TOPIC_TITLE' => $post_info['topic_title'])
|
|
indvdum@0
|
110 |
);
|
|
indvdum@0
|
111 |
}
|
|
indvdum@0
|
112 |
|
|
indvdum@0
|
113 |
$extensions = $attachments = $topic_tracking_info = array();
|
|
indvdum@0
|
114 |
|
|
indvdum@0
|
115 |
// Get topic tracking info
|
|
indvdum@0
|
116 |
if ($config['load_db_lastread'])
|
|
indvdum@0
|
117 |
{
|
|
indvdum@0
|
118 |
$tmp_topic_data = array($post_info['topic_id'] => $post_info);
|
|
indvdum@0
|
119 |
$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
|
120 |
unset($tmp_topic_data);
|
|
indvdum@0
|
121 |
}
|
|
indvdum@0
|
122 |
else
|
|
indvdum@0
|
123 |
{
|
|
indvdum@0
|
124 |
$topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
|
|
indvdum@0
|
125 |
}
|
|
indvdum@0
|
126 |
|
|
indvdum@0
|
127 |
$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
|
128 |
|
|
indvdum@0
|
129 |
// Process message, leave it uncensored
|
|
indvdum@0
|
130 |
$message = $post_info['post_text'];
|
|
indvdum@0
|
131 |
|
|
indvdum@0
|
132 |
if ($post_info['bbcode_bitfield'])
|
|
indvdum@0
|
133 |
{
|
|
indvdum@0
|
134 |
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
|
|
indvdum@0
|
135 |
$bbcode = new bbcode($post_info['bbcode_bitfield']);
|
|
indvdum@0
|
136 |
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
|
|
indvdum@0
|
137 |
}
|
|
indvdum@0
|
138 |
|
|
indvdum@0
|
139 |
$message = bbcode_nl2br($message);
|
|
indvdum@0
|
140 |
$message = smiley_text($message);
|
|
indvdum@0
|
141 |
|
|
indvdum@0
|
142 |
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
|
|
indvdum@0
|
143 |
{
|
|
indvdum@0
|
144 |
$extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
|
|
indvdum@0
|
145 |
|
|
indvdum@0
|
146 |
$sql = 'SELECT *
|
|
indvdum@0
|
147 |
FROM ' . ATTACHMENTS_TABLE . '
|
|
indvdum@0
|
148 |
WHERE post_msg_id = ' . $post_id . '
|
|
indvdum@0
|
149 |
AND in_message = 0
|
|
indvdum@0
|
150 |
ORDER BY filetime DESC, post_msg_id ASC';
|
|
indvdum@0
|
151 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
152 |
|
|
indvdum@0
|
153 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
154 |
{
|
|
indvdum@0
|
155 |
$attachments[] = $row;
|
|
indvdum@0
|
156 |
}
|
|
indvdum@0
|
157 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
158 |
|
|
indvdum@0
|
159 |
if (sizeof($attachments))
|
|
indvdum@0
|
160 |
{
|
|
indvdum@0
|
161 |
$update_count = array();
|
|
indvdum@0
|
162 |
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
|
|
indvdum@0
|
163 |
}
|
|
indvdum@0
|
164 |
|
|
indvdum@0
|
165 |
// Display not already displayed Attachments for this post, we already parsed them. ;)
|
|
indvdum@0
|
166 |
if (!empty($attachments))
|
|
indvdum@0
|
167 |
{
|
|
indvdum@0
|
168 |
$template->assign_var('S_HAS_ATTACHMENTS', true);
|
|
indvdum@0
|
169 |
|
|
indvdum@0
|
170 |
foreach ($attachments as $attachment)
|
|
indvdum@0
|
171 |
{
|
|
indvdum@0
|
172 |
$template->assign_block_vars('attachment', array(
|
|
indvdum@0
|
173 |
'DISPLAY_ATTACHMENT' => $attachment)
|
|
indvdum@0
|
174 |
);
|
|
indvdum@0
|
175 |
}
|
|
indvdum@0
|
176 |
}
|
|
indvdum@0
|
177 |
}
|
|
indvdum@0
|
178 |
|
|
indvdum@0
|
179 |
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
|
|
indvdum@0
|
180 |
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']);
|
|
indvdum@0
|
181 |
|
|
indvdum@0
|
182 |
$template->assign_vars(array(
|
|
indvdum@0
|
183 |
'S_MCP_QUEUE' => true,
|
|
indvdum@0
|
184 |
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"),
|
|
indvdum@0
|
185 |
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
|
|
indvdum@0
|
186 |
'S_POST_REPORTED' => $post_info['post_reported'],
|
|
indvdum@0
|
187 |
'S_POST_UNAPPROVED' => !$post_info['post_approved'],
|
|
indvdum@0
|
188 |
'S_POST_LOCKED' => $post_info['post_edit_locked'],
|
|
indvdum@0
|
189 |
'S_USER_NOTES' => true,
|
|
indvdum@0
|
190 |
|
|
indvdum@0
|
191 |
'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
|
192 |
'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
|
193 |
'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
|
194 |
'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']),
|
|
indvdum@0
|
195 |
'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
|
196 |
'U_VIEW_POST' => $post_url,
|
|
indvdum@0
|
197 |
'U_VIEW_TOPIC' => $topic_url,
|
|
indvdum@0
|
198 |
|
|
indvdum@0
|
199 |
'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'),
|
|
indvdum@0
|
200 |
|
|
indvdum@0
|
201 |
'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue' . (($topic_id) ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . "&start=$start\">", '</a>'),
|
|
indvdum@0
|
202 |
'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'),
|
|
indvdum@0
|
203 |
'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'),
|
|
indvdum@0
|
204 |
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
|
|
indvdum@0
|
205 |
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
|
|
indvdum@0
|
206 |
'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
|
|
indvdum@0
|
207 |
|
|
indvdum@0
|
208 |
'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
indvdum@0
|
209 |
'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
indvdum@0
|
210 |
'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
indvdum@0
|
211 |
'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
|
|
indvdum@0
|
212 |
|
|
indvdum@0
|
213 |
'POST_PREVIEW' => $message,
|
|
indvdum@0
|
214 |
'POST_SUBJECT' => $post_info['post_subject'],
|
|
indvdum@0
|
215 |
'POST_DATE' => $user->format_date($post_info['post_time']),
|
|
indvdum@0
|
216 |
'POST_IP' => $post_info['poster_ip'],
|
|
indvdum@0
|
217 |
'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
|
|
indvdum@0
|
218 |
'POST_ID' => $post_info['post_id'],
|
|
indvdum@0
|
219 |
'S_FIRST_POST' => ($post_info['topic_first_post_id'] == $post_id),
|
|
indvdum@0
|
220 |
|
|
indvdum@0
|
221 |
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id . '&lookup=' . $post_info['poster_ip']) . '#ip' : '',
|
|
indvdum@0
|
222 |
));
|
|
indvdum@0
|
223 |
|
|
indvdum@0
|
224 |
break;
|
|
indvdum@0
|
225 |
|
|
indvdum@0
|
226 |
case 'unapproved_topics':
|
|
indvdum@0
|
227 |
case 'unapproved_posts':
|
|
indvdum@0
|
228 |
$user->add_lang(array('viewtopic', 'viewforum'));
|
|
indvdum@0
|
229 |
|
|
indvdum@0
|
230 |
$topic_id = request_var('t', 0);
|
|
indvdum@0
|
231 |
$forum_info = array();
|
|
indvdum@0
|
232 |
|
|
indvdum@0
|
233 |
if ($topic_id)
|
|
indvdum@0
|
234 |
{
|
|
indvdum@0
|
235 |
$topic_info = get_topic_data(array($topic_id));
|
|
indvdum@0
|
236 |
|
|
indvdum@0
|
237 |
if (!sizeof($topic_info))
|
|
indvdum@0
|
238 |
{
|
|
indvdum@0
|
239 |
trigger_error('TOPIC_NOT_EXIST');
|
|
indvdum@0
|
240 |
}
|
|
indvdum@0
|
241 |
|
|
indvdum@0
|
242 |
$topic_info = $topic_info[$topic_id];
|
|
indvdum@0
|
243 |
$forum_id = $topic_info['forum_id'];
|
|
indvdum@0
|
244 |
}
|
|
indvdum@0
|
245 |
|
|
indvdum@0
|
246 |
$forum_list_approve = get_forum_list('m_approve', false, true);
|
|
indvdum@0
|
247 |
$forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs
|
|
indvdum@0
|
248 |
|
|
indvdum@0
|
249 |
// Remove forums we cannot read
|
|
indvdum@0
|
250 |
foreach ($forum_list_approve as $k => $forum_data)
|
|
indvdum@0
|
251 |
{
|
|
indvdum@0
|
252 |
if (!isset($forum_list_read[$forum_data['forum_id']]))
|
|
indvdum@0
|
253 |
{
|
|
indvdum@0
|
254 |
unset($forum_list_approve[$k]);
|
|
indvdum@0
|
255 |
}
|
|
indvdum@0
|
256 |
}
|
|
indvdum@0
|
257 |
unset($forum_list_read);
|
|
indvdum@0
|
258 |
|
|
indvdum@0
|
259 |
if (!$forum_id)
|
|
indvdum@0
|
260 |
{
|
|
indvdum@0
|
261 |
$forum_list = array();
|
|
indvdum@0
|
262 |
foreach ($forum_list_approve as $row)
|
|
indvdum@0
|
263 |
{
|
|
indvdum@0
|
264 |
$forum_list[] = $row['forum_id'];
|
|
indvdum@0
|
265 |
}
|
|
indvdum@0
|
266 |
|
|
indvdum@0
|
267 |
if (!sizeof($forum_list))
|
|
indvdum@0
|
268 |
{
|
|
indvdum@0
|
269 |
trigger_error('NOT_MODERATOR');
|
|
indvdum@0
|
270 |
}
|
|
indvdum@0
|
271 |
|
|
indvdum@0
|
272 |
$global_id = $forum_list[0];
|
|
indvdum@0
|
273 |
|
|
indvdum@0
|
274 |
$forum_list = implode(', ', $forum_list);
|
|
indvdum@0
|
275 |
|
|
indvdum@0
|
276 |
$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
|
|
indvdum@0
|
277 |
FROM ' . FORUMS_TABLE . "
|
|
indvdum@0
|
278 |
WHERE forum_id IN (0, $forum_list)";
|
|
indvdum@0
|
279 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
280 |
$forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics');
|
|
indvdum@0
|
281 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
282 |
}
|
|
indvdum@0
|
283 |
else
|
|
indvdum@0
|
284 |
{
|
|
indvdum@0
|
285 |
$forum_info = get_forum_data(array($forum_id), 'm_approve');
|
|
indvdum@0
|
286 |
|
|
indvdum@0
|
287 |
if (!sizeof($forum_info))
|
|
indvdum@0
|
288 |
{
|
|
indvdum@0
|
289 |
trigger_error('NOT_MODERATOR');
|
|
indvdum@0
|
290 |
}
|
|
indvdum@0
|
291 |
|
|
indvdum@0
|
292 |
$forum_info = $forum_info[$forum_id];
|
|
indvdum@0
|
293 |
$forum_list = $forum_id;
|
|
indvdum@0
|
294 |
$global_id = $forum_id;
|
|
indvdum@0
|
295 |
}
|
|
indvdum@0
|
296 |
|
|
indvdum@0
|
297 |
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
|
|
indvdum@0
|
298 |
foreach ($forum_list_approve as $row)
|
|
indvdum@0
|
299 |
{
|
|
indvdum@0
|
300 |
$forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat(' ', $row['padding']) . $row['forum_name'] . '</option>';
|
|
indvdum@0
|
301 |
}
|
|
indvdum@0
|
302 |
|
|
indvdum@0
|
303 |
$sort_days = $total = 0;
|
|
indvdum@0
|
304 |
$sort_key = $sort_dir = '';
|
|
indvdum@0
|
305 |
$sort_by_sql = $sort_order_sql = array();
|
|
indvdum@0
|
306 |
mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id);
|
|
indvdum@0
|
307 |
|
|
indvdum@0
|
308 |
$forum_topics = ($total == -1) ? $forum_info['forum_topics'] : $total;
|
|
indvdum@0
|
309 |
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
|
indvdum@0
|
310 |
|
|
indvdum@0
|
311 |
$forum_names = array();
|
|
indvdum@0
|
312 |
|
|
indvdum@0
|
313 |
if ($mode == 'unapproved_posts')
|
|
indvdum@0
|
314 |
{
|
|
indvdum@0
|
315 |
$sql = 'SELECT p.post_id
|
|
indvdum@0
|
316 |
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . "
|
|
indvdum@0
|
317 |
WHERE p.forum_id IN (0, $forum_list)
|
|
indvdum@0
|
318 |
AND p.post_approved = 0
|
|
indvdum@0
|
319 |
" . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
|
|
indvdum@0
|
320 |
' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
|
|
indvdum@0
|
321 |
AND t.topic_id = p.topic_id
|
|
indvdum@0
|
322 |
AND t.topic_first_post_id <> p.post_id
|
|
indvdum@0
|
323 |
$limit_time_sql
|
|
indvdum@0
|
324 |
ORDER BY $sort_order_sql";
|
|
indvdum@0
|
325 |
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
|
indvdum@0
|
326 |
|
|
indvdum@0
|
327 |
$i = 0;
|
|
indvdum@0
|
328 |
$post_ids = array();
|
|
indvdum@0
|
329 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
330 |
{
|
|
indvdum@0
|
331 |
$post_ids[] = $row['post_id'];
|
|
indvdum@0
|
332 |
$row_num[$row['post_id']] = $i++;
|
|
indvdum@0
|
333 |
}
|
|
indvdum@0
|
334 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
335 |
|
|
indvdum@0
|
336 |
if (sizeof($post_ids))
|
|
indvdum@0
|
337 |
{
|
|
indvdum@0
|
338 |
$sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, u.username_clean, u.user_colour
|
|
indvdum@0
|
339 |
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
|
|
indvdum@0
|
340 |
WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . '
|
|
indvdum@0
|
341 |
AND t.topic_id = p.topic_id
|
|
indvdum@0
|
342 |
AND u.user_id = p.poster_id
|
|
indvdum@0
|
343 |
ORDER BY ' . $sort_order_sql;
|
|
indvdum@0
|
344 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
345 |
|
|
indvdum@0
|
346 |
$post_data = $rowset = array();
|
|
indvdum@0
|
347 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
348 |
{
|
|
indvdum@0
|
349 |
if ($row['forum_id'])
|
|
indvdum@0
|
350 |
{
|
|
indvdum@0
|
351 |
$forum_names[] = $row['forum_id'];
|
|
indvdum@0
|
352 |
}
|
|
indvdum@0
|
353 |
$post_data[$row['post_id']] = $row;
|
|
indvdum@0
|
354 |
}
|
|
indvdum@0
|
355 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
356 |
|
|
indvdum@0
|
357 |
foreach ($post_ids as $post_id)
|
|
indvdum@0
|
358 |
{
|
|
indvdum@0
|
359 |
$rowset[] = $post_data[$post_id];
|
|
indvdum@0
|
360 |
}
|
|
indvdum@0
|
361 |
unset($post_data, $post_ids);
|
|
indvdum@0
|
362 |
}
|
|
indvdum@0
|
363 |
else
|
|
indvdum@0
|
364 |
{
|
|
indvdum@0
|
365 |
$rowset = array();
|
|
indvdum@0
|
366 |
}
|
|
indvdum@0
|
367 |
}
|
|
indvdum@0
|
368 |
else
|
|
indvdum@0
|
369 |
{
|
|
indvdum@0
|
370 |
$sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour
|
|
indvdum@0
|
371 |
FROM ' . TOPICS_TABLE . " t
|
|
indvdum@0
|
372 |
WHERE forum_id IN (0, $forum_list)
|
|
indvdum@0
|
373 |
AND topic_approved = 0
|
|
indvdum@0
|
374 |
$limit_time_sql
|
|
indvdum@0
|
375 |
ORDER BY $sort_order_sql";
|
|
indvdum@0
|
376 |
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
|
indvdum@0
|
377 |
|
|
indvdum@0
|
378 |
$rowset = array();
|
|
indvdum@0
|
379 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
380 |
{
|
|
indvdum@0
|
381 |
if ($row['forum_id'])
|
|
indvdum@0
|
382 |
{
|
|
indvdum@0
|
383 |
$forum_names[] = $row['forum_id'];
|
|
indvdum@0
|
384 |
}
|
|
indvdum@0
|
385 |
$rowset[] = $row;
|
|
indvdum@0
|
386 |
}
|
|
indvdum@0
|
387 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
388 |
}
|
|
indvdum@0
|
389 |
|
|
indvdum@0
|
390 |
if (sizeof($forum_names))
|
|
indvdum@0
|
391 |
{
|
|
indvdum@0
|
392 |
// Select the names for the forum_ids
|
|
indvdum@0
|
393 |
$sql = 'SELECT forum_id, forum_name
|
|
indvdum@0
|
394 |
FROM ' . FORUMS_TABLE . '
|
|
indvdum@0
|
395 |
WHERE ' . $db->sql_in_set('forum_id', $forum_names);
|
|
indvdum@0
|
396 |
$result = $db->sql_query($sql, 3600);
|
|
indvdum@0
|
397 |
|
|
indvdum@0
|
398 |
$forum_names = array();
|
|
indvdum@0
|
399 |
while ($row = $db->sql_fetchrow($result))
|
|
indvdum@0
|
400 |
{
|
|
indvdum@0
|
401 |
$forum_names[$row['forum_id']] = $row['forum_name'];
|
|
indvdum@0
|
402 |
}
|
|
indvdum@0
|
403 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
404 |
}
|
|
indvdum@0
|
405 |
|
|
indvdum@0
|
406 |
foreach ($rowset as $row)
|
|
indvdum@0
|
407 |
{
|
|
indvdum@0
|
408 |
$global_topic = ($row['forum_id']) ? false : true;
|
|
indvdum@0
|
409 |
if ($global_topic)
|
|
indvdum@0
|
410 |
{
|
|
indvdum@0
|
411 |
$row['forum_id'] = $global_id;
|
|
indvdum@0
|
412 |
}
|
|
indvdum@0
|
413 |
|
|
indvdum@0
|
414 |
if (empty($row['post_username']))
|
|
indvdum@0
|
415 |
{
|
|
indvdum@0
|
416 |
$row['post_username'] = $user->lang['GUEST'];
|
|
indvdum@0
|
417 |
}
|
|
indvdum@0
|
418 |
|
|
indvdum@0
|
419 |
$template->assign_block_vars('postrow', array(
|
|
indvdum@0
|
420 |
'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),
|
|
indvdum@0
|
421 |
'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
|
|
indvdum@0
|
422 |
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''),
|
|
indvdum@0
|
423 |
'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&start=$start&mode=approve_details&f={$row['forum_id']}&p={$row['post_id']}" . (($mode == 'unapproved_topics') ? "&t={$row['topic_id']}" : '')),
|
|
indvdum@0
|
424 |
|
|
indvdum@0
|
425 |
'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
indvdum@0
|
426 |
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
indvdum@0
|
427 |
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
indvdum@0
|
428 |
'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
|
|
indvdum@0
|
429 |
|
|
indvdum@0
|
430 |
'POST_ID' => $row['post_id'],
|
|
indvdum@0
|
431 |
'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'],
|
|
indvdum@0
|
432 |
'POST_SUBJECT' => ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
|
|
indvdum@0
|
433 |
'TOPIC_TITLE' => $row['topic_title'],
|
|
indvdum@0
|
434 |
'POST_TIME' => $user->format_date($row['post_time']))
|
|
indvdum@0
|
435 |
);
|
|
indvdum@0
|
436 |
}
|
|
indvdum@0
|
437 |
unset($rowset, $forum_names);
|
|
indvdum@0
|
438 |
|
|
indvdum@0
|
439 |
// Now display the page
|
|
indvdum@0
|
440 |
$template->assign_vars(array(
|
|
indvdum@0
|
441 |
'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'],
|
|
indvdum@0
|
442 |
'L_EXPLAIN' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN'],
|
|
indvdum@0
|
443 |
'L_TITLE' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS'],
|
|
indvdum@0
|
444 |
'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '',
|
|
indvdum@0
|
445 |
|
|
indvdum@0
|
446 |
'S_FORUM_OPTIONS' => $forum_options,
|
|
indvdum@0
|
447 |
'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')),
|
|
indvdum@0
|
448 |
'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true,
|
|
indvdum@0
|
449 |
|
|
indvdum@0
|
450 |
'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $total, $config['topics_per_page'], $start),
|
|
indvdum@0
|
451 |
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
|
|
indvdum@0
|
452 |
'TOPIC_ID' => $topic_id,
|
|
indvdum@0
|
453 |
'TOTAL' => ($total == 1) ? (($mode == 'unapproved_posts') ? $user->lang['VIEW_TOPIC_POST'] : $user->lang['VIEW_FORUM_TOPIC']) : sprintf((($mode == 'unapproved_posts') ? $user->lang['VIEW_TOPIC_POSTS'] : $user->lang['VIEW_FORUM_TOPICS']), $total),
|
|
indvdum@0
|
454 |
));
|
|
indvdum@0
|
455 |
|
|
indvdum@0
|
456 |
$this->tpl_name = 'mcp_queue';
|
|
indvdum@0
|
457 |
break;
|
|
indvdum@0
|
458 |
}
|
|
indvdum@0
|
459 |
}
|
|
indvdum@0
|
460 |
}
|
|
indvdum@0
|
461 |
|
|
indvdum@0
|
462 |
/**
|
|
indvdum@0
|
463 |
* Approve Post/Topic
|
|
indvdum@0
|
464 |
*/
|
|
indvdum@0
|
465 |
function approve_post($post_id_list, $id, $mode)
|
|
indvdum@0
|
466 |
{
|
|
indvdum@0
|
467 |
global $db, $template, $user, $config;
|
|
indvdum@0
|
468 |
global $phpEx, $phpbb_root_path;
|
|
indvdum@0
|
469 |
|
|
indvdum@0
|
470 |
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
|
|
indvdum@0
|
471 |
{
|
|
indvdum@0
|
472 |
trigger_error('NOT_AUTHORISED');
|
|
indvdum@0
|
473 |
}
|
|
indvdum@0
|
474 |
|
|
indvdum@0
|
475 |
$redirect = request_var('redirect', build_url(array('quickmod')));
|
|
indvdum@0
|
476 |
$success_msg = '';
|
|
indvdum@0
|
477 |
|
|
indvdum@0
|
478 |
$s_hidden_fields = build_hidden_fields(array(
|
|
indvdum@0
|
479 |
'i' => $id,
|
|
indvdum@0
|
480 |
'mode' => $mode,
|
|
indvdum@0
|
481 |
'post_id_list' => $post_id_list,
|
|
indvdum@0
|
482 |
'action' => 'approve',
|
|
indvdum@0
|
483 |
'redirect' => $redirect)
|
|
indvdum@0
|
484 |
);
|
|
indvdum@0
|
485 |
|
|
indvdum@0
|
486 |
$post_info = get_post_data($post_id_list, 'm_approve');
|
|
indvdum@0
|
487 |
|
|
indvdum@0
|
488 |
if (confirm_box(true))
|
|
indvdum@0
|
489 |
{
|
|
indvdum@0
|
490 |
$notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false;
|
|
indvdum@0
|
491 |
|
|
indvdum@0
|
492 |
// If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1
|
|
indvdum@0
|
493 |
// If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1
|
|
indvdum@0
|
494 |
|
|
indvdum@0
|
495 |
$total_topics = $total_posts = 0;
|
|
indvdum@0
|
496 |
$topic_approve_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array();
|
|
indvdum@0
|
497 |
$user_posts_sql = $post_approved_list = array();
|
|
indvdum@0
|
498 |
|
|
indvdum@0
|
499 |
foreach ($post_info as $post_id => $post_data)
|
|
indvdum@0
|
500 |
{
|
|
indvdum@0
|
501 |
if ($post_data['post_approved'])
|
|
indvdum@0
|
502 |
{
|
|
indvdum@0
|
503 |
$post_approved_list[] = $post_id;
|
|
indvdum@0
|
504 |
continue;
|
|
indvdum@0
|
505 |
}
|
|
indvdum@0
|
506 |
|
|
indvdum@0
|
507 |
$topic_id_list[$post_data['topic_id']] = 1;
|
|
indvdum@0
|
508 |
|
|
indvdum@0
|
509 |
if ($post_data['forum_id'])
|
|
indvdum@0
|
510 |
{
|
|
indvdum@0
|
511 |
$forum_id_list[$post_data['forum_id']] = 1;
|
|
indvdum@0
|
512 |
}
|
|
indvdum@0
|
513 |
|
|
indvdum@0
|
514 |
// User post update (we do not care about topic or post, since user posts are strictly connected to posts)
|
|
indvdum@0
|
515 |
// But we care about forums where post counts get not increased. ;)
|
|
indvdum@0
|
516 |
if ($post_data['post_postcount'])
|
|
indvdum@0
|
517 |
{
|
|
indvdum@0
|
518 |
$user_posts_sql[$post_data['poster_id']] = (empty($user_posts_sql[$post_data['poster_id']])) ? 1 : $user_posts_sql[$post_data['poster_id']] + 1;
|
|
indvdum@0
|
519 |
}
|
|
indvdum@0
|
520 |
|
|
indvdum@0
|
521 |
// Topic or Post. ;)
|
|
indvdum@0
|
522 |
if ($post_data['topic_first_post_id'] == $post_id)
|
|
indvdum@0
|
523 |
{
|
|
indvdum@0
|
524 |
if ($post_data['forum_id'])
|
|
indvdum@0
|
525 |
{
|
|
indvdum@0
|
526 |
$total_topics++;
|
|
indvdum@0
|
527 |
}
|
|
indvdum@0
|
528 |
$topic_approve_sql[] = $post_data['topic_id'];
|
|
indvdum@0
|
529 |
|
|
indvdum@0
|
530 |
$approve_log[] = array(
|
|
indvdum@0
|
531 |
'type' => 'topic',
|
|
indvdum@0
|
532 |
'post_subject' => $post_data['post_subject'],
|
|
indvdum@0
|
533 |
'forum_id' => $post_data['forum_id'],
|
|
indvdum@0
|
534 |
'topic_id' => $post_data['topic_id'],
|
|
indvdum@0
|
535 |
);
|
|
indvdum@0
|
536 |
}
|
|
indvdum@0
|
537 |
else
|
|
indvdum@0
|
538 |
{
|
|
indvdum@0
|
539 |
$approve_log[] = array(
|
|
indvdum@0
|
540 |
'type' => 'post',
|
|
indvdum@0
|
541 |
'post_subject' => $post_data['post_subject'],
|
|
indvdum@0
|
542 |
'forum_id' => $post_data['forum_id'],
|
|
indvdum@0
|
543 |
'topic_id' => $post_data['topic_id'],
|
|
indvdum@0
|
544 |
);
|
|
indvdum@0
|
545 |
}
|
|
indvdum@0
|
546 |
|
|
indvdum@0
|
547 |
if ($post_data['forum_id'])
|
|
indvdum@0
|
548 |
{
|
|
indvdum@0
|
549 |
$total_posts++;
|
|
indvdum@0
|
550 |
|
|
indvdum@0
|
551 |
// Increment by topic_replies if we approve a topic...
|
|
indvdum@0
|
552 |
// This works because we do not adjust the topic_replies when re-approving a topic after an edit.
|
|
indvdum@0
|
553 |
if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies'])
|
|
indvdum@0
|
554 |
{
|
|
indvdum@0
|
555 |
$total_posts += $post_data['topic_replies'];
|
|
indvdum@0
|
556 |
}
|
|
indvdum@0
|
557 |
}
|
|
indvdum@0
|
558 |
|
|
indvdum@0
|
559 |
$post_approve_sql[] = $post_id;
|
|
indvdum@0
|
560 |
}
|
|
indvdum@0
|
561 |
|
|
indvdum@0
|
562 |
$post_id_list = array_values(array_diff($post_id_list, $post_approved_list));
|
|
indvdum@0
|
563 |
for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++)
|
|
indvdum@0
|
564 |
{
|
|
indvdum@0
|
565 |
unset($post_info[$post_approved_list[$i]]);
|
|
indvdum@0
|
566 |
}
|
|
indvdum@0
|
567 |
|
|
indvdum@0
|
568 |
if (sizeof($topic_approve_sql))
|
|
indvdum@0
|
569 |
{
|
|
indvdum@0
|
570 |
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
|
indvdum@0
|
571 |
SET topic_approved = 1
|
|
indvdum@0
|
572 |
WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql);
|
|
indvdum@0
|
573 |
$db->sql_query($sql);
|
|
indvdum@0
|
574 |
}
|
|
indvdum@0
|
575 |
|
|
indvdum@0
|
576 |
if (sizeof($post_approve_sql))
|
|
indvdum@0
|
577 |
{
|
|
indvdum@0
|
578 |
$sql = 'UPDATE ' . POSTS_TABLE . '
|
|
indvdum@0
|
579 |
SET post_approved = 1
|
|
indvdum@0
|
580 |
WHERE ' . $db->sql_in_set('post_id', $post_approve_sql);
|
|
indvdum@0
|
581 |
$db->sql_query($sql);
|
|
indvdum@0
|
582 |
}
|
|
indvdum@0
|
583 |
|
|
indvdum@0
|
584 |
unset($topic_approve_sql, $post_approve_sql);
|
|
indvdum@0
|
585 |
|
|
indvdum@0
|
586 |
foreach ($approve_log as $log_data)
|
|
indvdum@0
|
587 |
{
|
|
indvdum@0
|
588 |
add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_APPROVED' : 'LOG_POST_APPROVED', $log_data['post_subject']);
|
|
indvdum@0
|
589 |
}
|
|
indvdum@0
|
590 |
|
|
indvdum@0
|
591 |
if (sizeof($user_posts_sql))
|
|
indvdum@0
|
592 |
{
|
|
indvdum@0
|
593 |
// Try to minimize the query count by merging users with the same post count additions
|
|
indvdum@0
|
594 |
$user_posts_update = array();
|
|
indvdum@0
|
595 |
|
|
indvdum@0
|
596 |
foreach ($user_posts_sql as $user_id => $user_posts)
|
|
indvdum@0
|
597 |
{
|
|
indvdum@0
|
598 |
$user_posts_update[$user_posts][] = $user_id;
|
|
indvdum@0
|
599 |
}
|
|
indvdum@0
|
600 |
|
|
indvdum@0
|
601 |
foreach ($user_posts_update as $user_posts => $user_id_ary)
|
|
indvdum@0
|
602 |
{
|
|
indvdum@0
|
603 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
indvdum@0
|
604 |
SET user_posts = user_posts + ' . $user_posts . '
|
|
indvdum@0
|
605 |
WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
|
|
indvdum@0
|
606 |
$db->sql_query($sql);
|
|
indvdum@0
|
607 |
}
|
|
indvdum@0
|
608 |
}
|
|
indvdum@0
|
609 |
|
|
indvdum@0
|
610 |
if ($total_topics)
|
|
indvdum@0
|
611 |
{
|
|
indvdum@0
|
612 |
set_config_count('num_topics', $total_topics, true);
|
|
indvdum@0
|
613 |
}
|
|
indvdum@0
|
614 |
|
|
indvdum@0
|
615 |
if ($total_posts)
|
|
indvdum@0
|
616 |
{
|
|
indvdum@0
|
617 |
set_config_count('num_posts', $total_posts, true);
|
|
indvdum@0
|
618 |
}
|
|
indvdum@0
|
619 |
|
|
indvdum@0
|
620 |
sync('topic', 'topic_id', array_keys($topic_id_list), true);
|
|
indvdum@0
|
621 |
sync('forum', 'forum_id', array_keys($forum_id_list), true, true);
|
|
indvdum@0
|
622 |
unset($topic_id_list, $forum_id_list);
|
|
indvdum@0
|
623 |
|
|
indvdum@0
|
624 |
$messenger = new messenger();
|
|
indvdum@0
|
625 |
|
|
indvdum@0
|
626 |
// Notify Poster?
|
|
indvdum@0
|
627 |
if ($notify_poster)
|
|
indvdum@0
|
628 |
{
|
|
indvdum@0
|
629 |
foreach ($post_info as $post_id => $post_data)
|
|
indvdum@0
|
630 |
{
|
|
indvdum@0
|
631 |
if ($post_data['poster_id'] == ANONYMOUS)
|
|
indvdum@0
|
632 |
{
|
|
indvdum@0
|
633 |
continue;
|
|
indvdum@0
|
634 |
}
|
|
indvdum@0
|
635 |
|
|
indvdum@0
|
636 |
$email_template = ($post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id']) ? 'topic_approved' : 'post_approved';
|
|
indvdum@0
|
637 |
|
|
indvdum@0
|
638 |
$messenger->template($email_template, $post_data['user_lang']);
|
|
indvdum@0
|
639 |
|
|
indvdum@0
|
640 |
$messenger->to($post_data['user_email'], $post_data['username']);
|
|
indvdum@0
|
641 |
$messenger->im($post_data['user_jabber'], $post_data['username']);
|
|
indvdum@0
|
642 |
|
|
indvdum@0
|
643 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
644 |
'USERNAME' => htmlspecialchars_decode($post_data['username']),
|
|
indvdum@0
|
645 |
'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])),
|
|
indvdum@0
|
646 |
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title'])),
|
|
indvdum@0
|
647 |
|
|
indvdum@0
|
648 |
'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&e=0",
|
|
indvdum@0
|
649 |
'U_VIEW_POST' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&p=$post_id&e=$post_id")
|
|
indvdum@0
|
650 |
);
|
|
indvdum@0
|
651 |
|
|
indvdum@0
|
652 |
$messenger->send($post_data['user_notify_type']);
|
|
indvdum@0
|
653 |
}
|
|
indvdum@0
|
654 |
}
|
|
indvdum@0
|
655 |
|
|
indvdum@0
|
656 |
$messenger->save_queue();
|
|
indvdum@0
|
657 |
|
|
indvdum@0
|
658 |
// Send out normal user notifications
|
|
indvdum@0
|
659 |
$email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
|
|
indvdum@0
|
660 |
|
|
indvdum@0
|
661 |
foreach ($post_info as $post_id => $post_data)
|
|
indvdum@0
|
662 |
{
|
|
indvdum@0
|
663 |
if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id'])
|
|
indvdum@0
|
664 |
{
|
|
indvdum@0
|
665 |
// Forum Notifications
|
|
indvdum@0
|
666 |
user_notification('post', $post_data['topic_title'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id);
|
|
indvdum@0
|
667 |
}
|
|
indvdum@0
|
668 |
else
|
|
indvdum@0
|
669 |
{
|
|
indvdum@0
|
670 |
// Topic Notifications
|
|
indvdum@0
|
671 |
user_notification('reply', $post_data['post_subject'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id);
|
|
indvdum@0
|
672 |
}
|
|
indvdum@0
|
673 |
}
|
|
indvdum@0
|
674 |
|
|
indvdum@0
|
675 |
if (sizeof($post_id_list) == 1)
|
|
indvdum@0
|
676 |
{
|
|
indvdum@0
|
677 |
$post_data = $post_info[$post_id_list[0]];
|
|
indvdum@0
|
678 |
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_data['forum_id']}&t={$post_data['topic_id']}&p={$post_data['post_id']}") . '#p' . $post_data['post_id'];
|
|
indvdum@0
|
679 |
}
|
|
indvdum@0
|
680 |
unset($post_info);
|
|
indvdum@0
|
681 |
|
|
indvdum@0
|
682 |
if ($total_topics)
|
|
indvdum@0
|
683 |
{
|
|
indvdum@0
|
684 |
$success_msg = ($total_topics == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
|
|
indvdum@0
|
685 |
}
|
|
indvdum@0
|
686 |
else
|
|
indvdum@0
|
687 |
{
|
|
indvdum@0
|
688 |
$success_msg = (sizeof($post_id_list) + sizeof($post_approved_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
|
|
indvdum@0
|
689 |
}
|
|
indvdum@0
|
690 |
}
|
|
indvdum@0
|
691 |
else
|
|
indvdum@0
|
692 |
{
|
|
indvdum@0
|
693 |
$show_notify = false;
|
|
indvdum@0
|
694 |
|
|
indvdum@0
|
695 |
if ($config['email_enable'] || $config['jab_enable'])
|
|
indvdum@0
|
696 |
{
|
|
indvdum@0
|
697 |
foreach ($post_info as $post_data)
|
|
indvdum@0
|
698 |
{
|
|
indvdum@0
|
699 |
if ($post_data['poster_id'] == ANONYMOUS)
|
|
indvdum@0
|
700 |
{
|
|
indvdum@0
|
701 |
continue;
|
|
indvdum@0
|
702 |
}
|
|
indvdum@0
|
703 |
else
|
|
indvdum@0
|
704 |
{
|
|
indvdum@0
|
705 |
$show_notify = true;
|
|
indvdum@0
|
706 |
break;
|
|
indvdum@0
|
707 |
}
|
|
indvdum@0
|
708 |
}
|
|
indvdum@0
|
709 |
}
|
|
indvdum@0
|
710 |
|
|
indvdum@0
|
711 |
$template->assign_vars(array(
|
|
indvdum@0
|
712 |
'S_NOTIFY_POSTER' => $show_notify,
|
|
indvdum@0
|
713 |
'S_APPROVE' => true)
|
|
indvdum@0
|
714 |
);
|
|
indvdum@0
|
715 |
|
|
indvdum@0
|
716 |
confirm_box(false, 'APPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
|
|
indvdum@0
|
717 |
}
|
|
indvdum@0
|
718 |
|
|
indvdum@0
|
719 |
$redirect = request_var('redirect', "index.$phpEx");
|
|
indvdum@0
|
720 |
$redirect = reapply_sid($redirect);
|
|
indvdum@0
|
721 |
|
|
indvdum@0
|
722 |
if (!$success_msg)
|
|
indvdum@0
|
723 |
{
|
|
indvdum@0
|
724 |
redirect($redirect);
|
|
indvdum@0
|
725 |
}
|
|
indvdum@0
|
726 |
else
|
|
indvdum@0
|
727 |
{
|
|
indvdum@0
|
728 |
meta_refresh(3, $redirect);
|
|
indvdum@0
|
729 |
|
|
indvdum@0
|
730 |
// If approving one post, also give links back to post...
|
|
indvdum@0
|
731 |
$add_message = '';
|
|
indvdum@0
|
732 |
if (sizeof($post_id_list) == 1 && !empty($post_url))
|
|
indvdum@0
|
733 |
{
|
|
indvdum@0
|
734 |
$add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>');
|
|
indvdum@0
|
735 |
}
|
|
indvdum@0
|
736 |
|
|
indvdum@0
|
737 |
trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message);
|
|
indvdum@0
|
738 |
}
|
|
indvdum@0
|
739 |
}
|
|
indvdum@0
|
740 |
|
|
indvdum@0
|
741 |
/**
|
|
indvdum@0
|
742 |
* Disapprove Post/Topic
|
|
indvdum@0
|
743 |
*/
|
|
indvdum@0
|
744 |
function disapprove_post($post_id_list, $id, $mode)
|
|
indvdum@0
|
745 |
{
|
|
indvdum@0
|
746 |
global $db, $template, $user, $config;
|
|
indvdum@0
|
747 |
global $phpEx, $phpbb_root_path;
|
|
indvdum@0
|
748 |
|
|
indvdum@0
|
749 |
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
|
|
indvdum@0
|
750 |
{
|
|
indvdum@0
|
751 |
trigger_error('NOT_AUTHORISED');
|
|
indvdum@0
|
752 |
}
|
|
indvdum@0
|
753 |
|
|
indvdum@0
|
754 |
$redirect = request_var('redirect', build_url(array('t', 'mode', 'quickmod')) . "&mode=$mode");
|
|
indvdum@0
|
755 |
$reason = utf8_normalize_nfc(request_var('reason', '', true));
|
|
indvdum@0
|
756 |
$reason_id = request_var('reason_id', 0);
|
|
indvdum@0
|
757 |
$success_msg = $additional_msg = '';
|
|
indvdum@0
|
758 |
|
|
indvdum@0
|
759 |
$s_hidden_fields = build_hidden_fields(array(
|
|
indvdum@0
|
760 |
'i' => $id,
|
|
indvdum@0
|
761 |
'mode' => $mode,
|
|
indvdum@0
|
762 |
'post_id_list' => $post_id_list,
|
|
indvdum@0
|
763 |
'action' => 'disapprove',
|
|
indvdum@0
|
764 |
'redirect' => $redirect)
|
|
indvdum@0
|
765 |
);
|
|
indvdum@0
|
766 |
|
|
indvdum@0
|
767 |
$notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false;
|
|
indvdum@0
|
768 |
$disapprove_reason = '';
|
|
indvdum@0
|
769 |
|
|
indvdum@0
|
770 |
if ($reason_id)
|
|
indvdum@0
|
771 |
{
|
|
indvdum@0
|
772 |
$sql = 'SELECT reason_title, reason_description
|
|
indvdum@0
|
773 |
FROM ' . REPORTS_REASONS_TABLE . "
|
|
indvdum@0
|
774 |
WHERE reason_id = $reason_id";
|
|
indvdum@0
|
775 |
$result = $db->sql_query($sql);
|
|
indvdum@0
|
776 |
$row = $db->sql_fetchrow($result);
|
|
indvdum@0
|
777 |
$db->sql_freeresult($result);
|
|
indvdum@0
|
778 |
|
|
indvdum@0
|
779 |
if (!$row || (!$reason && strtolower($row['reason_title']) == 'other'))
|
|
indvdum@0
|
780 |
{
|
|
indvdum@0
|
781 |
$additional_msg = $user->lang['NO_REASON_DISAPPROVAL'];
|
|
indvdum@0
|
782 |
unset($_REQUEST['confirm_key']);
|
|
indvdum@0
|
783 |
unset($_POST['confirm_key']);
|
|
indvdum@0
|
784 |
unset($_POST['confirm']);
|
|
indvdum@0
|
785 |
}
|
|
indvdum@0
|
786 |
else
|
|
indvdum@0
|
787 |
{
|
|
indvdum@0
|
788 |
// If the reason is defined within the language file, we will use the localized version, else just use the database entry...
|
|
indvdum@0
|
789 |
$disapprove_reason = (strtolower($row['reason_title']) != 'other') ? ((isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])] : $row['reason_description']) : '';
|
|
indvdum@0
|
790 |
$disapprove_reason .= ($reason) ? "\n\n" . $reason : '';
|
|
indvdum@0
|
791 |
|
|
indvdum@0
|
792 |
if (isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
|
|
indvdum@0
|
793 |
{
|
|
indvdum@0
|
794 |
$disapprove_reason_lang = strtoupper($row['reason_title']);
|
|
indvdum@0
|
795 |
}
|
|
indvdum@0
|
796 |
|
|
indvdum@0
|
797 |
$email_disapprove_reason = $disapprove_reason;
|
|
indvdum@0
|
798 |
}
|
|
indvdum@0
|
799 |
}
|
|
indvdum@0
|
800 |
|
|
indvdum@0
|
801 |
$post_info = get_post_data($post_id_list, 'm_approve');
|
|
indvdum@0
|
802 |
|
|
indvdum@0
|
803 |
if (confirm_box(true))
|
|
indvdum@0
|
804 |
{
|
|
indvdum@0
|
805 |
$disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array();
|
|
indvdum@0
|
806 |
$topic_replies_real = $post_disapprove_list = array();
|
|
indvdum@0
|
807 |
|
|
indvdum@0
|
808 |
// Build a list of posts to be unapproved and get the related topics real replies count
|
|
indvdum@0
|
809 |
foreach ($post_info as $post_id => $post_data)
|
|
indvdum@0
|
810 |
{
|
|
indvdum@0
|
811 |
$post_disapprove_list[$post_id] = $post_data['topic_id'];
|
|
indvdum@0
|
812 |
if (!isset($topic_replies_real[$post_data['topic_id']]))
|
|
indvdum@0
|
813 |
{
|
|
indvdum@0
|
814 |
$topic_replies_real[$post_data['topic_id']] = $post_data['topic_replies_real'];
|
|
indvdum@0
|
815 |
}
|
|
indvdum@0
|
816 |
}
|
|
indvdum@0
|
817 |
|
|
indvdum@0
|
818 |
// Now we build the log array
|
|
indvdum@0
|
819 |
foreach ($post_disapprove_list as $post_id => $topic_id)
|
|
indvdum@0
|
820 |
{
|
|
indvdum@0
|
821 |
// If the count of disapproved posts for the topic is greater
|
|
indvdum@0
|
822 |
// than topic's real replies count, the whole topic is disapproved/deleted
|
|
indvdum@0
|
823 |
if (sizeof(array_keys($post_disapprove_list, $topic_id)) > $topic_replies_real[$topic_id])
|
|
indvdum@0
|
824 |
{
|
|
indvdum@0
|
825 |
// Don't write the log more than once for every topic
|
|
indvdum@0
|
826 |
if (!isset($disapprove_log_topics[$topic_id]))
|
|
indvdum@0
|
827 |
{
|
|
indvdum@0
|
828 |
// Build disapproved topics log
|
|
indvdum@0
|
829 |
$disapprove_log_topics[$topic_id] = array(
|
|
indvdum@0
|
830 |
'type' => 'topic',
|
|
indvdum@0
|
831 |
'post_subject' => $post_info[$post_id]['topic_title'],
|
|
indvdum@0
|
832 |
'forum_id' => $post_info[$post_id]['forum_id'],
|
|
indvdum@0
|
833 |
'topic_id' => 0, // useless to log a topic id, as it will be deleted
|
|
indvdum@0
|
834 |
);
|
|
indvdum@0
|
835 |
}
|
|
indvdum@0
|
836 |
}
|
|
indvdum@0
|
837 |
else
|
|
indvdum@0
|
838 |
{
|
|
indvdum@0
|
839 |
// Build disapproved posts log
|
|
indvdum@0
|
840 |
$disapprove_log_posts[] = array(
|
|
indvdum@0
|
841 |
'type' => 'post',
|
|
indvdum@0
|
842 |
'post_subject' => $post_info[$post_id]['post_subject'],
|
|
indvdum@0
|
843 |
'forum_id' => $post_info[$post_id]['forum_id'],
|
|
indvdum@0
|
844 |
'topic_id' => $post_info[$post_id]['topic_id'],
|
|
indvdum@0
|
845 |
);
|
|
indvdum@0
|
846 |
|
|
indvdum@0
|
847 |
}
|
|
indvdum@0
|
848 |
}
|
|
indvdum@0
|
849 |
|
|
indvdum@0
|
850 |
// Get disapproved posts/topics counts separately
|
|
indvdum@0
|
851 |
$num_disapproved_topics = sizeof($disapprove_log_topics);
|
|
indvdum@0
|
852 |
$num_disapproved_posts = sizeof($disapprove_log_posts);
|
|
indvdum@0
|
853 |
|
|
indvdum@0
|
854 |
// Build the whole log
|
|
indvdum@0
|
855 |
$disapprove_log = array_merge($disapprove_log_topics, $disapprove_log_posts);
|
|
indvdum@0
|
856 |
|
|
indvdum@0
|
857 |
// Unset unneeded arrays
|
|
indvdum@0
|
858 |
unset($post_data, $disapprove_log_topics, $disapprove_log_posts);
|
|
indvdum@0
|
859 |
|
|
indvdum@0
|
860 |
// Let's do the job - delete disapproved posts
|
|
indvdum@0
|
861 |
if (sizeof($post_disapprove_list))
|
|
indvdum@0
|
862 |
{
|
|
indvdum@0
|
863 |
if (!function_exists('delete_posts'))
|
|
indvdum@0
|
864 |
{
|
|
indvdum@0
|
865 |
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
|
indvdum@0
|
866 |
}
|
|
indvdum@0
|
867 |
|
|
indvdum@0
|
868 |
// We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts
|
|
indvdum@0
|
869 |
// Note: function delete_posts triggers related forums/topics sync,
|
|
indvdum@0
|
870 |
// so we don't need to call update_post_information later and to adjust real topic replies or forum topics count manually
|
|
indvdum@0
|
871 |
delete_posts('post_id', array_keys($post_disapprove_list));
|
|
indvdum@0
|
872 |
|
|
indvdum@0
|
873 |
foreach ($disapprove_log as $log_data)
|
|
indvdum@0
|
874 |
{
|
|
indvdum@0
|
875 |
add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED', $log_data['post_subject'], $disapprove_reason);
|
|
indvdum@0
|
876 |
}
|
|
indvdum@0
|
877 |
}
|
|
indvdum@0
|
878 |
|
|
indvdum@0
|
879 |
$messenger = new messenger();
|
|
indvdum@0
|
880 |
|
|
indvdum@0
|
881 |
// Notify Poster?
|
|
indvdum@0
|
882 |
if ($notify_poster)
|
|
indvdum@0
|
883 |
{
|
|
indvdum@0
|
884 |
$lang_reasons = array();
|
|
indvdum@0
|
885 |
|
|
indvdum@0
|
886 |
foreach ($post_info as $post_id => $post_data)
|
|
indvdum@0
|
887 |
{
|
|
indvdum@0
|
888 |
if ($post_data['poster_id'] == ANONYMOUS)
|
|
indvdum@0
|
889 |
{
|
|
indvdum@0
|
890 |
continue;
|
|
indvdum@0
|
891 |
}
|
|
indvdum@0
|
892 |
|
|
indvdum@0
|
893 |
if (isset($disapprove_reason_lang))
|
|
indvdum@0
|
894 |
{
|
|
indvdum@0
|
895 |
// Okay we need to get the reason from the posters language
|
|
indvdum@0
|
896 |
if (!isset($lang_reasons[$post_data['user_lang']]))
|
|
indvdum@0
|
897 |
{
|
|
indvdum@0
|
898 |
// Assign the current users translation as the default, this is not ideal but getting the board default adds another layer of complexity.
|
|
indvdum@0
|
899 |
$lang_reasons[$post_data['user_lang']] = $user->lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang];
|
|
indvdum@0
|
900 |
|
|
indvdum@0
|
901 |
// Only load up the language pack if the language is different to the current one
|
|
indvdum@0
|
902 |
if ($post_data['user_lang'] != $user->lang_name && file_exists($phpbb_root_path . '/language/' . $post_data['user_lang'] . '/mcp.' . $phpEx))
|
|
indvdum@0
|
903 |
{
|
|
indvdum@0
|
904 |
// Load up the language pack
|
|
indvdum@0
|
905 |
$lang = array();
|
|
indvdum@0
|
906 |
@include($phpbb_root_path . '/language/' . basename($post_data['user_lang']) . '/mcp.' . $phpEx);
|
|
indvdum@0
|
907 |
|
|
indvdum@0
|
908 |
// If we find the reason in this language pack use it
|
|
indvdum@0
|
909 |
if (isset($lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang]))
|
|
indvdum@0
|
910 |
{
|
|
indvdum@0
|
911 |
$lang_reasons[$post_data['user_lang']] = $lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang];
|
|
indvdum@0
|
912 |
}
|
|
indvdum@0
|
913 |
|
|
indvdum@0
|
914 |
unset($lang); // Free memory
|
|
indvdum@0
|
915 |
}
|
|
indvdum@0
|
916 |
}
|
|
indvdum@0
|
917 |
|
|
indvdum@0
|
918 |
$email_disapprove_reason = $lang_reasons[$post_data['user_lang']];
|
|
indvdum@0
|
919 |
$email_disapprove_reason .= ($reason) ? "\n\n" . $reason : '';
|
|
indvdum@0
|
920 |
}
|
|
indvdum@0
|
921 |
|
|
indvdum@0
|
922 |
$email_template = ($post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id']) ? 'topic_disapproved' : 'post_disapproved';
|
|
indvdum@0
|
923 |
|
|
indvdum@0
|
924 |
$messenger->template($email_template, $post_data['user_lang']);
|
|
indvdum@0
|
925 |
|
|
indvdum@0
|
926 |
$messenger->to($post_data['user_email'], $post_data['username']);
|
|
indvdum@0
|
927 |
$messenger->im($post_data['user_jabber'], $post_data['username']);
|
|
indvdum@0
|
928 |
|
|
indvdum@0
|
929 |
$messenger->assign_vars(array(
|
|
indvdum@0
|
930 |
'USERNAME' => htmlspecialchars_decode($post_data['username']),
|
|
indvdum@0
|
931 |
'REASON' => htmlspecialchars_decode($email_disapprove_reason),
|
|
indvdum@0
|
932 |
'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])),
|
|
indvdum@0
|
933 |
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title'])))
|
|
indvdum@0
|
934 |
);
|
|
indvdum@0
|
935 |
|
|
indvdum@0
|
936 |
$messenger->send($post_data['user_notify_type']);
|
|
indvdum@0
|
937 |
}
|
|
indvdum@0
|
938 |
|
|
indvdum@0
|
939 |
unset($lang_reasons);
|
|
indvdum@0
|
940 |
}
|
|
indvdum@0
|
941 |
unset($post_info, $disapprove_reason, $email_disapprove_reason, $disapprove_reason_lang);
|
|
indvdum@0
|
942 |
|
|
indvdum@0
|
943 |
$messenger->save_queue();
|
|
indvdum@0
|
944 |
|
|
indvdum@0
|
945 |
if ($num_disapproved_topics)
|
|
indvdum@0
|
946 |
{
|
|
indvdum@0
|
947 |
$success_msg = ($num_disapproved_topics == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
|
|
indvdum@0
|
948 |
}
|
|
indvdum@0
|
949 |
else
|
|
indvdum@0
|
950 |
{
|
|
indvdum@0
|
951 |
$success_msg = ($num_disapproved_posts == 1) ? 'POST_DISAPPROVED_SUCCESS' : 'POSTS_DISAPPROVED_SUCCESS';
|
|
indvdum@0
|
952 |
}
|
|
indvdum@0
|
953 |
}
|
|
indvdum@0
|
954 |
else
|
|
indvdum@0
|
955 |
{
|
|
indvdum@0
|
956 |
include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
|
indvdum@0
|
957 |
|
|
indvdum@0
|
958 |
display_reasons($reason_id);
|
|
indvdum@0
|
959 |
|
|
indvdum@0
|
960 |
$show_notify = false;
|
|
indvdum@0
|
961 |
|
|
indvdum@0
|
962 |
foreach ($post_info as $post_data)
|
|
indvdum@0
|
963 |
{
|
|
indvdum@0
|
964 |
if ($post_data['poster_id'] == ANONYMOUS)
|
|
indvdum@0
|
965 |
{
|
|
indvdum@0
|
966 |
continue;
|
|
indvdum@0
|
967 |
}
|
|
indvdum@0
|
968 |
else
|
|
indvdum@0
|
969 |
{
|
|
indvdum@0
|
970 |
$show_notify = true;
|
|
indvdum@0
|
971 |
break;
|
|
indvdum@0
|
972 |
}
|
|
indvdum@0
|
973 |
}
|
|
indvdum@0
|
974 |
|
|
indvdum@0
|
975 |
$template->assign_vars(array(
|
|
indvdum@0
|
976 |
'S_NOTIFY_POSTER' => $show_notify,
|
|
indvdum@0
|
977 |
'S_APPROVE' => false,
|
|
indvdum@0
|
978 |
'REASON' => $reason,
|
|
indvdum@0
|
979 |
'ADDITIONAL_MSG' => $additional_msg)
|
|
indvdum@0
|
980 |
);
|
|
indvdum@0
|
981 |
|
|
indvdum@0
|
982 |
confirm_box(false, 'DISAPPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html');
|
|
indvdum@0
|
983 |
}
|
|
indvdum@0
|
984 |
|
|
indvdum@0
|
985 |
$redirect = request_var('redirect', "index.$phpEx");
|
|
indvdum@0
|
986 |
$redirect = reapply_sid($redirect);
|
|
indvdum@0
|
987 |
|
|
indvdum@0
|
988 |
if (!$success_msg)
|
|
indvdum@0
|
989 |
{
|
|
indvdum@0
|
990 |
redirect($redirect);
|
|
indvdum@0
|
991 |
}
|
|
indvdum@0
|
992 |
else
|
|
indvdum@0
|
993 |
{
|
|
indvdum@0
|
994 |
meta_refresh(3, $redirect);
|
|
indvdum@0
|
995 |
trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
|
|
indvdum@0
|
996 |
}
|
|
indvdum@0
|
997 |
}
|
|
indvdum@0
|
998 |
|
|
indvdum@0
|
999 |
?> |