[ticket/15951] Add core.mcp_delete_topic_modify_permissions

Allow modification to permissions when deleting topics
This allows $check_permission to be false in the phpbb_check_ids function call

PHPBB3-15951
This commit is contained in:
Alec 2019-01-24 13:05:33 -05:00
parent d7ccd22383
commit f4a1d4ef02

View file

@ -881,16 +881,38 @@ function mcp_restore_topic($topic_ids)
*/
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, $phpbb_log;
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log, $phpbb_dispatcher;
$check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete';
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array($check_permission)))
$forum_id = $request->variable('f', 0);
$check_permission = ($is_soft) ? ['m_softdelete'] : ['m_delete'];
/**
* This event allows you to modify the current user's checked permissions when deleting a topic
*
* @event core.mcp_delete_topic_modify_permissions
* @var array topic_ids The array of topic IDs to be deleted
* @var int forum_id The current forum ID
* @var bool is_soft Boolean designating whether we're soft deleting or not
* @var string soft_delete_reason The reason we're soft deleting
* @var string action The current delete action
* @var array check_permission The array with a permission to check for, can be set to false to not check them
* @since 3.2.6-RC1
*/
$vars = array(
'topic_ids',
'forum_id',
'is_soft',
'soft_delete_reason',
'action',
'check_permission',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_delete_topic_modify_permissions', compact($vars)));
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', $check_permission))
{
return;
}
$redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
$forum_id = $request->variable('f', 0);
$s_hidden_fields = array(
'topic_id_list' => $topic_ids,