mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[feature/soft-delete] Split deleting soft-deleted posts from unapproving posts
PHPBB3-9657
This commit is contained in:
parent
24e1881ea1
commit
4498c5aaeb
2 changed files with 61 additions and 10 deletions
|
@ -724,7 +724,7 @@ function mcp_restore_topic($topic_ids)
|
||||||
/**
|
/**
|
||||||
* Delete Topics
|
* Delete Topics
|
||||||
*/
|
*/
|
||||||
function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '')
|
function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_topic')
|
||||||
{
|
{
|
||||||
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request;
|
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request;
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
|
||||||
$s_hidden_fields = array(
|
$s_hidden_fields = array(
|
||||||
'topic_id_list' => $topic_ids,
|
'topic_id_list' => $topic_ids,
|
||||||
'f' => $forum_id,
|
'f' => $forum_id,
|
||||||
'action' => 'delete_topic',
|
'action' => $action,
|
||||||
'redirect' => $redirect,
|
'redirect' => $redirect,
|
||||||
);
|
);
|
||||||
$success_msg = '';
|
$success_msg = '';
|
||||||
|
@ -852,7 +852,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
|
||||||
/**
|
/**
|
||||||
* Delete Posts
|
* Delete Posts
|
||||||
*/
|
*/
|
||||||
function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '')
|
function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_post')
|
||||||
{
|
{
|
||||||
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request;
|
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request;
|
||||||
|
|
||||||
|
@ -867,7 +867,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '')
|
||||||
$s_hidden_fields = array(
|
$s_hidden_fields = array(
|
||||||
'post_id_list' => $post_ids,
|
'post_id_list' => $post_ids,
|
||||||
'f' => $forum_id,
|
'f' => $forum_id,
|
||||||
'action' => 'delete_post',
|
'action' => $action,
|
||||||
'redirect' => $redirect,
|
'redirect' => $redirect,
|
||||||
);
|
);
|
||||||
$success_msg = '';
|
$success_msg = '';
|
||||||
|
|
|
@ -66,19 +66,70 @@ class mcp_queue
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
case 'disapprove':
|
|
||||||
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
|
||||||
|
|
||||||
$post_id_list = $request->variable('post_id_list', array(0));
|
$post_id_list = $request->variable('post_id_list', array(0));
|
||||||
$topic_id_list = $request->variable('topic_id_list', array(0));
|
$topic_id_list = $request->variable('topic_id_list', array(0));
|
||||||
|
|
||||||
if (!empty($post_id_list))
|
if (!empty($post_id_list))
|
||||||
{
|
{
|
||||||
self::disapprove_posts($post_id_list, 'queue', $mode);
|
if (!function_exists('mcp_delete_post'))
|
||||||
|
{
|
||||||
|
global $phpbb_root_path, $phpEx;
|
||||||
|
include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
|
||||||
|
}
|
||||||
|
mcp_delete_post($post_id_list, false, '', $action);
|
||||||
}
|
}
|
||||||
else if (!empty($topic_id_list))
|
else if (!empty($topic_id_list))
|
||||||
{
|
{
|
||||||
self::disapprove_topics($action, $topic_id_list, 'queue', $mode);
|
if (!function_exists('mcp_delete_topic'))
|
||||||
|
{
|
||||||
|
global $phpbb_root_path, $phpEx;
|
||||||
|
include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
|
||||||
|
}
|
||||||
|
mcp_delete_topic($topic_id_list, false, '', $action);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trigger_error('NO_POST_SELECTED');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'disapprove':
|
||||||
|
$post_id_list = $request->variable('post_id_list', array(0));
|
||||||
|
$topic_id_list = $request->variable('topic_id_list', array(0));
|
||||||
|
|
||||||
|
if (!empty($topic_id_list) && $mode == 'deleted_topics')
|
||||||
|
{
|
||||||
|
if (!function_exists('mcp_delete_topics'))
|
||||||
|
{
|
||||||
|
global $phpbb_root_path, $phpEx;
|
||||||
|
include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx);
|
||||||
|
}
|
||||||
|
mcp_delete_topic($topic_id_list, false, '', 'disapprove');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
||||||
|
|
||||||
|
if (!empty($topic_id_list))
|
||||||
|
{
|
||||||
|
$post_visibility = ($mode == 'deleted_topics') ? ITEM_DELETED : ITEM_UNAPPROVED;
|
||||||
|
$sql = 'SELECT post_id
|
||||||
|
FROM ' . POSTS_TABLE . '
|
||||||
|
WHERE post_visibility = ' . $post_visibility . '
|
||||||
|
AND ' . $db->sql_in_set('topic_id', $topic_id_list);
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$post_id_list = array();
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$post_id_list[] = (int) $row['post_id'];
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($post_id_list))
|
||||||
|
{
|
||||||
|
self::disapprove_posts($post_id_list, 'queue', $mode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -893,7 +944,7 @@ class mcp_queue
|
||||||
'redirect' => $redirect)
|
'redirect' => $redirect)
|
||||||
);
|
);
|
||||||
|
|
||||||
$notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false;
|
$notify_poster = $request->is_set('notify_poster');
|
||||||
$disapprove_reason = '';
|
$disapprove_reason = '';
|
||||||
|
|
||||||
if ($reason_id)
|
if ($reason_id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue