~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/php/phpBB3/includes/mcp/mcp_queue.php

  • Committer: dcoles
  • Date: 2008-02-13 04:10:55 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:443
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0

Show diffs side-by-side

added added

removed removed

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