--- db/prgsrc/drupal/modules/chgk_db/chgk_db.module 2010/03/21 18:06:04 1.4 +++ db/prgsrc/drupal/modules/chgk_db/chgk_db.module 2010/04/24 18:04:15 1.5 @@ -104,9 +104,20 @@ function chgk_db_fb2($string) { $tournament = DbPackage::newFromDb($string); $tournament->getAll(); $xml = theme('chgk_db_fb2', $tournament); - header("Content-Type: application/octet-stream"); - header("Content-Disposition: attachment; filename=\"$string.fb2\"\n"); - print $xml;; + $filename = "$string.fb2"; + $zipname = $filename.".zip"; + + header("Content-Type: application/octet-stream\n"); + header("Content-Type: application/force-download\n"); + header("Content-Type: application/download\n"); + header("Content-Type: application/x-zip-compressed; name=$filename\n"); + header("Content-Disposition: attachment; filename=$filename.zip \n"); + chdir(file_directory_temp()); + $f = fopen ($filename, "w"); + fputs($f, $xml); + fclose($f); + system("zip $zipname $filename>/dev/null"); + print passthru("cat $zipname"); exit; #print $tournament->getFb2(); }