[feature/soft-delete] Add checkbox to restoring posts like on approve

PHPBB3-9567
This commit is contained in:
Joas Schilling 2012-10-15 15:19:32 +02:00
parent a92927d24c
commit b1ce8a8c13
2 changed files with 53 additions and 30 deletions

View file

@ -458,8 +458,6 @@ class mcp_queue
/** /**
* Restore Posts * Restore Posts
* *
* @todo: Add some XSS protection, or even a confirm_box()
*
* @param $post_id_list array IDs of the posts to restore * @param $post_id_list array IDs of the posts to restore
* @param $id mixed Category of the current active module * @param $id mixed Category of the current active module
* @param $mode string Active module * @param $mode string Active module
@ -476,11 +474,20 @@ class mcp_queue
} }
$redirect = request_var('redirect', build_url(array('quickmod'))); $redirect = request_var('redirect', build_url(array('quickmod')));
$redirect = reapply_sid($redirect);
$success_msg = ''; $success_msg = '';
$s_hidden_fields = build_hidden_fields(array(
'i' => $id,
'mode' => $mode,
'post_id_list' => $post_id_list,
'action' => 'approve',
'redirect' => $redirect)
);
$post_info = get_post_data($post_id_list, 'm_approve'); $post_info = get_post_data($post_id_list, 'm_approve');
if (confirm_box(true))
{
$topic_info = array(); $topic_info = array();
// Group the posts by topic_id // Group the posts by topic_id
@ -513,11 +520,22 @@ class mcp_queue
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'])); 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']));
} }
$success_msg = '';
if (sizeof($post_info) >= 1) if (sizeof($post_info) >= 1)
{ {
$success_msg = (sizeof($post_info) == 1) ? 'POST_RESTORED_SUCCESS' : 'POSTS_RESTORED_SUCCESS'; $success_msg = (sizeof($post_info) == 1) ? 'POST_RESTORED_SUCCESS' : 'POSTS_RESTORED_SUCCESS';
} }
}
else
{
$template->assign_vars(array(
'S_APPROVE' => true,
));
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) if (!$success_msg)
{ {

View file

@ -306,6 +306,11 @@ $lang = array_merge($lang, array(
'REPORT_POST_EXPLAIN' => 'Use this form to report the selected post to the forum moderators and board administrators. Reporting should generally be used only if the post breaks forum rules.', 'REPORT_POST_EXPLAIN' => 'Use this form to report the selected post to the forum moderators and board administrators. Reporting should generally be used only if the post breaks forum rules.',
'REPORT_REASON' => 'Report reason', 'REPORT_REASON' => 'Report reason',
'REPORT_TIME' => 'Report time', 'REPORT_TIME' => 'Report time',
'RESTORE' => 'Restore',
'RESTORE_POST' => 'Restore post',
'RESTORE_POST_CONFIRM' => 'Are you sure you want to restore this post?',
'RESTORE_POSTS' => 'Restore posts',
'RESTORE_POSTS_CONFIRM' => 'Are you sure you want to restore the selected posts?',
'RESYNC' => 'Resync', 'RESYNC' => 'Resync',
'RETURN_MESSAGE' => '%sReturn to the message%s', 'RETURN_MESSAGE' => '%sReturn to the message%s',
'RETURN_NEW_FORUM' => '%sGo to the new forum%s', 'RETURN_NEW_FORUM' => '%sGo to the new forum%s',