]> source.dussan.org Git - nextcloud-server.git/commitdiff
drop allowZIPdownload and maxZIPSize as options
authorMorris Jobke <morris.jobke@gmail.com>
Mon, 2 Jun 2014 14:29:03 +0000 (16:29 +0200)
committerMorris Jobke <morris.jobke@gmail.com>
Mon, 2 Jun 2014 14:29:03 +0000 (16:29 +0200)
apps/files/admin.php
apps/files/appinfo/update.php [new file with mode: 0644]
apps/files/index.php
apps/files/js/admin.js
apps/files/js/fileactions.js
apps/files/list.php
apps/files/templates/admin.php
apps/files/templates/list.php
apps/files_sharing/public.php
apps/files_sharing/templates/public.php
lib/private/files.php

index 02c3147dba58cbe5bc17b13a63bd1da339e0b510..bf12af74105372b4992c9a96111190d568656f8c 100644 (file)
@@ -34,17 +34,7 @@ if($_POST && OC_Util::isCallRegistered()) {
                        $maxUploadFilesize = OCP\Util::humanFileSize($setMaxSize);
                }
        }
-       if(isset($_POST['maxZipInputSize'])) {
-               $maxZipInputSize=$_POST['maxZipInputSize'];
-               OCP\Config::setSystemValue('maxZipInputSize', OCP\Util::computerFileSize($maxZipInputSize));
-       }
-       if(isset($_POST['submitFilesAdminSettings'])) {
-               OCP\Config::setSystemValue('allowZipDownload', isset($_POST['allowZipDownload']));
-       }
 }
-$maxZipInputSizeDefault = OCP\Util::computerFileSize('800 MB');
-$maxZipInputSize = OCP\Util::humanFileSize(OCP\Config::getSystemValue('maxZipInputSize', $maxZipInputSizeDefault));
-$allowZipDownload = intval(OCP\Config::getSystemValue('allowZipDownload', true));
 
 OCP\App::setActiveNavigationEntry( "files_administration" );
 
@@ -56,6 +46,4 @@ $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize);
 // max possible makes only sense on a 32 bit system
 $tmpl->assign( 'displayMaxPossibleUploadSize', PHP_INT_SIZE===4);
 $tmpl->assign( 'maxPossibleUploadSize', OCP\Util::humanFileSize(PHP_INT_MAX));
-$tmpl->assign( 'allowZipDownload', $allowZipDownload);
-$tmpl->assign( 'maxZipInputSize', $maxZipInputSize);
 return $tmpl->fetchPage();
diff --git a/apps/files/appinfo/update.php b/apps/files/appinfo/update.php
new file mode 100644 (file)
index 0000000..5f054f2
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+// this drops the keys below, because they aren't needed anymore
+// core related
+if (version_compare(\OC_Config::getValue('version', '0.0.0'), '7.0.0', '<')) {
+       \OC_Config::deleteKey('allowZipDownload');
+       \OC_Config::deleteKey('maxZipInputSize');
+}
index 95ae7977eccf1ff125a5b56b430d468c6134a3b6..ba46866ab19af11690d09d2a84faa2e2aaedca51 100644 (file)
@@ -123,6 +123,5 @@ $tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow
 $tmpl->assign("encryptionInitStatus", $encryptionInitStatus);
 $tmpl->assign('appNavigation', $nav);
 $tmpl->assign('appContents', $contentItems);
-$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
 
 $tmpl->printPage();
index 842b73c0caefa5b4d319aa83747909dc802ba5e9..dcfec824cfe08473761f93d900dfc675222826d7 100644 (file)
@@ -25,12 +25,4 @@ $(document).ready(function() {
                // To get rid of onClick()
                switchPublicFolder();
        });
-
-       $('#allowZipDownload').bind('change', function() {
-               if($('#allowZipDownload').attr('checked')) {
-                       $('#maxZipInputSize').removeAttr('disabled');
-               } else {
-                       $('#maxZipInputSize').attr('disabled', 'disabled');
-               }
-       });
 });
