diff --git a/CHANGELOG.md b/CHANGELOG.md index 85fee3987..ed38e4688 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ - Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka)) - Fixed `md5()` deprecated in PHP 8.4 [\#1561](https://github.com/torrentpier/torrentpier/pull/1561) ([belomaxorka](https://github.com/belomaxorka)) - Increased `USEREMAIL_MAX_LENGTH` [\#1566](https://github.com/torrentpier/torrentpier/pull/1566) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#1570](https://github.com/torrentpier/torrentpier/pull/1570), [\#1571](https://github.com/torrentpier/torrentpier/pull/1571), [\#1575](https://github.com/torrentpier/torrentpier/pull/1575), [\#1589](https://github.com/torrentpier/torrentpier/pull/1589), [\#1592](https://github.com/torrentpier/torrentpier/pull/1592) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#1570](https://github.com/torrentpier/torrentpier/pull/1570), [\#1571](https://github.com/torrentpier/torrentpier/pull/1571), [\#1575](https://github.com/torrentpier/torrentpier/pull/1575), [\#1589](https://github.com/torrentpier/torrentpier/pull/1589), [\#1592](https://github.com/torrentpier/torrentpier/pull/1592), [\#1605](https://github.com/torrentpier/torrentpier/pull/1605) ([belomaxorka](https://github.com/belomaxorka)) - New Crowdin updates [\#1569](https://github.com/torrentpier/torrentpier/pull/1569), [\#1572](https://github.com/torrentpier/torrentpier/pull/1572), [\#1573](https://github.com/torrentpier/torrentpier/pull/1573), [\#1574](https://github.com/torrentpier/torrentpier/pull/1574), [\#1588](https://github.com/torrentpier/torrentpier/pull/1588), [\#1590](https://github.com/torrentpier/torrentpier/pull/1590), [\#1600](https://github.com/torrentpier/torrentpier/pull/1600), [\#1601](https://github.com/torrentpier/torrentpier/pull/1601) ([Exileum](https://github.com/Exileum)) ## [v2.4.4](https://github.com/torrentpier/torrentpier/tree/v2.4.4) (2024-07-22) diff --git a/install.php b/install.php index 5d4acedc9..25c999ca5 100644 --- a/install.php +++ b/install.php @@ -137,7 +137,7 @@ function chmod_r(string $dir, int $dirPermissions, int $filePermissions): void $fullPath = realpath($dir . '/' . $file); if (is_dir($fullPath)) { - // out("- Directory: $fullPath"); + out("- Directory: $fullPath"); chmod($fullPath, $dirPermissions); chmod_r($fullPath, $dirPermissions, $filePermissions); } elseif (is_file($fullPath)) { diff --git a/library/attach_mod/includes/functions_delete.php b/library/attach_mod/includes/functions_delete.php index 3ed0f1c5a..f2b91a909 100644 --- a/library/attach_mod/includes/functions_delete.php +++ b/library/attach_mod/includes/functions_delete.php @@ -186,12 +186,6 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, DB()->sql_freeresult($result); if ($num_rows == 0) { - // TorrServer integration - if ($bb_cfg['torr_server']['enabled']) { - $torrServer = new \TorrentPier\TorrServerAPI(); - $torrServer->removeM3U($attach_id_array[$i]); - } - $sql = 'SELECT attach_id, physical_filename, thumbnail FROM ' . BB_ATTACHMENTS_DESC . ' WHERE attach_id = ' . (int)$attach_id_array[$i]; @@ -219,6 +213,12 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0, if (!(DB()->sql_query($sql))) { bb_die($lang['ERROR_DELETED_ATTACHMENTS']); } + + // TorrServer integration + if ($bb_cfg['torr_server']['enabled']) { + $torrServer = new \TorrentPier\TorrServerAPI(); + $torrServer->removeM3U($attachments[$j]['attach_id']); + } } } else { DB()->sql_freeresult($result); diff --git a/library/config.php b/library/config.php index 0fd52f4b2..3c08f828d 100644 --- a/library/config.php +++ b/library/config.php @@ -112,7 +112,7 @@ $bb_cfg['client_ban'] = [ // TorrServer integration $bb_cfg['torr_server'] = [ // Read more: https://github.com/YouROK/TorrServer - 'enabled' => true, + 'enabled' => false, 'url' => "http://$domain_name:8090", 'timeout' => 5 ]; diff --git a/library/includes/cron/jobs/attach_maintenance.php b/library/includes/cron/jobs/attach_maintenance.php index 179cfadf6..8c9122701 100644 --- a/library/includes/cron/jobs/attach_maintenance.php +++ b/library/includes/cron/jobs/attach_maintenance.php @@ -48,7 +48,7 @@ if ($dir = @opendir($attach_dir)) { $f_len = 0; while (false !== ($f = readdir($dir))) { - if ($f == 'index.php' || $f == '.htaccess' || is_dir("$attach_dir/$f") || is_link("$attach_dir/$f")) { + if (str_starts_with($f, \TorrentPier\TorrServerAPI::M3U['prefix']) || $f == 'index.php' || $f == '.htaccess' || is_dir("$attach_dir/$f") || is_link("$attach_dir/$f")) { continue; } $f = DB()->escape($f); @@ -144,7 +144,7 @@ if ($check_attachments) { $orphan_db_attach[] = $row['attach_id']; } // Delete all orphan attachments - if ($bb_cfg['torr_server']['enabled']) { + if ($bb_cfg['torr_server']['enabled'] && $fix_errors) { foreach ($orphan_db_attach as $attach_id) { // TorrServer integration $torrServer = new \TorrentPier\TorrServerAPI(); diff --git a/library/language/source/main.php b/library/language/source/main.php index 9db83e78a..31e3ebde2 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -1267,6 +1267,7 @@ $lang['DOWNLOAD'] = 'Download'; // this Language Variable is defined in admin.ph $lang['FILESIZE'] = 'Filesize'; $lang['VIEWED'] = 'Viewed'; $lang['EXTENSION_DISABLED_AFTER_POSTING'] = 'The Extension \'%s\' was deactivated by an board admin, therefore this Attachment is not displayed.'; // used in Posts and PM's, replace %s with mime type +$lang['DOWNLOAD_M3U_FILE'] = 'Download .m3u file'; $lang['ATTACHMENT'] = 'Attachments'; $lang['ATTACHMENT_THUMBNAIL'] = 'Attachment Thumbnail'; @@ -1353,6 +1354,7 @@ $lang['BT_FLIST_BTMR_HASH'] = 'BTMR Hash'; $lang['BT_FLIST_BTMR_NOTICE'] = 'BitTorrent Merkle Root is a hash of a file embedded in torrents with BitTorrent v2 support, tracker users can extract, calculate them, also download deduplicated torrents using desktop tools such as Torrent Merkle Root Reader'; $lang['BT_FLIST_CREATION_DATE'] = 'Creation date'; $lang['BT_FLIST_FILE_PATH'] = 'Path (%s)'; +$lang['BT_FLIST_LINK_TITLE'] = 'File hashes | .torrent meta-info'; $lang['BT_UNREG_FROM_TRACKER'] = 'Remove from tracker'; $lang['BT_UNREGISTERED'] = 'Torrent unregistered'; $lang['BT_UNREGISTERED_ALREADY'] = 'Torrent already unregistered'; diff --git a/src/Legacy/Admin/Common.php b/src/Legacy/Admin/Common.php index 985d34e76..99cf8b626 100644 --- a/src/Legacy/Admin/Common.php +++ b/src/Legacy/Admin/Common.php @@ -217,7 +217,7 @@ class Common */ public static function topic_delete($mode_or_topic_id, $forum_id = null, $prune_time = 0, $prune_all = false) { - global $lang, $log_action; + global $bb_cfg, $lang, $log_action; $topic_csv = []; $prune = ($mode_or_topic_id === 'prune'); @@ -330,7 +330,7 @@ class Common $result = DB()->query(" SELECT - d.physical_filename + d.physical_filename, a.attach_id FROM " . $tmp_delete_topics . " del, " . BB_POSTS . " p, @@ -347,6 +347,11 @@ class Common @unlink("$attach_dir/" . $filename); @unlink("$attach_dir/" . THUMB_DIR . '/t_' . $filename); } + // TorrServer integration + if ($bb_cfg['torr_server']['enabled']) { + $torrServer = new \TorrentPier\TorrServerAPI(); + $torrServer->removeM3U($row['attach_id']); + } } unset($row, $result); diff --git a/styles/templates/default/viewtopic_attach.tpl b/styles/templates/default/viewtopic_attach.tpl index 1ff876fa0..0fbd140a7 100644 --- a/styles/templates/default/viewtopic_attach.tpl +++ b/styles/templates/default/viewtopic_attach.tpl @@ -146,7 +146,7 @@ @@ -176,7 +176,7 @@
-

Download .m3u
+

{L_DOWNLOAD_M3U_FILE}

{L_DOWNLOAD_M3U_FILE}
{postrow.attach.tor_reged.DOWNLOAD_NAME} - + {L_BT_FLIST_LINK_TITLE}  {postrow.attach.tor_reged.MAGNET}