Show torrent status changes in actions log (#1688)

* Show torrent status changes in actions log

* Updated

* Updated

* Update mod_action.php

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-12-01 22:11:37 +07:00 committed by GitHub
commit 58e6ffac7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 43 additions and 4 deletions

View file

@ -17,6 +17,7 @@
- Improved BitTorrent clients ban functionality [\#1657](https://github.com/torrentpier/torrentpier/pull/1657) ([belomaxorka](https://github.com/belomaxorka))
- Improved `filelist.php` [\#1586](https://github.com/torrentpier/torrentpier/pull/1586) ([belomaxorka](https://github.com/belomaxorka))
- Invites: Permanent invites feature [\#1670](https://github.com/torrentpier/torrentpier/pull/1670) ([belomaxorka](https://github.com/belomaxorka))
- Show torrent status changes in actions log [\#1688](https://github.com/torrentpier/torrentpier/pull/1688) ([belomaxorka](https://github.com/belomaxorka))
- Changed database encoding to `utf8mb4_unicode_ci` [\#1684](https://github.com/torrentpier/torrentpier/pull/1684) ([belomaxorka](https://github.com/belomaxorka))
- Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka))
- BBCode: Fixed relative links working [\#1613](https://github.com/torrentpier/torrentpier/pull/1613) ([belomaxorka](https://github.com/belomaxorka))

View file

@ -225,6 +225,7 @@ if ($log_rowset) {
case $log_type['mod_topic_unlock']:
case $log_type['mod_topic_set_downloaded']:
case $log_type['mod_topic_unset_downloaded']:
case $log_type['mod_topic_change_tor_status']:
case $log_type['mod_topic_renamed']:
case $log_type['mod_post_delete']:
case $log_type['mod_post_pin']:

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $userdata, $bb_cfg, $lang;
global $userdata, $bb_cfg, $lang, $log_action;
if (!$attach_id = (int)$this->request['attach_id']) {
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
@ -87,6 +87,19 @@ switch ($mode) {
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $new_status);
// Log action
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], $bb_cfg['tor_icons'][$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b>', $bb_cfg['tor_icons'][$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');
if ($comment) {
$log_msg .= "<br>{$lang['COMMENT']}: <b>$comment</b>.";
}
$log_action->mod('mod_topic_change_tor_status', array(
'forum_id' => $tor['forum_id'],
'topic_id' => $tor['topic_id'],
'topic_title' => $tor['topic_title'],
'user_id' => $userdata['user_id'],
'log_msg' => $log_msg . '<br>-------------',
));
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b> &middot; ' . profile_url($userdata) . ' &middot; <i>' . delta_time(TIMENOW) . $lang['TOR_BACK'] . '</i>';
if ($bb_cfg['tor_comment'] && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, $bb_cfg['tor_reply']))) {

View file

@ -30,7 +30,28 @@ switch ($mode) {
$topic_ids = DB()->fetch_rowset("SELECT attach_id FROM " . BB_BT_TORRENTS . " WHERE topic_id IN($topics)", 'attach_id');
foreach ($topic_ids as $attach_id) {
$tor = DB()->fetch_row("
SELECT
tor.forum_id, tor.topic_id, t.topic_title, tor.tor_status
FROM " . BB_BT_TORRENTS . " tor
INNER JOIN " . BB_TOPICS . " t ON(t.topic_id = tor.topic_id)
WHERE tor.attach_id = $attach_id LIMIT 1");
if (!$tor) {
$this->ajax_die($lang['TORRENT_FAILED']);
}
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $status);
// Log action
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], $bb_cfg['tor_icons'][$status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$status] . '</b>', $bb_cfg['tor_icons'][$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');
$log_action->mod('mod_topic_change_tor_status', array(
'forum_id' => $tor['forum_id'],
'topic_id' => $tor['topic_id'],
'topic_title' => $tor['topic_title'],
'user_id' => $userdata['user_id'],
'log_msg' => $log_msg . '<br>-------------',
));
}
$this->response['status'] = $bb_cfg['tor_icons'][$status];
$this->response['topics'] = explode(',', $topics);

View file

@ -1436,6 +1436,7 @@ $lang['CHANGE_TOR_TYPE'] = 'Type the torrent successfully changed';
$lang['DEL_TORRENT'] = 'Are you sure you want to delete the torrent?';
$lang['DEL_MOVE_TORRENT'] = 'Are you sure you want to delete and move the topic?';
$lang['UNEXECUTED_RELEASE'] = 'Do you have a shapeless release before creating a new fix his unformed!';
$lang['TOR_STATUS_LOG_ACTION'] = 'New status: %s.<br>Previous status: %s.';
// tor_comment
$lang['TOR_MOD_TITLE'] = 'Changing the status of distribution - %s';
@ -2811,6 +2812,7 @@ $lang['LOG_ACTION']['LOG_TYPE'] = [
'mod_topic_split' => 'Topic:<br /> <b>split</b>',
'mod_topic_set_downloaded' => 'Topic:<br /> <b>set downloaded</b>',
'mod_topic_unset_downloaded' => 'Topic:<br /> <b>unset downloaded</b>',
'mod_topic_change_tor_status' => 'Topic:<br /> <b>changed torrent status</b>',
'mod_topic_renamed' => 'Topic:<br /> <b>renamed</b>',
'mod_post_delete' => 'Post:<br /> <b>deleted</b>',
'mod_post_pin' => 'Post:<br /> <b>pinned</b>',

View file

@ -27,9 +27,10 @@ class LogAction
'mod_post_pin' => 9,
'mod_post_unpin' => 10,
'mod_topic_split' => 11,
'adm_user_delete' => 12,
'adm_user_ban' => 13,
'adm_user_unban' => 14,
'mod_topic_change_tor_status' => 12,
'adm_user_delete' => 13,
'adm_user_ban' => 14,
'adm_user_unban' => 15,
];
public $log_type_select = [];
public $log_disabled = false;