1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-04 14:47:52 +02:00

[feature/soft-delete] Turn restore_post() into a method and add the docs

PHPBB3-9567
This commit is contained in:
Joas Schilling 2012-10-15 14:02:16 +02:00
parent a58a76ef5f
commit 7c2cc9cfef
2 changed files with 88 additions and 85 deletions

View File

@ -62,7 +62,7 @@ class mcp_queue
}
else if ($action == 'restore')
{
restore_post($post_id_list, 'queue', $mode);
$this->restore_posts($post_id_list, 'queue', $mode);
}
else
{
@ -454,14 +454,19 @@ class mcp_queue
break;
}
}
}
/**
* Restore Post/Topic
*/
function restore_post($post_id_list, $id, $mode)
{
/**
* 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
* @return void
*/
function restore_posts($post_id_list, $id, $mode)
{
global $db, $template, $user, $config;
global $phpEx, $phpbb_root_path, $request;
@ -499,6 +504,8 @@ function restore_post($post_id_list, $id, $mode)
{
$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)
@ -507,17 +514,9 @@ function restore_post($post_id_list, $id, $mode)
}
$success_msg = '';
/**
* Currently only works for approving posts
if (sizeof($topic_info) > 1)
{
$success_msg = ((sizeof($post_info) == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
}
else
*/
if (sizeof($post_info) >= 1)
{
$success_msg = (sizeof($post_info) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS';
$success_msg = (sizeof($post_info) == 1) ? 'POST_RESTORED_SUCCESS' : 'POSTS_RESTORED_SUCCESS';
}
if (!$success_msg)
@ -526,7 +525,7 @@ function restore_post($post_id_list, $id, $mode)
}
else
{
// If approving one post, also give links back to post...
// If restoring one post, also give links back to post...
$add_message = '';
if (sizeof($post_id_list) == 1 && !empty($post_url))
{
@ -549,8 +548,10 @@ function restore_post($post_id_list, $id, $mode)
meta_refresh(3, $redirect);
trigger_error($message);
}
}
}
/**
* Approve Post/Topic
*/

View File

@ -269,15 +269,17 @@ $lang = array_merge($lang, array(
'POSTS_DISAPPROVED_SUCCESS' => 'The selected posts have been disapproved.',
'POSTS_LOCKED_SUCCESS' => 'The selected posts have been locked successfully.',
'POSTS_MERGED_SUCCESS' => 'The selected posts have been merged.',
'POSTS_UNLOCKED_SUCCESS' => 'The selected posts have been unlocked successfully.',
'POSTS_PER_PAGE' => 'Posts per page',
'POSTS_PER_PAGE_EXPLAIN' => '(Set to 0 to view all posts.)',
'POSTS_RESTORED_SUCCESS' => 'The selected posts have been restored successfully.',
'POSTS_UNLOCKED_SUCCESS' => 'The selected posts have been unlocked successfully.',
'POST_APPROVED_SUCCESS' => 'The selected post has been approved.',
'POST_DELETED_SUCCESS' => 'The selected post has been successfully removed from the database.',
'POST_DISAPPROVED_SUCCESS' => 'The selected post has been disapproved.',
'POST_LOCKED_SUCCESS' => 'Post locked successfully.',
'POST_NOT_EXIST' => 'The post you requested does not exist.',
'POST_REPORTED_SUCCESS' => 'This post has been successfully reported.',
'POST_RESTORED_SUCCESS' => 'This post has been restored successfully.',
'POST_UNLOCKED_SUCCESS' => 'Post unlocked successfully.',
'READ_USERNOTES' => 'User notes',