Show torrent type (gold / silver) changes in actions log (#1689)

* Minor improvements

* Updated

* Update mod_action.php

* Update modcp.php

* Update change_torrent.php

* Updated

* Update change_torrent.php

* Update main.php

* Updated

* Update LogAction.php

* Update LogAction.php

* Update LogAction.php

* Update main.php

* Update change_torrent.php

* Update change_torrent.php

* Update change_torrent.php

* Updated

* Update CHANGELOG.md

* Update change_torrent.php
This commit is contained in:
Roman Kelesidis 2024-12-02 01:22:58 +07:00 committed by GitHub
commit 6f59d5fea6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 47 additions and 31 deletions

View file

@ -89,16 +89,15 @@ switch ($mode) {
// 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) {
if ($comment && $comment != $lang['COMMENT']) {
$log_msg .= "<br>{$lang['COMMENT']}: <b>$comment</b>.";
}
$log_action->mod('mod_topic_change_tor_status', array(
$log_action->mod('mod_topic_change_tor_status', [
'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>';

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 (!isset($this->request['attach_id'])) {
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
@ -25,7 +25,7 @@ $type = (string)$this->request['type'];
$torrent = DB()->fetch_row("
SELECT
a.post_id, d.physical_filename, d.extension, d.tracker_status,
t.topic_first_post_id,
t.topic_first_post_id, t.topic_title,
p.poster_id, p.topic_id, p.forum_id,
f.allow_reg_tracker
FROM
@ -63,12 +63,25 @@ switch ($type) {
case 'unset_silver_gold':
if ($type == 'set_silver') {
$tor_type = TOR_TYPE_SILVER;
$tor_type_lang = $lang['SILVER'];
} elseif ($type == 'set_gold') {
$tor_type = TOR_TYPE_GOLD;
$tor_type_lang = $lang['GOLD'];
} else {
$tor_type = 0;
$tor_type_lang = "{$lang['UNSET_GOLD_TORRENT']} / {$lang['UNSET_SILVER_TORRENT']}";
}
\TorrentPier\Legacy\Torrent::change_tor_type($attach_id, $tor_type);
// Log action
$log_action->mod('mod_topic_change_tor_type', [
'forum_id' => $torrent['forum_id'],
'topic_id' => $torrent['topic_id'],
'topic_title' => $torrent['topic_title'],
'log_msg' => sprintf($lang['TOR_TYPE_LOG_ACTION'], $tor_type_lang),
]);
$title = $lang['CHANGE_TOR_TYPE'];
$url = make_url(TOPIC_URL . $torrent['topic_id']);
break;

View file

@ -31,11 +31,11 @@ switch ($mode) {
foreach ($topic_ids as $attach_id) {
$tor = DB()->fetch_row("
SELECT
tor.forum_id, tor.topic_id, t.topic_title, tor.tor_status
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");
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']);
@ -45,13 +45,12 @@ switch ($mode) {
// 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(
$log_action->mod('mod_topic_change_tor_status', [
'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);