status != 'disabled') { $total_size += sprintf("%.2f",($song->size/1048576)); array_push( $song_files, $song->file ); } // if song isn't disabled } return array($song_files,$total_size); } //get_song_files /** * send_zip * takes array of full paths to songs * zips them and sends them * @param $name name of the zip file to be created * @param $song_files array of full paths to songs to zip create w/ call to get_song_files */ function send_zip( $name, $song_files ) { /* Require needed library */ require_once Config::get('prefix') . '/modules/archive/archive.lib.php'; $arc = new zip_file( $name . ".zip" ); $options = array( 'inmemory' => 1, // create archive in memory 'storepaths' => 0, // only store file name, not full path 'level' => 0 // no compression ); $arc->set_options( $options ); $arc->add_files( $song_files ); if (count($arc->error)) { debug_event('archive',"Error: unable to add songs",'3'); } // if failed to add songs if (!$arc->create_archive()) { debug_event('archive',"Error: unable to create archive",'3'); } // if failed to create archive $arc->download_file(); } // send_zip ?>