aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp/mcp_main.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-10-31 17:29:55 +0100
committerJoas Schilling <nickvergessen@gmx.de>2012-10-31 21:28:06 +0100
commit8d05dad63471ffbc58feecd1f44cfa5703f0d5f1 (patch)
tree5b4e7c65be3b7e0ac2c75aedc373b3e89cf195d8 /phpBB/includes/mcp/mcp_main.php
parent18dec1026ad8cc5dea6117ca1336ca9eba41aa2a (diff)
downloadforums-8d05dad63471ffbc58feecd1f44cfa5703f0d5f1.tar
forums-8d05dad63471ffbc58feecd1f44cfa5703f0d5f1.tar.gz
forums-8d05dad63471ffbc58feecd1f44cfa5703f0d5f1.tar.bz2
forums-8d05dad63471ffbc58feecd1f44cfa5703f0d5f1.tar.xz
forums-8d05dad63471ffbc58feecd1f44cfa5703f0d5f1.zip
[feature/soft-delete] Display message when the posts are already soft deleted
PHPBB3-9567
Diffstat (limited to 'phpBB/includes/mcp/mcp_main.php')
-rw-r--r--phpBB/includes/mcp/mcp_main.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index bb2dd7d63d..c7e2252729 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -785,7 +785,21 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
$user->add_lang('posting');
+ $only_softdeleted = false;
+ // If there are only soft deleted topics, we display a message why the option is not available
+ if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id))
+ {
+ $sql = 'SELECT topic_id
+ FROM ' . TOPICS_TABLE . '
+ WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . '
+ AND topic_visibility <> ' . ITEM_DELETED;
+ $result = $db->sql_query_limit($sql, 1);
+ $only_softdeleted = (bool) $db->sql_fetchfield('topic_id');
+ $db->sql_freeresult($result);
+ }
+
$template->assign_vars(array(
+ 'S_SOFTDELETED' => $only_softdeleted,
'S_TOPIC_MODE' => true,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),
@@ -997,8 +1011,21 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '')
$user->add_lang('posting');
+ $only_softdeleted = false;
+ // If there are only soft deleted posts, we display a message why the option is not available
+ if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id))
+ {
+ $sql = 'SELECT post_id
+ FROM ' . POSTS_TABLE . '
+ WHERE ' . $db->sql_in_set('post_id', $post_ids) . '
+ AND post_visibility <> ' . ITEM_DELETED;
+ $result = $db->sql_query_limit($sql, 1);
+ $only_softdeleted = (bool) $db->sql_fetchfield('post_id');
+ $db->sql_freeresult($result);
+ }
+
$template->assign_vars(array(
- 'S_TOPIC_MODE' => true,
+ 'S_SOFTDELETED' => $only_softdeleted,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),
'S_DELETE_REASON' => $auth->acl_get('m_softdelete', $forum_id),