diff options
Diffstat (limited to 'phpBB/includes/mcp/mcp_reports.php')
| -rw-r--r-- | phpBB/includes/mcp/mcp_reports.php | 63 | 
1 files changed, 57 insertions, 6 deletions
| diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index bcfbd25c0f..45265c89e7 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -74,17 +74,66 @@ class mcp_reports  				// closed reports are accessed by report id  				$report_id = $request->variable('r', 0); -				$sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, r.reported_post_uid, r.reported_post_bitfield, r.reported_post_enable_magic_url, r.reported_post_enable_smilies, r.reported_post_enable_bbcode, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour -					FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u -					WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . ' +				$sql_ary = array( +					'SELECT'	=> 'r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, r.reported_post_uid, r.reported_post_bitfield, r.reported_post_enable_magic_url, r.reported_post_enable_smilies, r.reported_post_enable_bbcode, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour', + +					'FROM'		=> array( +						REPORTS_TABLE			=> 'r', +						REPORTS_REASONS_TABLE	=> 'rr', +						USERS_TABLE				=> 'u', +					), + +					'WHERE'		=> (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '  						AND rr.reason_id = r.reason_id  						AND r.user_id = u.user_id -						AND r.pm_id = 0 -					ORDER BY report_closed ASC'; +						AND r.pm_id = 0', + +					'ORDER_BY'	=> 'report_closed ASC', +				); + +				/** +				* Allow changing the query to obtain the user-submitted report. +				* +				* @event core.mcp_reports_report_details_query_before +				* @var	array	sql_ary			The array in the format of the query builder with the query +				* @var	mixed	forum_id		The forum_id, the number in the f GET parameter +				* @var	int		post_id			The post_id of the report being viewed (if 0, it is meaningless) +				* @var	int		report_id		The report_id of the report being viewed +				* @since 3.1.5-RC1 +				*/ +				$vars = array( +					'sql_ary', +					'forum_id', +					'post_id', +					'report_id', +				); +				extract($phpbb_dispatcher->trigger_event('core.mcp_reports_report_details_query_before', compact($vars))); + +				$sql = $db->sql_build_query('SELECT', $sql_ary);  				$result = $db->sql_query_limit($sql, 1);  				$report = $db->sql_fetchrow($result);  				$db->sql_freeresult($result); +				/** +				* Allow changing the data obtained from the user-submitted report. +				* +				* @event core.mcp_reports_report_details_query_after +				* @var	array	sql_ary		The array in the format of the query builder with the query that had been executted +				* @var	mixed	forum_id	The forum_id, the number in the f GET parameter +				* @var	int		post_id		The post_id of the report being viewed (if 0, it is meaningless) +				* @var	int		report_id	The report_id of the report being viewed +				* @var	int		report		The query's resulting row. +				* @since 3.1.5-RC1 +				*/ +				$vars = array( +					'sql_ary', +					'forum_id', +					'post_id', +					'report_id', +					'report', +				); +				extract($phpbb_dispatcher->trigger_event('core.mcp_reports_report_details_query_after', compact($vars))); +  				if (!$report)  				{  					trigger_error('NO_REPORT'); @@ -93,7 +142,7 @@ class mcp_reports  				/* @var $phpbb_notifications \phpbb\notification\manager */  				$phpbb_notifications = $phpbb_container->get('notification_manager'); -				$phpbb_notifications->mark_notifications_read('notification.type.report_post', $post_id, $user->data['user_id']); +				$phpbb_notifications->mark_notifications('report_post', $post_id, $user->data['user_id']);  				if (!$report_id && $report['report_closed'])  				{ @@ -491,6 +540,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)  	{  		$post_id_list[] = $row[$id_column];  	} +	$db->sql_freeresult($result);  	$post_id_list = array_unique($post_id_list);  	if ($pm) @@ -666,6 +716,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)  				$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_REPORT_' .  strtoupper($action) . 'D', false, array(  					'forum_id' => $post_info[$report['post_id']]['forum_id'],  					'topic_id' => $post_info[$report['post_id']]['topic_id'], +					'post_id'  => $report['post_id'],  					$post_info[$report['post_id']]['post_subject']  				));  				$phpbb_notifications->delete_notifications('notification.type.report_post', $report['post_id']); | 
