diff --git a/admin/admin_log.php b/admin/admin_log.php index 01dbba373..f5c665187 100644 --- a/admin/admin_log.php +++ b/admin/admin_log.php @@ -235,6 +235,7 @@ if ($log_rowset) { case $log_type['mod_post_pin']: case $log_type['mod_post_unpin']: case $log_type['mod_topic_split']: + case $log_type['mod_topic_attach_updated']: // topic_title if (!empty($row['log_topic_title'])) { $topic_title = $row['log_topic_title']; diff --git a/library/language/source/main.php b/library/language/source/main.php index 1a4b56a5c..b7f1c348b 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -2835,6 +2835,7 @@ $lang['LOG_ACTION']['LOG_TYPE'] = [ 'mod_topic_tor_unregister' => 'Topic:
torrent unregistered', 'mod_topic_tor_register' => 'Topic:
torrent registered', 'mod_topic_tor_delete' => 'Topic:
torrent deleted', + 'mod_topic_attach_updated' => 'Topic:
attachment updated', 'mod_topic_renamed' => 'Topic:
renamed', 'mod_post_delete' => 'Post:
deleted', 'mod_post_pin' => 'Post:
pinned', diff --git a/posting.php b/posting.php index f823d5a66..024f6b17e 100644 --- a/posting.php +++ b/posting.php @@ -372,6 +372,16 @@ if (($delete || $mode == 'delete') && !$confirm) { if (!$error_msg) { \TorrentPier\Legacy\Post::user_notification($mode, $post_data, $post_info['topic_title'], $forum_id, $topic_id, $notify_user); + + if (defined('ATTACHMENT_UPDATED') && ATTACHMENT_UPDATED['status']) { + global $log_action; + $log_action->mod('mod_topic_attach_updated', [ + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + 'topic_title' => $post_info['topic_title'], + 'log_msg' => sprintf('Attachment type: %s', ATTACHMENT_UPDATED['attachment_type']) + ]); + } } if ($mode == 'newtopic' || $mode == 'reply') { diff --git a/src/Legacy/Attach.php b/src/Legacy/Attach.php index ae0eefedc..3cff7b424 100644 --- a/src/Legacy/Attach.php +++ b/src/Legacy/Attach.php @@ -475,18 +475,25 @@ class Attach // Delete the Old Attachment unlink_attach($row['physical_filename']); + $attachment_type = $lang['ATTACHMENT']; + if ((int)$row['thumbnail'] === 1) { unlink_attach($row['physical_filename'], MODE_THUMBNAIL); + $attachment_type = $lang['ATTACHMENT_THUMBNAIL']; } - // todo: log action - torrent updated - //bt if ($this->attachment_extension_list[$actual_element] === TORRENT_EXT && $attachments[$actual_element]['tracker_status']) { Torrent::tracker_unregister($attachment_id); + $attachment_type = $lang['TORRENT']; } //bt end + \define('ATTACHMENT_UPDATED', [ + 'status' => true, + 'attachment_type' => $attachment_type + ]); + // Make sure it is displayed $this->attachment_list[$actual_element] = $this->attach_filename; $this->attachment_comment_list[$actual_element] = $comment; diff --git a/src/Legacy/LogAction.php b/src/Legacy/LogAction.php index e4af99bb7..4b11ad65e 100644 --- a/src/Legacy/LogAction.php +++ b/src/Legacy/LogAction.php @@ -35,6 +35,7 @@ class LogAction 'mod_topic_tor_unregister' => 17, 'mod_topic_tor_register' => 18, 'mod_topic_tor_delete' => 19, + 'mod_topic_attach_updated' => 20, ]; public $log_type_select = []; public $log_disabled = false;