static function exec(array $files, $name = null) { if (!extension_loaded('zip')) { exit('Zip Extension no loaded.'); } if ($name !== null) { self::$filename = $name; } self::doZip($files); }
$DB->query("SELECT DATE_FORMAT(t.Time,'%b \'%y') AS Month, t.GroupID, t.Media, t.Format, t.Encoding, IF(t.RemasterYear=0,tg.Year,t.RemasterYear), tg.Name, t.Size, f.File FROM torrents as t JOIN torrents_group AS tg ON t.GroupID=tg.ID LEFT JOIN torrents_files AS f ON t.ID=f.TorrentID ".$SQL); $Downloads = $DB->to_array(false,MYSQLI_NUM,false); $Artists = get_artists($DB->collect('GroupID')); list($UserID, $Username) = array_values(user_info($UserID)); $Zip = new ZIP($Username.'\'s '.ucfirst($_GET['type'])); foreach($Downloads as $Download) { list($Month, $GroupID, $Media, $Format, $Encoding, $Year, $Album, $Size, $Contents) = $Download; $Artist = display_artists($Artists[$GroupID],false); $Contents = unserialize(base64_decode($Contents)); $Tor = new TORRENT($Contents, true); $Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce'); unset($Tor->Val['announce-list']); $Zip->add_file($Tor->enc(), file_string($Month).'/'.file_string($Artist.$Album).' - '.file_string($Year).' ('.file_string($Media).' - '.file_string($Format).' - '.file_string($Encoding).').torrent'); } $Zip->close_stream();