diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2012-03-19 11:56:02 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2012-03-19 11:56:02 +0100 |
commit | b13ab2b17eb485aec13c7fb1e88e25e1c9901d72 (patch) | |
tree | 58259ba29b5833107b62bf08688eaefefe46cdb9 /lib/files.php | |
parent | 194211500b601d8582fa1e8396fb4c8e4970224d (diff) | |
download | nextcloud-server-b13ab2b17eb485aec13c7fb1e88e25e1c9901d72.tar.gz nextcloud-server-b13ab2b17eb485aec13c7fb1e88e25e1c9901d72.zip |
enable admin to turn off ZIP downloads
user interface offers multi-file/folder downloads only if available
make function name more clear
Diffstat (limited to 'lib/files.php')
-rw-r--r-- | lib/files.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/files.php b/lib/files.php index 50223df1d36..662f0b59724 100644 --- a/lib/files.php +++ b/lib/files.php @@ -59,7 +59,7 @@ class OC_Files { } if(is_array($files)){ - self::checkZipInputSize($dir,$files); + self::validateZipDownload($dir,$files); $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); $zip = new ZipArchive(); @@ -80,7 +80,7 @@ class OC_Files { $zip->close(); set_time_limit($executionTime); }elseif(OC_Filesystem::is_dir($dir.'/'.$files)){ - self::checkZipInputSize($dir,$files); + self::validateZipDownload($dir,$files); $executionTime = intval(ini_get('max_execution_time')); set_time_limit(0); $zip = new ZipArchive(); @@ -223,7 +223,22 @@ class OC_Files { * @param dir $dir * @param files $files */ - static function checkZipInputSize($dir, $files) { + static function validateZipDownload($dir, $files) { + if(!OC_Preferences::getValue('', 'files', 'allowZipDownload', 1)) { + $l = new OC_L10N('files'); + header("HTTP/1.0 409 Conflict"); + $tmpl = new OC_Template( '', 'error', 'user' ); + $errors = array( + array( + 'error' => $l->t('ZIP download is turned off.'), + 'hint' => $l->t('Files need to be downloaded one by one.') . '<br/><a href="javascript:history.back()">' . $l->t('Back to Files') . '</a>', + ) + ); + $tmpl->assign('errors', $errors); + $tmpl->printPage(); + exit; + } + $zipLimit = OC_Preferences::getValue('', 'files', 'maxZipInputSize', OC_Helper::computerFileSize('800 MB')); if($zipLimit > 0) { $totalsize = 0; |