From 985a8769a4dbd6cf9d2efd268240c63732bae967 Mon Sep 17 00:00:00 2001 From: Git Date: Wed, 7 May 2014 08:00:45 +0000 Subject: [PATCH] Empty commit --- classes/requests.class.php | 2 +- sections/ajax/artist.php | 6 +- sections/ajax/better/single.php | 6 +- sections/ajax/bookmarks/torrents.php | 72 +++++++++++--------- sections/better/single.php | 6 +- sections/bookmarks/edit_torrents.php | 2 +- sections/bookmarks/torrents.php | 8 ++- sections/collages/manage.php | 6 +- sections/collages/torrent_collage.php | 6 +- sections/feeds/index.php | 2 +- sections/torrents/voter_picks.php | 6 +- sections/user/takemoderate.php | 8 +-- sections/userhistory/subscribed_collages.php | 6 +- 13 files changed, 86 insertions(+), 50 deletions(-) diff --git a/classes/requests.class.php b/classes/requests.class.php index db4865ab..a81cdaab 100644 --- a/classes/requests.class.php +++ b/classes/requests.class.php @@ -45,7 +45,7 @@ public static function update_sphinx_requests($RequestID) { WHERE ID = $RequestID"); G::$DB->set_query_id($QueryID); - G::$Cache->delete_value("requests_$RequestID"); + G::$Cache->delete_value("request_$RequestID"); } diff --git a/sections/ajax/artist.php b/sections/ajax/artist.php index 7047569a..77bb5087 100644 --- a/sections/ajax/artist.php +++ b/sections/ajax/artist.php @@ -173,7 +173,11 @@ function compare($X, $Y) { $JsonTorrents = array(); $Tags = array(); $NumTorrents = $NumSeeders = $NumLeechers = $NumSnatches = 0; -foreach ($TorrentList as $GroupID => $Group) { +foreach ($GroupIDs as $GroupID) { + if (!isset($TorrentList[$GroupID])) { + continue; + } + $Group = $TorrentList[$GroupID]; extract(Torrents::array_group($Group)); foreach ($Artists as &$Artist) { diff --git a/sections/ajax/better/single.php b/sections/ajax/better/single.php index 6582db01..32a184ad 100644 --- a/sections/ajax/better/single.php +++ b/sections/ajax/better/single.php @@ -19,7 +19,11 @@ $Results = Torrents::get_groups(array_keys($GroupIDs)); $JsonResults = array(); -foreach ($Results as $GroupID => $Group) { +foreach ($GroupIDs as $GroupID) { + if (!isset($Results[$GroupID])) { + continue; + } + $Group = $Results[$GroupIDs]; extract(Torrents::array_group($Group)); $FlacID = $GroupIDs[$GroupID]['TorrentID']; diff --git a/sections/ajax/bookmarks/torrents.php b/sections/ajax/bookmarks/torrents.php index 2636a2d2..f1302860 100644 --- a/sections/ajax/bookmarks/torrents.php +++ b/sections/ajax/bookmarks/torrents.php @@ -29,45 +29,49 @@ function compare($X, $Y) { $JsonBookmarks = array(); -list(, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID); -foreach ($TorrentList as $Torrent) { +list($GroupIDs, $CollageDataList, $GroupList) = Users::get_bookmarks($UserID); +foreach($GroupIDs as $GroupID) { + if (!isset($GroupList[$GroupID])) { + continue; + } + $Group = $GroupList[$GroupID]; $JsonTorrents = array(); - foreach ($Torrent['Torrents'] as $GroupTorrents) { + foreach ($Group['Torrents'] as $Torrent) { $JsonTorrents[] = array( - 'id' => (int)$GroupTorrents['ID'], - 'groupId' => (int)$GroupTorrents['GroupID'], - 'media' => $GroupTorrents['Media'], - 'format' => $GroupTorrents['Format'], - 'encoding' => $GroupTorrents['Encoding'], - 'remasterYear' => (int)$GroupTorrents['RemasterYear'], - 'remastered' => $GroupTorrents['Remastered'] == 1, - 'remasterTitle' => $GroupTorrents['RemasterTitle'], - 'remasterRecordLabel' => $GroupTorrents['RemasterRecordLabel'], - 'remasterCatalogueNumber' => $GroupTorrents['RemasterCatalogueNumber'], - 'scene' => $GroupTorrents['Scene'] == 1, - 'hasLog' => $GroupTorrents['HasLog'] == 1, - 'hasCue' => $GroupTorrents['HasCue'] == 1, - 'logScore' => (float)$GroupTorrents['LogScore'], - 'fileCount' => (int)$GroupTorrents['FileCount'], - 'freeTorrent' => $GroupTorrents['FreeTorrent'] == 1, - 'size' => (float)$GroupTorrents['Size'], - 'leechers' => (int)$GroupTorrents['Leechers'], - 'seeders' => (int)$GroupTorrents['Seeders'], - 'snatched' => (int)$GroupTorrents['Snatched'], - 'time' => $GroupTorrents['Time'], - 'hasFile' => (int)$GroupTorrents['HasFile'] + 'id' => (int)$Torrent['ID'], + 'groupId' => (int)$Torrent['GroupID'], + 'media' => $Torrent['Media'], + 'format' => $Torrent['Format'], + 'encoding' => $Torrent['Encoding'], + 'remasterYear' => (int)$Torrent['RemasterYear'], + 'remastered' => $Torrent['Remastered'] == 1, + 'remasterTitle' => $Torrent['RemasterTitle'], + 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'], + 'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'], + 'scene' => $Torrent['Scene'] == 1, + 'hasLog' => $Torrent['HasLog'] == 1, + 'hasCue' => $Torrent['HasCue'] == 1, + 'logScore' => (float)$Torrent['LogScore'], + 'fileCount' => (int)$Torrent['FileCount'], + 'freeTorrent' => $Torrent['FreeTorrent'] == 1, + 'size' => (float)$Torrent['Size'], + 'leechers' => (int)$Torrent['Leechers'], + 'seeders' => (int)$Torrent['Seeders'], + 'snatched' => (int)$Torrent['Snatched'], + 'time' => $Torrent['Time'], + 'hasFile' => (int)$Torrent['HasFile'] ); } $JsonBookmarks[] = array( - 'id' => (int)$Torrent['ID'], - 'name' => $Torrent['Name'], - 'year' => (int)$Torrent['Year'], - 'recordLabel' => $Torrent['RecordLabel'], - 'catalogueNumber' => $Torrent['CatalogueNumber'], - 'tagList' => $Torrent['TagList'], - 'releaseType' => $Torrent['ReleaseType'], - 'vanityHouse' => $Torrent['VanityHouse'] == 1, - 'image' => $CollageDataList[$Torrent['ID']]['WikiImage'], + 'id' => (int)$Group['ID'], + 'name' => $Group['Name'], + 'year' => (int)$Group['Year'], + 'recordLabel' => $Group['RecordLabel'], + 'catalogueNumber' => $Group['CatalogueNumber'], + 'tagList' => $Group['TagList'], + 'releaseType' => $Group['ReleaseType'], + 'vanityHouse' => $Group['VanityHouse'] == 1, + 'image' => $Group['WikiImage'], 'torrents' => $JsonTorrents ); } diff --git a/sections/better/single.php b/sections/better/single.php index f59c60ca..12425caa 100644 --- a/sections/better/single.php +++ b/sections/better/single.php @@ -29,7 +29,11 @@ Torrent $Group) { +foreach ($GroupIDs as $GroupID) { + if (!isset($Results[$GroupID])) { + continue; + } + $Group = $Results[$GroupID]; extract(Torrents::array_group($Group)); $TorrentTags = new Tags($TagList); diff --git a/sections/bookmarks/edit_torrents.php b/sections/bookmarks/edit_torrents.php index 8c1e39bb..d3eb5561 100644 --- a/sections/bookmarks/edit_torrents.php +++ b/sections/bookmarks/edit_torrents.php @@ -26,7 +26,7 @@ $EditType = isset($_GET['type']) ? $_GET['type'] : 'torrents'; -list(, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID); +list(, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID); // TODO: $TorrentList might not have the correct order, use the $GroupIDs instead $TT = new MASS_USER_TORRENTS_TABLE_VIEW($TorrentList, $CollageDataList, $EditType, 'Organize Torrent Bookmarks'); $TT->render_all(); diff --git a/sections/bookmarks/torrents.php b/sections/bookmarks/torrents.php index 7f395242..edd1450a 100644 --- a/sections/bookmarks/torrents.php +++ b/sections/bookmarks/torrents.php @@ -36,8 +36,12 @@ function compare($X, $Y) { $NumGroups = 0; $ArtistCount = array(); -list(, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID); -foreach ($TorrentList as $GroupID => $Group) { +list($GroupIDs, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID); +foreach ($GroupIDs as $GroupID) { + if (!isset($TorrentList[$GroupID])) { + continue; + } + $Group = $TorrentList[$GroupID]; extract(Torrents::array_group($Group)); list(, $Sort, $AddedTime) = array_values($CollageDataList[$GroupID]); diff --git a/sections/collages/manage.php b/sections/collages/manage.php index 89063678..d6aa88c8 100644 --- a/sections/collages/manage.php +++ b/sections/collages/manage.php @@ -80,7 +80,11 @@ $Group) { + foreach ($GroupIDs as $GroupID) { + if (!isset($TorrentList[$GroupID])) { + continue; + } + $Group = $TorrentList[$GroupID]; extract(Torrents::array_group($Group)); list(, $UserID, $Username, $Sort, $CatNum) = array_values($CollageDataList[$GroupID]); diff --git a/sections/collages/torrent_collage.php b/sections/collages/torrent_collage.php index 65e6282b..ca43ce0f 100644 --- a/sections/collages/torrent_collage.php +++ b/sections/collages/torrent_collage.php @@ -34,7 +34,11 @@ function compare($X, $Y) { $UserAdditions = array(); $Number = 0; -foreach ($TorrentList as $GroupID => $Group) { +foreach ($GroupIDs as $GroupID) { + if (!isset($TorrentList[$GroupID])) { + continue; + } + $Group = $TorrentList[$GroupID]; extract(Torrents::array_group($Group)); $UserID = $Contributors[$GroupID]; $TorrentTags = new Tags($TagList); diff --git a/sections/feeds/index.php b/sections/feeds/index.php index cd43e637..de5bfc99 100644 --- a/sections/feeds/index.php +++ b/sections/feeds/index.php @@ -91,7 +91,7 @@ ORDER BY Time DESC LIMIT 20"); $Blog = $DB->to_array(); - $Cache->cache_value('Blog', $Blog, 1209600); + $Cache->cache_value('blog', $Blog, 1209600); } foreach ($Blog as $BlogItem) { list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $BlogItem; diff --git a/sections/torrents/voter_picks.php b/sections/torrents/voter_picks.php index ff097b3c..98db3d61 100644 --- a/sections/torrents/voter_picks.php +++ b/sections/torrents/voter_picks.php @@ -46,7 +46,11 @@ $Groups = Torrents::get_groups($Top10Groups, true, true, false); $i = 0; - foreach ($Groups as $MatchGroupID => $MatchGroup) { + foreach ($Top10Groups as $MatchGroupID) { + if (!isset($Groups[$MatchGroupID])) { + continue; + } + $MatchGroup = $Groups[$MatchGroupID]; $i++; $Str = Artists::display_artists($MatchGroup['ExtendedArtists']).''.$MatchGroup['Name'].''; ?> diff --git a/sections/user/takemoderate.php b/sections/user/takemoderate.php index d5818bec..5112d63d 100644 --- a/sections/user/takemoderate.php +++ b/sections/user/takemoderate.php @@ -424,14 +424,14 @@ || (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID']))) { $UpdateSet[] = "Uploaded = '$Uploaded'"; $EditSummary[] = "uploaded changed from ".Format::get_size($Cur['Uploaded']).' to '.Format::get_size($Uploaded); - $Cache->delete_value("users_stats_$UserID"); + $Cache->delete_value("user_stats_$UserID"); } if ($Downloaded != $Cur['Downloaded'] && $Downloaded != $_POST['OldDownloaded'] && (check_perms('users_edit_ratio') || (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID']))) { $UpdateSet[] = "Downloaded = '$Downloaded'"; $EditSummary[] = "downloaded changed from ".Format::get_size($Cur['Downloaded']).' to '.Format::get_size($Downloaded); - $Cache->delete_value("users_stats_$UserID"); + $Cache->delete_value("user_stats_$UserID"); } if ($FLTokens != $Cur['FLTokens'] && (check_perms('users_edit_ratio') || (check_perms('users_edit_own_ratio') && $UserID == $LoggedUser['ID']))) { @@ -714,8 +714,8 @@ $UpdateSet[] = "Uploaded = Uploaded + '$MergeUploaded'"; $UpdateSet[] = "Downloaded = Downloaded + '$MergeDownloaded'"; $EditSummary[] = 'stats merged from '.site_url()."user.php?id=$MergeID ($MergeStatsFrom) (previous stats: Uploaded: ".Format::get_size($Cur['Uploaded']).', Downloaded: '.Format::get_size($Cur['Downloaded']).', Ratio: '.Format::get_ratio($Cur['Uploaded'], $Cur['Downloaded']).')'; - $Cache->delete_value("users_stats_$UserID"); - $Cache->delete_value("users_stats_$MergeID"); + $Cache->delete_value("user_stats_$UserID"); + $Cache->delete_value("user_stats_$MergeID"); } } diff --git a/sections/userhistory/subscribed_collages.php b/sections/userhistory/subscribed_collages.php index dde94a11..80fe1170 100644 --- a/sections/userhistory/subscribed_collages.php +++ b/sections/userhistory/subscribed_collages.php @@ -97,7 +97,11 @@ $Artists = Artists::get_artists($GroupIDs); $Number = 0; - foreach ($TorrentList as $GroupID => $Group) { + foreach ($GroupIDs as $GroupID) { + if (!isset($TorrentList[$GroupID])) { + continue; + } + $Group = $TorrentList[$GroupID]; extract(Torrents::array_group($Group)); $DisplayName = '';