From 3afbda1694cfe96c2331c63b174a2b69c073b5de Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Mon, 21 Aug 2023 23:17:48 +0700 Subject: [PATCH 1/2] Show pin & unpin actions in log actions --- admin/admin_log.php | 4 +++- library/includes/functions.php | 10 ++++++---- library/language/en/main.php | 2 ++ library/language/ru/main.php | 2 ++ library/language/uk/main.php | 2 ++ modcp.php | 24 ++++++++++++++++++++++++ 6 files changed, 39 insertions(+), 5 deletions(-) diff --git a/admin/admin_log.php b/admin/admin_log.php index 26b4e10e..271ef85b 100644 --- a/admin/admin_log.php +++ b/admin/admin_log.php @@ -265,6 +265,8 @@ case $log_type['mod_topic_lock']: case $log_type['mod_topic_unlock']: case $log_type['mod_post_delete']: + case $log_type['mod_post_pin']: + case $log_type['mod_post_unpin']: case $log_type['mod_topic_split']: // topic_title if (!empty($row['log_topic_title'])) @@ -326,7 +328,7 @@ 'TOPIC_HREF_NEW_S' => url_arg($url, $topic_key, $row['log_topic_id_new']), 'TOPIC_TITLE_NEW' => $topic_title_new, - 'DATE' => bb_date($row['log_time'], 'd-M-y'), + 'DATE' => bb_date($row['log_time'], 'd-M-y', false), 'TIME' => bb_date($row['log_time'], 'H:i'), 'DATETIME_HREF_S' => $datetime_href_s, 'MSG' => $msg, diff --git a/library/includes/functions.php b/library/includes/functions.php index 31bf92f1..30c7c99f 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -2122,10 +2122,12 @@ class log_action 'mod_topic_lock' => 3, 'mod_topic_unlock' => 4, 'mod_post_delete' => 5, - 'mod_topic_split' => 6, - 'adm_user_delete' => 7, - 'adm_user_ban' => 8, - 'adm_user_unban' => 9, + 'mod_post_pin' => 6, + 'mod_post_unpin' => 7, + 'mod_topic_split' => 8, + 'adm_user_delete' => 9, + 'adm_user_ban' => 10, + 'adm_user_unban' => 11, ); var $log_type_select = array(); var $log_disabled = false; diff --git a/library/language/en/main.php b/library/language/en/main.php index 4db24db3..9b26ca30 100644 --- a/library/language/en/main.php +++ b/library/language/en/main.php @@ -2543,6 +2543,8 @@ 'mod_topic_unlock' => 'Topic:
opened', 'mod_topic_split' => 'Topic:
split', 'mod_post_delete' => 'Post:
deleted', + 'mod_post_pin' => 'Post:
pinned', + 'mod_post_unpin' => 'Post:
unpinned', 'adm_user_delete' => 'User:
deleted', 'adm_user_ban' => 'User:
ban', 'adm_user_unban' => 'User:
unban', diff --git a/library/language/ru/main.php b/library/language/ru/main.php index c9aa4b8a..50d5e3cc 100644 --- a/library/language/ru/main.php +++ b/library/language/ru/main.php @@ -2543,6 +2543,8 @@ 'mod_topic_unlock' => 'Топик:
открыт', 'mod_topic_split' => 'Топик:
разделен', 'mod_post_delete' => 'Пост:
удален', + 'mod_post_pin' => 'Пост:
закреплен', + 'mod_post_unpin' => 'Пост:
откреплен', 'adm_user_delete' => 'Юзер:
удален', 'adm_user_ban' => 'Юзер:
забанен', 'adm_user_unban' => 'Юзер:
разбанен' diff --git a/library/language/uk/main.php b/library/language/uk/main.php index f02ad3a8..e83e2500 100644 --- a/library/language/uk/main.php +++ b/library/language/uk/main.php @@ -2543,6 +2543,8 @@ 'mod_topic_unlock' => 'Топік:
відкритий', 'mod_topic_split' => 'Топік:
розділений', 'mod_post_delete' => 'Пост:
видалений', + 'mod_post_pin' => 'Пост:
закріплений', + 'mod_post_unpin' => 'Пост:
відкріплений', 'adm_user_delete' => 'Юзер:
видалений', 'adm_user_ban' => 'Юзер:
забанен', 'adm_user_unban' => 'Юзер:
разбанен' diff --git a/modcp.php b/modcp.php index c5e6e0a1..713816d0 100644 --- a/modcp.php +++ b/modcp.php @@ -806,6 +806,18 @@ function validate_mode_condition($request_index, $mod_action='') { WHERE topic_id IN($topic_csv) "); + // Log action + $type = ($pin) ? 'mod_post_pin' : 'mod_post_unpin'; + + foreach ($log_topics as $topic_id => $topic_title) + { + $log_action->mod($type, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + 'topic_title' => $topic_title, + )); + } + $msg = ($pin) ? $lang['POST_PINNED'] : $lang['POST_UNPINNED']; bb_die(return_msg_mcp($msg)); } @@ -840,6 +852,18 @@ function validate_mode_condition($request_index, $mod_action='') { WHERE topic_id IN($topic_csv) "); + // Log action + $type = ($pin) ? 'mod_post_pin' : 'mod_post_unpin'; + + foreach ($log_topics as $topic_id => $topic_title) + { + $log_action->mod($type, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + 'topic_title' => $topic_title, + )); + } + $msg = ($pin) ? $lang['POST_PINNED'] : $lang['POST_UNPINNED']; bb_die(return_msg_mcp($msg)); } From b236d91dd72c87bf2e95f2f92ba9ae6727298ae4 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Mon, 21 Aug 2023 23:18:58 +0700 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b74a2d3..08e30ee3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ **Merged pull requests:** - Release v2.1.5-2023.08 🎉 +- Show pin & unpin actions in log actions [\#225](https://github.com/torrentpier/torrentpier-lts/pull/225) ([belomaxorka](https://github.com/belomaxorka)) - Minor improvements [\#215](https://github.com/torrentpier/torrentpier-lts/pull/215), [\#216](https://github.com/torrentpier/torrentpier-lts/pull/216), [\#217](https://github.com/torrentpier/torrentpier-lts/pull/217), [\#218](https://github.com/torrentpier/torrentpier-lts/pull/218), [\#221](https://github.com/torrentpier/torrentpier-lts/pull/221), [\#222](https://github.com/torrentpier/torrentpier-lts/pull/222), [\#224](https://github.com/torrentpier/torrentpier-lts/pull/224) ([belomaxorka](https://github.com/belomaxorka)) ## [v2.1.5-2023.07](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.07) (2023-08-04)