diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2012-10-15 15:19:32 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2012-10-15 15:19:32 +0200 |
commit | b1ce8a8c13eca920abf3659fcbfec267684071bb (patch) | |
tree | 7dcfedf5d8e456d283111811b9df5693af56b7e3 /phpBB/includes/mcp/mcp_queue.php | |
parent | a92927d24cace3b3444cb3502de765c6e8e16fa9 (diff) | |
download | forums-b1ce8a8c13eca920abf3659fcbfec267684071bb.tar forums-b1ce8a8c13eca920abf3659fcbfec267684071bb.tar.gz forums-b1ce8a8c13eca920abf3659fcbfec267684071bb.tar.bz2 forums-b1ce8a8c13eca920abf3659fcbfec267684071bb.tar.xz forums-b1ce8a8c13eca920abf3659fcbfec267684071bb.zip |
[feature/soft-delete] Add checkbox to restoring posts like on approve
PHPBB3-9567
Diffstat (limited to 'phpBB/includes/mcp/mcp_queue.php')
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 72 |
1 files changed, 45 insertions, 27 deletions
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 99c4a6eccb..a56d4ac898 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -458,8 +458,6 @@ class mcp_queue /** * Restore Posts * - * @todo: Add some XSS protection, or even a confirm_box() - * * @param $post_id_list array IDs of the posts to restore * @param $id mixed Category of the current active module * @param $mode string Active module @@ -476,49 +474,69 @@ class mcp_queue } $redirect = request_var('redirect', build_url(array('quickmod'))); - $redirect = reapply_sid($redirect); $success_msg = ''; - $post_info = get_post_data($post_id_list, 'm_approve'); + $s_hidden_fields = build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'post_id_list' => $post_id_list, + 'action' => 'approve', + 'redirect' => $redirect) + ); - $topic_info = array(); + $post_info = get_post_data($post_id_list, 'm_approve'); - // Group the posts by topic_id - foreach ($post_info as $post_id => $post_data) + if (confirm_box(true)) { - if ($post_data['post_visibility'] == ITEM_APPROVED) + $topic_info = array(); + + // Group the posts by topic_id + foreach ($post_info as $post_id => $post_data) { - continue; - } - $topic_id = (int) $post_data['topic_id']; + if ($post_data['post_visibility'] == ITEM_APPROVED) + { + continue; + } + $topic_id = (int) $post_data['topic_id']; - $topic_info[$topic_id]['posts'][] = (int) $post_id; - $topic_info[$topic_id]['forum_id'] = (int) $post_data['forum_id']; + $topic_info[$topic_id]['posts'][] = (int) $post_id; + $topic_info[$topic_id]['forum_id'] = (int) $post_data['forum_id']; - if ($post_id == $post_data['topic_first_post_id']) - { - $topic_info[$topic_id]['first_post'] = true; + if ($post_id == $post_data['topic_first_post_id']) + { + $topic_info[$topic_id]['first_post'] = true; + } + + if ($post_id == $post_data['topic_last_post_id']) + { + $topic_info[$topic_id]['last_post'] = true; + } + + $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_data['forum_id']}&t={$post_data['topic_id']}&p={$post_data['post_id']}") . '#p' . $post_data['post_id']; } - if ($post_id == $post_data['topic_last_post_id']) + foreach ($topic_info as $topic_id => $topic_data) { - $topic_info[$topic_id]['last_post'] = true; + phpbb_content_visibility::set_post_visibility(ITEM_APPROVED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '', isset($topic_data['first_post']), isset($topic_data['last_post'])); } - $post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$post_data['forum_id']}&t={$post_data['topic_id']}&p={$post_data['post_id']}") . '#p' . $post_data['post_id']; + if (sizeof($post_info) >= 1) + { + $success_msg = (sizeof($post_info) == 1) ? 'POST_RESTORED_SUCCESS' : 'POSTS_RESTORED_SUCCESS'; + } } - - foreach ($topic_info as $topic_id => $topic_data) + else { - phpbb_content_visibility::set_post_visibility(ITEM_APPROVED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '', isset($topic_data['first_post']), isset($topic_data['last_post'])); - } + $template->assign_vars(array( + 'S_APPROVE' => true, + )); - $success_msg = ''; - if (sizeof($post_info) >= 1) - { - $success_msg = (sizeof($post_info) == 1) ? 'POST_RESTORED_SUCCESS' : 'POSTS_RESTORED_SUCCESS'; + confirm_box(false, 'RESTORE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + if (!$success_msg) { redirect($redirect); |