Make get_torrent_info() as public method for re-use (#1697)

* Make `get_torrent_info()` as public method for re-use

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-12-02 23:11:44 +07:00 committed by GitHub
commit 2ae9f72c1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 23 deletions

View file

@ -19,31 +19,11 @@ if (!isset($this->request['attach_id'])) {
if (!isset($this->request['type'])) {
$this->ajax_die('empty type');
}
$attach_id = (int)$this->request['attach_id'];
$type = (string)$this->request['type'];
$torrent = DB()->fetch_row("
SELECT
a.post_id, d.physical_filename, d.extension, d.tracker_status,
t.topic_first_post_id, t.topic_title,
p.poster_id, p.topic_id, p.forum_id,
f.allow_reg_tracker
FROM
" . BB_ATTACHMENTS . " a,
" . BB_ATTACHMENTS_DESC . " d,
" . BB_POSTS . " p,
" . BB_TOPICS . " t,
" . BB_FORUMS . " f
WHERE
a.attach_id = $attach_id
AND d.attach_id = $attach_id
AND p.post_id = a.post_id
AND t.topic_id = p.topic_id
AND f.forum_id = p.forum_id
LIMIT 1
");
if (!$torrent) {
if (!$torrent = \TorrentPier\Legacy\Torrent::get_torrent_info($attach_id)) {
$this->ajax_die($lang['INVALID_ATTACH_ID']);
}