mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
improve torrents + torrentrss
This commit is contained in:
@@ -17,7 +17,7 @@ function hex_esc($matches) {
|
||||
}
|
||||
$dllink = false;
|
||||
|
||||
$where = "torrents.visible = 'yes'";
|
||||
$where = "";
|
||||
if ($passkey){
|
||||
$res = sql_query("SELECT id, enabled, parked, passkey FROM users WHERE passkey=". sqlesc($passkey)." LIMIT 1");
|
||||
$user = mysql_fetch_array($res);
|
||||
@@ -96,8 +96,11 @@ if ($approvalStatusNoneVisible == 'no' && !user_can('staffmem', false, $user['id
|
||||
$browseMode = get_setting('main.browsecat');
|
||||
$onlyBrowseSection = get_setting('main.spsct') != 'yes' || !user_can('view_special_torrent', false, $user['id']);
|
||||
if ($onlyBrowseSection) {
|
||||
$where .= ($where ? " AND " : "") . "categories.mode = $browseMode";
|
||||
$allBrowseCategoryId = \App\Models\SearchBox::listCategoryId($browseMode);
|
||||
$where .= ($where ? " AND " : "") . sprintf("torrents.category in (%s)", implode(",", $allBrowseCategoryId));
|
||||
}
|
||||
//visible
|
||||
$where .= ($where ? " AND " : "") . "torrents.visible = 'yes'";
|
||||
//check price
|
||||
if (isset($_GET['paid']) && in_array($_GET['paid'], ['0', '1', '2'], true)) {
|
||||
$paidFilter = $_GET['paid'];
|
||||
@@ -174,12 +177,12 @@ if ($where) {
|
||||
$sort = "id desc";
|
||||
$fieldStr = "torrents.id, torrents.category, torrents.name, torrents.small_descr, torrent_extras.descr, torrents.info_hash, torrents.size, torrents.added, torrents.anonymous, torrents.owner, categories.name AS category_name";
|
||||
if (!$noNormalResults) {
|
||||
$query = "SELECT $fieldStr FROM torrents LEFT JOIN categories ON category = categories.id left join torrent_extras on torrent_extras.torrent_id = torrents.id $normalWhere ORDER BY $sort LIMIT $limit";
|
||||
$query = "SELECT $fieldStr FROM torrents LEFT JOIN categories ON torrents.category = categories.id left join torrent_extras on torrent_extras.torrent_id = torrents.id $normalWhere ORDER BY $sort LIMIT $limit";
|
||||
$normalRows = \Nexus\Database\NexusDB::select($query);
|
||||
}
|
||||
if (!empty($prependIdArr) && $startindex == 0) {
|
||||
$prependIdStr = implode(',', $prependIdArr);
|
||||
$prependRows = \Nexus\Database\NexusDB::select("SELECT $fieldStr FROM torrents LEFT JOIN categories ON category = categories.id left join torrent_extras on torrent_extras.torrent_id = torrents.id where torrents.id in ($prependIdStr) and $where ORDER BY field(torrents.id, $prependIdStr)");
|
||||
$prependRows = \Nexus\Database\NexusDB::select("SELECT $fieldStr FROM torrents LEFT JOIN categories ON torrents.category = categories.id left join torrent_extras on torrent_extras.torrent_id = torrents.id where torrents.id in ($prependIdStr) and $where ORDER BY field(torrents.id, $prependIdStr)");
|
||||
}
|
||||
$list = [];
|
||||
foreach ($prependRows as $row) {
|
||||
|
||||
+16
-7
@@ -116,6 +116,7 @@ $wherestandardina = array();
|
||||
$whereprocessingina = array();
|
||||
$whereteamina = array();
|
||||
$whereaudiocodecina = array();
|
||||
$whereothera = [];
|
||||
//----------------- start whether show torrents from all sections---------------------//
|
||||
if ($_GET)
|
||||
$allsec = intval($_GET["allsec"] ?? 0);
|
||||
@@ -161,11 +162,6 @@ elseif ($inclbookmarked == 2) //not bookmarked
|
||||
}
|
||||
// ----------------- end bookmarked ---------------------//
|
||||
|
||||
if (!isset($CURUSER) || !user_can('seebanned')) {
|
||||
$wherea[] = "banned = 'no'";
|
||||
$searchParams["banned"] = 'no';
|
||||
}
|
||||
|
||||
// ----------------- start include dead ---------------------//
|
||||
if (isset($_GET["incldead"]))
|
||||
$include_dead = intval($_GET["incldead"] ?? 0);
|
||||
@@ -192,14 +188,23 @@ if ($include_dead == 0) //all(active,dead)
|
||||
elseif ($include_dead == 1) //active
|
||||
{
|
||||
$addparam .= "incldead=1&";
|
||||
$wherea[] = "visible = 'yes'";
|
||||
// $wherea[] = "visible = 'yes'";
|
||||
$whereothera[] = "visible = 'yes'";
|
||||
}
|
||||
elseif ($include_dead == 2) //dead
|
||||
{
|
||||
$addparam .= "incldead=2&";
|
||||
$wherea[] = "visible = 'no'";
|
||||
// $wherea[] = "visible = 'no'";
|
||||
$whereothera[] = "visible = 'no'";
|
||||
}
|
||||
// ----------------- end include dead ---------------------//
|
||||
|
||||
if (!isset($CURUSER) || !user_can('seebanned')) {
|
||||
// $wherea[] = "banned = 'no'";
|
||||
$whereothera[] = "banned = 'no'";
|
||||
$searchParams["banned"] = 'no';
|
||||
}
|
||||
|
||||
$special_state = 0;
|
||||
if ($_GET)
|
||||
$special_state = intval($_GET["spstate"] ?? 0);
|
||||
@@ -907,6 +912,10 @@ $where .= ($where ? " AND " : "") . "team IN(" . $whereteamin . ")";
|
||||
if ($whereaudiocodecin)
|
||||
$where .= ($where ? " AND " : "") . "audiocodec IN(" . $whereaudiocodecin . ")";
|
||||
}
|
||||
//last
|
||||
if (!empty($whereothera)) {
|
||||
$where .= ($where ? " AND " : "") . implode(" AND ", $whereothera);
|
||||
}
|
||||
|
||||
$tagFilter = "";
|
||||
$tagId = intval($_REQUEST['tag_id'] ?? 0);
|
||||
|
||||
Reference in New Issue
Block a user