mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
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:
parent
66e7db25bf
commit
58e6ffac7f
6 changed files with 43 additions and 4 deletions
|
@ -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> · ' . profile_url($userdata) . ' · <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']))) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue