mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
filter get params in torrent rss
This commit is contained in:
@@ -4,6 +4,17 @@ $passkey = $_GET['passkey'] ?? $CURUSER['passkey'] ?? '';
|
|||||||
if (!$passkey) {
|
if (!$passkey) {
|
||||||
die("require passkey");
|
die("require passkey");
|
||||||
}
|
}
|
||||||
|
$exactParams = ['inclbookmarked', 'paid', 'rows', 'icat', 'ismalldescr', 'isize', 'iuplder', 'search', 'search_mode', 'sticky', 'linktype'];
|
||||||
|
$prefixedParams = ['cat', 'sou', 'med', 'cod', 'sta', 'pro', 'tea', 'aud'];
|
||||||
|
foreach ($_GET as $key => $value) {
|
||||||
|
if (in_array($key, $exactParams, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (preg_match('/^(cat|sou|med|cod|sta|pro|tea|aud)\d+$/', $key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
unset($_GET[$key]);
|
||||||
|
}
|
||||||
$cacheKey = "nexus_rss:$passkey:" . md5(http_build_query($_GET));
|
$cacheKey = "nexus_rss:$passkey:" . md5(http_build_query($_GET));
|
||||||
$cacheData = \Nexus\Database\NexusDB::cache_get($cacheKey);
|
$cacheData = \Nexus\Database\NexusDB::cache_get($cacheKey);
|
||||||
if ($cacheData && nexus_env('APP_ENV') != 'local') {
|
if ($cacheData && nexus_env('APP_ENV') != 'local') {
|
||||||
@@ -79,10 +90,6 @@ if (isset($searchstr)){
|
|||||||
$where .= ($where ? " AND " : "") . implode(" AND ", $wherea);
|
$where .= ($where ? " AND " : "") . implode(" AND ", $wherea);
|
||||||
}
|
}
|
||||||
$limit = "";
|
$limit = "";
|
||||||
$startindex = intval($_GET['startindex'] ?? 0);
|
|
||||||
if ($startindex) {
|
|
||||||
$limit .= $startindex.", ";
|
|
||||||
}
|
|
||||||
$showrows = intval($_GET['rows'] ?? 0);
|
$showrows = intval($_GET['rows'] ?? 0);
|
||||||
if($showrows < 1 || $showrows > 50) {
|
if($showrows < 1 || $showrows > 50) {
|
||||||
$showrows = 50;
|
$showrows = 50;
|
||||||
@@ -184,7 +191,7 @@ if (!$noNormalResults) {
|
|||||||
return \Nexus\Database\NexusDB::select($query);
|
return \Nexus\Database\NexusDB::select($query);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!empty($prependIdArr) && $startindex == 0) {
|
if (!empty($prependIdArr)) {
|
||||||
$prependIdStr = implode(',', $prependIdArr);
|
$prependIdStr = implode(',', $prependIdArr);
|
||||||
$query = "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)";
|
$query = "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)";
|
||||||
$prependRows = \Nexus\Database\NexusDB::remember(sprintf("nexus_rss:prepend:%s", md5($query)), 300, function () use ($query) {
|
$prependRows = \Nexus\Database\NexusDB::remember(sprintf("nexus_rss:prepend:%s", md5($query)), 300, function () use ($query) {
|
||||||
|
|||||||
Reference in New Issue
Block a user