Minor improvements (#1605)

* Minor improvements

* Updated

* Update functions_delete.php

* Update attach_maintenance.php

* Update attach_maintenance.php

* Update config.php

* Updated

* Update viewtopic_attach.tpl

* Updated

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-08-21 01:41:57 +07:00 committed by GitHub
commit 82e7552a9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 22 additions and 15 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 <a href="%s" target="_blank" referrerpolicy="origin">Torrent Merkle Root Reader</a>';
$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';

View file

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

View file

@ -146,7 +146,7 @@
<table class="attach bordered med">
<tr class="row3">
<th colspan="3" class="{postrow.attach.tor_reged.DL_LINK_CLASS}">{postrow.attach.tor_reged.DOWNLOAD_NAME}
<a href="{postrow.attach.tor_reged.FILELIST_LINK}" title="File hashes | .torrent meta-info" target="_blank"><img src="{postrow.attach.tor_reged.FILELIST_ICON}" width="12" height="12" border="0"></a>
<a href="{postrow.attach.tor_reged.FILELIST_LINK}" title="{L_BT_FLIST_LINK_TITLE}" target="_blank"><img alt="{L_BT_FLIST_LINK_TITLE}" src="{postrow.attach.tor_reged.FILELIST_ICON}" width="12" height="12" border="0"></a>
<!-- IF MAGNET_LINKS and not postrow.attach.tor_reged.TOR_FROZEN -->&nbsp;{postrow.attach.tor_reged.MAGNET}<!-- ENDIF --></th>
</tr>
<!-- IF postrow.attach.tor_reged.TOR_TYPE -->
@ -176,7 +176,7 @@
<!-- BEGIN tor_server -->
<!-- IF postrow.attach.tor_reged.tor_server.TORR_SERVER_M3U_LINK -->
<hr>
<a href="{postrow.attach.tor_reged.tor_server.TORR_SERVER_M3U_LINK}" target="_blank"><p><img src="{postrow.attach.tor_reged.tor_server.TORR_SERVER_M3U_ICON}" width="21" height="21" border="0"></p>Download .m3u</a>
<a href="{postrow.attach.tor_reged.tor_server.TORR_SERVER_M3U_LINK}" target="_blank"><p><img alt="{L_DOWNLOAD_M3U_FILE}" src="{postrow.attach.tor_reged.tor_server.TORR_SERVER_M3U_ICON}" width="21" height="21" border="0"></p>{L_DOWNLOAD_M3U_FILE}</a>
<!-- ENDIF -->
<!-- END tor_server -->
</td>