From 14fb6002b0e72f3788c7d26bd47284646610e3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B8nstantine=20Kovalensky?= <45331093+kovalensky@users.noreply.github.com> Date: Fri, 26 Jan 2024 23:58:14 +0400 Subject: [PATCH] Little fix (#1341) --- filelist.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/filelist.php b/filelist.php index 9ae8bff4c..c127cdd10 100644 --- a/filelist.php +++ b/filelist.php @@ -70,7 +70,7 @@ try { bb_simple_die(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}"), 410); } -if ($torrent->isPrivate() && IS_GUEST) { +if (IS_GUEST && $torrent->isPrivate()) { bb_simple_die($lang['BT_PRIVATE_TORRENT'], 403); } @@ -78,7 +78,10 @@ $files = $torrent->$t_version_field()->$t_files_field(); $allFiles = ''; foreach ($files as $file) { - $allFiles .= '' . clean_tor_dirname(implode('/', $file->path)) . '' . humn_size($file->length, 2) . '' . ($t_hash_field === 'sha1' ? 'SHA1: ' : '') . $file->$t_hash_field . ''; + $path = clean_tor_dirname(implode('/', $file->path)); + $size = humn_size($file->length, 2); + $hash = ($t_hash_field === 'sha1' && isset($file->$t_hash_field)) ? "SHA1: {$file->$t_hash_field}" : $file->$t_hash_field; + $allFiles .= '' . $path . '' . $size . '' . $hash . ''; } $data = [