query("SELECT t.ID AS TorrentID, DATE_FORMAT(".$Month.",'%Y - %m') AS Month, t.GroupID, t.Media, t.Format, t.Encoding, IF(t.RemasterYear=0,tg.Year,t.RemasterYear) AS 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); $TorrentFilesQ = $DB->query("SELECT TorrentID, File FROM torrents_files WHERE TorrentID IN (".implode(',', $TorrentIDs).")", false); if (is_int($TorrentFilesQ)) { // Query failed. Let's not create a broken zip archive foreach ($TorrentIDs as $TorrentID) { $Download =& $Downloads[$TorrentID]; $Download['Artist'] = Artists::display_artists($Artists[$Download['GroupID']], false, true, false); $Collector->fail_file($Download); } continue; } while (list($TorrentID, $TorrentFile) = $DB->next_record(MYSQLI_NUM, false)) { $Download =& $Downloads[$TorrentID]; $Download['Artist'] = Artists::display_artists($Artists[$Download['GroupID']], false, true, false); $Collector->add_file($TorrentFile, $Download, $Download['Month']); unset($Download); } } $Collector->finalize(false); define('IE_WORKAROUND_NO_CACHE_HEADERS', 1);