diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3abee5daa..f3e3ccbef 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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))
diff --git a/admin/admin_log.php b/admin/admin_log.php
index e25ee7d7e..7b2a03def 100644
--- a/admin/admin_log.php
+++ b/admin/admin_log.php
@@ -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']:
diff --git a/library/ajax/change_tor_status.php b/library/ajax/change_tor_status.php
index d193fba7e..dc67e9782 100644
--- a/library/ajax/change_tor_status.php
+++ b/library/ajax/change_tor_status.php
@@ -89,16 +89,15 @@ switch ($mode) {
// Log action
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], $bb_cfg['tor_icons'][$new_status] . ' ' . $lang['TOR_STATUS_NAME'][$new_status] . '', $bb_cfg['tor_icons'][$tor['tor_status']] . ' ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '');
- if ($comment) {
+ if ($comment && $comment != $lang['COMMENT']) {
$log_msg .= "
{$lang['COMMENT']}: $comment.";
}
- $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 . '
-------------',
- ));
+ ]);
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] . ' ' . $lang['TOR_STATUS_NAME'][$new_status] . ' · ' . profile_url($userdata) . ' · ' . delta_time(TIMENOW) . $lang['TOR_BACK'] . '';
diff --git a/library/ajax/change_torrent.php b/library/ajax/change_torrent.php
index d0aa4b01b..4e7559510 100644
--- a/library/ajax/change_torrent.php
+++ b/library/ajax/change_torrent.php
@@ -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;
diff --git a/library/ajax/mod_action.php b/library/ajax/mod_action.php
index 22edfc39c..eaacae59a 100644
--- a/library/ajax/mod_action.php
+++ b/library/ajax/mod_action.php
@@ -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] . ' ' . $lang['TOR_STATUS_NAME'][$status] . '', $bb_cfg['tor_icons'][$tor['tor_status']] . ' ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '');
- $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 . '
-------------',
- ));
+ ]);
}
$this->response['status'] = $bb_cfg['tor_icons'][$status];
$this->response['topics'] = explode(',', $topics);
diff --git a/library/config.php b/library/config.php
index f7974a22b..24f874383 100644
--- a/library/config.php
+++ b/library/config.php
@@ -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
diff --git a/library/language/source/main.php b/library/language/source/main.php
index d841717f9..ee9e69e85 100644
--- a/library/language/source/main.php
+++ b/library/language/source/main.php
@@ -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:
set downloaded',
'mod_topic_unset_downloaded' => 'Topic:
unset downloaded',
'mod_topic_change_tor_status' => 'Topic:
changed torrent status',
+ 'mod_topic_change_tor_type' => 'Topic:
changed torrent type',
'mod_topic_renamed' => 'Topic:
renamed',
'mod_post_delete' => 'Post:
deleted',
'mod_post_pin' => 'Post:
pinned',
diff --git a/modcp.php b/modcp.php
index 35f9a9e37..73685d931 100644
--- a/modcp.php
+++ b/modcp.php
@@ -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;
diff --git a/src/Legacy/LogAction.php b/src/Legacy/LogAction.php
index 5a799844e..7934680b0 100644
--- a/src/Legacy/LogAction.php
+++ b/src/Legacy/LogAction.php
@@ -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;