phpBB

Code Changes

File: includes/mcp/mcp_main.php

  Unmodified   Added   Modified   Removed
Line 28Line 28
	var $p_master;
var $u_action;


	var $p_master;
var $u_action;


	function mcp_main(&$p_master)

	function __construct($p_master)

	{

	{

		$this->p_master = &$p_master;

		$this->p_master = $p_master;

	}

function main($id, $mode)

	}

function main($id, $mode)

Line 40Line 40
		global $phpbb_dispatcher;

$quickmod = ($mode == 'quickmod') ? true : false;

		global $phpbb_dispatcher;

$quickmod = ($mode == 'quickmod') ? true : false;

 

/**
* Event to perform additional actions before an MCP action is executed.
*
* @event core.mcp_main_before
* @var string action The action that is about to be performed
* @var string mode The mode in which the MCP is accessed, e.g. front, forum_view, topic_view, post_details, quickmod
* @var boolean quickmod Whether or not the action is performed via QuickMod
* @since 3.2.8-RC1
*/
$vars = [
'action',
'mode',
'quickmod',
];
extract($phpbb_dispatcher->trigger_event('core.mcp_main_before', compact($vars)));


switch ($action)
{


switch ($action)
{

Line 47Line 63
			case 'unlock':
$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));


			case 'unlock':
$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));


				if (!sizeof($topic_ids))

				if (!count($topic_ids))

				{
trigger_error('NO_TOPIC_SELECTED');
}

				{
trigger_error('NO_TOPIC_SELECTED');
}

Line 60Line 76

$post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));



$post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));


				if (!sizeof($post_ids))

				if (!count($post_ids))

				{
trigger_error('NO_POST_SELECTED');
}

				{
trigger_error('NO_POST_SELECTED');
}

Line 75Line 91

$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));



$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));


				if (!sizeof($topic_ids))

				if (!count($topic_ids))

				{
trigger_error('NO_TOPIC_SELECTED');
}

				{
trigger_error('NO_TOPIC_SELECTED');
}

Line 88Line 104

$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));



$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));


				if (!sizeof($topic_ids))

				if (!count($topic_ids))

				{
trigger_error('NO_TOPIC_SELECTED');
}

				{
trigger_error('NO_TOPIC_SELECTED');
}

Line 101Line 117

$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));



$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));


				if (!sizeof($topic_ids))

				if (!count($topic_ids))

				{
trigger_error('NO_TOPIC_SELECTED');
}

				{
trigger_error('NO_TOPIC_SELECTED');
}

Line 118Line 134
				$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
$soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false;


				$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));
$soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false;


				if (!sizeof($topic_ids))

				if (!count($topic_ids))

				{
trigger_error('NO_TOPIC_SELECTED');
}

				{
trigger_error('NO_TOPIC_SELECTED');
}

Line 135Line 151
				$post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
$soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false;


				$post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0));
$soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false;


				if (!sizeof($post_ids))

				if (!count($post_ids))

				{
trigger_error('NO_POST_SELECTED');
}

				{
trigger_error('NO_POST_SELECTED');
}

Line 148Line 164

$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));



$topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0));


				if (!sizeof($topic_ids))

				if (!count($topic_ids))

				{
trigger_error('NO_TOPIC_SELECTED');
}

				{
trigger_error('NO_TOPIC_SELECTED');
}

Line 164Line 180
				* @var	string	action		Topic quick moderation action name
* @var bool quickmod Flag indicating whether MCP is in quick moderation mode
* @since 3.1.0-a4

				* @var	string	action		Topic quick moderation action name
* @var bool quickmod Flag indicating whether MCP is in quick moderation mode
* @since 3.1.0-a4

				* @change 3.1.0-RC4 Added variables: action, quickmod

				* @changed 3.1.0-RC4 Added variables: action, quickmod

				*/
$vars = array('action', 'quickmod');
extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars)));

				*/
$vars = array('action', 'quickmod');
extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars)));

