From 30213816ae2824f423b49b5e9c91806b0676ce4b Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Mon, 20 Oct 2014 00:24:16 +0200 Subject: [PATCH 1/2] [ticket/13100] Display only confirmation buttons when deleting shadow topic PHPBB3-13100 --- phpBB/includes/mcp/mcp_main.php | 15 +++++++++++++-- .../prosilver/template/confirm_delete_body.html | 4 ++++ .../subsilver2/template/confirm_delete_body.html | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 19a0ee3051..fb9d89755e 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -813,8 +813,18 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' $user->add_lang('posting'); + $only_shadow = false; + // If there are only shadow topics, we neither need a reason nor softdelete + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + AND topic_moved_id = 0'; + $result = $db->sql_query_limit($sql, 1); + $only_shadow = !$db->sql_fetchfield('topic_id'); + $db->sql_freeresult($result); + $only_softdeleted = false; - if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id)) + if (!$only_shadow && $auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id)) { // If there are only soft deleted topics, we display a message why the option is not available $sql = 'SELECT topic_id @@ -827,6 +837,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' } $template->assign_vars(array( + 'S_SHADOW_TOPICS' => $only_shadow, 'S_SOFTDELETED' => $only_softdeleted, 'S_TOPIC_MODE' => true, 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), @@ -839,7 +850,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' $l_confirm .= '_PERMANENTLY'; $s_hidden_fields['delete_permanent'] = '1'; } - else if (!$auth->acl_get('m_softdelete', $forum_id)) + else if ($only_shadow || !$auth->acl_get('m_softdelete', $forum_id)) { $s_hidden_fields['delete_permanent'] = '1'; } diff --git a/phpBB/styles/prosilver/template/confirm_delete_body.html b/phpBB/styles/prosilver/template/confirm_delete_body.html index f164b5f357..f0a7ab2bdb 100644 --- a/phpBB/styles/prosilver/template/confirm_delete_body.html +++ b/phpBB/styles/prosilver/template/confirm_delete_body.html @@ -2,6 +2,7 @@

{MESSAGE_TEXT}

+ +
  @@ -33,6 +35,7 @@

{MESSAGE_TEXT}

+
@@ -51,6 +54,7 @@
+
{S_HIDDEN_FIELDS} diff --git a/phpBB/styles/subsilver2/template/confirm_delete_body.html b/phpBB/styles/subsilver2/template/confirm_delete_body.html index 18df397fc3..44aec9b60a 100644 --- a/phpBB/styles/subsilver2/template/confirm_delete_body.html +++ b/phpBB/styles/subsilver2/template/confirm_delete_body.html @@ -14,6 +14,7 @@

{MESSAGE_TEXT}


+ @@ -30,6 +31,7 @@

+ {S_HIDDEN_FIELDS}    From e502c8db86313e1cdb41fe27978bf3be8076ba0c Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Tue, 4 Nov 2014 00:46:06 +0100 Subject: [PATCH 2/2] [ticket/13100] Remove pointless variable PHPBB3-13100 --- phpBB/includes/mcp/mcp_main.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index fb9d89755e..227ae84bd6 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -813,7 +813,6 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' $user->add_lang('posting'); - $only_shadow = false; // If there are only shadow topics, we neither need a reason nor softdelete $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . '