Whitespace and use ZM_DIR_EXPORT instead of ZM_DIR_TMP
This commit is contained in:
parent
fd2d2a0d77
commit
e364a541d4
|
@ -18,45 +18,44 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( !canView( 'Events' ) )
|
if ( !canView( 'Events' ) ) {
|
||||||
{
|
$view = 'error';
|
||||||
$view = "error";
|
return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$archivetype = $_REQUEST['type'];
|
$archivetype = $_REQUEST['type'];
|
||||||
|
|
||||||
if ( $archivetype ) {
|
if ( $archivetype ) {
|
||||||
switch ($archivetype) {
|
switch ($archivetype) {
|
||||||
case "tar":
|
case 'tar':
|
||||||
$mimetype = "gzip";
|
$mimetype = 'gzip';
|
||||||
$file_ext = "tar.gz";
|
$file_ext = 'tar.gz';
|
||||||
break;
|
break;
|
||||||
case "zip":
|
case 'zip':
|
||||||
$mimetype = "zip";
|
$mimetype = 'zip';
|
||||||
$file_ext = "zip";
|
$file_ext = 'zip';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$mimetype = NULL;
|
$mimetype = NULL;
|
||||||
$file_ext = NULL;
|
$file_ext = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $mimetype ) {
|
if ( $mimetype ) {
|
||||||
$filename = "zmExport.$file_ext";
|
$filename = "zmExport.$file_ext";
|
||||||
$filename_path = ZM_DIR_TEMP."/".$filename;
|
$filename_path = ZM_DIR_EXPORTS.'/'.$filename;
|
||||||
if ( is_readable($filename_path) ) {
|
if ( is_readable($filename_path) ) {
|
||||||
header( "Content-type: application/$mimetype" );
|
header( "Content-type: application/$mimetype" );
|
||||||
header( "Content-Disposition: attachment; filename=$filename");
|
header( "Content-Disposition: attachment; filename=$filename");
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
readfile( $filename_path );
|
readfile( $filename_path );
|
||||||
} else {
|
|
||||||
Error("$filename_path does not exist or is not readable.");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Error("Unsupported archive type specified. Supported archives are tar and zip");
|
Error("$filename_path does not exist or is not readable.");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Error("Unsupported archive type specified. Supported archives are tar and zip");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Error("No archive type given to archive.php. Please specify a tar or zip archive.");
|
Error("No archive type given to archive.php. Please specify a tar or zip archive.");
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue