Move filelist feature to another file (#1268)

This commit is contained in:
Cønstantine Kovalensky 2023-12-26 20:52:05 +04:00 committed by GitHub
commit ed34bbb735
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 14 deletions

View file

@ -7,9 +7,7 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/ */
if (!defined('BB_ROOT')) { require __DIR__ . '/common.php';
die(basename(__FILE__));
}
// Start session management // Start session management
$user->session_start(); $user->session_start();
@ -19,7 +17,7 @@ if ($bb_cfg['bt_disable_dht'] && IS_GUEST) {
die($lang['BT_PRIVATE_TRACKER']); die($lang['BT_PRIVATE_TRACKER']);
} }
$topic_id = !empty($_GET['filelist']) ? (int)$_GET['filelist'] : (http_response_code(404) && die($lang['INVALID_TOPIC_ID'])); $topic_id = !empty($_GET['topic']) ? (int)$_GET['topic'] : (http_response_code(404) && die($lang['INVALID_TOPIC_ID']));
$sql = 'SELECT t.attach_id, t.info_hash, t.info_hash_v2, t.size, ad.physical_filename $sql = 'SELECT t.attach_id, t.info_hash, t.info_hash_v2, t.size, ad.physical_filename
FROM ' . BB_BT_TORRENTS . ' t FROM ' . BB_BT_TORRENTS . ' t
@ -81,6 +79,7 @@ $data = [
'client' => isset($torrent['created by']) ? htmlCHR(substr($torrent['created by'], 0, 20)) : 'unknown client', 'client' => isset($torrent['created by']) ? htmlCHR(substr($torrent['created by'], 0, 20)) : 'unknown client',
'date' => (isset($torrent['creation date']) && is_numeric($torrent['creation date'])) ? date('d-M-Y H:i (e)', $torrent['creation date']) : 'unknown', 'date' => (isset($torrent['creation date']) && is_numeric($torrent['creation date'])) ? date('d-M-Y H:i (e)', $torrent['creation date']) : 'unknown',
'size' => humn_size($row['size']), 'size' => humn_size($row['size']),
'site_url' => FULL_URL,
'topic_url' => TOPIC_URL . $topic_id, 'topic_url' => TOPIC_URL . $topic_id,
]; ];
@ -90,11 +89,15 @@ echo <<<EOF
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=0.1, maximum-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=0.1, maximum-scale=1.0" />
<meta name="robots" content="index"> <meta name="robots" content="index" />
<meta name="description" content="File listing for topic - $topic_id | {$data['name']} ({$data['size']})"> <meta name="description" content="File listing for topic - $topic_id | {$data['name']} ({$data['size']})" />
<link rel="shortcut icon" href="favicon.png" type="image/x-icon"> <meta name="generator" content="TorrentPier" />
<meta name="version" content="{$bb_cfg['tp_version']}" />
<link rel="shortcut icon" href="favicon.png" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" href="{$data['site_url']}opensearch_desc.xml" title="{$bb_cfg['sitename']} (Forum)" />
<link rel="search" type="application/opensearchdescription+xml" href="{$data['site_url']}opensearch_desc_bt.xml" title="{$bb_cfg['sitename']} (Tracker)" />
<title>{$data['name']} ({$data['size']}) | {$bb_cfg['sitename']}</title> <title>{$data['name']} ({$data['size']}) | {$bb_cfg['sitename']}</title>
</head> </head>
@ -165,7 +168,7 @@ sup {
opacity: 0.97; opacity: 0.97;
} }
</style> </style>
<a href = "{$data['topic_url']}" style = "font-family: Monospace; color: #569904;">🠔 Back to the topic</a> <a href = "{$data['site_url']}{$data['topic_url']}" style = "font-family: Monospace; color: #569904;">🠔 Back to the topic</a>
<center> <center>
<h2 style="color: #b3b3b3; font-family: Monospace;">Name: {$data['name']} | Date: {$data['date']} | Size: {$data['size']}</h2> <h2 style="color: #b3b3b3; font-family: Monospace;">Name: {$data['name']} | Date: {$data['date']} | Size: {$data['size']}</h2>
<p> <p>
@ -192,9 +195,7 @@ echo $files['list'];
echo ' echo '
</table> </table>
<p> <p style = "color: gray; font-family: Calibri Light">Generated by <a href = "https://github.com/torrentpier/torrentpier" target="_blank" title = "Bull-powered BitTorrent tracker engine">TorrentPier</a></p>
<p style = "color: gray; font-family: Calibri">Generated by <a href = "https://github.com/torrentpier/torrentpier" target="_blank" title = "Bull-powered BitTorrent tracker engine">TorrentPier</a></p>
</p>
</center> </center>
</body> </body>
</html>'; </html>';

View file

@ -296,7 +296,7 @@ define('POSTING_URL', $bb_cfg['posting_url']);
define('PROFILE_URL', 'profile.php?mode=viewprofile&amp;u='); define('PROFILE_URL', 'profile.php?mode=viewprofile&amp;u=');
define('BONUS_URL', 'profile.php?mode=bonus'); define('BONUS_URL', 'profile.php?mode=bonus');
define('TOPIC_URL', 'viewtopic.php?t='); define('TOPIC_URL', 'viewtopic.php?t=');
define('FILELIST_URL', 'viewtopic.php?filelist='); define('FILELIST_URL', 'filelist.php?topic=');
define('USER_AGENT', strtolower($_SERVER['HTTP_USER_AGENT'])); define('USER_AGENT', strtolower($_SERVER['HTTP_USER_AGENT']));

View file

@ -24,7 +24,6 @@ $page_cfg['load_tpl_vars'] = [
]; ];
$newest = $next_topic_id = 0; $newest = $next_topic_id = 0;
$file_list = isset($_GET['filelist']) ? include(INC_DIR . '/file_list_v2.php') : 0;
$start = isset($_GET['start']) ? abs((int)$_GET['start']) : 0; $start = isset($_GET['start']) ? abs((int)$_GET['start']) : 0;
$topic_id = isset($_GET[POST_TOPIC_URL]) ? (int)$_GET[POST_TOPIC_URL] : 0; $topic_id = isset($_GET[POST_TOPIC_URL]) ? (int)$_GET[POST_TOPIC_URL] : 0;
$post_id = (!$topic_id && isset($_GET[POST_POST_URL])) ? (int)$_GET[POST_POST_URL] : 0; $post_id = (!$topic_id && isset($_GET[POST_POST_URL])) ? (int)$_GET[POST_POST_URL] : 0;