mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 05:13:54 -07:00
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:
parent
47e8c9a7ee
commit
2ae9f72c1b
3 changed files with 4 additions and 23 deletions
|
@ -22,6 +22,7 @@
|
||||||
- Show torrent type (gold / silver) changes in actions log [\#1689](https://github.com/torrentpier/torrentpier/pull/1689) ([belomaxorka](https://github.com/belomaxorka))
|
- Show torrent type (gold / silver) changes in actions log [\#1689](https://github.com/torrentpier/torrentpier/pull/1689) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Changed database encoding to `utf8mb4_unicode_ci` [\#1684](https://github.com/torrentpier/torrentpier/pull/1684) ([belomaxorka](https://github.com/belomaxorka))
|
- Changed database encoding to `utf8mb4_unicode_ci` [\#1684](https://github.com/torrentpier/torrentpier/pull/1684) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka))
|
- Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
|
- Make `get_torrent_info()` as public method for re-use [\#1697](https://github.com/torrentpier/torrentpier/pull/1697) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- BBCode: Fixed relative links working [\#1613](https://github.com/torrentpier/torrentpier/pull/1613) ([belomaxorka](https://github.com/belomaxorka))
|
- BBCode: Fixed relative links working [\#1613](https://github.com/torrentpier/torrentpier/pull/1613) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Fixed empty `topic_id` in log actions after topic rename [\#1687](https://github.com/torrentpier/torrentpier/pull/1687) ([belomaxorka](https://github.com/belomaxorka))
|
- Fixed empty `topic_id` in log actions after topic rename [\#1687](https://github.com/torrentpier/torrentpier/pull/1687) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Fixed broken torrent stats displaying [\#1672](https://github.com/torrentpier/torrentpier/pull/1672), [\#1673](https://github.com/torrentpier/torrentpier/pull/1673) ([belomaxorka](https://github.com/belomaxorka))
|
- Fixed broken torrent stats displaying [\#1672](https://github.com/torrentpier/torrentpier/pull/1672), [\#1673](https://github.com/torrentpier/torrentpier/pull/1673) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
|
|
|
@ -19,31 +19,11 @@ if (!isset($this->request['attach_id'])) {
|
||||||
if (!isset($this->request['type'])) {
|
if (!isset($this->request['type'])) {
|
||||||
$this->ajax_die('empty type');
|
$this->ajax_die('empty type');
|
||||||
}
|
}
|
||||||
|
|
||||||
$attach_id = (int)$this->request['attach_id'];
|
$attach_id = (int)$this->request['attach_id'];
|
||||||
$type = (string)$this->request['type'];
|
$type = (string)$this->request['type'];
|
||||||
|
|
||||||
$torrent = DB()->fetch_row("
|
if (!$torrent = \TorrentPier\Legacy\Torrent::get_torrent_info($attach_id)) {
|
||||||
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) {
|
|
||||||
$this->ajax_die($lang['INVALID_ATTACH_ID']);
|
$this->ajax_die($lang['INVALID_ATTACH_ID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Torrent
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private static function get_torrent_info($attach_id)
|
public static function get_torrent_info($attach_id)
|
||||||
{
|
{
|
||||||
global $lang;
|
global $lang;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue