From bf7041eeb9682dc7a47a6837af700f9f56ec0d27 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sun, 14 Sep 2014 10:38:56 -0700 Subject: [PATCH 1/3] [ticket/13019] Always accept a reason for deleting a post/topic. PHPBB3-13019 --- phpBB/includes/functions_posting.php | 8 ++++---- phpBB/posting.php | 10 ++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 768011fa5b..1fdc7ee9ea 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2538,7 +2538,7 @@ function phpbb_upload_popup($forum_style = 0) /** * Do the various checks required for removing posts as well as removing it */ -function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $soft_delete_reason = '') +function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '') { global $user, $auth, $config, $request; global $phpbb_root_path, $phpEx; @@ -2571,19 +2571,19 @@ function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $ 'post_postcount' => $post_data['post_postcount'], ); - $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $soft_delete_reason); + $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $delete_reason); $post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username']; if ($next_post_id === false) { - add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username, $soft_delete_reason); + add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username, $delete_reason); $meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"); $message = $user->lang['POST_DELETED']; } else { - add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username, $soft_delete_reason); + add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username, $delete_reason); $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; $message = $user->lang['POST_DELETED']; diff --git a/phpBB/posting.php b/phpBB/posting.php index 4c3d012ca5..18572a3a6c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -436,9 +436,8 @@ if ($mode == 'delete' || $mode == 'soft_delete') trigger_error('NO_POST'); } - $allow_reason = $auth->acl_get('m_softdelete', $forum_id) || ($auth->acl_gets('m_delete', 'f_delete', $forum_id) && $auth->acl_gets('m_softdelete', 'f_softdelete', $forum_id)); - $soft_delete_reason = ($mode == 'soft_delete' && $allow_reason) ? $request->variable('delete_reason', '', true) : ''; - phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $soft_delete_reason); + $delete_reason = $request->variable('delete_reason', '', true); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $delete_reason); return; } @@ -1258,9 +1257,8 @@ if ($submit || $preview || $refresh) // Handle delete mode... if ($request->is_set_post('delete') || $request->is_set_post('delete_permanent')) { - $allow_reason = $auth->acl_get('m_softdelete', $forum_id) || ($auth->acl_gets('m_delete', 'f_delete', $forum_id) && $auth->acl_gets('m_softdelete', 'f_softdelete', $forum_id)); - $soft_delete_reason = (!$request->is_set_post('delete_permanent') && $allow_reason) ? $request->variable('delete_reason', '', true) : ''; - phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $soft_delete_reason); + $delete_reason = $request->variable('delete_reason', '', true); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $delete_reason); return; } From 8c11927b553717a8cd7d2afeb3e545ed54551c20 Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sun, 14 Sep 2014 10:39:25 -0700 Subject: [PATCH 2/3] [ticket/13019] Rename deletion reason label. PHPBB3-13019 --- phpBB/language/en/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php index 2cd6ec59cc..924395ed44 100644 --- a/phpBB/language/en/posting.php +++ b/phpBB/language/en/posting.php @@ -93,7 +93,7 @@ $lang = array_merge($lang, array( 'DELETE_POST_PERMANENTLY' => 'Permanently delete this post so it can not be recovered', 'DELETE_POSTS_CONFIRM' => 'Are you sure you want to delete these posts?', 'DELETE_POSTS_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete these posts?', - 'DELETE_REASON' => 'Soft delete reason', + 'DELETE_REASON' => 'Reason for deletion', 'DELETE_REASON_EXPLAIN' => 'The specified reason for deletion will be visible to moderators.', 'DELETE_POST_WARN' => 'Delete this post', 'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?', From ffe24d5b8f1892426574367c777109d899a0e9ff Mon Sep 17 00:00:00 2001 From: Cesar G Date: Sun, 14 Sep 2014 10:39:53 -0700 Subject: [PATCH 3/3] [ticket/13019] Do not hide reason field when deleting permanently. PHPBB3-13019 --- phpBB/styles/prosilver/template/ajax.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 13e8d02469..168efff4b4 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -353,14 +353,6 @@ $('.display_post').click(function(e) { $('#post_hidden' + postId).hide(); }); -$('#delete_permanent').click(function () { - if ($(this).prop('checked')) { - $('#delete_reason').hide(); - } else { - $('#delete_reason').show(); - } -}); - /** * Toggle the member search panel in memberlist.php. *