aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
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
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')
-rw-r--r--phpBB/includes/mcp/mcp_main.php29
-rw-r--r--phpBB/language/en/posting.php2
-rw-r--r--phpBB/posting.php1
-rw-r--r--phpBB/styles/prosilver/template/posting_delete_post_body.html14
4 files changed, 41 insertions, 5 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),
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 10e1d48d38..16d3e9a37a 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -184,6 +184,7 @@ $lang = array_merge($lang, array(
'POLL_VOTE_CHANGE' => 'Allow re-voting',
'POLL_VOTE_CHANGE_EXPLAIN' => 'If enabled users are able to change their vote.',
'POSTED_ATTACHMENTS' => 'Posted attachments',
+ 'POST_ALREADY_SOFTDELETED' => 'The post is already soft deleted, you can only hard delete it.',
'POST_APPROVAL_NOTIFY' => 'You will be notified when your post has been approved.',
'POST_CONFIRMATION' => 'Confirmation of post',
'POST_CONFIRM_EXPLAIN' => 'To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.',
@@ -240,6 +241,7 @@ $lang = array_merge($lang, array(
'TOO_MANY_URLS' => 'Your message contains too many URLs. The maximum number of URLs allowed is %d.',
'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.',
'TOPIC_BUMPED' => 'Topic has been bumped successfully.',
+ 'TOPIC_ALREADY_SOFTDELETED' => 'The topic is already soft deleted, you can only hard delete it.',
'UNAUTHORISED_BBCODE' => 'You cannot use certain BBCodes: %s.',
'UNGLOBALISE_EXPLAIN' => 'To switch this topic back from being global to a normal topic, you need to select the forum you wish this topic to be displayed.',
diff --git a/phpBB/posting.php b/phpBB/posting.php
index d1c48b38b0..e0ab56f7b7 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -1587,6 +1587,7 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof
global $template;
$template->assign_vars(array(
+ 'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id) || $auth->acl_get('f_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id) || $auth->acl_get('f_softdelete', $forum_id),
'S_DELETE_REASON' => $auth->acl_get('m_softdelete', $forum_id),
diff --git a/phpBB/styles/prosilver/template/posting_delete_post_body.html b/phpBB/styles/prosilver/template/posting_delete_post_body.html
index 967ecaca78..9ad9e985be 100644
--- a/phpBB/styles/prosilver/template/posting_delete_post_body.html
+++ b/phpBB/styles/prosilver/template/posting_delete_post_body.html
@@ -7,26 +7,32 @@
<h2>{MESSAGE_TITLE}</h2>
<p>{MESSAGE_TEXT}</p>
- <!-- IF S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE) -->
+ <!-- IF S_SOFTDELETED and S_TOPIC_MODE and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
+ <p>{L_TOPIC_ALREADY_SOFTDELETED}</p>
+ <!-- ELSEIF S_SOFTDELETED and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
+ <p>{L_POST_ALREADY_SOFTDELETED}</p>
+ <!-- ENDIF -->
+
+ <!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) -->
<fieldset class="fields1">
<!-- IF S_TOPIC_MODE and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
<dl>
<dt><label for="soft_delete">{L_DELETE_TOPIC_SOFT}:</label></dt>
<dd><label for="soft_delete"><input id="soft_delete" name="soft_delete" type="checkbox" checked="checked" value="1" /> {L_DELETE_TOPIC_SOFT_EXP}</label></dd>
</dl>
- <!-- ELSE IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
+ <!-- ELSEIF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
<dl>
<dt><label for="soft_delete">{L_DELETE_POST_SOFT}:</label></dt>
<dd><label for="soft_delete"><input id="soft_delete" name="soft_delete" type="checkbox" checked="checked" value="1" /> {L_DELETE_POST_SOFT_EXP}</label></dd>
</dl>
<!-- ENDIF -->
- <!-- IF S_DELETE_REASON -->
+ <!-- IF S_DELETE_REASON -->
<dl>
<dt><label for="delete_reason">{L_DELETE_POST_REASON}:</label></dt>
<dd><input type="text" name="delete_reason" id="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></dd>
</dl>
- <!-- ENDIF -->
+ <!-- ENDIF -->
</fieldset>
<!-- ENDIF -->