phpBB

Code Changes

File: includes/mcp/mcp_main.php

  Unmodified   Added   Modified   Removed
Line 285Line 285
function change_topic_type($action, $topic_ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path;

function change_topic_type($action, $topic_ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path;


// For changing topic types, we only allow operations in one forum.
$forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('f_announce', 'f_sticky', 'm_'), true);

if ($forum_id === false)
{
return;
}

 

switch ($action)
{


switch ($action)
{

Line 316Line 308

default:
$new_topic_type = POST_NORMAL;


default:
$new_topic_type = POST_NORMAL;

			$check_acl = '';

			$check_acl = false;

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

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

 
	}

$forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', $check_acl, true);

if ($forum_id === false)
{
return;

	}

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

	}

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

Line 1048Line 1047
		$total_posts = 0;
$new_topic_id_list = array();


		$total_posts = 0;
$new_topic_id_list = array();


		if ($topic_data['enable_indexing'])





foreach ($topic_data as $topic_id => $topic_row)
{
if (!isset($search_type) && $topic_row['enable_indexing'])

		{
// Select the search method and do some additional checks to ensure it can actually be utilised
$search_type = basename($config['search_type']);

		{
// Select the search method and do some additional checks to ensure it can actually be utilised
$search_type = basename($config['search_type']);

Line 1072Line 1074
				trigger_error($error);
}
}

				trigger_error($error);
}
}

		else

			else if (!isset($search_type) && !$topic_row['enable_indexing'])

		{
$search_type = false;
}


		{
$search_type = false;
}


		foreach ($topic_data as $topic_id => $topic_row)
{

 
			$sql_ary = array(
'forum_id' => (int) $to_forum_id,
'icon_id' => (int) $topic_row['icon_id'],

			$sql_ary = array(
'forum_id' => (int) $to_forum_id,
'icon_id' => (int) $topic_row['icon_id'],

Line 1187Line 1187
				// Copy whether the topic is dotted
markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']);


				// Copy whether the topic is dotted
markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']);


				if ($search_type)

				if (!empty($search_type))

				{

				{

					$search->index($search_mode, $sql_ary['post_id'], $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], ($topic_row['topic_type'] == POST_GLOBAL) ? 0 : $to_forum_id);

					$search->index($search_mode, $new_post_id, $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], ($topic_row['topic_type'] == POST_GLOBAL) ? 0 : $to_forum_id);

					$search_mode = 'reply'; // After one we index replies
}


					$search_mode = 'reply'; // After one we index replies
}


Line 1231Line 1231
				}
}


				}
}


 
			// Copy topic subscriptions to new topic

			$sql = 'SELECT user_id, notify_status
FROM ' . TOPICS_WATCH_TABLE . '
WHERE topic_id = ' . $topic_id;

			$sql = 'SELECT user_id, notify_status
FROM ' . TOPICS_WATCH_TABLE . '
WHERE topic_id = ' . $topic_id;

Line 1250Line 1251
			if (sizeof($sql_ary))
{
$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);

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

 
			}

// Copy bookmarks to new topic
$sql = 'SELECT user_id
FROM ' . BOOKMARKS_TABLE . '
WHERE topic_id = ' . $topic_id;
$result = $db->sql_query($sql);

$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$sql_ary[] = array(
'topic_id' => (int) $new_topic_id,
'user_id' => (int) $row['user_id'],
);
}
$db->sql_freeresult($result);

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

			}
}


			}
}