diff options
Diffstat (limited to 'phpBB/includes/mcp/mcp_queue.php')
| -rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 95 | 
1 files changed, 59 insertions, 36 deletions
| diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 3567e545f0..f379392b12 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -35,14 +35,14 @@ class mcp_queue  	public function main($id, $mode)  	{ -		global $auth, $db, $user, $template, $cache, $request; +		global $auth, $db, $user, $template, $request;  		global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container;  		global $phpbb_dispatcher;  		include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); -		$forum_id = request_var('f', 0); -		$start = request_var('start', 0); +		$forum_id = $request->variable('f', 0); +		$start = $request->variable('start', 0);  		$this->page_title = 'MCP_QUEUE'; @@ -104,7 +104,7 @@ class mcp_queue  				if (!empty($topic_id_list) && $mode == 'deleted_topics')  				{ -					if (!function_exists('mcp_delete_topics')) +					if (!function_exists('mcp_delete_topic'))  					{  						global $phpbb_root_path, $phpEx;  						include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx); @@ -154,9 +154,10 @@ class mcp_queue  				$user->add_lang(array('posting', 'viewtopic')); -				$post_id = request_var('p', 0); -				$topic_id = request_var('t', 0); +				$post_id = $request->variable('p', 0); +				$topic_id = $request->variable('t', 0); +				/* @var $phpbb_notifications \phpbb\notification\manager */  				$phpbb_notifications = $phpbb_container->get('notification_manager');  				if ($topic_id) @@ -166,7 +167,7 @@ class mcp_queue  					{  						$post_id = (int) $topic_info[$topic_id]['topic_first_post_id']; -						$phpbb_notifications->mark_notifications_read('notification.type.topic_in_queue', $topic_id, $user->data['user_id']); +						$phpbb_notifications->mark_notifications('topic_in_queue', $topic_id, $user->data['user_id']);  					}  					else  					{ @@ -174,7 +175,7 @@ class mcp_queue  					}  				} -				$phpbb_notifications->mark_notifications_read('notification.type.post_in_queue', $post_id, $user->data['user_id']); +				$phpbb_notifications->mark_notifications('post_in_queue', $post_id, $user->data['user_id']);  				$post_info = phpbb_get_post_data(array($post_id), 'm_approve', true); @@ -194,7 +195,7 @@ class mcp_queue  					));  				} -				$extensions = $attachments = $topic_tracking_info = array(); +				$attachments = $topic_tracking_info = array();  				// Get topic tracking info  				if ($config['load_db_lastread']) @@ -216,8 +217,6 @@ class mcp_queue  				if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))  				{ -					$extensions = $cache->obtain_attach_extensions($post_info['forum_id']); -  					$sql = 'SELECT *  						FROM ' . ATTACHMENTS_TABLE . '  						WHERE post_msg_id = ' . $post_id . ' @@ -320,7 +319,7 @@ class mcp_queue  					'POST_SUBJECT'			=> $post_info['post_subject'],  					'POST_DATE'				=> $user->format_date($post_info['post_time']),  					'POST_IP'				=> $post_info['poster_ip'], -					'POST_IPADDR'			=> ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', +					'POST_IPADDR'			=> ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',  					'POST_ID'				=> $post_info['post_id'],  					'S_FIRST_POST'			=> ($post_info['topic_first_post_id'] == $post_id), @@ -342,6 +341,8 @@ class mcp_queue  				$topic_id = $request->variable('t', 0);  				$forum_info = array(); + +				/* @var $pagination \phpbb\pagination */  				$pagination = $phpbb_container->get('pagination');  				if ($topic_id) @@ -399,7 +400,6 @@ class mcp_queue  						trigger_error('NOT_MODERATOR');  					} -					$forum_info = $forum_info[$forum_id];  					$forum_list = $forum_id;  				} @@ -414,7 +414,6 @@ class mcp_queue  				$sort_by_sql = $sort_order_sql = array();  				phpbb_mcp_sorting($mode, $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); -				$forum_topics = ($total == -1) ? $forum_info['forum_topics_approved'] : $total;  				$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';  				$forum_names = array(); @@ -578,7 +577,7 @@ class mcp_queue  						'POST_SUBJECT'	=> ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'],  						'TOPIC_TITLE'	=> $row['topic_title'],  						'POST_TIME'		=> $user->format_date($row['post_time']), -						'ATTACH_ICON_IMG'	=> ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', +						'S_HAS_ATTACHMENTS'	=> $auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment'],  					));  				}  				unset($rowset, $forum_names); @@ -618,17 +617,18 @@ class mcp_queue  	*/  	static public function approve_posts($action, $post_id_list, $id, $mode)  	{ -		global $db, $template, $user, $config, $request, $phpbb_container, $phpbb_dispatcher; -		global $phpEx, $phpbb_root_path; +		global $template, $user, $request, $phpbb_container, $phpbb_dispatcher; +		global $phpEx, $phpbb_root_path, $phpbb_log;  		if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))  		{ +			send_status_line(403, 'Forbidden');  			trigger_error('NOT_AUTHORISED');  		}  		$redirect = $request->variable('redirect', build_url(array('quickmod')));  		$redirect = reapply_sid($redirect); -		$success_msg = $post_url = ''; +		$post_url = '';  		$approve_log = array();  		$num_topics = 0; @@ -677,10 +677,12 @@ class mcp_queue  				$approve_log[] = array(  					'forum_id'		=> $post_data['forum_id'],  					'topic_id'		=> $post_data['topic_id'], +					'post_id'		=> $post_id,  					'post_subject'	=> $post_data['post_subject'],  				);  			} +			/* @var $phpbb_content_visibility \phpbb\content_visibility */  			$phpbb_content_visibility = $phpbb_container->get('content.visibility');  			foreach ($topic_info as $topic_id => $topic_data)  			{ @@ -689,12 +691,18 @@ class mcp_queue  			foreach ($approve_log as $log_data)  			{ -				add_log('mod', $log_data['forum_id'], $log_data['topic_id'], 'LOG_POST_' . strtoupper($action) . 'D', $log_data['post_subject']); +				$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_POST_' . strtoupper($action) . 'D', false, array( +					'forum_id' => $log_data['forum_id'], +					'topic_id' => $log_data['topic_id'], +					'post_id'  => $log_data['post_id'], +					$log_data['post_subject'] +				));  			}  			// Only send out the mails, when the posts are being approved  			if ($action == 'approve')  			{ +				/* @var $phpbb_notifications \phpbb\notification\manager */  				$phpbb_notifications = $phpbb_container->get('notification_manager');  				// Handle notifications @@ -731,7 +739,7 @@ class mcp_queue  					$phpbb_notifications->add_notifications(array('notification.type.quote'), $post_data);  					$phpbb_notifications->delete_notifications('notification.type.post_in_queue', $post_id); -					$phpbb_notifications->mark_notifications_read(array( +					$phpbb_notifications->mark_notifications(array(  						'notification.type.quote',  						'notification.type.bookmark',  						'notification.type.post', @@ -865,11 +873,12 @@ class mcp_queue  	*/  	static public function approve_topics($action, $topic_id_list, $id, $mode)  	{ -		global $db, $template, $user, $config; +		global $db, $template, $user, $phpbb_log;  		global $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_dispatcher;  		if (!phpbb_check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve')))  		{ +			send_status_line(403, 'Forbidden');  			trigger_error('NOT_AUTHORISED');  		} @@ -892,6 +901,7 @@ class mcp_queue  		{  			$notify_poster = ($action == 'approve' && isset($_REQUEST['notify_poster'])) ? true : false; +			/* @var $phpbb_content_visibility \phpbb\content_visibility */  			$phpbb_content_visibility = $phpbb_container->get('content.visibility');  			$first_post_ids = array(); @@ -916,7 +926,11 @@ class mcp_queue  			foreach ($approve_log as $log_data)  			{ -				add_log('mod', $log_data['forum_id'], $log_data['topic_id'], 'LOG_TOPIC_' . strtoupper($action) . 'D', $log_data['topic_title']); +				$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_' . strtoupper($action) . 'D', false, array( +					'forum_id' => $log_data['forum_id'], +					'topic_id' => $log_data['topic_id'], +					$log_data['topic_title'] +				));  			}  			// Only send out the mails, when the posts are being approved @@ -935,6 +949,7 @@ class mcp_queue  				$db->sql_freeresult($result);  				// Handle notifications +				/* @var $phpbb_notifications \phpbb\notification\manager */  				$phpbb_notifications = $phpbb_container->get('notification_manager');  				foreach ($topic_info as $topic_id => $topic_data) @@ -961,8 +976,8 @@ class mcp_queue  						), $topic_data);  					} -					$phpbb_notifications->mark_notifications_read('notification.type.quote', $topic_data['post_id'], $user->data['user_id']); -					$phpbb_notifications->mark_notifications_read('notification.type.topic', $topic_id, $user->data['user_id']); +					$phpbb_notifications->mark_notifications('quote', $topic_data['post_id'], $user->data['user_id']); +					$phpbb_notifications->mark_notifications('topic', $topic_id, $user->data['user_id']);  					if ($notify_poster)  					{ @@ -1056,11 +1071,12 @@ class mcp_queue  	*/  	static public function disapprove_posts($post_id_list, $id, $mode)  	{ -		global $db, $template, $user, $config, $phpbb_container, $phpbb_dispatcher; -		global $phpEx, $phpbb_root_path, $request; +		global $db, $template, $user, $phpbb_container, $phpbb_dispatcher; +		global $phpEx, $phpbb_root_path, $request, $phpbb_log;  		if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))  		{ +			send_status_line(403, 'Forbidden');  			trigger_error('NOT_AUTHORISED');  		} @@ -1068,7 +1084,7 @@ class mcp_queue  		$redirect = reapply_sid($redirect);  		$reason = $request->variable('reason', '', true);  		$reason_id = $request->variable('reason_id', 0); -		$success_msg = $additional_msg = ''; +		$additional_msg = '';  		$s_hidden_fields = build_hidden_fields(array(  			'i'				=> $id, @@ -1126,7 +1142,7 @@ class mcp_queue  		if (confirm_box(true))  		{ -			$disapprove_log = $disapprove_log_topics = $disapprove_log_posts = array(); +			$disapprove_log_topics = $disapprove_log_posts = array();  			$topic_posts_unapproved = $post_disapprove_list = $topic_information = array();  			// Build a list of posts to be disapproved and get the related topics real replies count @@ -1217,16 +1233,28 @@ class mcp_queue  					if ($is_disapproving)  					{  						$l_log_message = ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED'; -						add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $l_log_message, $log_data['post_subject'], $disapprove_reason, $log_data['post_username']); +						$phpbb_log->add('mod', $user->data['user_id'], $user->ip, $l_log_message, false, array( +							'forum_id' => $log_data['forum_id'], +							'topic_id' => $log_data['topic_id'], +							$log_data['post_subject'], +							$disapprove_reason, +							$log_data['post_username'] +						));  					}  					else  					{  						$l_log_message = ($log_data['type'] == 'topic') ? 'LOG_DELETE_TOPIC' : 'LOG_DELETE_POST'; -						add_log('mod', $log_data['forum_id'], $log_data['topic_id'], $l_log_message, $log_data['post_subject'], $log_data['post_username']); +						$phpbb_log->add('mod', $user->data['user_id'], $user->ip, $l_log_message, false, array( +							'forum_id' => $log_data['forum_id'], +							'topic_id' => $log_data['topic_id'], +							$log_data['post_subject'], +							$log_data['post_username'] +						));  					}  				}  			} +			/* @var $phpbb_notifications \phpbb\notification\manager */  			$phpbb_notifications = $phpbb_container->get('notification_manager');  			$lang_reasons = array(); @@ -1388,11 +1416,6 @@ class mcp_queue  		}  		else  		{ -			if (!function_exists('display_reasons')) -			{ -				include($phpbb_root_path . 'includes/functions_display.' . $phpEx); -			} -  			$show_notify = false;  			foreach ($post_info as $post_data) @@ -1412,7 +1435,7 @@ class mcp_queue  			$confirm_template = 'mcp_approve.html';  			if ($is_disapproving)  			{ -				display_reasons($reason_id); +				$phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id);  			}  			else  			{ | 
