diff --git a/app/Models/Torrent.php b/app/Models/Torrent.php index 155495e2..c0ee10d3 100644 --- a/app/Models/Torrent.php +++ b/app/Models/Torrent.php @@ -300,9 +300,8 @@ class Torrent extends NexusModel return $result; } - public function getHrAttribute(): string + public function getHrRealAttribute(): string { -// $hrMode = Setting::get('hr.mode'); $searchBoxId = $this->basic_category->mode ?? 0; if ($searchBoxId == 0) { do_log(sprintf('[INVALID_CATEGORY], Torrent: %s, category: %s invalid', $this->id, $this->category), 'error'); diff --git a/public/torrentrss.php b/public/torrentrss.php index 34eab548..54808999 100644 --- a/public/torrentrss.php +++ b/public/torrentrss.php @@ -123,9 +123,11 @@ if (!empty($_GET['sort']) && $_GET['sort'] == 'newest') { } else { $sort = "pos_state desc, id desc"; } -$query = "SELECT torrents.id, torrents.category, torrents.name, torrents.small_descr, torrents.descr, torrents.info_hash, torrents.size, torrents.added, torrents.anonymous, users.username AS username, categories.id AS cat_id, categories.name AS cat_name FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where ORDER BY $sort LIMIT $limit"; +//$query = "SELECT torrents.id, torrents.category, torrents.name, torrents.small_descr, torrents.descr, torrents.info_hash, torrents.size, torrents.added, torrents.anonymous, users.username AS username, categories.id AS cat_id, categories.name AS cat_name FROM torrents LEFT JOIN categories ON category = categories.id LEFT JOIN users ON torrents.owner = users.id $where ORDER BY $sort LIMIT $limit"; +$query = "SELECT torrents.id, torrents.category, torrents.name, torrents.small_descr, torrents.descr, torrents.info_hash, torrents.size, torrents.added, torrents.anonymous, torrents.owner, categories.name AS category_name FROM torrents LEFT JOIN categories ON category = categories.id $where ORDER BY $sort LIMIT $limit"; $list = \Nexus\Database\NexusDB::select($query); -$list = apply_filter('torrent_list', $list, $startindex == 0 ? 0 : 1, null); +$list = apply_filter('torrent_list', $list, $startindex == 0 ? 0 : 1, null, $_GET['search'] ?? ''); +//dd($list); $torrentRep = new \App\Repositories\TorrentRepository(); $url = get_protocol_prefix().$BASEURL; $year = substr($datefounded, 0, 4); @@ -162,15 +164,16 @@ $xml .= ' //'); foreach ($list as $row) { + $ownerInfo = get_user_row($row['owner']); $title = ""; if ($row['anonymous'] == 'yes') $author = 'anonymous'; - else $author = $row['username']; + else $author = $ownerInfo['username']; $itemurl = $url."/details.php?id=".$row['id']; if ($dllink) $itemdlurl = $url."/download.php?id=".$row['id']."&downhash=" . rawurlencode( $user['id'] . '|'. $torrentRep->encryptDownHash($row['id'], $user)); else $itemdlurl = $url."/download.php?id=".$row['id']; - if (!empty($_GET['icat'])) $title .= "[".$row['cat_name']."]"; + if (!empty($_GET['icat'])) $title .= "[".$row['category_name']."]"; $title .= $row['name']; if (!empty($_GET['ismalldescr']) && !empty($row['small_descr'])) $title .= "[".$row['small_descr']."]"; if (!empty($_GET['isize'])) $title .= "[".mksize($row['size'])."]"; @@ -183,7 +186,7 @@ foreach ($list as $row) '; //print(' '.$author.''); $xml .= ''.$author.'@'.$_SERVER['HTTP_HOST'].' ('.$author.')'; -$xml .= ''.$row['cat_name'].' +$xml .= ''.$row['category_name'].' '.preg_replace_callback('/./s', 'hex_esc', hash_pad($row['info_hash'])).' diff --git a/public/torrents.php b/public/torrents.php index 69380346..6bc9b2ff 100644 --- a/public/torrents.php +++ b/public/torrents.php @@ -1182,7 +1182,7 @@ if ($count) { $rows[] = $row; } } - $rows = apply_filter('torrent_list', $rows, $page, $sectiontype); + $rows = apply_filter('torrent_list', $rows, $page, $sectiontype, $_GET['search'] ?? ''); print($pagertop); if ($sectiontype == $browsecatmode) torrenttable($rows, "torrents", $sectiontype);