Show torrent's announcers list in filelist.php page (#1708)

* Show torrent's announcers list in `filelist.php` page

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update filelist.php

* Updated

* Updated

* Updated

* Updated

* Updated

* Update filelist.tpl
This commit is contained in:
Roman Kelesidis 2024-12-14 15:20:44 +07:00 committed by GitHub
commit fd951a27fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 50 additions and 3 deletions

View file

@ -6,6 +6,7 @@
**Merged pull requests:** **Merged pull requests:**
- Release 2.4.5 🍧️ ([belomaxorka](https://github.com/belomaxorka)) - Release 2.4.5 🍧️ ([belomaxorka](https://github.com/belomaxorka))
- Show torrent's announcers list in `filelist.php` page [\#1708](https://github.com/torrentpier/torrentpier/pull/1708) ([belomaxorka](https://github.com/belomaxorka))
- [Configurable] Show magnet-links for guests [\#1712](https://github.com/torrentpier/torrentpier/pull/1712) ([belomaxorka](https://github.com/belomaxorka)) - [Configurable] Show magnet-links for guests [\#1712](https://github.com/torrentpier/torrentpier/pull/1712) ([belomaxorka](https://github.com/belomaxorka))
- Set `cursor: pointer;` for buttons, inputs (buttons) [\#1710](https://github.com/torrentpier/torrentpier/pull/1710), [\#1711](https://github.com/torrentpier/torrentpier/pull/1711) ([belomaxorka](https://github.com/belomaxorka)) - Set `cursor: pointer;` for buttons, inputs (buttons) [\#1710](https://github.com/torrentpier/torrentpier/pull/1710), [\#1711](https://github.com/torrentpier/torrentpier/pull/1711) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1705](https://github.com/torrentpier/torrentpier/pull/1705) ([belomaxorka](https://github.com/belomaxorka)) - Minor improvements [\#1705](https://github.com/torrentpier/torrentpier/pull/1705) ([belomaxorka](https://github.com/belomaxorka))

View file

@ -74,6 +74,7 @@ if (IS_GUEST && $torrent->isPrivate()) {
bb_die($lang['BT_PRIVATE_TORRENT'], 403); bb_die($lang['BT_PRIVATE_TORRENT'], 403);
} }
// Get torrent files
$files = $torrent->$t_version_field()->$t_files_field(); $files = $torrent->$t_version_field()->$t_files_field();
if ($meta_v1 && $meta_v2) { if ($meta_v1 && $meta_v2) {
$files = new \RecursiveIteratorIterator($files); // Flatten the list $files = new \RecursiveIteratorIterator($files); // Flatten the list
@ -95,11 +96,26 @@ foreach ($files as $file) {
$torrent_name = !empty($t_name = $torrent->getName()) ? str_short(htmlCHR($t_name), 200) : $lang['UNKNOWN']; $torrent_name = !empty($t_name = $torrent->getName()) ? str_short(htmlCHR($t_name), 200) : $lang['UNKNOWN'];
$torrent_size = humn_size($row['size'], 2); $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([ $template->assign_vars([
'PAGE_TITLE' => "$torrent_name (" . $torrent_size . ")", 'PAGE_TITLE' => "$torrent_name (" . $torrent_size . ")",
'FILES_COUNT' => sprintf($lang['BT_FLIST_FILE_PATH'], declension(iterator_count($files), 'files')), 'FILES_COUNT' => sprintf($lang['BT_FLIST_FILE_PATH'], declension(iterator_count($files), 'files')),
'TORRENT_CREATION_DATE' => (!empty($dt = $torrent->getCreationDate()) && is_numeric($creation_date = $dt->getTimestamp())) ? date('d-M-Y H:i (e)', $creation_date) : $lang['UNKNOWN'], 'TORRENT_CREATION_DATE' => (!empty($dt = $torrent->getCreationDate()) && is_numeric($creation_date = $dt->getTimestamp())) ? date('d-M-Y H:i (e)', $creation_date) : $lang['UNKNOWN'],
'TORRENT_CLIENT' => !empty($creator = $torrent->getCreatedBy()) ? htmlCHR($creator) : $lang['UNKNOWN'], 'TORRENT_CLIENT' => !empty($creator = $torrent->getCreatedBy()) ? htmlCHR($creator) : $lang['UNKNOWN'],
'TORRENT_PRIVATE' => $torrent->isPrivate() ? $lang['YES'] : $lang['NO'],
'BTMR_NOTICE' => sprintf($lang['BT_FLIST_BTMR_NOTICE'], 'https://github.com/kovalensky/tmrr'), 'BTMR_NOTICE' => sprintf($lang['BT_FLIST_BTMR_NOTICE'], 'https://github.com/kovalensky/tmrr'),
'U_TOPIC' => TOPIC_URL . $topic_id, 'U_TOPIC' => TOPIC_URL . $topic_id,

View file

@ -1370,12 +1370,17 @@ $lang['BT_REG_FAIL'] = 'Could not register torrent on tracker';
$lang['BT_REG_FAIL_SAME_HASH'] = 'Another torrent with same info_hash already <a href="%s"><b>registered</b></a>'; $lang['BT_REG_FAIL_SAME_HASH'] = 'Another torrent with same info_hash already <a href="%s"><b>registered</b></a>';
$lang['BT_V1_ONLY_DISALLOWED'] = 'v1-only torrents have been disabled by the administrator at the moment, allowed: v2 and hybrids'; $lang['BT_V1_ONLY_DISALLOWED'] = 'v1-only torrents have been disabled by the administrator at the moment, allowed: v2 and hybrids';
$lang['BT_V2_ONLY_DISALLOWED'] = 'v2-only torrents have been disabled by the administrator at the moment, allowed: v1 and hybrids'; $lang['BT_V2_ONLY_DISALLOWED'] = 'v2-only torrents have been disabled by the administrator at the moment, allowed: v1 and hybrids';
$lang['BT_FLIST'] = 'Files list';
$lang['BT_FLIST_LIMIT'] = 'Tracker settings do not allow to process lists with more than %d files. Current number is: %d'; $lang['BT_FLIST_LIMIT'] = 'Tracker settings do not allow to process lists with more than %d files. Current number is: %d';
$lang['BT_FLIST_BTMR_HASH'] = 'BTMR Hash'; $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_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_CREATION_DATE'] = 'Creation date';
$lang['BT_IS_PRIVATE'] = 'Private torrent';
$lang['BT_FLIST_FILE_PATH'] = 'Path (%s)'; $lang['BT_FLIST_FILE_PATH'] = 'Path (%s)';
$lang['BT_FLIST_LINK_TITLE'] = 'File hashes | .torrent meta-info'; $lang['BT_FLIST_LINK_TITLE'] = 'File hashes | .torrent meta-info';
$lang['BT_FLIST_ANNOUNCERS_LIST'] = 'Announcers list';
$lang['BT_FLIST_ANNOUNCERS'] = 'Announcers';
$lang['BT_FLIST_ANNOUNCERS_NOTICE'] = 'This list contains announcers of torrent file';
$lang['BT_UNREG_FROM_TRACKER'] = 'Remove from tracker'; $lang['BT_UNREG_FROM_TRACKER'] = 'Remove from tracker';
$lang['BT_UNREGISTERED'] = 'Torrent unregistered'; $lang['BT_UNREGISTERED'] = 'Torrent unregistered';
$lang['BT_UNREGISTERED_ALREADY'] = 'Torrent already unregistered'; $lang['BT_UNREGISTERED_ALREADY'] = 'Torrent already unregistered';
@ -1720,7 +1725,6 @@ $lang['NOTICE'] = '!ATTENTION!';
$lang['COPY'] = 'The site does not give electronic versions of products, and is engaged only in a collecting and cataloguing of the references sent and published at a forum by our readers. If you are the legal owner of any submitted material and do not wish that the reference to it was in our catalogue, contact us and we shall immediately remove her. Files for an exchange on tracker are given by users of a site, and the administration does not bear the responsibility for their maintenance. The request to not fill in the files protected by copyrights, and also files of the illegal maintenance!'; $lang['COPY'] = 'The site does not give electronic versions of products, and is engaged only in a collecting and cataloguing of the references sent and published at a forum by our readers. If you are the legal owner of any submitted material and do not wish that the reference to it was in our catalogue, contact us and we shall immediately remove her. Files for an exchange on tracker are given by users of a site, and the administration does not bear the responsibility for their maintenance. The request to not fill in the files protected by copyrights, and also files of the illegal maintenance!';
// FILELIST // FILELIST
$lang['FILELIST'] = 'Filelist';
$lang['COLLAPSE'] = 'Collapse directory'; $lang['COLLAPSE'] = 'Collapse directory';
$lang['EXPAND'] = 'Expand'; $lang['EXPAND'] = 'Expand';
$lang['SWITCH'] = 'Switch'; $lang['SWITCH'] = 'Switch';

View file

@ -2,9 +2,35 @@
<ul> <ul>
<li>{L_BT_FLIST_CREATION_DATE}: <b>{TORRENT_CREATION_DATE}</b></li> <li>{L_BT_FLIST_CREATION_DATE}: <b>{TORRENT_CREATION_DATE}</b></li>
<li>{L_DL_CLIENT}: <b>{TORRENT_CLIENT}</b></li> <li>{L_DL_CLIENT}: <b>{TORRENT_CLIENT}</b></li>
<li>{L_BT_IS_PRIVATE}: <b>{TORRENT_PRIVATE}</b></li>
</ul> </ul>
<br> <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"> <table class="forumline">
<thead> <thead>
<tr> <tr>

View file

@ -172,7 +172,7 @@
<p>{postrow.attach.tor_reged.S_UPLOAD_IMAGE}</p><p><b>{L_DOWNLOAD}</b></p></a> <p>{postrow.attach.tor_reged.S_UPLOAD_IMAGE}</p><p><b>{L_DOWNLOAD}</b></p></a>
<!-- ENDIF --> <!-- ENDIF -->
<p class="small">{postrow.attach.tor_reged.FILESIZE}</p> <p class="small">{postrow.attach.tor_reged.FILESIZE}</p>
<p style="padding-top: 6px;"><input id="tor-filelist-btn" type="button" class="lite" value="{L_FILELIST}" /></p> <p style="padding-top: 6px;"><input id="tor-filelist-btn" type="button" class="lite" value="{L_BT_FLIST}" /></p>
<!-- BEGIN tor_server --> <!-- BEGIN tor_server -->
<!-- IF postrow.attach.tor_reged.tor_server.TORR_SERVER_M3U_LINK --> <!-- IF postrow.attach.tor_reged.tor_server.TORR_SERVER_M3U_LINK -->
<hr> <hr>