Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
mcp_post.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 /**
015 * @ignore
016 */
017 if (!defined('IN_PHPBB'))
018 {
019 exit;
020 }
021
022 /**
023 * Handling actions in post details screen
024 */
025 function mcp_post_details($id, $mode, $action)
026 {
027 global $phpEx, $phpbb_root_path, $config, $request;
028 global $template, $db, $user, $auth;
029 global $phpbb_dispatcher;
030
031 $user->add_lang('posting');
032
033 $post_id = $request->variable('p', 0);
034 $start = $request->variable('start', 0);
035
036 // Get post data
037 $post_info = phpbb_get_post_data(array($post_id), false, true);
038
039 add_form_key('mcp_post_details');
040
041 if (!sizeof($post_info))
042 {
043 trigger_error('POST_NOT_EXIST');
044 }
045
046 $post_info = $post_info[$post_id];
047 $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url());
048
049 switch ($action)
050 {
051 case 'whois':
052
053 if ($auth->acl_get('m_info', $post_info['forum_id']))
054 {
055 $ip = $request->variable('ip', '');
056 include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
057
058 $template->assign_vars(array(
059 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&p=$post_id") . '">', '</a>'),
060 'U_RETURN_POST' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&p=$post_id"),
061 'L_RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''),
062 'WHOIS' => user_ipwhois($ip),
063 ));
064 }
065
066 // We're done with the whois page so return
067 return;
068
069 break;
070
071 case 'chgposter':
072 case 'chgposter_ip':
073
074 if ($action == 'chgposter')
075 {
076 $username = $request->variable('username', '', true);
077 $sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
078 }
079 else
080 {
081 $new_user_id = $request->variable('u', 0);
082 $sql_where = 'user_id = ' . $new_user_id;
083 }
084
085 $sql = 'SELECT *
086 FROM ' . USERS_TABLE . '
087 WHERE ' . $sql_where;
088 $result = $db->sql_query($sql);
089 $row = $db->sql_fetchrow($result);
090 $db->sql_freeresult($result);
091
092 if (!$row)
093 {
094 trigger_error('NO_USER');
095 }
096
097 if ($auth->acl_get('m_chgposter', $post_info['forum_id']))
098 {
099 if (check_form_key('mcp_post_details'))
100 {
101 change_poster($post_info, $row);
102 }
103 else
104 {
105 trigger_error('FORM_INVALID');
106 }
107 }
108
109 break;
110
111 default:
112
113 /**
114 * This event allows you to handle custom post moderation options
115 *
116 * @event core.mcp_post_additional_options
117 * @var string action Post moderation action name
118 * @var array post_info Information on the affected post
119 * @since 3.1.5-RC1
120 */
121 $vars = array('action', 'post_info');
122 extract($phpbb_dispatcher->trigger_event('core.mcp_post_additional_options', compact($vars)));
123
124 break;
125 }
126
127 // Set some vars
128 $users_ary = $usernames_ary = array();
129 $attachments = $extensions = array();
130 $post_id = $post_info['post_id'];
131
132 // Get topic tracking info
133 if ($config['load_db_lastread'])
134 {
135 $tmp_topic_data = array($post_info['topic_id'] => $post_info);
136 $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']));
137 unset($tmp_topic_data);
138 }
139 else
140 {
141 $topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
142 }
143
144 $post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false;
145
146 // Process message, leave it uncensored
147 $parse_flags = ($post_info['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
148 $message = generate_text_for_display($post_info['post_text'], $post_info['bbcode_uid'], $post_info['bbcode_bitfield'], $parse_flags, false);
149
150 if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
151 {
152 $sql = 'SELECT *
153 FROM ' . ATTACHMENTS_TABLE . '
154 WHERE post_msg_id = ' . $post_id . '
155 AND in_message = 0
156 ORDER BY filetime DESC, post_msg_id ASC';
157 $result = $db->sql_query($sql);
158
159 while ($row = $db->sql_fetchrow($result))
160 {
161 $attachments[] = $row;
162 }
163 $db->sql_freeresult($result);
164
165 if (sizeof($attachments))
166 {
167 $user->add_lang('viewtopic');
168 $update_count = array();
169 parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
170 }
171
172 // Display not already displayed Attachments for this post, we already parsed them. ;)
173 if (!empty($attachments))
174 {
175 $template->assign_var('S_HAS_ATTACHMENTS', true);
176
177 foreach ($attachments as $attachment)
178 {
179 $template->assign_block_vars('attachment', array(
180 'DISPLAY_ATTACHMENT' => $attachment)
181 );
182 }
183 }
184 }
185
186 // Deleting information
187 if ($post_info['post_visibility'] == ITEM_DELETED && $post_info['post_delete_user'])
188 {
189 // User having deleted the post also being the post author?
190 if (!$post_info['post_delete_user'] || $post_info['post_delete_user'] == $post_info['poster_id'])
191 {
192 $display_username = get_username_string('full', $post_info['poster_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']);
193 }
194 else
195 {
196 $sql = 'SELECT user_id, username, user_colour
197 FROM ' . USERS_TABLE . '
198 WHERE user_id = ' . (int) $post_info['post_delete_user'];
199 $result = $db->sql_query($sql);
200 $user_delete_row = $db->sql_fetchrow($result);
201 $db->sql_freeresult($result);
202 $display_username = get_username_string('full', $post_info['post_delete_user'], $user_delete_row['username'], $user_delete_row['user_colour']);
203 }
204
205 $user->add_lang('viewtopic');
206 $l_deleted_by = $user->lang('DELETED_INFORMATION', $display_username, $user->format_date($post_info['post_delete_time'], false, true));
207 }
208 else
209 {
210 $l_deleted_by = '';
211 }
212
213 $mcp_post_template_data = array(
214 'U_MCP_ACTION' => "$url&i=main&quickmod=1&mode=post_details", // Use this for mode paramaters
215 'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters
216 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f={$post_info['forum_id']}"),
217
218 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
219 'S_CAN_CHGPOSTER' => $auth->acl_get('m_chgposter', $post_info['forum_id']),
220 'S_CAN_LOCK_POST' => $auth->acl_get('m_lock', $post_info['forum_id']),
221 'S_CAN_DELETE_POST' => $auth->acl_get('m_delete', $post_info['forum_id']),
222
223 'S_POST_REPORTED' => ($post_info['post_reported']) ? true : false,
224 'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE) ? true : false,
225 'S_POST_DELETED' => ($post_info['post_visibility'] == ITEM_DELETED) ? true : false,
226 'S_POST_LOCKED' => ($post_info['post_edit_locked']) ? true : false,
227 'S_USER_NOTES' => true,
228 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false,
229 'DELETED_MESSAGE' => $l_deleted_by,
230 'DELETE_REASON' => $post_info['post_delete_reason'],
231
232 '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']}") : '',
233 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp_chgposter&field=username&select_single=true'),
234 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),
235 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id),
236 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']),
237 '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']) : '',
238 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']),
239 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']),
240
241 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'),
242
243 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_info['forum_id']}&p=$post_id") . "#p$post_id\">", '</a>'),
244 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$post_info['forum_id']}&start={$start}") . '">', '</a>'),
245 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
246 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
247 'DELETED_IMG' => $user->img('icon_topic_deleted', $user->lang['POST_DELETED']),
248 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
249 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']),
250
251 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
252 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
253 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
254 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']),
255
256 'POST_PREVIEW' => $message,
257 'POST_SUBJECT' => $post_info['post_subject'],
258 'POST_DATE' => $user->format_date($post_info['post_time']),
259 'POST_IP' => $post_info['poster_ip'],
260 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
261 'POST_ID' => $post_info['post_id'],
262
263 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&i=$id&mode=$mode&lookup={$post_info['poster_ip']}#ip" : '',
264 'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$post_info['poster_ip']}") : '',
265 );
266
267 $s_additional_opts = false;
268
269 /**
270 * Event to add/modify MCP post template data
271 *
272 * @event core.mcp_post_template_data
273 * @var array post_info Array with the post information
274 * @var array mcp_post_template_data Array with the MCP post template data
275 * @var array attachments Array with the post attachments, if any
276 * @var bool s_additional_opts Must be set to true in extension if additional options are presented in MCP post panel
277 * @since 3.1.5-RC1
278 */
279 $vars = array(
280 'post_info',
281 'mcp_post_template_data',
282 'attachments',
283 's_additional_opts',
284 );
285 extract($phpbb_dispatcher->trigger_event('core.mcp_post_template_data', compact($vars)));
286
287 $template->assign_vars($mcp_post_template_data);
288 $template->assign_var('S_MCP_POST_ADDITIONAL_OPTS', $s_additional_opts);
289
290 unset($mcp_post_template_data);
291
292 // Get User Notes
293 $log_data = array();
294 $log_count = false;
295 view_log('user', $log_data, $log_count, $config['posts_per_page'], 0, 0, 0, $post_info['user_id']);
296
297 if (!empty($log_data))
298 {
299 $template->assign_var('S_USER_NOTES', true);
300
301 foreach ($log_data as $row)
302 {
303 $template->assign_block_vars('usernotes', array(
304 'REPORT_BY' => $row['username_full'],
305 'REPORT_AT' => $user->format_date($row['time']),
306 'ACTION' => $row['action'],
307 'ID' => $row['id'])
308 );
309 }
310 }
311
312 // Get Reports
313 if ($auth->acl_get('m_report', $post_info['forum_id']))
314 {
315 $sql = 'SELECT r.*, re.*, u.user_id, u.username
316 FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u, ' . REPORTS_REASONS_TABLE . " re
317 WHERE r.post_id = $post_id
318 AND r.reason_id = re.reason_id
319 AND u.user_id = r.user_id
320 ORDER BY r.report_time DESC";
321 $result = $db->sql_query($sql);
322
323 if ($row = $db->sql_fetchrow($result))
324 {
325 $template->assign_var('S_SHOW_REPORTS', true);
326
327 do
328 {
329 // If the reason is defined within the language file, we will use the localized version, else just use the database entry...
330 if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]))
331 {
332 $row['reson_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])];
333 $row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])];
334 }
335
336 $template->assign_block_vars('reports', array(
337 'REPORT_ID' => $row['report_id'],
338 'REASON_TITLE' => $row['reason_title'],
339 'REASON_DESC' => $row['reason_description'],
340 'REPORTER' => get_username_string('username', $row['user_id'], $row['username']),
341 'U_REPORTER' => get_username_string('profile', $row['user_id'], $row['username']),
342 'USER_NOTIFY' => ($row['user_notify']) ? true : false,
343 'REPORT_TIME' => $user->format_date($row['report_time']),
344 'REPORT_TEXT' => bbcode_nl2br(trim($row['report_text'])),
345 ));
346 }
347 while ($row = $db->sql_fetchrow($result));
348 }
349 $db->sql_freeresult($result);
350 }
351
352 // Get IP
353 if ($auth->acl_get('m_info', $post_info['forum_id']))
354 {
355 $rdns_ip_num = $request->variable('rdns', '');
356
357 if ($rdns_ip_num != 'all')
358 {
359 $template->assign_vars(array(
360 'U_LOOKUP_ALL' => "$url&i=main&mode=post_details&rdns=all")
361 );
362 }
363
364 // Get other users who've posted under this IP
365 $sql = 'SELECT poster_id, COUNT(poster_id) as postings
366 FROM ' . POSTS_TABLE . "
367 WHERE poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "'
368 GROUP BY poster_id
369 ORDER BY postings DESC";
370 $result = $db->sql_query($sql);
371
372 while ($row = $db->sql_fetchrow($result))
373 {
374 // Fill the user select list with users who have posted under this IP
375 if ($row['poster_id'] != $post_info['poster_id'])
376 {
377 $users_ary[$row['poster_id']] = $row;
378 }
379 }
380 $db->sql_freeresult($result);
381
382 if (sizeof($users_ary))
383 {
384 // Get the usernames
385 $sql = 'SELECT user_id, username
386 FROM ' . USERS_TABLE . '
387 WHERE ' . $db->sql_in_set('user_id', array_keys($users_ary));
388 $result = $db->sql_query($sql);
389
390 while ($row = $db->sql_fetchrow($result))
391 {
392 $users_ary[$row['user_id']]['username'] = $row['username'];
393 $usernames_ary[utf8_clean_string($row['username'])] = $users_ary[$row['user_id']];
394 }
395 $db->sql_freeresult($result);
396
397 foreach ($users_ary as $user_id => $user_row)
398 {
399 $template->assign_block_vars('userrow', array(
400 'USERNAME' => get_username_string('username', $user_id, $user_row['username']),
401 'NUM_POSTS' => $user_row['postings'],
402 'L_POST_S' => ($user_row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'],
403
404 'U_PROFILE' => get_username_string('profile', $user_id, $user_row['username']),
405 'U_SEARCHPOSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $user_id . '&sr=topics'))
406 );
407 }
408 }
409
410 // Get other IP's this user has posted under
411
412 // A compound index on poster_id, poster_ip (posts table) would help speed up this query a lot,
413 // but the extra size is only valuable if there are persons having more than a thousands posts.
414 // This is better left to the really really big forums.
415
416 $sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
417 FROM ' . POSTS_TABLE . '
418 WHERE poster_id = ' . $post_info['poster_id'] . "
419 GROUP BY poster_ip
420 ORDER BY postings DESC";
421 $result = $db->sql_query($sql);
422
423 while ($row = $db->sql_fetchrow($result))
424 {
425 $hostname = (($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') && $row['poster_ip']) ? @gethostbyaddr($row['poster_ip']) : '';
426
427 $template->assign_block_vars('iprow', array(
428 'IP' => $row['poster_ip'],
429 'HOSTNAME' => $hostname,
430 'NUM_POSTS' => $row['postings'],
431 'L_POST_S' => ($row['postings'] == 1) ? $user->lang['POST'] : $user->lang['POSTS'],
432
433 'U_LOOKUP_IP' => ($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') ? '' : "$url&i=$id&mode=post_details&rdns={$row['poster_ip']}#ip",
434 'U_WHOIS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$row['poster_ip']}"))
435 );
436 }
437 $db->sql_freeresult($result);
438
439 $user_select = '';
440
441 if (sizeof($usernames_ary))
442 {
443 ksort($usernames_ary);
444
445 foreach ($usernames_ary as $row)
446 {
447 $user_select .= '<option value="' . $row['poster_id'] . '">' . $row['username'] . "</option>\n";
448 }
449 }
450
451 $template->assign_var('S_USER_SELECT', $user_select);
452 }
453
454 }
455
456 /**
457 * Change a post's poster
458 */
459 function change_poster(&$post_info, $userdata)
460 {
461 global $auth, $db, $config, $phpbb_root_path, $phpEx, $user, $phpbb_log, $phpbb_dispatcher;
462
463 if (empty($userdata) || $userdata['user_id'] == $post_info['user_id'])
464 {
465 return;
466 }
467
468 $post_id = $post_info['post_id'];
469
470 $sql = 'UPDATE ' . POSTS_TABLE . "
471 SET poster_id = {$userdata['user_id']}
472 WHERE post_id = $post_id";
473 $db->sql_query($sql);
474
475 // Resync topic/forum if needed
476 if ($post_info['topic_last_post_id'] == $post_id || $post_info['forum_last_post_id'] == $post_id || $post_info['topic_first_post_id'] == $post_id)
477 {
478 sync('topic', 'topic_id', $post_info['topic_id'], false, false);
479 sync('forum', 'forum_id', $post_info['forum_id'], false, false);
480 }
481
482 // Adjust post counts... only if the post is approved (else, it was not added the users post count anyway)
483 if ($post_info['post_postcount'] && $post_info['post_visibility'] == ITEM_APPROVED)
484 {
485 $sql = 'UPDATE ' . USERS_TABLE . '
486 SET user_posts = user_posts - 1
487 WHERE user_id = ' . $post_info['user_id'] .'
488 AND user_posts > 0';
489 $db->sql_query($sql);
490
491 $sql = 'UPDATE ' . USERS_TABLE . '
492 SET user_posts = user_posts + 1
493 WHERE user_id = ' . $userdata['user_id'];
494 $db->sql_query($sql);
495 }
496
497 // Add posted to information for this topic for the new user
498 markread('post', $post_info['forum_id'], $post_info['topic_id'], time(), $userdata['user_id']);
499
500 // Remove the dotted topic option if the old user has no more posts within this topic
501 if ($config['load_db_track'] && $post_info['user_id'] != ANONYMOUS)
502 {
503 $sql = 'SELECT topic_id
504 FROM ' . POSTS_TABLE . '
505 WHERE topic_id = ' . $post_info['topic_id'] . '
506 AND poster_id = ' . $post_info['user_id'];
507 $result = $db->sql_query_limit($sql, 1);
508 $topic_id = (int) $db->sql_fetchfield('topic_id');
509 $db->sql_freeresult($result);
510
511 if (!$topic_id)
512 {
513 $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . '
514 WHERE user_id = ' . $post_info['user_id'] . '
515 AND topic_id = ' . $post_info['topic_id'];
516 $db->sql_query($sql);
517 }
518 }
519
520 // change the poster_id within the attachments table, else the data becomes out of sync and errors displayed because of wrong ownership
521 if ($post_info['post_attachment'])
522 {
523 $sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
524 SET poster_id = ' . $userdata['user_id'] . '
525 WHERE poster_id = ' . $post_info['user_id'] . '
526 AND post_msg_id = ' . $post_info['post_id'] . '
527 AND topic_id = ' . $post_info['topic_id'];
528 $db->sql_query($sql);
529 }
530
531 // refresh search cache of this post
532 $search_type = $config['search_type'];
533
534 if (class_exists($search_type))
535 {
536 // We do some additional checks in the module to ensure it can actually be utilised
537 $error = false;
538 $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
539
540 if (!$error && method_exists($search, 'destroy_cache'))
541 {
542 $search->destroy_cache(array(), array($post_info['user_id'], $userdata['user_id']));
543 }
544 }
545
546 $from_username = $post_info['username'];
547 $to_username = $userdata['username'];
548
549 /**
550 * This event allows you to perform additional tasks after changing a post's poster
551 *
552 * @event core.mcp_change_poster_after
553 * @var array userdata Information on a post's new poster
554 * @var array post_info Information on the affected post
555 * @since 3.1.6-RC1
556 * @changed 3.1.7-RC1 Change location to prevent post_info from being set to the new post information
557 */
558 $vars = array('userdata', 'post_info');
559 extract($phpbb_dispatcher->trigger_event('core.mcp_change_poster_after', compact($vars)));
560
561 // Renew post info
562 $post_info = phpbb_get_post_data(array($post_id), false, true);
563
564 if (!sizeof($post_info))
565 {
566 trigger_error('POST_NOT_EXIST');
567 }
568
569 $post_info = $post_info[$post_id];
570
571 // Now add log entry
572 $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MCP_CHANGE_POSTER', false, array(
573 'forum_id' => $post_info['forum_id'],
574 'topic_id' => $post_info['topic_id'],
575 'post_id' => $post_info['post_id'],
576 $post_info['topic_title'],
577 $from_username,
578 $to_username
579 ));
580 }
581