phpBB

Code Changes

File: includes/mcp/mcp_main.php

  Unmodified   Added   Modified   Removed
Line 35Line 35

function main($id, $mode)
{


function main($id, $mode)
{

		global $auth, $db, $user, $template, $action;
global $config, $phpbb_root_path, $phpEx, $request;

		global $auth, $user, $action;
global $phpbb_root_path, $phpEx, $request;

		global $phpbb_dispatcher;

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

		global $phpbb_dispatcher;

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

Line 45Line 45
		{
case 'lock':
case 'unlock':

		{
case 'lock':
case 'unlock':

				$topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));

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


if (!sizeof($topic_ids))
{


if (!sizeof($topic_ids))
{

Line 58Line 58
			case 'lock_post':
case 'unlock_post':


			case 'lock_post':
case 'unlock_post':


				$post_ids = (!$quickmod) ? request_var('post_id_list', array(0)) : array(request_var('p', 0));

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


if (!sizeof($post_ids))
{


if (!sizeof($post_ids))
{

Line 73Line 73
			case 'make_global':
case 'make_normal':


			case 'make_global':
case 'make_normal':


				$topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));

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


if (!sizeof($topic_ids))
{


if (!sizeof($topic_ids))
{

Line 86Line 86
			case 'move':
$user->add_lang('viewtopic');


			case 'move':
$user->add_lang('viewtopic');


				$topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));

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


if (!sizeof($topic_ids))
{


if (!sizeof($topic_ids))
{

Line 99Line 99
			case 'fork':
$user->add_lang('viewtopic');


			case 'fork':
$user->add_lang('viewtopic');


				$topic_ids = (!$quickmod) ? request_var('topic_id_list', array(0)) : array(request_var('t', 0));

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


if (!sizeof($topic_ids))
{


if (!sizeof($topic_ids))
{

Line 189Line 189

$user->add_lang('viewforum');



$user->add_lang('viewforum');


				$forum_id = request_var('f', 0);

				$forum_id = $request->variable('f', 0);


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



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


Line 226Line 226
			break;

default:

			break;

default:

 
				if ($quickmod)
{
switch ($action)
{
case 'lock':
case 'unlock':
case 'make_announce':
case 'make_sticky':
case 'make_global':
case 'make_normal':
case 'make_onindex':
case 'move':
case 'fork':
case 'delete_topic':
trigger_error('TOPIC_NOT_EXIST');
break;

case 'lock_post':
case 'unlock_post':
case 'delete_post':
trigger_error('POST_NOT_EXIST');
break;
}
}


				trigger_error('NO_MODE', E_USER_ERROR);
break;
}

				trigger_error('NO_MODE', E_USER_ERROR);
break;
}

Line 237Line 262
*/
function lock_unlock($action, $ids)
{

*/
function lock_unlock($action, $ids)
{

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

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


if ($action == 'lock' || $action == 'unlock')
{


if ($action == 'lock' || $action == 'unlock')
{

Line 273Line 298
	}
unset($orig_ids);


	}
unset($orig_ids);


	$redirect = request_var('redirect', build_url(array('action', 'quickmod')));

	$redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));

	$redirect = reapply_sid($redirect);

$s_hidden_fields = build_hidden_fields(array(

	$redirect = reapply_sid($redirect);

$s_hidden_fields = build_hidden_fields(array(

Line 281Line 306
		'action'			=> $action,
'redirect' => $redirect)
);

		'action'			=> $action,
'redirect' => $redirect)
);

	$success_msg = '';

 

if (confirm_box(true))
{


if (confirm_box(true))
{

Line 294Line 318

foreach ($data as $id => $row)
{


foreach ($data as $id => $row)
{

			add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_' . strtoupper($action), $row['topic_title']);






			$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($action), false, array(
'forum_id' => $row['forum_id'],
'topic_id' => $row['topic_id'],
'post_id' => isset($row['post_id']) ? $row['post_id'] : 0,
$row['topic_title']
));

		}

		}

 

/**
* Perform additional actions after locking/unlocking posts/topics
*
* @event core.mcp_lock_unlock_after
* @var string action Variable containing the action we perform on the posts/topics ('lock', 'unlock', 'lock_post' or 'unlock_post')
* @var array ids Array containing the post/topic IDs that have been locked/unlocked
* @var array data Array containing posts/topics data
* @since 3.1.7-RC1
*/
$vars = array(
'action',
'ids',
'data',
);
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 . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';


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

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

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

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


switch ($action)
{


switch ($action)
{

Line 333Line 378

case 'make_global':
$new_topic_type = POST_GLOBAL;


case 'make_global':
$new_topic_type = POST_GLOBAL;

			$check_acl = 'f_announce';

			$check_acl = 'f_announce_global';

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


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


Line 357Line 402
		return;
}


		return;
}


	$redirect = request_var('redirect', build_url(array('action', 'quickmod')));

	$redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));

	$redirect = reapply_sid($redirect);

$s_hidden_fields = array(

	$redirect = reapply_sid($redirect);

$s_hidden_fields = array(

Line 366Line 411
		'action'		=> $action,
'redirect' => $redirect,
);

		'action'		=> $action,
'redirect' => $redirect,
);

	$success_msg = '';

 

if (confirm_box(true))
{


if (confirm_box(true))
{

Line 396Line 440

foreach ($data as $topic_id => $row)
{


foreach ($data as $topic_id => $row)
{

				add_log('mod', $forum_id, $topic_id, 'LOG_TOPIC_TYPE_CHANGED', $row['topic_title']);





				$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_TYPE_CHANGED', false, array(
'forum_id' => $forum_id,
'topic_id' => $topic_id,
$row['topic_title']
));

			}
}


			}
}


Line 422Line 470
*/
function mcp_move_topic($topic_ids)
{

*/
function mcp_move_topic($topic_ids)
{

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

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

	global $phpEx, $phpbb_root_path;

// Here we limit the operation to one forum only

	global $phpEx, $phpbb_root_path;

// Here we limit the operation to one forum only

Line 433Line 481
		return;
}


		return;
}


	$to_forum_id = request_var('to_forum_id', 0);
$redirect = request_var('redirect', build_url(array('action', 'quickmod')));

	$to_forum_id = $request->variable('to_forum_id', 0);
$redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));

	$additional_msg = $success_msg = '';

$s_hidden_fields = build_hidden_fields(array(

	$additional_msg = $success_msg = '';

$s_hidden_fields = build_hidden_fields(array(

Line 583Line 631
					'poll_max_options'		=>	(int) $row['poll_max_options'],
'poll_last_vote' => (int) $row['poll_last_vote']
);

					'poll_max_options'		=>	(int) $row['poll_max_options'],
'poll_last_vote' => (int) $row['poll_last_vote']
);

 

/**
* Perform actions before shadow topic is created.
*
* @event core.mcp_main_modify_shadow_sql
* @var array shadow SQL array to be used by $db->sql_build_array
* @since 3.1.11-RC1
*/
$vars = array(
'shadow',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_shadow_sql', compact($vars)));


$db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow));



$db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow));


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


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


	$redirect = request_var('redirect', "index.$phpEx");

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

	$redirect = reapply_sid($redirect);

