diff options
Diffstat (limited to 'phpBB/report.php')
-rw-r--r-- | phpBB/report.php | 90 |
1 files changed, 70 insertions, 20 deletions
diff --git a/phpBB/report.php b/phpBB/report.php index c909b4fcf3..3ea6bb40c5 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -1,10 +1,13 @@ <?php /** * -* @package phpBB3 -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -72,8 +75,14 @@ if ($post_id) trigger_error('POST_NOT_EXIST'); } - $forum_id = (int) ($report_data['forum_id']) ? $report_data['forum_id'] : $forum_id; - $topic_id = (int) $report_data['topic_id']; + $forum_id = (int) $report_data['forum_id']; + $topic_id = (int) $report_data['topic_id']; + $reported_post_text = $report_data['post_text']; + $reported_post_bitfield = $report_data['bbcode_bitfield']; + $reported_post_uid = $report_data['bbcode_uid']; + $reported_post_enable_bbcode = $report_data['enable_bbcode']; + $reported_post_enable_smilies = $report_data['enable_smilies']; + $reported_post_enable_magic_url = $report_data['enable_magic_url']; $sql = 'SELECT * FROM ' . FORUMS_TABLE . ' @@ -90,6 +99,24 @@ if ($post_id) // Check required permissions $acl_check_ary = array('f_list' => 'POST_NOT_EXIST', 'f_read' => 'USER_CANNOT_READ', 'f_report' => 'USER_CANNOT_REPORT'); + /** + * This event allows you to do extra auth checks and verify if the user + * has the required permissions + * + * @event core.report_post_auth + * @var array forum_data All data available from the forums table on this post's forum + * @var array report_data All data available from the topics and the posts tables on this post (and its topic) + * @var array acl_check_ary An array with the ACL to be tested. The evaluation is made in the same order as the array is sorted + * The key is the ACL name and the value is the language key for the error message. + * @since 3.1.3-RC1 + */ + $vars = array( + 'forum_data', + 'report_data', + 'acl_check_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.report_post_auth', compact($vars))); + foreach ($acl_check_ary as $acl => $error) { if (!$auth->acl_get($acl, $forum_id)) @@ -131,12 +158,18 @@ else $message .= '<br /><br />' . sprintf($user->lang['RETURN_PM'], '<a href="' . $redirect_url . '">', '</a>'); trigger_error($message); } + + $reported_post_text = $report_data['message_text']; + $reported_post_bitfield = $report_data['bbcode_bitfield']; + $reported_post_uid = $report_data['bbcode_uid']; + $reported_post_enable_bbcode = $report_data['enable_bbcode']; + $reported_post_enable_smilies = $report_data['enable_smilies']; + $reported_post_enable_magic_url = $report_data['enable_magic_url']; } if ($config['enable_post_confirm'] && !$user->data['is_registered']) { - include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); - $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']); + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); $captcha->init(CONFIRM_REPORT); } @@ -175,20 +208,28 @@ if ($submit && $reason_id) } $sql_ary = array( - 'reason_id' => (int) $reason_id, - 'post_id' => $post_id, - 'pm_id' => $pm_id, - 'user_id' => (int) $user->data['user_id'], - 'user_notify' => (int) $user_notify, - 'report_closed' => 0, - 'report_time' => (int) time(), - 'report_text' => (string) $report_text + 'reason_id' => (int) $reason_id, + 'post_id' => $post_id, + 'pm_id' => $pm_id, + 'user_id' => (int) $user->data['user_id'], + 'user_notify' => (int) $user_notify, + 'report_closed' => 0, + 'report_time' => (int) time(), + 'report_text' => (string) $report_text, + 'reported_post_text' => $reported_post_text, + 'reported_post_uid' => $reported_post_uid, + 'reported_post_bitfield' => $reported_post_bitfield, + 'reported_post_enable_bbcode' => $reported_post_enable_bbcode, + 'reported_post_enable_smilies' => $reported_post_enable_smilies, + 'reported_post_enable_magic_url' => $reported_post_enable_magic_url, ); $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $db->sql_query($sql); $report_id = $db->sql_nextid(); + $phpbb_notifications = $phpbb_container->get('notification_manager'); + if ($post_id) { $sql = 'UPDATE ' . POSTS_TABLE . ' @@ -207,6 +248,10 @@ if ($submit && $reason_id) $lang_return = $user->lang['RETURN_TOPIC']; $lang_success = $user->lang['POST_REPORTED_SUCCESS']; + + $phpbb_notifications->add_notifications('notification.type.report_post', array_merge($report_data, $row, $forum_data, array( + 'report_text' => $report_text, + ))); } else { @@ -233,6 +278,12 @@ if ($submit && $reason_id) $lang_return = $user->lang['RETURN_PM']; $lang_success = $user->lang['PM_REPORTED_SUCCESS']; + + $phpbb_notifications->add_notifications('notification.type.report_pm', array_merge($report_data, $row, array( + 'report_text' => $report_text, + 'from_user_id' => $report_data['author_id'], + 'report_id' => $report_id, + ))); } meta_refresh(3, $redirect_url); @@ -271,8 +322,9 @@ $template->assign_vars(array( 'S_HIDDEN_FIELDS' => (sizeof($s_hidden_fields)) ? $s_hidden_fields : null, 'S_NOTIFY' => $user_notify, - 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false) -); + 'S_CAN_NOTIFY' => ($user->data['is_registered']) ? true : false, + 'S_IN_REPORT' => true, +)); generate_forum_nav($forum_data); @@ -284,5 +336,3 @@ $template->set_filenames(array( ); page_footer(); - -?>
\ No newline at end of file |