aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-11-03 22:53:54 +0100
committerJoas Schilling <nickvergessen@gmx.de>2012-11-03 22:53:54 +0100
commitdfcfccf537658b83401b78afc851239f4842a4e5 (patch)
tree62d71e8e77d5e446c64910119c00f534193a6e9f /phpBB
parent6999d776d48831a48fa7f2882c7bbf767308e512 (diff)
downloadforums-dfcfccf537658b83401b78afc851239f4842a4e5.tar
forums-dfcfccf537658b83401b78afc851239f4842a4e5.tar.gz
forums-dfcfccf537658b83401b78afc851239f4842a4e5.tar.bz2
forums-dfcfccf537658b83401b78afc851239f4842a4e5.tar.xz
forums-dfcfccf537658b83401b78afc851239f4842a4e5.zip
[feature/soft-delete] Fix deleting via post editing
PHPBB3-9567
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/language/en/posting.php2
-rw-r--r--phpBB/posting.php22
-rw-r--r--phpBB/styles/prosilver/template/confirm_delete_body.html2
-rw-r--r--phpBB/styles/prosilver/template/posting_editor.html26
4 files changed, 32 insertions, 20 deletions
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 5418069d08..c3b06a77d7 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -85,7 +85,7 @@ $lang = array_merge($lang, array(
'DELETE_POSTS_PERMANENTLY_CONFIRM' => 'Are you sure you want to <strong>permanently</strong> delete these posts?',
'DELETE_REASON' => 'Delete reason',
'DELETE_REASON_EXPLAIN' => 'The reason is only used when the post is not deleted permanently.',
- 'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered',
+ 'DELETE_POST_WARN' => 'Deleted this post',
'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?',
'DELETE_TOPIC_PERMANENTLY' => 'Permanently delete this topic so it can not be recovered',
'DELETE_TOPIC_PERMANENTLY_CONFIRM' => 'Are you sure you want to <strong>permanently</strong> delete this topic?',
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 96907ee790..4c92d85a20 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -322,6 +322,12 @@ if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id))
// Handle delete mode...
if ($mode == 'delete' || $mode == 'soft_delete')
{
+ if ($mode == 'soft_delete' && $post_data['post_visibility'] == ITEM_DELETED)
+ {
+ $user->setup('posting');
+ trigger_error('NO_POST');
+ }
+
$soft_delete_reason = ($mode == 'soft_delete' && $auth->acl_get('m_softdelete', $forum_id)) ? utf8_normalize_nfc(request_var('delete_reason', '', true)) : '';
handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $soft_delete_reason);
return;
@@ -1110,6 +1116,14 @@ if ($submit || $preview || $refresh)
$captcha->reset();
}
+ // Handle delete mode...
+ if ($request->is_set_post('delete') || $request->is_set_post('delete_permanent'))
+ {
+ $soft_delete_reason = (!$request->is_set_post('delete_permanent') && $auth->acl_get('m_softdelete', $forum_id)) ? utf8_normalize_nfc(request_var('delete_reason', '', true)) : '';
+ handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $soft_delete_reason);
+ return;
+ }
+
// Check the permissions for post approval. Moderators are not affected.
if ((!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id']) && empty($data['force_approved_state'])) || (isset($data['force_approved_state']) && !$data['force_approved_state']))
{
@@ -1430,8 +1444,9 @@ $template->assign_vars(array(
'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '',
'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false,
'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '',
- 'S_SOFT_DELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '',
- 'S_SOFT_DELETE_ALLOWED' => ($mode == 'edit' && phpbb_content_visibility::can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false,
+ 'S_SOFTDELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '',
+ 'S_DELETE_REASON' => ($mode == 'edit' && $auth->acl_get('m_softdelete', $forum_id)) ? true : false,
+ 'S_SOFTDELETE_ALLOWED' => ($mode == 'edit' && phpbb_content_visibility::can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false,
'S_RESTORE_ALLOWED' => $auth->acl_get('m_approve', $forum_id),
'S_IS_DELETED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? true : false,
'S_LINKS_ALLOWED' => $url_status,
@@ -1584,10 +1599,11 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof
}
else
{
- global $template;
+ global $template, $request;
$template->assign_vars(array(
'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED,
+ 'S_CHECKED_PERMANENT' => $request->is_set_post('delete_permanent') ? ' checked="checked"' : '',
'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/confirm_delete_body.html b/phpBB/styles/prosilver/template/confirm_delete_body.html
index 1e6e03ca0d..c56ee703a7 100644
--- a/phpBB/styles/prosilver/template/confirm_delete_body.html
+++ b/phpBB/styles/prosilver/template/confirm_delete_body.html
@@ -15,7 +15,7 @@
<dt><label for="delete_permanent">{L_DELETE_PERMANENTLY}:</label></dt>
<dd>
<label for="delete_permanent">
- <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" />
+ <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} />
<!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF -->
</label>
</dd>
diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html
index f8fccf2d2f..6a87126fb1 100644
--- a/phpBB/styles/prosilver/template/posting_editor.html
+++ b/phpBB/styles/prosilver/template/posting_editor.html
@@ -73,21 +73,6 @@
<!-- ENDIF -->
<div class="clear"></div>
-
- <!-- ENDIF -->
-
- <!-- IF S_DELETE_ALLOWED -->
- <dl>
- <dt><label for="delete">{L_DELETE_POST}:</label></dt>
- <dd><label for="delete"><input type="checkbox" name="delete" id="delete" /> {L_DELETE_POST_WARN}</label></dd>
- </dl>
- <!-- ENDIF -->
-
- <!-- IF (S_SOFT_DELETE_ALLOWED and not S_IS_DELETED) or (S_RESTORE_ALLOWED and S_IS_DELETED) -->
- <dl>
- <dt><label for="soft_delete">{L_SOFT_DELETE_POST}:</label></dt>
- <dd><label for="soft_delete"><input type="checkbox" name="soft_delete"{S_SOFT_DELETE_CHECKED} id="soft_delete" /> {L_SOFT_DELETE_POST_EXPLAIN}</label></dd>
- </dl>
<!-- ENDIF -->
<!-- IF S_SHOW_TOPIC_ICONS or S_SHOW_PM_ICONS -->
@@ -261,6 +246,17 @@
</dl>
<!-- ENDIF -->
+ <!-- IF S_SOFTDELETE_ALLOWED or S_DELETE_ALLOWED -->
+ <hr class="dashed" />
+ <dl>
+ <dt><label for="delete">{L_DELETE_POST}:</label></dt>
+ <dd><label for="delete"><input type="checkbox" name="delete" id="delete" {S_SOFTDELETE_CHECKED} /> {L_DELETE_POST_WARN}</label></dd>
+ <!-- IF S_DELETE_ALLOWED and S_SOFTDELETE_ALLOWED -->
+ <dd><label for="delete_permanent"><input type="checkbox" name="delete_permanent" id="delete_permanent" /> {L_DELETE_POST_PERMANENTLY}</label></dd>
+ <!-- ENDIF -->
+ </dl>
+ <!-- ENDIF -->
+
<!-- IF S_EDIT_REASON -->
<dl>
<dt><label for="edit_reason">{L_EDIT_REASON}:</label></dt>