phpBB

Code Changes

File: includes/mcp/mcp_topic.php

  Unmodified   Added   Modified   Removed
Line 54Line 54
	$sort			= isset($_POST['sort']) ? true : false;
$submitted_id_list = $request->variable('post_ids', array(0));
$checked_ids = $post_id_list = $request->variable('post_id_list', array(0));

	$sort			= isset($_POST['sort']) ? true : false;
$submitted_id_list = $request->variable('post_ids', array(0));
$checked_ids = $post_id_list = $request->variable('post_id_list', array(0));

 
	$view		= $request->variable('view', '');


// Resync Topic?
if ($action == 'resync')


// Resync Topic?
if ($action == 'resync')

Line 179Line 180
	{
$rowset[] = $row;
$post_id_list[] = $row['post_id'];

	{
$rowset[] = $row;
$post_id_list[] = $row['post_id'];

 
		$rowset_posttime['post_time'] = $row['post_time'];

	}
$db->sql_freeresult($result);


	}
$db->sql_freeresult($result);


Line 192Line 194
	else
{
$topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id);

	else
{
$topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id);

 
	}

$first_unread = $post_unread = false;

$post_unread = (isset($topic_tracking_info[$topic_id]) && $rowset_posttime['post_time'] > $topic_tracking_info[$topic_id]) ? true : false;

$s_first_unread = false;
if (!$first_unread && $post_unread)
{
$s_first_unread = $first_unread = true;

	}

$has_unapproved_posts = $has_deleted_posts = false;

	}

$has_unapproved_posts = $has_deleted_posts = false;

Line 242Line 254
	);
extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_post_data', compact($vars)));


	);
extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_post_data', compact($vars)));


	foreach ($rowset as $i => $row)

	foreach ($rowset as $current_row_number => $row)

	{
$message = $row['post_text'];
$post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title'];

	{
$message = $row['post_text'];
$post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title'];

Line 287Line 299
			'S_POST_DELETED'	=> ($row['post_visibility'] == ITEM_DELETED && $auth->acl_get('m_approve', $topic_info['forum_id'])),
'S_CHECKED' => (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false,
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,

			'S_POST_DELETED'	=> ($row['post_visibility'] == ITEM_DELETED && $auth->acl_get('m_approve', $topic_info['forum_id'])),
'S_CHECKED' => (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false,
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,

 
			'S_FIRST_UNREAD'	=> $s_first_unread,
'S_UNREAD_VIEW' => $view == 'unread',





			'U_POST_DETAILS'	=> "$url&i=$id&p={$row['post_id']}&mode=post_details" . (($forum_id) ? "&f=$forum_id" : ''),
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '',
'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '',


			'U_POST_DETAILS'	=> "$url&i=$id&p={$row['post_id']}&mode=post_details",
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&p=' . $row['post_id']) : '',
'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&p=' . $row['post_id']) : '',
'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'],

		);

/**

		);

/**

Line 336Line 351
			}
}


			}
}


		unset($rowset[$i]);

		unset($rowset[$current_row_number]);

	}

// Display topic icons for split topic

	}

// Display topic icons for split topic

Line 379Line 394
		$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $posts_per_page, $start);
}


		$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $posts_per_page, $start);
}


	$template->assign_vars(array(

	$topic_row = [

		'TOPIC_TITLE'		=> $topic_info['topic_title'],

		'TOPIC_TITLE'		=> $topic_info['topic_title'],

		'U_VIEW_TOPIC'		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']),

		'U_VIEW_TOPIC'		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_info['topic_id']),





		'TO_TOPIC_ID'		=> $to_topic_id,
'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_topic_info['forum_id'] . '&amp;t=' . $to_topic_id) . '">' . $to_topic_info['topic_title'] . '</a>') : '',

		'TO_TOPIC_ID'		=> $to_topic_id ?: '',
'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $to_topic_id) . '">' . $to_topic_info['topic_title'] . '</a>') : '',


'SPLIT_SUBJECT' => $subject,
'POSTS_PER_PAGE' => $posts_per_page,


'SPLIT_SUBJECT' => $subject,
'POSTS_PER_PAGE' => $posts_per_page,

Line 416Line 431

'U_SELECT_TOPIC' => "$url&amp;i=$id&amp;mode=forum_view&amp;action=merge_select" . (($forum_id) ? "&amp;f=$forum_id" : ''),



'U_SELECT_TOPIC' => "$url&amp;i=$id&amp;mode=forum_view&amp;action=merge_select" . (($forum_id) ? "&amp;f=$forum_id" : ''),


		'RETURN_TOPIC'		=> sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_info['forum_id']}&amp;t={$topic_info['topic_id']}&amp;start=$start") . '">', '</a>'),

		'RETURN_TOPIC'		=> sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$topic_info['topic_id']}&amp;start=$start") . '">', '</a>'),

		'RETURN_FORUM'		=> sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$topic_info['forum_id']}&amp;start=$start") . '">', '</a>'),

'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total),

		'RETURN_FORUM'		=> sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$topic_info['forum_id']}&amp;start=$start") . '">', '</a>'),

'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total),

	));











































	];

/**
* Event to modify the template data block for topic data output in the MCP
*
* @event core.mcp_topic_review_modify_topic_row
* @var string action Moderation action type to be performed with the topic
* @var bool has_unapproved_posts Flag indicating if the topic has unapproved posts
* @var int icon_id Split topic icon ID
* @var int id ID of the tab we are displaying
* @var string mode Mode of the MCP page we are displaying
* @var int topic_id The topic ID we are currently reviewing
* @var int forum_id The forum ID we are currently in
* @var bool s_topic_icons Flag indicating if split topic icon to be displayed
* @var int start Start item of this page
* @var string subject Subject of the topic to be split
* @var array topic_info Array with topic data
* @var int to_forum_id Forum id the topic is being moved to
* @var int to_topic_id Topic ID the topic is being merged with
* @var array topic_row Topic template data array
* @var int total Total posts count
* @since 3.3.5-RC1
*/
$vars = [
'action',
'has_unapproved_posts',
'icon_id',
'id',
'mode',
'topic_id',
'forum_id',
's_topic_icons',
'start',
'subject',
'topic_info',
'to_forum_id',
'to_topic_id',
'topic_row',
'total',
];
extract($phpbb_dispatcher->trigger_event('core.mcp_topic_review_modify_topic_row', compact($vars)));

$template->assign_vars($topic_row);

}

