From 334265fc839f95d24cce44ec675ae8cef7b4bfaa Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 3 Nov 2012 22:57:49 +0100 Subject: [PATCH] [feature/soft-delete] Fix displaying the button/permission When the post is already softdeleted the options should only be available if *_delete is granted. PHPBB3-9567 --- phpBB/includes/functions_display.php | 2 +- phpBB/viewtopic.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index ed91d9ad1c..6f166e2a14 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -788,7 +788,7 @@ function gen_forum_auth_level($mode, $forum_id, $forum_status) ($auth->acl_get('f_post', $forum_id) && !$locked) ? $user->lang['RULES_POST_CAN'] : $user->lang['RULES_POST_CANNOT'], ($auth->acl_get('f_reply', $forum_id) && !$locked) ? $user->lang['RULES_REPLY_CAN'] : $user->lang['RULES_REPLY_CANNOT'], ($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $forum_id) && !$locked) ? $user->lang['RULES_EDIT_CAN'] : $user->lang['RULES_EDIT_CANNOT'], - ($user->data['is_registered'] && $auth->acl_gets('f_delete', 'm_delete', $forum_id) && !$locked) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'], + ($user->data['is_registered'] && ($auth->acl_gets('f_delete', 'm_delete', $forum_id) || $auth->acl_gets('f_softdelete', 'm_softdelete', $forum_id)) && !$locked) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'], ); if ($config['allow_attachments']) diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 04e1697aac..2e04b660b2 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -531,7 +531,7 @@ $quickmod_array = array( 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))), 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))), - 'delete_topic' => array('DELETE_TOPIC', $auth->acl_get('m_delete', $forum_id)), + 'delete_topic' => array('DELETE_TOPIC', ($auth->acl_get('m_delete', $forum_id) || (($topic_data['topic_visibility'] != ITEM_DELETED) && $auth->acl_get('m_softdelete', $forum_id)))), 'restore_topic' => array('RESTORE_TOPIC', (($topic_data['topic_visibility'] == ITEM_DELETED) && $auth->acl_get('m_approve', $forum_id))), 'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED), 'split' => array('SPLIT_TOPIC', $auth->acl_get('m_split', $forum_id)), @@ -1591,9 +1591,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']) ))); - $delete_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_delete', $forum_id) || ( + $delete_allowed = ($user->data['is_registered'] && (($auth->acl_get('m_delete', $forum_id) || ($auth->acl_get('m_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) || ( $user->data['user_id'] == $poster_id && - $auth->acl_get('f_delete', $forum_id) && + ($auth->acl_get('f_delete', $forum_id) || ($auth->acl_get('f_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) && $topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) && // we do not want to allow removal of the last post if a moderator locked it!