Update filelist.php

This commit is contained in:
Roman Kelesidis 2025-04-15 20:16:19 +03:00
commit 90eae65a58

View file

@ -35,13 +35,15 @@ if (!$row = DB()->fetch_row($sql)) {
} }
// Previous/next topic links // Previous/next topic links
$topics_sql = ' $sql = '
(SELECT topic_id FROM ' . BB_BT_TORRENTS . ' WHERE topic_id < ' . $topic_id . ' ORDER BY topic_id DESC LIMIT 1) (SELECT topic_id FROM ' . BB_BT_TORRENTS . ' WHERE topic_id < ' . $topic_id . ' ORDER BY topic_id DESC LIMIT 1)
UNION UNION
(SELECT topic_id FROM ' . BB_BT_TORRENTS . ' WHERE topic_id >= ' . $topic_id . ' ORDER BY topic_id ASC LIMIT 2) (SELECT topic_id FROM ' . BB_BT_TORRENTS . ' WHERE topic_id >= ' . $topic_id . ' ORDER BY topic_id ASC LIMIT 2)
ORDER BY topic_id ASC'; ORDER BY topic_id ASC';
$topics = DB()->fetch_rowset($topics_sql); if (!$topics = DB()->fetch_rowset($sql)) {
bb_die($lang['INVALID_TOPIC_ID_DB'], 404);
}
$topic_ids = array_column($topics, 'topic_id'); $topic_ids = array_column($topics, 'topic_id');
$current_index = array_search($topic_id, $topic_ids); $current_index = array_search($topic_id, $topic_ids);
@ -61,6 +63,7 @@ $template->assign_vars([
'U_NEXT_TOPIC' => "filelist.php?t=$next_topic_id", 'U_NEXT_TOPIC' => "filelist.php?t=$next_topic_id",
'U_PREV_TOPIC' => "filelist.php?t=$prev_topic_id", 'U_PREV_TOPIC' => "filelist.php?t=$prev_topic_id",
]); ]);
unset($prev_topic_id, $next_topic_id, $current_index, $topic_ids, $topics);
// Protocol meta // Protocol meta
$meta_v1 = !empty($row['info_hash']); $meta_v1 = !empty($row['info_hash']);