From dccc9ceeb58754dee811838d616449f0251d251b Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Sat, 26 Apr 2014 00:47:06 +0200 Subject: [PATCH 1/9] [ticket/11942] Delete post/topic reason should be added to logs https://tracker.phpbb.com/browse/PHPBB3-11942 PHPBB3-11942 --- phpBB/includes/mcp/mcp_main.php | 4 ++-- phpBB/language/en/acp/common.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 6b2e9266b3..0343c2f631 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -784,7 +784,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' $return = $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason); if (!empty($return)) { - add_log('mod', $row['forum_id'], $topic_id, 'LOG_SOFTDELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']); + add_log('mod', $row['forum_id'], $topic_id, 'LOG_SOFTDELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name'], $soft_delete_reason); } } else @@ -944,7 +944,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', foreach ($approve_log as $row) { $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; - add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_SOFTDELETE_POST', $row['post_subject'], $post_username); + add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_SOFTDELETE_POST', $row['post_subject'], $post_username, $soft_delete_reason); } $topic_id = $request->variable('t', 0); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 6f6a5f901f..66dc09b071 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -556,8 +556,8 @@ $lang = array_merge($lang, array( 'LOG_REPORT_CLOSED' => 'Closed report
» %s', 'LOG_REPORT_DELETED' => 'Deleted report
» %s', 'LOG_RESTORE_TOPIC' => 'Restored topic “%1$s” written by
» %2$s', - 'LOG_SOFTDELETE_POST' => 'Soft deleted post “%1$s” written by
» %2$s', - 'LOG_SOFTDELETE_TOPIC' => 'Soft deleted topic “%1$s” written by
» %2$s', + 'LOG_SOFTDELETE_POST' => 'Soft deleted post “%1$s” written by “%2$s”
» %3$s', + 'LOG_SOFTDELETE_TOPIC' => 'Soft deleted topic “%1$s” written by “%2$s”
» %3$s', 'LOG_SPLIT_DESTINATION' => 'Moved split posts
» to %s', 'LOG_SPLIT_SOURCE' => 'Split posts
» from %s', From 1c336c355965fbe47717744e0d5fb04125d12247 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Sat, 26 Apr 2014 12:47:24 +0200 Subject: [PATCH 2/9] [ticket/11942] Adding the reason to hard deleted topic/post PHPBB3-11942 --- phpBB/includes/mcp/mcp_main.php | 4 ++-- phpBB/language/en/acp/common.php | 8 ++++---- phpBB/posting.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 0343c2f631..075e49453f 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -789,7 +789,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' } else { - add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']); + add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name'], $soft_delete_reason); } } } @@ -987,7 +987,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', foreach ($post_data as $id => $row) { $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; - add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject'], $post_username); + add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject'], $post_username, $soft_delete_reason); } // Now delete the posts, topics and forums are automatically resync'ed diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 66dc09b071..3dec17b05d 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -539,9 +539,9 @@ $lang = array_merge($lang, array( 'LOG_APPROVE_TOPIC' => 'Approved topic
» %s', 'LOG_BUMP_TOPIC' => 'User bumped topic
» %s', - 'LOG_DELETE_POST' => 'Deleted post “%1$s” written by
» %2$s', + 'LOG_DELETE_POST' => 'Deleted post “%1$s” written by “%2$s” with the following reason
» %3$s', 'LOG_DELETE_SHADOW_TOPIC' => 'Deleted shadow topic
» %s', - 'LOG_DELETE_TOPIC' => 'Deleted topic “%1$s” written by
» %2$s', + 'LOG_DELETE_TOPIC' => 'Deleted topic “%1$s” written by “%2$s” with the following reason
» %3$s', 'LOG_FORK' => 'Copied topic
» from %s', 'LOG_LOCK' => 'Locked topic
» %s', 'LOG_LOCK_POST' => 'Locked post
» %s', @@ -556,8 +556,8 @@ $lang = array_merge($lang, array( 'LOG_REPORT_CLOSED' => 'Closed report
» %s', 'LOG_REPORT_DELETED' => 'Deleted report
» %s', 'LOG_RESTORE_TOPIC' => 'Restored topic “%1$s” written by
» %2$s', - 'LOG_SOFTDELETE_POST' => 'Soft deleted post “%1$s” written by “%2$s”
» %3$s', - 'LOG_SOFTDELETE_TOPIC' => 'Soft deleted topic “%1$s” written by “%2$s”
» %3$s', + 'LOG_SOFTDELETE_POST' => 'Soft deleted post “%1$s” written by “%2$s” with the following reason
» %3$s', + 'LOG_SOFTDELETE_TOPIC' => 'Soft deleted topic “%1$s” written by “%2$s” with the following reason
» %3$s', 'LOG_SPLIT_DESTINATION' => 'Moved split posts
» to %s', 'LOG_SPLIT_SOURCE' => 'Split posts
» from %s', diff --git a/phpBB/posting.php b/phpBB/posting.php index cfd6524e62..46ccf40e5c 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1709,14 +1709,14 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof 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); + add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username, $soft_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); + add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username, $soft_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']; From fee4e6193397234afe0de57aa0045b9a11bf8fe5 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Mon, 28 Apr 2014 18:43:29 +0200 Subject: [PATCH 3/9] [ticket/11942] Change the formulation PHPBB3-11942 --- phpBB/language/en/acp/common.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 3dec17b05d..2cd7ef7b64 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -539,9 +539,9 @@ $lang = array_merge($lang, array( 'LOG_APPROVE_TOPIC' => 'Approved topic
» %s', 'LOG_BUMP_TOPIC' => 'User bumped topic
» %s', - 'LOG_DELETE_POST' => 'Deleted post “%1$s” written by “%2$s” with the following reason
» %3$s', + 'LOG_DELETE_POST' => 'Deleted post “%1$s” written by “%2$s” for the following reason
» %3$s', 'LOG_DELETE_SHADOW_TOPIC' => 'Deleted shadow topic
» %s', - 'LOG_DELETE_TOPIC' => 'Deleted topic “%1$s” written by “%2$s” with the following reason
» %3$s', + 'LOG_DELETE_TOPIC' => 'Deleted topic “%1$s” written by “%2$s” for the following reason
» %3$s', 'LOG_FORK' => 'Copied topic
» from %s', 'LOG_LOCK' => 'Locked topic
» %s', 'LOG_LOCK_POST' => 'Locked post
» %s', @@ -556,8 +556,8 @@ $lang = array_merge($lang, array( 'LOG_REPORT_CLOSED' => 'Closed report
» %s', 'LOG_REPORT_DELETED' => 'Deleted report
» %s', 'LOG_RESTORE_TOPIC' => 'Restored topic “%1$s” written by
» %2$s', - 'LOG_SOFTDELETE_POST' => 'Soft deleted post “%1$s” written by “%2$s” with the following reason
» %3$s', - 'LOG_SOFTDELETE_TOPIC' => 'Soft deleted topic “%1$s” written by “%2$s” with the following reason
» %3$s', + 'LOG_SOFTDELETE_POST' => 'Soft deleted post “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_SOFTDELETE_TOPIC' => 'Soft deleted topic “%1$s” written by “%2$s” for the following reason
» %3$s', 'LOG_SPLIT_DESTINATION' => 'Moved split posts
» to %s', 'LOG_SPLIT_SOURCE' => 'Split posts
» from %s', From cc1a304da6c8946cfd3d46fc08548109a8e1c05b Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Fri, 2 May 2014 13:16:00 +0200 Subject: [PATCH 4/9] [ticket/11942] Edits messages PHPBB3-11942 --- phpBB/includes/functions_posting.php | 2 +- phpBB/language/en/acp/common.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 547ea69e81..d9b935ccc2 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1653,7 +1653,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($user->data['user_id'] != $poster_id) { $log_subject = ($subject) ? $subject : $data['topic_title']; - add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST']); + add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST'], $data['post_edit_reason']); } if (!isset($sql_data[POSTS_TABLE]['sql'])) diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 2cd7ef7b64..f2513f647e 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -551,7 +551,7 @@ $lang = array_merge($lang, array( 'LOG_PM_REPORT_DELETED' => 'Deleted PM report
» %s', 'LOG_POST_APPROVED' => 'Approved post
» %s', 'LOG_POST_DISAPPROVED' => 'Disapproved post “%1$s” written by “%3$s” for the following reason
» %2$s', - 'LOG_POST_EDITED' => 'Edited post “%1$s” written by
» %2$s', + 'LOG_POST_EDITED' => 'Edited post “%1$s” written by “%2$s” for the following reason
» %3$s', 'LOG_POST_RESTORED' => 'Restored post
» %s', 'LOG_REPORT_CLOSED' => 'Closed report
» %s', 'LOG_REPORT_DELETED' => 'Deleted report
» %s', From 237619792dd2d7b6c9e057307139e6bb52283df3 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 19:28:26 +0200 Subject: [PATCH 5/9] [ticket/11942] Always display delete reason PHPBB3-11942 --- phpBB/includes/mcp/mcp_main.php | 2 -- phpBB/posting.php | 2 -- .../template/confirm_delete_body.html | 20 ++++++++----------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 075e49453f..c133c4f574 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -823,7 +823,6 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' 'S_TOPIC_MODE' => true, '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), )); $l_confirm = (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS'; @@ -1060,7 +1059,6 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', '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), )); $l_confirm = (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS'; diff --git a/phpBB/posting.php b/phpBB/posting.php index 46ccf40e5c..cc39f70b48 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1740,14 +1740,12 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof $can_delete = $auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id)); $can_softdelete = $auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id)); - $display_reason = $auth->acl_get('m_softdelete', $forum_id) || ($can_delete && $can_softdelete); $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' => $can_delete, 'S_ALLOWED_SOFTDELETE' => $can_softdelete, - 'S_DELETE_REASON' => $display_reason, )); $l_confirm = 'DELETE_POST'; diff --git a/phpBB/styles/prosilver/template/confirm_delete_body.html b/phpBB/styles/prosilver/template/confirm_delete_body.html index 2d4dde5cd5..e755a76ae6 100644 --- a/phpBB/styles/prosilver/template/confirm_delete_body.html +++ b/phpBB/styles/prosilver/template/confirm_delete_body.html @@ -11,12 +11,10 @@ - - - +
@@ -51,12 +49,10 @@ - -
-

{L_DELETE_REASON_EXPLAIN}
-
-
- +
+

{L_DELETE_REASON_EXPLAIN}
+
+
From 12e0e358d1b04af41c34039dbc23b54f260883fd Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 19:35:42 +0200 Subject: [PATCH 6/9] [ticket/11942] Apply the modifications to subsilver PHPBB3-11942 --- phpBB/posting.php | 1 - phpBB/styles/prosilver/template/confirm_delete_body.html | 4 ++-- phpBB/styles/subsilver2/template/confirm_delete_body.html | 4 +--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index cc39f70b48..2d25aedae8 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1537,7 +1537,6 @@ $template->assign_vars(array( '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_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, diff --git a/phpBB/styles/prosilver/template/confirm_delete_body.html b/phpBB/styles/prosilver/template/confirm_delete_body.html index e755a76ae6..31dd9896cc 100644 --- a/phpBB/styles/prosilver/template/confirm_delete_body.html +++ b/phpBB/styles/prosilver/template/confirm_delete_body.html @@ -2,7 +2,7 @@

{MESSAGE_TEXT}

- +