Skip to content

Commit

Permalink
Download Log Fix for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
gjr-osweb committed Dec 4, 2014
1 parent f374c2c commit 71dbd18
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions zp-core/admin-logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,31 @@
}
break;
case 'download_log':
include_once(SERVERPATH . '/' . ZENFOLDER . '/lib-zipStream.php');
$zip = new ZipStream(sanitize($_GET['tab'], 3) . '.zip');
$zip->add_file_from_path(basename($file), $file);
$zip->finish();
$zipname = sanitize($_GET['tab'], 3) . '.zip';
if (class_exists('ZipArchive')) {
$zip = new ZipArchive;
$zip->open($zipname, ZipArchive::CREATE);
$zip->addFile($file, basename($file));
$zip->close();
ob_get_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=" . basename($zipname) . ";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($zipname));
readfile($zipname);
// remove zip file from temp path
unlink($zipname);
exit;
} else {
include_once(SERVERPATH . '/' . ZENFOLDER . '/lib-zipStream.php');
$zip = new ZipStream($zipname);
$zip->add_file_from_path(internalToFilesystem(basename($file)),internalToFilesystem($file));
$zip->finish();
}
break;
}
}
Expand Down

0 comments on commit 71dbd18

Please sign in to comment.