phpBB

Code Changes

File: includes/mcp/mcp_topic.php

  Unmodified   Added   Modified   Removed
Line 25Line 25
function mcp_topic_view($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;

function mcp_topic_view($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;

	global $template, $db, $user, $auth, $cache, $phpbb_container;

	global $template, $db, $user, $auth, $cache, $phpbb_container, $phpbb_dispatcher;


$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url());



$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url());


Line 147Line 147
	$result = $db->sql_query_limit($sql, $posts_per_page, $start);

$rowset = $post_id_list = array();

	$result = $db->sql_query_limit($sql, $posts_per_page, $start);

$rowset = $post_id_list = array();

	$bbcode_bitfield = '';

 
	while ($row = $db->sql_fetchrow($result))
{
$rowset[] = $row;
$post_id_list[] = $row['post_id'];

	while ($row = $db->sql_fetchrow($result))
{
$rowset[] = $row;
$post_id_list[] = $row['post_id'];

		$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);

 
	}
$db->sql_freeresult($result);

	}
$db->sql_freeresult($result);


if ($bbcode_bitfield !== '')
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}

 

$topic_tracking_info = array();



$topic_tracking_info = array();


Line 201Line 193
			$db->sql_freeresult($result);
}
}

			$db->sql_freeresult($result);
}
}

 

/**
* Event to modify the post data for the MCP topic review before assigning the posts
*
* @event core.mcp_topic_modify_post_data
* @var array attachments List of attachments post_id => array of attachments
* @var int forum_id The forum ID we are currently in
* @var int id ID of the tab we are displaying
* @var string mode Mode of the MCP page we are displaying
* @var array post_id_list Array with post ids we are going to display
* @var array rowset Array with the posts data
* @var int topic_id The topic ID we are currently reviewing
* @since 3.1.7-RC1
*/
$vars = array(
'attachments',
'forum_id',
'id',
'mode',
'post_id_list',
'rowset',
'topic_id',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_post_data', compact($vars)));


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


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

Line 228Line 244

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



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


		$template->assign_block_vars('postrow', array(

		$post_row = array(

			'POST_AUTHOR_FULL'		=> get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),

			'POST_AUTHOR_FULL'		=> get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),

Line 250Line 266

'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_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_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']) : '',

		);

		);

 

$current_row_number = $i;

/**
* Event to modify the template data block for topic reviews in the MCP
*
* @event core.mcp_topic_review_modify_row
* @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 int start Start item of this page
* @var int current_row_number Number of the post on this page
* @var array post_row Template block array of the current post
* @var array row Array with original post and user data
* @var array topic_info Array with topic data
* @var int total Total posts count
* @since 3.1.4-RC1
*/
$vars = array(
'id',
'mode',
'topic_id',
'forum_id',
'start',
'current_row_number',
'post_row',
'row',
'topic_info',
'total',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_topic_review_modify_row', compact($vars)));

$template->assign_block_vars('postrow', $post_row);


// Display not already displayed Attachments for this post, we already parsed them. ;)
if (!empty($attachments[$row['post_id']]))


// Display not already displayed Attachments for this post, we already parsed them. ;)
if (!empty($attachments[$row['post_id']]))

Line 357Line 407
function split_topic($action, $topic_id, $to_forum_id, $subject)
{
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config;

function split_topic($action, $topic_id, $to_forum_id, $subject)
{
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config;

 
	global $phpbb_dispatcher;


$post_id_list = request_var('post_id_list', array(0));
$forum_id = request_var('forum_id', 0);


$post_id_list = request_var('post_id_list', array(0));
$forum_id = request_var('forum_id', 0);

Line 516Line 567
			SET post_subject = '" . $db->sql_escape($subject) . "'
WHERE post_id = {$post_id_list[0]}";
$db->sql_query($sql);

			SET post_subject = '" . $db->sql_escape($subject) . "'
WHERE post_id = {$post_id_list[0]}";
$db->sql_query($sql);

 

// Grab data for first post in split topic
$sql_array = array(
'SELECT' => 'p.post_id, p.forum_id, p.poster_id, p.post_text, f.enable_indexing',
'FROM' => array(
POSTS_TABLE => 'p',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(FORUMS_TABLE => 'f'),
'ON' => 'p.forum_id = f.forum_id',
)
),
'WHERE' => "post_id = {$post_id_list[0]}",
);
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql);
$first_post_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

// Index first post as if it were edited
if ($first_post_data['enable_indexing'])
{
// Select the search method and do some additional checks to ensure it can actually be utilised
$search_type = $config['search_type'];

if (!class_exists($search_type))
{
trigger_error('NO_SUCH_SEARCH_MODULE');
}

$error = false;
$search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);

if ($error)
{
trigger_error($error);
}

$search->index('edit', $first_post_data['post_id'], $first_post_data['post_text'], $subject, $first_post_data['poster_id'], $first_post_data['forum_id']);
}


// Copy topic subscriptions to new topic
$sql = 'SELECT user_id, notify_status


// Copy topic subscriptions to new topic
$sql = 'SELECT user_id, notify_status

Line 584Line 676
*/
function merge_posts($topic_id, $to_topic_id)
{

*/
function merge_posts($topic_id, $to_topic_id)
{

	global $db, $template, $user, $phpEx, $phpbb_root_path, $auth;

	global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $phpbb_dispatcher;


if (!$to_topic_id)
{


if (!$to_topic_id)
{

Line 684Line 776
		$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_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");
$redirect = reapply_sid($redirect);

		$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_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&amp;t=$to_topic_id");
$redirect = reapply_sid($redirect);

 

/**
* Perform additional actions after merging posts.
*
* @event core.mcp_topics_merge_posts_after
* @var int topic_id The topic ID from which posts are being moved
* @var int to_topic_id The topic ID to which posts are being moved
* @since 3.1.11-RC1
*/
$vars = array(
'topic_id',
'to_topic_id',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_topics_merge_posts_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);