query(" SELECT t.ID AS TorrentID, DATE_FORMAT($Month, '%Y - %m') AS Month, t.GroupID, t.Media, t.Container, t.Codec, t.Resolution, t.AudioFormat, t.Subbing, t.Language, t.Subber, tg.Year, tg.Name, t.Size FROM torrents AS t JOIN torrents_group AS tg ON t.GroupID = tg.ID $SQL GROUP BY TorrentID"); $Collector = new TorrentsDL($DownloadsQ, "$Username's ".ucfirst($_GET['type'])); while (list($Downloads, $GroupIDs) = $Collector->get_downloads('TorrentID')) { $Artists = Artists::get_artists($GroupIDs); $TorrentIDs = array_keys($GroupIDs); foreach ($TorrentIDs as $TorrentID) { $TorrentFile = file_get_contents(TORRENT_STORE.$TorrentID.'.torrent'); $Download =& $Downloads[$TorrentID]; // unzip(1) corrupts files if an emdash is present. Replace them. $Download['Artist'] = str_replace('–','-',Artists::display_artists($Artists[$Download['GroupID']], false, true, false)); $Collector->add_file($TorrentFile, $Download, $Download['Month']); unset($Download); } } $Collector->finalize(false); define('SKIP_NO_CACHE_HEADERS', 1);