mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/soft-delete] Fix restoring/approving posts with mcp moderation
PHPBB3-9567
This commit is contained in:
parent
f0e2d21f8c
commit
18dec1026a
3 changed files with 21 additions and 14 deletions
|
@ -25,12 +25,12 @@ class mcp_queue
|
|||
var $p_master;
|
||||
var $u_action;
|
||||
|
||||
function mcp_queue(&$p_master)
|
||||
public function mcp_queue(&$p_master)
|
||||
{
|
||||
$this->p_master = &$p_master;
|
||||
}
|
||||
|
||||
function main($id, $mode)
|
||||
public function main($id, $mode)
|
||||
{
|
||||
global $auth, $db, $user, $template, $cache;
|
||||
global $config, $phpbb_root_path, $phpEx, $action;
|
||||
|
@ -56,11 +56,11 @@ class mcp_queue
|
|||
{
|
||||
if (!empty($post_id_list))
|
||||
{
|
||||
$this->approve_posts($action, $post_id_list, 'queue', $mode);
|
||||
self::approve_posts($action, $post_id_list, 'queue', $mode);
|
||||
}
|
||||
else if (!empty($topic_id_list))
|
||||
{
|
||||
$this->approve_topics($action, $topic_id_list, 'queue', $mode);
|
||||
self::approve_topics($action, $topic_id_list, 'queue', $mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ class mcp_queue
|
|||
|
||||
if (!empty($post_id_list))
|
||||
{
|
||||
$this->disapprove_posts($post_id_list, 'queue', $mode);
|
||||
self::disapprove_posts($post_id_list, 'queue', $mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -493,7 +493,7 @@ class mcp_queue
|
|||
* @param $mode string Active module
|
||||
* @return void
|
||||
*/
|
||||
function approve_posts($action, $post_id_list, $id, $mode)
|
||||
static public function approve_posts($action, $post_id_list, $id, $mode)
|
||||
{
|
||||
global $db, $template, $user, $config;
|
||||
global $phpEx, $phpbb_root_path, $request;
|
||||
|
@ -686,7 +686,7 @@ class mcp_queue
|
|||
* @param $mode string Active module
|
||||
* @return void
|
||||
*/
|
||||
function approve_topics($action, $topic_id_list, $id, $mode)
|
||||
static public function approve_topics($action, $topic_id_list, $id, $mode)
|
||||
{
|
||||
global $db, $template, $user, $config;
|
||||
global $phpEx, $phpbb_root_path, $request;
|
||||
|
@ -849,7 +849,7 @@ class mcp_queue
|
|||
* @param $mode string Active module
|
||||
* @return void
|
||||
*/
|
||||
function disapprove_posts($post_id_list, $id, $mode)
|
||||
static public function disapprove_posts($post_id_list, $id, $mode)
|
||||
{
|
||||
global $db, $template, $user, $config;
|
||||
global $phpEx, $phpbb_root_path;
|
||||
|
|
|
@ -84,8 +84,8 @@ function mcp_topic_view($id, $mode, $action)
|
|||
$subject = $topic_info['topic_title'];
|
||||
}
|
||||
|
||||
// Approve posts?
|
||||
if ($action == 'approve' && $auth->acl_get('m_approve', $topic_info['forum_id']))
|
||||
// Restore or pprove posts?
|
||||
if (($action == 'restore' || $action == 'approve') && $auth->acl_get('m_approve', $topic_info['forum_id']))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/mcp/mcp_queue.' . $phpEx);
|
||||
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
|
||||
|
@ -98,7 +98,7 @@ function mcp_topic_view($id, $mode, $action)
|
|||
|
||||
if (!$sort)
|
||||
{
|
||||
approve_post($post_id_list, $id, $mode);
|
||||
mcp_queue::approve_posts($action, $post_id_list, $id, $mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ function mcp_topic_view($id, $mode, $action)
|
|||
$topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id);
|
||||
}
|
||||
|
||||
$has_unapproved_posts = false;
|
||||
$has_unapproved_posts = $has_deleted_posts = false;
|
||||
|
||||
// Grab extensions
|
||||
$extensions = $attachments = array();
|
||||
|
@ -225,6 +225,11 @@ function mcp_topic_view($id, $mode, $action)
|
|||
$has_unapproved_posts = true;
|
||||
}
|
||||
|
||||
if ($row['post_visibility'] == ITEM_DELETED)
|
||||
{
|
||||
$has_deleted_posts = true;
|
||||
}
|
||||
|
||||
$post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
|
||||
$template->assign_block_vars('postrow', array(
|
||||
|
@ -305,7 +310,7 @@ function mcp_topic_view($id, $mode, $action)
|
|||
{
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $posts_per_page, $start);
|
||||
}
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TOPIC_TITLE' => $topic_info['topic_title'],
|
||||
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']),
|
||||
|
@ -319,7 +324,7 @@ function mcp_topic_view($id, $mode, $action)
|
|||
|
||||
'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'),
|
||||
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'),
|
||||
'DELETED_IMG' => $user->img('icon_topic_deleted', 'POST_DELETED'),
|
||||
'DELETED_IMG' => $user->img('icon_topic_deleted', 'POST_DELETED'),
|
||||
'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'),
|
||||
|
||||
'S_MCP_ACTION' => "$url&i=$id&mode=$mode&action=$action&start=$start",
|
||||
|
@ -328,6 +333,7 @@ function mcp_topic_view($id, $mode, $action)
|
|||
'S_CAN_MERGE' => ($auth->acl_get('m_merge', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_DELETE' => ($auth->acl_get('m_delete', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_APPROVE' => ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_RESTORE' => ($has_deleted_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? true : false,
|
||||
'S_CAN_SYNC' => $auth->acl_get('m_', $topic_info['forum_id']),
|
||||
|
|
|
@ -160,6 +160,7 @@ onload_functions.push('subPanels()');
|
|||
<!-- IF S_CAN_APPROVE --><option value="approve">{L_APPROVE_POSTS}</option><!-- ENDIF -->
|
||||
<!-- IF S_CAN_LOCK --><option value="lock_post">{L_LOCK_POST_POSTS} [ {L_LOCK_POST_EXPLAIN} ]</option><option value="unlock_post">{L_UNLOCK_POST_POSTS}</option><!-- ENDIF -->
|
||||
<!-- IF S_CAN_DELETE --><option value="delete_post">{L_DELETE_POSTS}</option><!-- ENDIF -->
|
||||
<!-- IF S_CAN_RESTORE --><option value="restore">{L_RESTORE_POSTS}</option><!-- ENDIF -->
|
||||
<!-- IF S_CAN_MERGE --><option value="merge_posts"<!-- IF S_MERGE_VIEW --> selected="selected"<!-- ENDIF -->>{L_MERGE_POSTS}</option><!-- ENDIF -->
|
||||
<!-- IF S_CAN_SPLIT --><option value="split_all"<!-- IF S_SPLIT_VIEW --> selected="selected"<!-- ENDIF -->>{L_SPLIT_POSTS}</option><option value="split_beyond">{L_SPLIT_AFTER}</option><!-- ENDIF -->
|
||||
<!-- IF S_CAN_SYNC --><option value="resync">{L_RESYNC}</option><!-- ENDIF -->
|
||||
|
|
Loading…
Add table
Reference in a new issue