diff options
Diffstat (limited to 'phpBB/includes/mcp/mcp_queue.php')
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 200 |
1 files changed, 0 insertions, 200 deletions
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index f4a78525c8..5e7c53c8de 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -467,206 +467,6 @@ class mcp_queue } /** - * Restore Posts - * - * @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 - * @return void - */ - function restore_posts($post_id_list, $id, $mode) - { - global $db, $template, $user, $config; - global $phpEx, $phpbb_root_path, $request; - - if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) - { - trigger_error('NOT_AUTHORISED'); - } - - $redirect = request_var('redirect', build_url(array('quickmod'))); - $success_msg = ''; - - $s_hidden_fields = build_hidden_fields(array( - 'i' => $id, - 'mode' => $mode, - 'post_id_list' => $post_id_list, - 'action' => 'restore', - 'redirect' => $redirect, - )); - - $post_info = get_post_data($post_id_list, 'm_approve'); - - if (confirm_box(true)) - { - $topic_info = array(); - - // Group the posts by topic_id - foreach ($post_info as $post_id => $post_data) - { - 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']; - - 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']; - } - - foreach ($topic_info as $topic_id => $topic_data) - { - 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'])); - } - - if (sizeof($post_info) >= 1) - { - $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) - { - redirect($redirect); - } - else - { - // If restoring one post, also give links back to post... - $add_message = ''; - if (sizeof($post_id_list) == 1 && !empty($post_url)) - { - $add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'); - } - - $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message; - - if ($request->is_ajax()) - { - $json_response = new phpbb_json_response; - $json_response->send(array( - 'MESSAGE_TITLE' => $user->lang['INFORMATION'], - 'MESSAGE_TEXT' => $message, - 'REFRESH_DATA' => null, - 'visible' => true, - )); - } - - meta_refresh(3, $redirect); - trigger_error($message); - } - } - - /** - * Restore topics - * - * @param $topic_id_list array IDs of the topics to restore - * @param $id mixed Category of the current active module - * @param $mode string Active module - * @return void - */ - function restore_topics($topic_id_list, $id, $mode) - { - global $db, $template, $user, $config; - global $phpEx, $phpbb_root_path, $request; - - if (!check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve'))) - { - trigger_error('NOT_AUTHORISED'); - } - - $redirect = request_var('redirect', build_url(array('quickmod'))); - $success_msg = ''; - - $s_hidden_fields = build_hidden_fields(array( - 'i' => $id, - 'mode' => $mode, - 'topic_id_list' => $topic_id_list, - 'action' => 'restore', - 'redirect' => $redirect, - )); - - $topic_info = get_topic_data($topic_id_list, 'm_approve'); - - if (confirm_box(true)) - { - foreach ($topic_info as $topic_id => $topic_data) - { - phpbb_content_visibility::set_post_visibility(ITEM_APPROVED, $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), ''); - $topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_data['forum_id']}&t={$topic_id}"); - } - - if (sizeof($topic_info) >= 1) - { - $success_msg = 'TOPIC' . ((sizeof($topic_info) == 1) ? '' : 'S') . '_RESTORED_SUCCESS'; - } - } - else - { - $template->assign_vars(array( - 'S_APPROVE' => true, - )); - - confirm_box(false, 'RESTORE_TOPIC' . ((sizeof($topic_info) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); - } - - $redirect = request_var('redirect', "index.$phpEx"); - $redirect = reapply_sid($redirect); - - if (!$success_msg) - { - redirect($redirect); - } - else - { - // If restoring one topic, also give links back to topic... - $add_message = ''; - if (sizeof($topic_info) == 1 && !empty($topic_url)) - { - $add_message = '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], '<a href="' . $topic_url . '">', '</a>'); - } - - $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message; - - if ($request->is_ajax()) - { - $json_response = new phpbb_json_response; - $json_response->send(array( - 'MESSAGE_TITLE' => $user->lang['INFORMATION'], - 'MESSAGE_TEXT' => $message, - 'REFRESH_DATA' => null, - 'visible' => true, - )); - } - - meta_refresh(3, $redirect); - trigger_error($message); - } - } - - /** * Approve/Restore posts * * @param $action string Action we perform on the posts ('approve' or 'restore') |