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

@ -1,6 +1,6 @@
# 📖 Change Log
## [v2.4.5-rc.1](https://github.com/torrentpier/torrentpier/tree/v2.4.5-rc.1) (2024-11-28)
## [v2.4.5-rc.1](https://github.com/torrentpier/torrentpier/tree/v2.4.5-rc.1) (2024-XX-XX)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.4...v2.4.5-rc.1)
**Merged pull requests:**
@ -18,6 +18,7 @@
- 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))
- Show torrent type (gold / silver) changes in actions log [\#1689](https://github.com/torrentpier/torrentpier/pull/1689) ([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

@ -226,6 +226,7 @@ if ($log_rowset) {
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_change_tor_type']:
case $log_type['mod_topic_renamed']:
case $log_type['mod_post_delete']:
case $log_type['mod_post_pin']:

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

@ -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);

View file

@ -19,7 +19,7 @@ $bb_cfg = [];
// Version info
$bb_cfg['tp_version'] = 'v2.4.5-rc.1';
$bb_cfg['tp_release_date'] = '28-11-2024';
$bb_cfg['tp_release_date'] = 'XX-XX-2024';
$bb_cfg['tp_release_codename'] = 'Cattle';
// Increase version number after changing JS or CSS

View file

@ -1471,6 +1471,7 @@ $lang['SET_SILVER_TORRENT'] = 'Make silver';
$lang['UNSET_SILVER_TORRENT'] = 'UnMake silver';
$lang['GOLD_STATUS'] = 'GOLD TORRENT! DOWNLOAD TRAFFIC DOES NOT CONSIDER!';
$lang['SILVER_STATUS'] = 'SILVER TORRENT! DOWNLOAD TRAFFIC PARTIALLY CONSIDERED!';
$lang['TOR_TYPE_LOG_ACTION'] = 'Torrent type changed to: %s';
$lang['TORRENT_STATUS'] = 'Search by status of release';
$lang['SEARCH_IN_FORUMS'] = 'Search in Forums';
@ -2813,6 +2814,7 @@ $lang['LOG_ACTION']['LOG_TYPE'] = [
'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_change_tor_type' => 'Topic:<br /> <b>changed torrent type</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

@ -698,7 +698,7 @@ switch ($mode) {
case 'post_pin':
case 'post_unpin':
$pin = ($mode == 'post_pin');
$new_topic_status = ($pin) ? 1 : 0;
$new_topic_status = $pin ? 1 : 0;
if (count((array)$topic_csv)) {
$sql = "
@ -728,7 +728,7 @@ switch ($mode) {
");
// Log action
$type = ($pin) ? 'mod_post_pin' : 'mod_post_unpin';
$type = $pin ? 'mod_post_pin' : 'mod_post_unpin';
foreach ($log_topics as $topic_id => $topic_title) {
$log_action->mod($type, [
@ -738,7 +738,7 @@ switch ($mode) {
]);
}
$msg = ($pin) ? $lang['POST_PINNED'] : $lang['POST_UNPINNED'];
$msg = $pin ? $lang['POST_PINNED'] : $lang['POST_UNPINNED'];
bb_die(return_msg_mcp($msg));
} elseif ($topic_id) {
$sql = "
@ -769,7 +769,7 @@ switch ($mode) {
");
// Log action
$type = ($pin) ? 'mod_post_pin' : 'mod_post_unpin';
$type = $pin ? 'mod_post_pin' : 'mod_post_unpin';
foreach ($log_topics as $topic_id => $topic_title) {
$log_action->mod($type, [
@ -779,7 +779,7 @@ switch ($mode) {
]);
}
$msg = ($pin) ? $lang['POST_PINNED'] : $lang['POST_UNPINNED'];
$msg = $pin ? $lang['POST_PINNED'] : $lang['POST_UNPINNED'];
bb_die(return_msg_mcp($msg));
}
break;

View file

@ -20,17 +20,18 @@ class LogAction
'mod_topic_move' => 2,
'mod_topic_lock' => 3,
'mod_topic_unlock' => 4,
'mod_topic_set_downloaded' => 5,
'mod_topic_unset_downloaded' => 6,
'mod_topic_renamed' => 7,
'mod_post_delete' => 8,
'mod_post_pin' => 9,
'mod_post_unpin' => 10,
'mod_topic_split' => 11,
'mod_topic_change_tor_status' => 12,
'adm_user_delete' => 13,
'adm_user_ban' => 14,
'adm_user_unban' => 15,
'mod_post_delete' => 5,
'mod_topic_split' => 6,
'adm_user_delete' => 7,
'adm_user_ban' => 8,
'adm_user_unban' => 9,
'mod_post_pin' => 10,
'mod_post_unpin' => 11,
'mod_topic_set_downloaded' => 12,
'mod_topic_unset_downloaded' => 13,
'mod_topic_renamed' => 14,
'mod_topic_change_tor_status' => 15,
'mod_topic_change_tor_type' => 16,
];
public $log_type_select = [];
public $log_disabled = false;