From ed34bbb73507e049cc023456e3c00a49fd89891b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B8nstantine=20Kovalensky?= <45331093+kovalensky@users.noreply.github.com> Date: Tue, 26 Dec 2023 20:52:05 +0400 Subject: [PATCH] Move filelist feature to another file (#1268) --- .../includes/file_list_v2.php => filelist.php | 25 ++++++++++--------- library/includes/init_bb.php | 2 +- viewtopic.php | 1 - 3 files changed, 14 insertions(+), 14 deletions(-) rename library/includes/file_list_v2.php => filelist.php (83%) diff --git a/library/includes/file_list_v2.php b/filelist.php similarity index 83% rename from library/includes/file_list_v2.php rename to filelist.php index 47891854d..71d6f32a3 100644 --- a/library/includes/file_list_v2.php +++ b/filelist.php @@ -7,9 +7,7 @@ * @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License */ -if (!defined('BB_ROOT')) { - die(basename(__FILE__)); -} +require __DIR__ . '/common.php'; // Start session management $user->session_start(); @@ -19,7 +17,7 @@ if ($bb_cfg['bt_disable_dht'] && IS_GUEST) { 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 FROM ' . BB_BT_TORRENTS . ' t @@ -81,6 +79,7 @@ $data = [ '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', 'size' => humn_size($row['size']), + 'site_url' => FULL_URL, 'topic_url' => TOPIC_URL . $topic_id, ]; @@ -90,11 +89,15 @@ echo << - + - - - + + + + + + + {$data['name']} ({$data['size']}) | {$bb_cfg['sitename']} @@ -165,7 +168,7 @@ sup { opacity: 0.97; } -🠔 Back to the topic +🠔 Back to the topic

Name: {$data['name']} | Date: {$data['date']} | Size: {$data['size']}

@@ -192,9 +195,7 @@ echo $files['list']; echo ' -

-

Generated by TorrentPier

-

+

Generated by TorrentPier

'; diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php index 3b2c60af0..0130cff9d 100644 --- a/library/includes/init_bb.php +++ b/library/includes/init_bb.php @@ -296,7 +296,7 @@ define('POSTING_URL', $bb_cfg['posting_url']); define('PROFILE_URL', 'profile.php?mode=viewprofile&u='); define('BONUS_URL', 'profile.php?mode=bonus'); 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'])); diff --git a/viewtopic.php b/viewtopic.php index 4a881b1be..6315958d1 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -24,7 +24,6 @@ $page_cfg['load_tpl_vars'] = [ ]; $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; $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;