Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit b350869

Browse files
committed
Fix Zip options tweaking, by properly separating zipBrowsingEnabled vs. zipCreationEnabled.
1 parent 49e44e2 commit b350869

File tree

7 files changed

+36
-13
lines changed

7 files changed

+36
-13
lines changed

core/src/core/classes/class.AJXP_Utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ public static function getAjxpMimes($keyword)
557557
} else if ($keyword == "audio") {
558558
return "mp3";
559559
} else if ($keyword == "zip") {
560-
if (ConfService::zipEnabled()) {
560+
if (ConfService::zipBrowsingEnabled()) {
561561
return "zip,ajxp_browsable_archive";
562562
} else {
563563
return "none_allowed";

core/src/core/classes/class.ConfService.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,9 +935,32 @@ public function deleteRepositoryInst($repoId)
935935
*/
936936
public static function zipEnabled()
937937
{
938-
if(ConfService::getCoreConf("DISABLE_ZIP_BROWSING") === true) return false;
939-
return ((function_exists("gzopen") || function_exists("gzopen64"))?true:false);
938+
return (function_exists("gzopen") || function_exists("gzopen64"));
940939
}
940+
941+
/**
942+
* Check if users are allowed to browse ZIP content
943+
* @static
944+
* @return bool
945+
*/
946+
public static function zipBrowsingEnabled()
947+
{
948+
if(!self::zipEnabled()) return false;
949+
return !ConfService::getCoreConf("DISABLE_ZIP_BROWSING");
950+
}
951+
952+
/**
953+
* Check if users are allowed to create ZIP archive
954+
* @static
955+
* @return bool
956+
*/
957+
public static function zipCreationEnabled()
958+
{
959+
if(!self::zipEnabled()) return false;
960+
return ConfService::getCoreConf("ZIP_CREATION");
961+
}
962+
963+
941964
/**
942965
* Get the list of all "conf" messages
943966
* @static

core/src/plugins/access.fs/fsActions.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
<processing>
213213
<clientCallback prepareModal="true"><![CDATA[
214214
var userSelection = ajaxplorer.getUserSelection();
215-
if((userSelection.isUnique() && !userSelection.hasDir()) || (zipEnabled && multipleFilesDownloadEnabled))
215+
if((userSelection.isUnique() && !userSelection.hasDir()) || multipleFilesDownloadEnabled)
216216
{
217217
if(gaTrackEvent){
218218
fileNames = userSelection.getFileNames();
@@ -285,7 +285,7 @@
285285
if(ajaxplorer){
286286
var userSelection = ajaxplorer.getUserSelection();
287287
var action = ajaxplorer.getActionBar().getActionByName("download");
288-
if(zipEnabled && multipleFilesDownloadEnabled){
288+
if(multipleFilesDownloadEnabled){
289289
if(action){
290290
if((userSelection.isUnique() && !userSelection.hasDir()) || userSelection.isEmpty()){
291291
action.setIconSrc('download_manager.png');
@@ -336,7 +336,7 @@
336336
<processing>
337337
<clientCallback prepareModal="true"><![CDATA[
338338
var userSelection = ajaxplorer.getUserSelection();
339-
if((zipEnabled && multipleFilesDownloadEnabled))
339+
if((multipleFilesDownloadEnabled))
340340
{
341341
var loadFunc = function(oForm){
342342
var zipName;
@@ -372,7 +372,7 @@
372372
if(ajaxplorer){
373373
var userSelection = ajaxplorer.getUserSelection();
374374
var action = ajaxplorer.getActionBar().getActionByName("compress");
375-
if(!zipEnabled || !multipleFilesDownloadEnabled){
375+
if(!multipleFilesDownloadEnabled){
376376
if(action){
377377
if(userSelection.isUnique()) action.selectionContext.multipleOnly = true;
378378
else action.selectionContext.unique = true;

core/src/plugins/action.cart/class.CartManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Class.create("CartManager", FetchedResultPane, {
129129

130130
var h = this.getLocalSelectionForPosting();
131131
if(h.size() == 0) return;
132-
if((zipEnabled && multipleFilesDownloadEnabled))
132+
if((window.multipleFilesDownloadEnabled))
133133
{
134134

135135
var zipName = window.prompt(MessageHash['action.cart.14'], this.__label);

core/src/plugins/action.powerfs/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<processing>
4242
<clientCallback prepareModal="true"><![CDATA[
4343
var userSelection = ajaxplorer.getUserSelection();
44-
if((userSelection.isUnique() && !userSelection.hasDir()) || (zipEnabled && multipleFilesDownloadEnabled))
44+
if((userSelection.isUnique() && !userSelection.hasDir()) || multipleFilesDownloadEnabled)
4545
{
4646
if(gaTrackEvent){
4747
fileNames = userSelection.getFileNames();

core/src/plugins/core.ajaxplorer/manifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
<global_param name="CLI_PHP" group="CONF_MESSAGE[Command Line]" type="string" label="CONF_MESSAGE[Command-line PHP]" description="CONF_MESSAGE[On specific hosts, you may have to use a specific path to access the php command line]" mandatory="false" default="php"/>
3232
<global_param name="CLI_USE_COM" group="CONF_MESSAGE[Command Line]" type="boolean" label="CONF_MESSAGE[Use COM class]" description="CONF_MESSAGE[On Windows running IIS, set this option to true if the COM extension is loaded, this may enable the use of the php command line.]" mandatory="false" default="false"/>
3333
<global_param name="DISABLE_ZIP_BROWSING" group="CONF_MESSAGE[Compression Features]" type="boolean" label="CONF_MESSAGE[Disable Zip browsing]" description="CONF_MESSAGE[Disable Zip files inline browsing. This can be necessary if you always store huge zip archives: it can have some impact on performance.]" mandatory="false" default="false"/>
34-
<global_param name="GZIP_COMPRESSION" group="CONF_MESSAGE[Compression Features]" type="boolean" label="CONF_MESSAGE[Gzip Download]" description="CONF_MESSAGE[Gzip files on-the-fly before downloading. Disabled by default, as it's generally useful only on small files, and decreases performances on big files. This has nothing to see with the Zip Creation feature, it's just a on-the-fly compression applied on a unique file at download.]" mandatory="false" default="false"/>
35-
<global_param name="GZIP_LIMIT" group="CONF_MESSAGE[Compression Features]" type="string" label="CONF_MESSAGE[Gzip Limit]" description="CONF_MESSAGE[If activated, a default limit should be set above when files are no more compressed.]" mandatory="false" default="1048576"/>
3634
<global_param name="ZIP_CREATION" expose="true" group="CONF_MESSAGE[Compression Features]" type="boolean" label="CONF_MESSAGE[Zip Creation]" description="CONF_MESSAGE[If you encounter problems with online zip creation or multiple files downloading, you can disable the feature.]" mandatory="false" default="true"/>
3735
<global_param name="ZIP_ENCODING" expose="false" group="CONF_MESSAGE[Compression Features]" type="string" label="CONF_MESSAGE[Zip Encoding]" description="CONF_MESSAGE[Set up a specific encoding (try IBM850 or CP437) for filenames to fix characters problems during Zip creation. This may create OS-incompatible archives (Win/Mac).]" mandatory="false"/>
36+
<global_param name="GZIP_COMPRESSION" group="CONF_MESSAGE[Compression Features]" type="boolean" label="CONF_MESSAGE[Gzip Download]" description="CONF_MESSAGE[Gzip files on-the-fly before downloading. Disabled by default, as it's generally useful only on small files, and decreases performances on big files. This has nothing to see with the Zip Creation feature, it's just a on-the-fly compression applied on a unique file at download.]" mandatory="false" default="false"/>
37+
<global_param name="GZIP_LIMIT" group="CONF_MESSAGE[Compression Features]" type="string" label="CONF_MESSAGE[Gzip Limit]" description="CONF_MESSAGE[If activated, a default limit should be set above when files are no more compressed.]" mandatory="false" default="1048576"/>
3838
<global_param name="SKIP_ADMIN_RIGHTS_ALL_REPOS" expose="false" group="CONF_MESSAGE[Miscellaneous]" type="boolean" label="CONF_MESSAGE[Skip auto-update admin rights]" description="CONF_MESSAGE[If you have tons of workspaces (which is not recommanded), admin users login can take a long time while updating admin access to all repositories. Use this option to disable this step, admin will always have access to the Settings.]" mandatory="false" default="false"/>
3939
<global_param name="NODENAME_MAX_LENGTH" expose="true" group="CONF_MESSAGE[Miscellaneous]" type="integer" label="CONF_MESSAGE[Filename length]" description="CONF_MESSAGE[Maximum characters length of new files or folders]" mandatory="false" default="255"/>
4040
<global_param name="AJXP_TMP_DIR" group="CONF_MESSAGE[Miscellaneous]" type="string" label="CONF_MESSAGE[Temporary Folder]" description="CONF_MESSAGE[This is necessary only if you have errors concerning the tmp dir access or writeability : most probably, they are due to PHP SAFE MODE (should disappear in php6) or various OPEN_BASEDIR restrictions. In that case, create and set writeable a tmp folder somewhere at the root of your hosting (but above the web/ or www/ or http/ if possible!!) and enter here the full path to this folder]" mandatory="false" default=""/>

core/src/plugins/gui.ajax/class.AJXP_ClientDriver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ public function computeBootConf()
271271
} else {
272272
$config["ajxpServerAccess"] = AJXP_SERVER_ACCESS;
273273
}
274-
$config["zipEnabled"] = ConfService::zipEnabled();
275-
$config["multipleFilesDownloadEnabled"] = ConfService::getCoreConf("ZIP_CREATION");
274+
$config["zipEnabled"] = ConfService::zipBrowsingEnabled();
275+
$config["multipleFilesDownloadEnabled"] = ConfService::zipCreationEnabled();
276276
$customIcon = $this->getFilteredOption("CUSTOM_ICON");
277277
self::filterXml($customIcon);
278278
$config["customWording"] = array(

0 commit comments

Comments
 (0)