Line 881 | Line 881 |
---|
*/ 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, $phpbb_log;
| global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log, $phpbb_dispatcher;
$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.3.3-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)));
|
|
|
$check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete'; if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array($check_permission)))
| if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', $check_permission))
|
{ return; }
$redirect = $request->variable('redirect', build_url(array('action', 'quickmod')));
|
{ 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,
| $s_hidden_fields = array( 'topic_id_list' => $topic_ids,
|
Line 1001 | Line 1023 |
---|
{ $s_hidden_fields['delete_permanent'] = '1'; }
|
{ $s_hidden_fields['delete_permanent'] = '1'; }
|
| /** * This event allows you to modify the hidden form fields when deleting topics * * @event core.mcp_delete_topic_modify_hidden_fields * @var string l_confirm The confirmation text language variable (DELETE_TOPIC(S), DELETE_TOPIC(S)_PERMANENTLY) * @var array s_hidden_fields The array holding the hidden form fields * @var array topic_ids The array of topic IDs to be deleted * @var int forum_id The current forum ID * @var bool only_softdeleted If the topic_ids are all soft deleted, this is true * @var bool only_shadow If the topic_ids are all shadow topics, this is true * @since 3.3.3-RC1 */ $vars = array( 'l_confirm', 's_hidden_fields', 'topic_ids', 'forum_id', 'only_softdeleted', 'only_shadow', ); extract($phpbb_dispatcher->trigger_event('core.mcp_delete_topic_modify_hidden_fields', compact($vars)));
|
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'); }
|
Line 1127 | Line 1171 |
---|
$return_link = array(); if ($affected_topics == 1 && $topic_id) {
|
$return_link = array(); if ($affected_topics == 1 && $topic_id) {
|
$return_link[] = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") . '">', '</a>');
| $return_link[] = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id") . '">', '</a>');
|
} $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>');
|
Line 1186 | Line 1230 |
---|
$return_link = array(); if ($affected_topics == 1 && !$deleted_topics && $topic_id) {
|
$return_link = array(); if ($affected_topics == 1 && !$deleted_topics && $topic_id) {
|
$return_link[] = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") . '">', '</a>');
| $return_link[] = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id") . '">', '</a>');
|
} $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>');
|
Line 1201 | Line 1245 |
---|
else { // Remove any post id anchor
|
else { // Remove any post id anchor
|
if ($anchor_pos = (strrpos($redirect, '#p')) !== false)
| if (($anchor_pos = strrpos($redirect, '#p')) !== false)
|
{ $redirect = substr($redirect, 0, $anchor_pos); }
| { $redirect = substr($redirect, 0, $anchor_pos); }
|
Line 1519 | Line 1563 |
---|
$counter[$row['poster_id']] = 1; } }
|
$counter[$row['poster_id']] = 1; } }
|
| /** * Modify the forked post's sql array before it's inserted into the database. * * @event core.mcp_main_modify_fork_post_sql * @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 array sql_ary SQL Array with the post's data * @var array row Post data * @var array counter Array with post counts * @since 3.3.5-RC1 */ $vars = [ 'new_topic_id', 'to_forum_id', 'sql_ary', 'row', 'counter', ]; extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_fork_post_sql', compact($vars)));
|
$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();
|