Line 174Line 190
		switch ($mode)
{
case 'front':

		switch ($mode)
{
case 'front':

 
				if (!function_exists('mcp_front_view'))
{

				include($phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx);

				include($phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx);

 
				}


$user->add_lang('acp/common');



$user->add_lang('acp/common');


Line 185Line 204
			break;

case 'forum_view':

			break;

case 'forum_view':

 
				if (!function_exists('mcp_forum_view'))
{

				include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx);

				include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx);

 
				}


$user->add_lang('viewforum');



$user->add_lang('viewforum');


Line 193Line 215

$forum_info = phpbb_get_forum_data($forum_id, 'm_', true);



$forum_info = phpbb_get_forum_data($forum_id, 'm_', true);


				if (!sizeof($forum_info))

				if (!count($forum_info))

				{
$this->main('main', 'front');
return;

				{
$this->main('main', 'front');
return;

Line 208Line 230
			break;

case 'topic_view':

			break;

case 'topic_view':

 
				if (!function_exists('mcp_topic_view'))
{

				include($phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx);

				include($phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx);

 
				}


mcp_topic_view($id, $mode, $action);



mcp_topic_view($id, $mode, $action);


Line 217Line 242
			break;

case 'post_details':

			break;

case 'post_details':

 
				if (!function_exists('mcp_post_details'))
{

				include($phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx);

				include($phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx);

 
				}


mcp_post_details($id, $mode, $action);



mcp_post_details($id, $mode, $action);


Line 342Line 370
		);
extract($phpbb_dispatcher->trigger_event('core.mcp_lock_unlock_after', compact($vars)));


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


		$success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';

		$success_msg = $l_prefix . ((count($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';


meta_refresh(2, $redirect);
$message = $user->lang[$success_msg];


meta_refresh(2, $redirect);
$message = $user->lang[$success_msg];

Line 355Line 383
	}
else
{

	}
else
{

		confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields);

		confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((count($ids) == 1) ? '' : 'S'), $s_hidden_fields);

	}

redirect($redirect);

	}

redirect($redirect);

