fix(filelist): Undefined property: FileTree::$length when v2 torrent only (#2004)

This commit is contained in:
Roman Kelesidis 2025-06-23 21:49:53 +03:00 committed by GitHub
parent a0fc2a9da9
commit 7f4cc9d3b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 38 deletions

View file

@ -82,7 +82,7 @@ if (IS_GUEST && $torrent->isPrivate()) {
// Get torrent files
$files = $torrent->$t_version_field()->$t_files_field();
if ($meta_v1 && $meta_v2) {
if ($meta_v2) {
$files = new \RecursiveIteratorIterator($files); // Flatten the list
}
@ -102,19 +102,6 @@ foreach ($files as $file) {
$torrent_name = !empty($t_name = $torrent->getName()) ? str_short(htmlCHR($t_name), 200) : $lang['UNKNOWN'];
$torrent_size = humn_size($row['size'], 2);
// Get announcers list
$announcers_list = $torrent->getAnnounceList()->toArray();
$announcers_count = 0;
foreach ($announcers_list as $announcer) {
$announcers_count++;
$row_class = ($announcers_count % 2) ? 'row1' : 'row2';
$template->assign_block_vars('announcers', [
'ROW_NUMBER' => $announcers_count,
'ROW_CLASS' => $row_class,
'ANNOUNCER' => $announcer[0]
]);
}
// Output page
$template->assign_vars([
'PAGE_TITLE' => "$torrent_name (" . $torrent_size . ")",

View file

@ -6,30 +6,6 @@
</ul>
<br/>
<h1 class="pagetitle">{L_BT_FLIST_ANNOUNCERS_LIST}</h1>
<table class="forumline">
<thead>
<tr>
<th>#</th>
<th>{L_BT_FLIST_ANNOUNCERS}</th>
</tr>
</thead>
<!-- BEGIN announcers -->
<tbody>
<tr class="{announcers.ROW_CLASS} tCenter">
<td>{announcers.ROW_NUMBER}</td>
<td>{announcers.ANNOUNCER}</td>
</tr>
</tbody>
<!-- END announcers -->
<tfoot>
<tr>
<td class="catBottom warnColor1" colspan="2">{L_BT_FLIST_ANNOUNCERS_NOTICE}</td>
</tr>
</tfoot>
</table>
<br/>
<h1 class="pagetitle">{L_BT_FLIST}</h1>
<table class="forumline">
<thead>