From 01838408b81d0cdf5724ab7165d954f67856d5bb Mon Sep 17 00:00:00 2001 From: Git Date: Fri, 4 Oct 2013 08:00:56 +0000 Subject: [PATCH] Empty commit --- classes/requests.class.php | 16 +++++++++------- classes/torrents.class.php | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/classes/requests.class.php b/classes/requests.class.php index 91958ca6..610b415f 100644 --- a/classes/requests.class.php +++ b/classes/requests.class.php @@ -53,21 +53,23 @@ public static function update_sphinx_requests($RequestID) { // //In places where the output from this is merged with sphinx filters, it will be in a different order. public static function get_requests($RequestIDs, $Return = true) { - // Make sure there's something in $RequestIDs, otherwise the SQL will break - if (count($RequestIDs) === 0) { - return array(); - } - $Found = $NotFound = array_fill_keys($RequestIDs, false); // Try to fetch the requests from the cache first. - foreach ($RequestIDs as $RequestID) { + foreach ($RequestIDs as $i => $RequestID) { + if (!is_number($RequestID)) { + unset($RequestIDs[$i], $Found[$GroupID], $NotFound[$GroupID]); + continue; + } $Data = G::$Cache->get_value("request_$RequestID"); if (!empty($Data)) { unset($NotFound[$RequestID]); $Found[$RequestID] = $Data; } } - + // Make sure there's something in $RequestIDs, otherwise the SQL will break + if (count($RequestIDs) === 0) { + return array(); + } $IDs = implode(',', array_keys($NotFound)); /* diff --git a/classes/torrents.class.php b/classes/torrents.class.php index 204bb174..8c79513a 100644 --- a/classes/torrents.class.php +++ b/classes/torrents.class.php @@ -46,23 +46,24 @@ class Torrents { * } */ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true, $Torrents = true) { - // Make sure there's something in $GroupIDs, otherwise the SQL - // will break - if (count($GroupIDs) == 0) { - return array(); - } - $Found = $NotFound = array_fill_keys($GroupIDs, false); $Key = $Torrents ? 'torrent_group_' : 'torrent_group_light_'; - foreach ($GroupIDs as $GroupID) { + foreach ($GroupIDs as $i => $GroupID) { + if (!is_number($GroupID)) { + unset($GroupIDs[$i], $Found[$GroupID], $NotFound[$GroupID]); + continue; + } $Data = G::$Cache->get_value($Key.$GroupID, true); - if (!empty($Data) && (@$Data['ver'] == CACHE::GROUP_VERSION)) { + if (!empty($Data) && $Data['ver'] == CACHE::GROUP_VERSION) { unset($NotFound[$GroupID]); $Found[$GroupID] = $Data['d']; } } - + // Make sure there's something in $GroupIDs, otherwise the SQL will break + if (count($GroupIDs) === 0) { + return array(); + } $IDs = implode(',', array_keys($NotFound)); /*