index 3df62f37518c68dd1f9d73202e7299d4f8ebc7e8..de02bf5e730c6d0efb8d4b65414ace6fd6c9ef3a 100644 (file)
                        });
 
                        this.setDefault('dir', 'Open');
-                       var downloadScope;
-                       if ($('#allowZipDownload').val() == 1) {
-                               downloadScope = 'all';
-                       } else {
-                               downloadScope = 'file';
-                       }
 
-                       this.register(downloadScope, 'Download', OC.PERMISSION_READ, function () {
+                       this.register('all', 'Download', OC.PERMISSION_READ, function () {
                                return OC.imagePath('core', 'actions/download');
                        }, function (filename, context) {
                                var dir = context.dir || context.fileList.getCurrentDirectory();
index e583839b2519449f3e1e366ec1b98fd18da8cec7..5ecbd1c7fa09349b14c47698ee9d3d2f6d7df440 100644 (file)
@@ -33,6 +33,5 @@ $uploadLimit=OCP\Util::uploadLimit();
 $tmpl = new OCP\Template('files', 'list', '');
 $tmpl->assign('uploadLimit', $uploadLimit); // PHP upload limit
 $tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
-$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
 $tmpl->printPage();
 
index 5f7d3261d6c1a5dd2e6b16f347a2493f3e072a06..a75f0c94878093824df5b7f64987cd5d231afd5e 100644 (file)
                <?php endif;?>
                <br/>
        <?php endif;?>
-       <input type="checkbox" name="allowZipDownload" id="allowZipDownload" value="1"
-                  title="<?php p($l->t( 'Needed for multi-file and folder downloads.' )); ?>"
-                  <?php if ($_['allowZipDownload']): ?> checked="checked"<?php endif; ?> />
-       <label for="allowZipDownload"><?php p($l->t( 'Enable ZIP-download' )); ?></label><br/>
-
-       <input type="text" name="maxZipInputSize" id="maxZipInputSize" style="width:180px;" value='<?php p($_['maxZipInputSize']) ?>'
-                  title="<?php p($l->t( '0 is unlimited' )); ?>"
-                  <?php if (!$_['allowZipDownload']): ?> disabled="disabled"<?php endif; ?> /><br />
-       <em><?php p($l->t( 'Maximum input size for ZIP files' )); ?> </em><br />
-
        <input type="hidden" value="<?php p($_['requesttoken']); ?>" name="requesttoken" />
        <input type="submit" name="submitFilesAdminSettings" id="submitFilesAdminSettings"
                   value="<?php p($l->t( 'Save' )); ?>"/>
index 17bf3b3de837e4d8df0727970dd558dd936b902a..eddcd9f62360d950914bad5f5630bb3e058e2484 100644 (file)
                                        <label for="select_all_files"></label>
                                        <a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a>
                                        <span id="selectedActionsList" class="selectedActions">
-                                               <?php if($_['allowZipDownload']) : ?>
-                                                       <a href="" class="download">
-                                                               <img class="svg" alt="Download"
-                                                                        src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>" />
-                                                               <?php p($l->t('Download'))?>
-                                                       </a>
-                                               <?php endif; ?>
+                                               <a href="" class="download">
+                                                       <img class="svg" alt="Download"
+                                                                src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>" />
+                                                       <?php p($l->t('Download'))?>
+                                               </a>
                                        </span>
                                </div>
                        </th>
@@ -89,7 +87,6 @@
        <tfoot>
        </tfoot>
 </table>
-<input type="hidden" name="allowZipDownload" id="allowZipDownload" value="<?php p($_['allowZipDownload']); ?>" />
 <input type="hidden" name="dir" id="dir" value="" />
 <div id="editor"></div><!-- FIXME Do not use this div in your app! It is deprecated and will be removed in the future! -->
 <div id="uploadsize-message" title="<?php p($l->t('Upload too large'))?>">
index 8a86cb3806a6f2c29ca3017ca93ae9fc6e621bea..4782c4dbe324f1b135d43d7d5aea22b1e051dfbf 100644 (file)
@@ -160,17 +160,12 @@ if (isset($path)) {
                        $folder->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
                        $folder->assign('freeSpace', $freeSpace);
                        $folder->assign('uploadLimit', $uploadLimit); // PHP upload limit
-                       $folder->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
                        $folder->assign('usedSpacePercent', 0);
                        $folder->assign('trash', false);
                        $tmpl->assign('folder', $folder->fetchPage());
-                       $allowZip = OCP\Config::getSystemValue('allowZipDownload', true);
-                       $tmpl->assign('allowZipDownload', intval($allowZip));
-                       $tmpl->assign('showDownloadButton', intval($allowZip));
                        $tmpl->assign('downloadURL',
                                OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath));
                } else {
-                       $tmpl->assign('showDownloadButton', true);
                        $tmpl->assign('dir', $dir);
 
                        // Show file preview if viewer is available
index 234b6d098387bca9f88d87408256e0371c7696a2..7b5f603a1053387a2c3b11a325874c498c028712 100644 (file)
                                                                                                          src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="<?php p($theme->getName()); ?>" /></a>
                <div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div>
                <div class="header-right">
-                       <?php if ($_['showDownloadButton']): ?>
                        <a href="<?php p($_['downloadURL']); ?>" id="download" class="button">
                                <img class="svg" alt="" src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>"/>
                                <?php p($l->t('Download'))?>
                        </a>
-                       <?php endif ?>
                </div>
 </div></header>
 <div id="content">
index 7c437a16a98aa831c3507579bf17e26e8396e0c0..739dae6418005f0fbd127cda4515da70cac91b5b 100644 (file)
@@ -108,7 +108,6 @@ class OC_Files {
                                $xsendfile = false;
                        }
                } else {
-                       self::validateZipDownload($dir, $files);
                        $zip = new ZipStreamer(false);
                }
                OC_Util::obEnd();
@@ -221,53 +220,6 @@ class OC_Files {
                }
        }
 
-       /**
-        * checks if the selected files are within the size constraint. If not, outputs an error page.
-        *
-        * @param string $dir
-        * @param array|string $files
-        */
-       static function validateZipDownload($dir, $files) {
-               if (!OC_Config::getValue('allowZipDownload', true)) {
-                       $l = OC_L10N::get('lib');
-                       header("HTTP/1.0 409 Conflict");
-                       OC_Template::printErrorPage(
-                                       $l->t('ZIP download is turned off.'),
-                                       $l->t('Files need to be downloaded one by one.')
-                                               . '<br/><a href="'.OCP\Util::linkTo('files', 'index.php', array('dir' => $dir)).'">' . $l->t('Back to Files') . '</a>'
-                       );
-                       exit;
-               }
-
-               $zipLimit = OC_Config::getValue('maxZipInputSize', OC_Helper::computerFileSize('800 MB'));
-               if ($zipLimit > 0) {
-                       $totalsize = 0;
-                       if(!is_array($files)) {
-                               $files = array($files);
-                       }
-                       foreach ($files as $file) {
-                               $path = $dir . '/' . $file;
-                               if(\OC\Files\Filesystem::is_dir($path)) {
-                                       foreach (\OC\Files\Filesystem::getDirectoryContent($path) as $i) {
-                                               $totalsize += $i['size'];
-                                       }
-                               } else {
-                                       $totalsize += \OC\Files\Filesystem::filesize($path);
-                               }
-                       }
-                       if ($totalsize > $zipLimit) {
-                               $l = OC_L10N::get('lib');
-                               header("HTTP/1.0 409 Conflict");
-                               OC_Template::printErrorPage(
-                                               $l->t('Selected files too large to generate zip file.'),
-                                               $l->t('Please download the files separately in smaller chunks or kindly ask your administrator.')
-                                               . '<br/><a href="'.OCP\Util::linkTo('files', 'index.php', array('dir' => $dir)).'">' . $l->t('Back to Files') . '</a>'
-                               );
-                               exit;
-                       }
-               }
-       }
-
        /**
         * set the maximum upload size limit for apache hosts using .htaccess
         *