/**

}

/**

Line 456Line 513

$post_info = $post_info[$post_id];
$subject = trim($subject);


$post_info = $post_info[$post_id];
$subject = trim($subject);

 

/**
* Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR.
* Using their Numeric Character Reference's Hexadecimal notation.
*/
$subject = utf8_encode_ucr($subject);


// Make some tests
if (!$subject)


// Make some tests
if (!$subject)

Line 590Line 653
			$topic_info['topic_title']
));


			$topic_info['topic_title']
));


		// Change topic title of first post
$sql = 'UPDATE ' . POSTS_TABLE . "
SET post_subject = '" . $db->sql_escape($subject) . "'





		// Change topic title of first post and write icon_id to post
$sql_ary = [
'post_subject' => $subject,
'icon_id' => $icon_id,
];
$sql = 'UPDATE ' . POSTS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "

			WHERE post_id = {$post_id_list[0]}";
$db->sql_query($sql);


			WHERE post_id = {$post_id_list[0]}";
$db->sql_query($sql);


Line 684Line 751

// Update forum statistics
$config->increment('num_topics', 1, false);


// Update forum statistics
$config->increment('num_topics', 1, false);

 
		sync('forum', 'forum_id', [$to_forum_id], true, true);


// Link back to both topics


// Link back to both topics

		$return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&amp;t=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
$redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");

		$return_link = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $post_info['topic_id']) . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $to_topic_id) . '">', '</a>');
$redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?t=$to_topic_id");

		$redirect = reapply_sid($redirect);

		$redirect = reapply_sid($redirect);

 

/**
* Event to access topic data after split
*
* @event core.mcp_topic_split_topic_after
* @var string action Split action type to be performed with the topic
* @var int topic_id The topic ID we are currently splitting
* @var int forum_id The forum ID we are currently in
* @var int start Start item of this page
* @var string subject Subject of the topic to be split
* @var array topic_info Array with topic data
* @var int to_forum_id Forum id the topic is being moved to
* @var int to_topic_id Topic ID the topic is being split to
* @since 3.3.5-RC1
*/
$vars = [
'action',
'topic_id',
'forum_id',
'start',
'subject',
'topic_info',
'to_forum_id',
'to_topic_id',
];
extract($phpbb_dispatcher->trigger_event('core.mcp_topic_split_topic_after', compact($vars)));


meta_refresh(3, $redirect);
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);


meta_refresh(3, $redirect);
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);

Line 783Line 877

if ($row)
{


if ($row)
{

			$return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $topic_id) . '">', '</a>');

			$return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id) . '">', '</a>');

		}
else
{

		}
else
{

Line 806Line 900
		sync('forum', 'forum_id', $sync_forums, true, true);

// Link to the new topic

		sync('forum', 'forum_id', $sync_forums, true, true);

// Link to the new topic

		$return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
$redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");

		$return_link .= (($return_link) ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $to_topic_id) . '">', '</a>');
$redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?t=$to_topic_id");

		$redirect = reapply_sid($redirect);

/**

		$redirect = reapply_sid($redirect);

/**