phpBB

Code Changes

File: includes/mcp/mcp_queue.php

  Unmodified   Added   Modified   Removed
Line 35Line 35

public function main($id, $mode)
{


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);


		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';



$this->page_title = 'MCP_QUEUE';


Line 72Line 72
			case 'delete':
$post_id_list = $request->variable('post_id_list', array(0));
$topic_id_list = $request->variable('topic_id_list', array(0));

			case 'delete':
$post_id_list = $request->variable('post_id_list', array(0));
$topic_id_list = $request->variable('topic_id_list', array(0));

 
				$delete_reason = $request->variable('delete_reason', '', true);


if (!empty($post_id_list))
{


if (!empty($post_id_list))
{

Line 80Line 81
						global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
}

						global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
}

					mcp_delete_post($post_id_list, false, '', $action);

					mcp_delete_post($post_id_list, false, $delete_reason, $action);

				}
else if (!empty($topic_id_list))
{

				}
else if (!empty($topic_id_list))
{

Line 89Line 90
						global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
}

						global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
}

					mcp_delete_topic($topic_id_list, false, '', $action);

					mcp_delete_topic($topic_id_list, false, $delete_reason, $action);

				}
else
{

				}
else
{

Line 103Line 104

if (!empty($topic_id_list) && $mode == 'deleted_topics')
{


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);

					{
global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);

Line 153Line 154

$user->add_lang(array('posting', 'viewtopic'));



$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)

				$phpbb_notifications = $phpbb_container->get('notification_manager');

if ($topic_id)

Line 165Line 167
					{
$post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];


					{
$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
{

					}
else
{

Line 173Line 175
					}
}


					}
}


				$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);



$post_info = phpbb_get_post_data(array($post_id), 'm_approve', true);


Line 193Line 195
					));
}


					));
}


				$extensions = $attachments = $topic_tracking_info = array();

				$attachments = $topic_tracking_info = array();


// Get topic tracking info
if ($config['load_db_lastread'])


// Get topic tracking info
if ($config['load_db_lastread'])

Line 215Line 217

if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{


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 . '

					$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE post_msg_id = ' . $post_id . '

Line 283Line 283
				$template->assign_vars(array(
'S_MCP_QUEUE' => true,
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"),

				$template->assign_vars(array(
'S_MCP_QUEUE' => true,
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f=$forum_id"),

 
					'S_CAN_DELETE_POST'		=> $auth->acl_get('m_delete', $post_info['forum_id']),

					'S_CAN_VIEWIP'			=> $auth->acl_get('m_info', $post_info['forum_id']),
'S_POST_REPORTED' => $post_info['post_reported'],
'S_POST_UNAPPROVED' => $post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE,

					'S_CAN_VIEWIP'			=> $auth->acl_get('m_info', $post_info['forum_id']),
'S_POST_REPORTED' => $post_info['post_reported'],
'S_POST_UNAPPROVED' => $post_info['post_visibility'] == ITEM_UNAPPROVED || $post_info['post_visibility'] == ITEM_REAPPROVE,

Line 318Line 319
					'POST_SUBJECT'			=> $post_info['post_subject'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],

					'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),


					'POST_ID'				=> $post_info['post_id'],
'S_FIRST_POST' => ($post_info['topic_first_post_id'] == $post_id),


Line 340Line 341

$topic_id = $request->variable('t', 0);
$forum_info = array();


$topic_id = $request->variable('t', 0);
$forum_info = array();

 

/* @var $pagination \phpbb\pagination */

				$pagination = $phpbb_container->get('pagination');

if ($topic_id)

				$pagination = $phpbb_container->get('pagination');

if ($topic_id)

Line 397Line 400
						trigger_error('NOT_MODERATOR');
}


						trigger_error('NOT_MODERATOR');
}


					$forum_info = $forum_info[$forum_id];

 
					$forum_list = $forum_id;
}

$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
foreach ($forum_list_approve as $row)
{

					$forum_list = $forum_id;
}

$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
foreach ($forum_list_approve as $row)
{

					$forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat('&nbsp; &nbsp;', $row['padding']) . $row['forum_name'] . '</option>';

					$forum_options .= '<option value="' . $row['forum_id'] . '"' . (($forum_id == $row['forum_id']) ? ' selected="selected"' : '') . '>' . str_repeat('&nbsp; &nbsp;', $row['padding']) . truncate_string($row['forum_name'], 30, 255, false, $user->lang['ELLIPSIS']) . '</option>';

				}

$sort_days = $total = 0;

				}

$sort_days = $total = 0;

Line 412Line 414
				$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);


				$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();

				$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';

$forum_names = array();

Line 576Line 577
						'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']),

						'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);

					));
}
unset($rowset, $forum_names);