if (!$success_msg)

	$redirect = reapply_sid($redirect);

if (!$success_msg)

Line 679Line 739
*/
function mcp_restore_topic($topic_ids)
{

*/
function mcp_restore_topic($topic_ids)
{

	global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;

	global $user, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log;


if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve')))
{


if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve')))
{

Line 703Line 763

$data = phpbb_get_topic_data($topic_ids);



$data = phpbb_get_topic_data($topic_ids);


 
		/* @var $phpbb_content_visibility \phpbb\content_visibility */

		$phpbb_content_visibility = $phpbb_container->get('content.visibility');
foreach ($data as $topic_id => $row)
{
$return = $phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), '');
if (!empty($return))
{

		$phpbb_content_visibility = $phpbb_container->get('content.visibility');
foreach ($data as $topic_id => $row)
{
$return = $phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), '');
if (!empty($return))
{

				add_log('mod', $row['forum_id'], $topic_id, 'LOG_RESTORE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']);






				$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_RESTORE_TOPIC', false, array(
'forum_id' => $row['forum_id'],
'topic_id' => $topic_id,
$row['topic_title'],
$row['topic_first_poster_name']
));

			}
}
}

			}
}
}

Line 752Line 818
*/
function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_topic')
{

*/
function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_topic')
{

	global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;

	global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log;


$check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete';
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array($check_permission)))


