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 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 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 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)
{


switch ($action)
{

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);

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

Line 424Line 471
			// 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);
}

 

$db->sql_transaction('commit');


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



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


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 930Line 990
			'DELETE_TOPIC_PERMANENTLY_EXPLAIN'	=> $user->lang('DELETE_TOPIC_PERMANENTLY', count($topic_ids)),
));


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


		$l_confirm = (count($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 988Line 1049

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


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

 
	$topic_id = 0;


$s_hidden_fields = array(
'post_id_list' => $post_ids,


$s_hidden_fields = array(
'post_id_list' => $post_ids,

Line 1060Line 1122
				$soft_delete_reason
));
}

				$soft_delete_reason
));
}


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

 

// Return links
$return_link = array();


// Return links
$return_link = array();

Line 1091Line 1151
		$topic_id_list = array();
while ($row = $db->sql_fetchrow($result))
{

		$topic_id_list = array();
while ($row = $db->sql_fetchrow($result))
{

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

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

		}
$affected_topics = count($topic_id_list);
$db->sql_freeresult($result);

		}
$affected_topics = count($topic_id_list);
$db->sql_freeresult($result);

Line 1121Line 1181

$deleted_topics = ($row = $db->sql_fetchrow($result)) ? ($affected_topics - $row['topics_left']) : $affected_topics;
$db->sql_freeresult($result);


$deleted_topics = ($row = $db->sql_fetchrow($result)) ? ($affected_topics - $row['topics_left']) : $affected_topics;
$db->sql_freeresult($result);


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

 

// Return links
$return_link = array();


// Return links
$return_link = array();

Line 1142Line 1200
			}
else
{

			}
else
{

 
				// Remove any post id anchor
if ($anchor_pos = (strrpos($redirect, '#p')) !== false)
{
$redirect = substr($redirect, 0, $anchor_pos);
}


				$success_msg = $user->lang['POST_DELETED_SUCCESS'];
}
}

				$success_msg = $user->lang['POST_DELETED_SUCCESS'];
}
}

Line 1184Line 1248
			'DELETE_POST_PERMANENTLY_EXPLAIN'	=> $user->lang('DELETE_POST_PERMANENTLY', count($post_ids)),
));


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


		$l_confirm = (count($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 1198Line 1263
		confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html');
}


		confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html');
}


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

 
	$redirect = reapply_sid($redirect);

if (!$success_msg)

	$redirect = reapply_sid($redirect);

if (!$success_msg)

Line 1457Line 1521
				}
$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 1484Line 1566
				// Copy Attachments
if ($row['post_attachment'])
{

				// Copy Attachments
if ($row['post_attachment'])
{

					$sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . "
WHERE post_msg_id = {$row['post_id']}
AND topic_id = $topic_id
AND in_message = 0";


					$sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . '
WHERE post_msg_id = ' . (int) $row['post_id'] . '
AND topic_id = ' . (int) $topic_id . '
AND in_message = 0
ORDER BY attach_id ASC';

					$result = $db->sql_query($sql);

$sql_ary = array();

					$result = $db->sql_query($sql);

$sql_ary = array();