Line 616Line 617
	*/
static public function approve_posts($action, $post_id_list, $id, $mode)
{

	*/
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')))
{


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);

			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;


		$approve_log = array();
$num_topics = 0;


Line 675Line 677
				$approve_log[] = array(
'forum_id' => $post_data['forum_id'],
'topic_id' => $post_data['topic_id'],

				$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'],
);
}


					'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)
{

			$phpbb_content_visibility = $phpbb_container->get('content.visibility');
foreach ($topic_info as $topic_id => $topic_data)
{

Line 687Line 691

foreach ($approve_log as $log_data)
{


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')
{

			}

// 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

				$phpbb_notifications = $phpbb_container->get('notification_manager');

// Handle notifications

Line 729Line 739
					$phpbb_notifications->add_notifications(array('notification.type.quote'), $post_data);
$phpbb_notifications->delete_notifications('notification.type.post_in_queue', $post_id);


					$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',

						'notification.type.quote',
'notification.type.bookmark',
'notification.type.post',

Line 863Line 873
	*/
static public function approve_topics($action, $topic_id_list, $id, $mode)
{

	*/
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')))
{

		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');
}


			trigger_error('NOT_AUTHORISED');
}


Line 890Line 901
		{
$notify_poster = ($action == 'approve' && isset($_REQUEST['notify_poster'])) ? true : false;


		{
$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();


			$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$first_post_ids = array();


Line 914Line 926

foreach ($approve_log as $log_data)
{


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

			}

// Only send out the mails, when the posts are being approved

Line 933Line 949
				$db->sql_freeresult($result);

// Handle notifications

				$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)

				$phpbb_notifications = $phpbb_container->get('notification_manager');

foreach ($topic_info as $topic_id => $topic_data)

Line 959Line 976
						), $topic_data);
}


						), $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)
{


if ($notify_poster)
{

Line 1054Line 1071
	*/
static public function disapprove_posts($post_id_list, $id, $mode)
{

	*/
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')))
{


if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
{

 
			send_status_line(403, 'Forbidden');

			trigger_error('NOT_AUTHORISED');
}


			trigger_error('NOT_AUTHORISED');
}


Line 1066Line 1084
		$redirect = reapply_sid($redirect);
$reason = $request->variable('reason', '', true);
$reason_id = $request->variable('reason_id', 0);

		$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,


$s_hidden_fields = build_hidden_fields(array(
'i' => $id,

Line 1124Line 1142

if (confirm_box(true))
{


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
foreach ($post_info as $post_id => $post_data)
{

			$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
foreach ($post_info as $post_id => $post_data)
{

 
				if ($mode === 'unapproved_topics' && $post_data['post_visibility'] == ITEM_APPROVED)
{
continue;
}


				$post_disapprove_list[$post_id] = $post_data['topic_id'];
if (!isset($topic_posts_unapproved[$post_data['topic_id']]))
{

				$post_disapprove_list[$post_id] = $post_data['topic_id'];
if (!isset($topic_posts_unapproved[$post_data['topic_id']]))
{

Line 1137Line 1160
					$topic_posts_unapproved[$post_data['topic_id']] = 0;
}
$topic_posts_unapproved[$post_data['topic_id']]++;

					$topic_posts_unapproved[$post_data['topic_id']] = 0;
}
$topic_posts_unapproved[$post_data['topic_id']]++;

 
			}

// Do not try to disapprove if no posts are selected
if (empty($post_disapprove_list))
{
trigger_error('NO_POST_SELECTED');

			}

// Now we build the log array

			}

// Now we build the log array

Line 1204Line 1233
					if ($is_disapproving)
{
$l_log_message = ($log_data['type'] == 'topic') ? 'LOG_TOPIC_DISAPPROVED' : 'LOG_POST_DISAPPROVED';

					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';

					}
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();

			$phpbb_notifications = $phpbb_container->get('notification_manager');

$lang_reasons = array();

Line 1240Line 1281
						continue;
}


						continue;
}


					$post_data['disapprove_reason'] = '';

					$post_data['disapprove_reason'] = $disapprove_reason;

					if (isset($disapprove_reason_lang))
{
// Okay we need to get the reason from the posters language

					if (isset($disapprove_reason_lang))
{
// Okay we need to get the reason from the posters language

Line 1375Line 1416
		}
else
{

		}
else
{

			if (!function_exists('display_reasons'))
{
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}


 
			$show_notify = false;

foreach ($post_info as $post_data)

			$show_notify = false;

foreach ($post_info as $post_data)

Line 1399Line 1435
			$confirm_template = 'mcp_approve.html';
if ($is_disapproving)
{

			$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
{

			}
else
{