$check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete';
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array($check_permission)))

Line 781Line 847
		{
if ($row['topic_moved_id'])
{

		{
if ($row['topic_moved_id'])
{

				add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_SHADOW_TOPIC', $row['topic_title']);





				$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_SHADOW_TOPIC', false, array(
'forum_id' => $row['forum_id'],
'topic_id' => $topic_id,
$row['topic_title']
));

			}
else
{
// Only soft delete non-shadow topics
if ($is_soft)
{

			}
else
{
// Only soft delete non-shadow topics
if ($is_soft)
{

 
					/* @var $phpbb_content_visibility \phpbb\content_visibility */

					$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$return = $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason);
if (!empty($return))
{

					$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$return = $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason);
if (!empty($return))
{

						add_log('mod', $row['forum_id'], $topic_id, 'LOG_SOFTDELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name'], $soft_delete_reason);







						$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SOFTDELETE_TOPIC', false, array(
'forum_id' => $row['forum_id'],
'topic_id' => $topic_id,
$row['topic_title'],
$row['topic_first_poster_name'],
$soft_delete_reason
));

					}
}
else
{

					}
}
else
{

					add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name'], $soft_delete_reason);







					$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_TOPIC', false, array(
'forum_id' => $row['forum_id'],
'topic_id' => $topic_id,
$row['topic_title'],
$row['topic_first_poster_name'],
$soft_delete_reason
));

				}
}
}

if (!$is_soft)
{

				}
}
}

if (!$is_soft)
{

			$return = delete_topics('topic_id', $topic_ids);

			delete_topics('topic_id', $topic_ids);

		}
}
else

		}
}
else

Line 812Line 895
		global $template;

$user->add_lang('posting');

		global $template;

$user->add_lang('posting');

 

// If there are only shadow topics, we neither need a reason nor softdelete
$sql = 'SELECT topic_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . '
AND topic_moved_id = 0';
$result = $db->sql_query_limit($sql, 1);
$only_shadow = !$db->sql_fetchfield('topic_id');
$db->sql_freeresult($result);


$only_softdeleted = false;


$only_softdeleted = false;

		if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id))

		if (!$only_shadow && $auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id))

		{
// If there are only soft deleted topics, we display a message why the option is not available
$sql = 'SELECT topic_id

		{
// If there are only soft deleted topics, we display a message why the option is not available
$sql = 'SELECT topic_id

Line 827Line 919
		}

$template->assign_vars(array(

		}

$template->assign_vars(array(

			'S_SOFTDELETED'			=> $only_softdeleted,
'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_SHADOW_TOPICS'					=> $only_shadow,
'S_SOFTDELETED' => $only_softdeleted,
'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)),

		));

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

		));

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

Line 839Line 933
			$l_confirm .= '_PERMANENTLY';
$s_hidden_fields['delete_permanent'] = '1';
}

			$l_confirm .= '_PERMANENTLY';
$s_hidden_fields['delete_permanent'] = '1';
}

		else if (!$auth->acl_get('m_softdelete', $forum_id))

		else if ($only_shadow || !$auth->acl_get('m_softdelete', $forum_id))

		{
$s_hidden_fields['delete_permanent'] = '1';
}

		{
$s_hidden_fields['delete_permanent'] = '1';
}