Line 366Line 394
*/
function change_topic_type($action, $topic_ids)
{

*/
function change_topic_type($action, $topic_ids)
{

	global $user, $db, $request, $phpbb_log;

	global $user, $db, $request, $phpbb_log, $phpbb_dispatcher;


switch ($action)
{
case 'make_announce':
$new_topic_type = POST_ANNOUNCE;
$check_acl = 'f_announce';


switch ($action)
{
case 'make_announce':
$new_topic_type = POST_ANNOUNCE;
$check_acl = 'f_announce';

			$l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS';

			$l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS';

		break;

case 'make_global':
$new_topic_type = POST_GLOBAL;
$check_acl = 'f_announce_global';

		break;

case 'make_global':
$new_topic_type = POST_GLOBAL;
$check_acl = 'f_announce_global';

			$l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS';

			$l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS';

		break;

case 'make_sticky':
$new_topic_type = POST_STICKY;
$check_acl = 'f_sticky';

		break;

case 'make_sticky':
$new_topic_type = POST_STICKY;
$check_acl = 'f_sticky';

			$l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES';

			$l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES';

		break;

default:
$new_topic_type = POST_NORMAL;
$check_acl = false;

		break;

default:
$new_topic_type = POST_NORMAL;
$check_acl = false;

			$l_new_type = (sizeof($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS';

			$l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS';

		break;
}


		break;
}


Line 414Line 442

if (confirm_box(true))
{


if (confirm_box(true))
{

 

/**
* Perform additional actions before changing topic(s) type
*
* @event core.mcp_change_topic_type_before
* @var int new_topic_type The candidated topic type.
* @var int forum_id The forum ID for the topic ID(s).
* @var array topic_ids Array containing the topic ID(s) that will be changed
* @since 3.2.6-RC1
*/
$vars = array(
'new_topic_type',
'forum_id',
'topic_ids',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_change_topic_type_before', compact($vars)));

$db->sql_transaction('begin');


		$sql = 'UPDATE ' . TOPICS_TABLE . "
SET topic_type = $new_topic_type
WHERE " . $db->sql_in_set('topic_id', $topic_ids);
$db->sql_query($sql);


		$sql = 'UPDATE ' . TOPICS_TABLE . "
SET topic_type = $new_topic_type
WHERE " . $db->sql_in_set('topic_id', $topic_ids);
$db->sql_query($sql);


		if (($new_topic_type == POST_GLOBAL) && sizeof($topic_ids))

		if (($new_topic_type == POST_GLOBAL) && count($topic_ids))

		{
// Delete topic shadows for global announcements
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids);

		{
// Delete topic shadows for global announcements
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids);

			$db->sql_query($sql);

$sql = 'UPDATE ' . TOPICS_TABLE . "
SET topic_type = $new_topic_type
WHERE " . $db->sql_in_set('topic_id', $topic_ids);

 
			$db->sql_query($sql);
}


			$db->sql_query($sql);
}


		$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';



		$db->sql_transaction('commit');

$success_msg = (count($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';





		if (sizeof($topic_ids))

		if (count($topic_ids))

		{
$data = phpbb_get_topic_data($topic_ids);


		{
$data = phpbb_get_topic_data($topic_ids);


Line 447Line 491
				));
}
}

				));
}
}

 

/**
* Perform additional actions after changing topic types
*
* @event core.mcp_change_topic_type_after
* @var int new_topic_type The newly changed topic type.
* @var int forum_id The forum ID where the newly changed topic type belongs to.
* @var array topic_ids Array containing the topic IDs that have been changed
* @since 3.2.6-RC1
*/
$vars = array(
'new_topic_type',
'forum_id',
'topic_ids',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_change_topic_type_after', compact($vars)));


meta_refresh(2, $redirect);
$message = $user->lang[$success_msg];


meta_refresh(2, $redirect);
$message = $user->lang[$success_msg];

Line 496Line 556
	{
$forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');


	{
$forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');


		if (!sizeof($forum_data))

		if (!count($forum_data))

		{
$additional_msg = $user->lang['FORUM_NOT_EXIST'];
}

		{
$additional_msg = $user->lang['FORUM_NOT_EXIST'];
}

Line 637Line 697
				*
* @event core.mcp_main_modify_shadow_sql
* @var array shadow SQL array to be used by $db->sql_build_array

				*
* @event core.mcp_main_modify_shadow_sql
* @var array shadow SQL array to be used by $db->sql_build_array

 
				* @var	array	row		Topic data

				* @since 3.1.11-RC1

				* @since 3.1.11-RC1

 
				* @changed 3.1.11-RC1 Added variable: row

				*/
$vars = array(
'shadow',

				*/
$vars = array(
'shadow',

 
					'row',

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


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


Line 688Line 751
			$sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted;
}


			$sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted;
}


		$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS';

		$success_msg = (count($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS';


foreach ($sync_sql as $forum_id_key => $array)
{


foreach ($sync_sql as $forum_id_key => $array)
{

Line 711Line 774
			'ADDITIONAL_MSG'		=> $additional_msg)
);


			'ADDITIONAL_MSG'		=> $additional_msg)
);


		confirm_box(false, 'MOVE_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');

		confirm_box(false, 'MOVE_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');

	}

$redirect = $request->variable('redirect', "index.$phpEx");

	}

$redirect = $request->variable('redirect', "index.$phpEx");

Line 759Line 822

if (confirm_box(true))
{


if (confirm_box(true))
{

		$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS';

		$success_msg = (count($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS';


$data = phpbb_get_topic_data($topic_ids);



$data = phpbb_get_topic_data($topic_ids);


Line 781Line 844
	}
else
{

	}
else
{

		confirm_box(false, (sizeof($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields);

		confirm_box(false, (count($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields);

	}

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

	}

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

Line 839Line 902

if (confirm_box(true))
{


if (confirm_box(true))
{

		$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS';

		$success_msg = (count($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS';


$data = phpbb_get_topic_data($topic_ids);



$data = phpbb_get_topic_data($topic_ids);


Line 924Line 987
			'S_TOPIC_MODE'						=> true,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),

			'S_TOPIC_MODE'						=> true,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),

			'DELETE_TOPIC_PERMANENTLY_EXPLAIN'	=> $user->lang('DELETE_TOPIC_PERMANENTLY', sizeof($topic_ids)),

			'DELETE_TOPIC_PERMANENTLY_EXPLAIN'	=> $user->lang('DELETE_TOPIC_PERMANENTLY', count($topic_ids)),

		));


		));


		$l_confirm = (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS';


		$count = count($topic_ids);
$l_confirm = $count === 1 ? 'DELETE_TOPIC' : 'DELETE_TOPICS';

		if ($only_softdeleted)
{

		if ($only_softdeleted)
{

			$l_confirm .= '_PERMANENTLY';

			$l_confirm = array($l_confirm . '_PERMANENTLY', $count);

			$s_hidden_fields['delete_permanent'] = '1';
}
else if ($only_shadow || !$auth->acl_get('m_softdelete', $forum_id))

			$s_hidden_fields['delete_permanent'] = '1';
}
else if ($only_shadow || !$auth->acl_get('m_softdelete', $forum_id))

Line 1039Line 1103
		{
$phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post']));
}

		{
$phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post']));
}

		$affected_topics = sizeof($topic_info);

		$affected_topics = count($topic_info);

		// None of the topics is really deleted, so a redirect won't hurt much.
$deleted_topics = 0;


		// None of the topics is really deleted, so a redirect won't hurt much.
$deleted_topics = 0;


		$success_msg = (sizeof($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS'];

		$success_msg = (count($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS'];


foreach ($approve_log as $row)
{


foreach ($approve_log as $row)
{

Line 1090Line 1154
		{
$topic_id_list[] = $row['topic_id'];
}

		{
$topic_id_list[] = $row['topic_id'];
}

		$affected_topics = sizeof($topic_id_list);

		$affected_topics = count($topic_id_list);

		$db->sql_freeresult($result);

$post_data = phpbb_get_post_data($post_ids);

		$db->sql_freeresult($result);

$post_data = phpbb_get_post_data($post_ids);

Line 1129Line 1193
		}
$return_link[] = sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) . '">', '</a>');


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


		if (sizeof($post_ids) == 1)

		if (count($post_ids) == 1)

		{
if ($deleted_topics)
{

		{
if ($deleted_topics)
{

Line 1178Line 1242
			'S_SOFTDELETED'						=> $only_softdeleted,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),

			'S_SOFTDELETED'						=> $only_softdeleted,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),

			'DELETE_POST_PERMANENTLY_EXPLAIN'	=> $user->lang('DELETE_POST_PERMANENTLY', sizeof($post_ids)),

			'DELETE_POST_PERMANENTLY_EXPLAIN'	=> $user->lang('DELETE_POST_PERMANENTLY', count($post_ids)),

		));


		));


		$l_confirm = (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS';


		$count = count($post_ids);
$l_confirm = $count === 1 ? 'DELETE_POST' : 'DELETE_POSTS';

		if ($only_softdeleted)
{

		if ($only_softdeleted)
{

			$l_confirm .= '_PERMANENTLY';

			$l_confirm = array($l_confirm . '_PERMANENTLY', $count);

			$s_hidden_fields['delete_permanent'] = '1';
}
else if (!$auth->acl_get('m_softdelete', $forum_id))

			$s_hidden_fields['delete_permanent'] = '1';
}
else if (!$auth->acl_get('m_softdelete', $forum_id))

Line 1244Line 1309
	{
$forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');


	{
$forum_data = phpbb_get_forum_data($to_forum_id, 'f_post');


		if (!sizeof($topic_ids))

		if (!count($topic_ids))

		{
$additional_msg = $user->lang['NO_TOPIC_SELECTED'];
}

		{
$additional_msg = $user->lang['NO_TOPIC_SELECTED'];
}

		else if (!sizeof($forum_data))

		else if (!count($forum_data))

		{
$additional_msg = $user->lang['FORUM_NOT_EXIST'];
}

		{
$additional_msg = $user->lang['FORUM_NOT_EXIST'];
}

Line 1343Line 1408
			* Perform actions before forked topic is created.
*
* @event core.mcp_main_modify_fork_sql

			* Perform actions before forked topic is created.
*
* @event core.mcp_main_modify_fork_sql

			* @var	array	sql_ary	SQL array to be used by $db->sql_build_array


			* @var	array	sql_ary		SQL array to be used by $db->sql_build_array
* @var array topic_row Topic data

			* @since 3.1.11-RC1

			* @since 3.1.11-RC1

 
			* @changed 3.1.11-RC1 Added variable: topic_row

			*/
$vars = array(
'sql_ary',

			*/
$vars = array(
'sql_ary',

 
				'topic_row',

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


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


Line 1403Line 1471
			}
$db->sql_freeresult($result);


			}
$db->sql_freeresult($result);


			if (!sizeof($post_rows))

			if (!count($post_rows))

			{
continue;
}

			{
continue;
}

Line 1451Line 1519
				}
$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_post_id = $db->sql_nextid();

				}
$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_post_id = $db->sql_nextid();

 

/**
* Perform actions after forked topic is created.
*
* @event core.mcp_main_fork_sql_after
* @var int new_topic_id The newly created topic ID
* @var int to_forum_id The forum ID where the forked topic has been moved to
* @var int new_post_id The newly created post ID
* @var array row Post data
* @since 3.2.4-RC1
*/
$vars = array(
'new_topic_id',
'to_forum_id',
'new_post_id',
'row',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_main_fork_sql_after', compact($vars)));


switch ($row['post_visibility'])
{


switch ($row['post_visibility'])
{

Line 1506Line 1592
					}
$db->sql_freeresult($result);


					}
$db->sql_freeresult($result);


					if (sizeof($sql_ary))

					if (count($sql_ary))

					{
$db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary);
}

					{
$db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary);
}

Line 1530Line 1616
			}
$db->sql_freeresult($result);


			}
$db->sql_freeresult($result);


			if (sizeof($sql_ary))

			if (count($sql_ary))

			{
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
}

			{
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
}

Line 1551Line 1637
			}
$db->sql_freeresult($result);


			}
$db->sql_freeresult($result);


			if (sizeof($sql_ary))

			if (count($sql_ary))

			{
$db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
}

			{
$db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary);
}

Line 1583Line 1669
		sync('topic', 'topic_id', $new_topic_id_list);
sync('forum', 'forum_id', $to_forum_id);


		sync('topic', 'topic_id', $new_topic_id_list);
sync('forum', 'forum_id', $to_forum_id);


		$config->increment('num_topics', sizeof($new_topic_id_list), false);

		$config->increment('num_topics', count($new_topic_id_list), false);

		$config->increment('num_posts', $total_posts, false);

foreach ($new_topic_id_list as $topic_id => $new_topic_id)

		$config->increment('num_posts', $total_posts, false);

foreach ($new_topic_id_list as $topic_id => $new_topic_id)

Line 1595Line 1681
			));
}


			));
}


		$success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';

		$success_msg = (count($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';

	}
else
{

	}
else
{

Line 1605Line 1691
			'ADDITIONAL_MSG'		=> $additional_msg)
);


			'ADDITIONAL_MSG'		=> $additional_msg)
);


		confirm_box(false, 'FORK_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');

		confirm_box(false, 'FORK_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');

	}

$redirect = $request->variable('redirect', "index.$phpEx");

	}

$redirect = $request->variable('redirect', "index.$phpEx");