From e364a541d4f34fea9cf64e7cf7fda5c572f62e13 Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 24 Jan 2018 22:21:43 +0100 Subject: [PATCH] Whitespace and use ZM_DIR_EXPORT instead of ZM_DIR_TMP --- web/views/archive.php | 59 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/web/views/archive.php b/web/views/archive.php index ce4e1b274..9238a925e 100644 --- a/web/views/archive.php +++ b/web/views/archive.php @@ -18,45 +18,44 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // -if ( !canView( 'Events' ) ) -{ - $view = "error"; - return; +if ( !canView( 'Events' ) ) { + $view = 'error'; + return; } $archivetype = $_REQUEST['type']; if ( $archivetype ) { - switch ($archivetype) { - case "tar": - $mimetype = "gzip"; - $file_ext = "tar.gz"; - break; - case "zip": - $mimetype = "zip"; - $file_ext = "zip"; - break; - default: - $mimetype = NULL; - $file_ext = NULL; - } + switch ($archivetype) { + case 'tar': + $mimetype = 'gzip'; + $file_ext = 'tar.gz'; + break; + case 'zip': + $mimetype = 'zip'; + $file_ext = 'zip'; + break; + default: + $mimetype = NULL; + $file_ext = NULL; + } - if ( $mimetype ) { - $filename = "zmExport.$file_ext"; - $filename_path = ZM_DIR_TEMP."/".$filename; - if ( is_readable($filename_path) ) { - header( "Content-type: application/$mimetype" ); - header( "Content-Disposition: attachment; filename=$filename"); - set_time_limit(0); - readfile( $filename_path ); - } else { - Error("$filename_path does not exist or is not readable."); - } + if ( $mimetype ) { + $filename = "zmExport.$file_ext"; + $filename_path = ZM_DIR_EXPORTS.'/'.$filename; + if ( is_readable($filename_path) ) { + header( "Content-type: application/$mimetype" ); + header( "Content-Disposition: attachment; filename=$filename"); + set_time_limit(0); + readfile( $filename_path ); } 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 { - 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."); } ?>