Line 881Line 975
*/
function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_post')
{

*/
function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_post')
{

	global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;

	global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log;


$check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete';
if (!phpbb_check_ids($post_ids, POSTS_TABLE, 'post_id', array($check_permission)))


$check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete';
if (!phpbb_check_ids($post_ids, POSTS_TABLE, 'post_id', array($check_permission)))

Line 931Line 1025
			$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'],
'poster_id' => $post_data['poster_id'],
'post_username' => $post_data['post_username'],

				'post_subject'	=> $post_data['post_subject'],
'poster_id' => $post_data['poster_id'],
'post_username' => $post_data['post_username'],

Line 938Line 1033
			);
}


			);
}


 
		/* @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 952Line 1048
		foreach ($approve_log as $row)
{
$post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username'];

		foreach ($approve_log as $row)
{
$post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username'];

			add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_SOFTDELETE_POST', $row['post_subject'], $post_username, $soft_delete_reason);








			$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SOFTDELETE_POST', false, array(
'forum_id' => $row['forum_id'],
'topic_id' => $row['topic_id'],
'post_id' => $row['post_id'],
$row['post_subject'],
$post_username,
$soft_delete_reason
));

		}

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

		}

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

Line 995Line 1098
		foreach ($post_data as $id => $row)
{
$post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username'];

		foreach ($post_data as $id => $row)
{
$post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username'];

			add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject'], $post_username, $soft_delete_reason);








			$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_POST', false, array(
'forum_id' => $row['forum_id'],
'topic_id' => $row['topic_id'],
'post_id' => $row['post_id'],
$row['post_subject'],
$post_username,
$soft_delete_reason
));

		}

// Now delete the posts, topics and forums are automatically resync'ed

		}

// Now delete the posts, topics and forums are automatically resync'ed

Line 1065Line 1175
		}

$template->assign_vars(array(

		}

$template->assign_vars(array(

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

		));

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

		));

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

Line 1109Line 1220
function mcp_fork_topic($topic_ids)
{
global $auth, $user, $db, $template, $config;

function mcp_fork_topic($topic_ids)
{
global $auth, $user, $db, $template, $config;

	global $phpEx, $phpbb_root_path;

	global $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher;


if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
{
return;
}



if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
{
return;
}


	$to_forum_id = request_var('to_forum_id', 0);
$forum_id = request_var('f', 0);
$redirect = request_var('redirect', build_url(array('action', 'quickmod')));

	$to_forum_id = $request->variable('to_forum_id', 0);
$forum_id = $request->variable('f', 0);
$redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));

	$additional_msg = $success_msg = '';
$counter = array();


	$additional_msg = $success_msg = '';
$counter = array();


Line 1187Line 1298
				}

$error = false;

				}

$error = false;

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

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

				$search_mode = 'post';

if ($error)

				$search_mode = 'post';

if ($error)

Line 1227Line 1338
				'poll_max_options'			=> (int) $topic_row['poll_max_options'],
'poll_vote_change' => (int) $topic_row['poll_vote_change'],
);

				'poll_max_options'			=> (int) $topic_row['poll_max_options'],
'poll_vote_change' => (int) $topic_row['poll_vote_change'],
);

 

/**
* 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
* @since 3.1.11-RC1
*/
$vars = array(
'sql_ary',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_fork_sql', compact($vars)));


$db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_topic_id = $db->sql_nextid();


$db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_topic_id = $db->sql_nextid();

Line 1248Line 1371

if ($topic_row['poll_start'])
{


if ($topic_row['poll_start'])
{

				$poll_rows = array();


 
				$sql = 'SELECT *
FROM ' . POLL_OPTIONS_TABLE . "
WHERE topic_id = $topic_id";

				$sql = 'SELECT *
FROM ' . POLL_OPTIONS_TABLE . "
WHERE topic_id = $topic_id";

Line 1266Line 1387

$db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
}


$db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
}

 
				$db->sql_freeresult($result);

			}

$sql = 'SELECT *

			}

$sql = 'SELECT *

Line 1461Line 1583
		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);


		set_config_count('num_topics', sizeof($new_topic_id_list), true);
set_config_count('num_posts', $total_posts, true);

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


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


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

			add_log('mod', $to_forum_id, $new_topic_id, 'LOG_FORK', $topic_row['forum_name']);





			$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_FORK', false, array(
'forum_id' => $to_forum_id,
'topic_id' => $new_topic_id,
$topic_row['forum_name']
));

		}

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

		}

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

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


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


	$redirect = request_var('redirect', "index.$phpEx");

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

	$redirect = reapply_sid($redirect);

if (!$success_msg)

	$redirect = reapply_sid($redirect);

if (!$success_msg)