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

Commit

Permalink
Fix Zip options tweaking, by properly separating zipBrowsingEnabled v…
Browse files Browse the repository at this point in the history
…s. zipCreationEnabled.
  • Loading branch information
cdujeu committed May 5, 2015
1 parent 49e44e2 commit b350869
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion core/src/core/classes/class.AJXP_Utils.php
Expand Up @@ -557,7 +557,7 @@ public static function getAjxpMimes($keyword)
} else if ($keyword == "audio") {
return "mp3";
} else if ($keyword == "zip") {
if (ConfService::zipEnabled()) {
if (ConfService::zipBrowsingEnabled()) {
return "zip,ajxp_browsable_archive";
} else {
return "none_allowed";
Expand Down
27 changes: 25 additions & 2 deletions core/src/core/classes/class.ConfService.php
Expand Up @@ -935,9 +935,32 @@ public function deleteRepositoryInst($repoId)
*/
public static function zipEnabled()
{
if(ConfService::getCoreConf("DISABLE_ZIP_BROWSING") === true) return false;
return ((function_exists("gzopen") || function_exists("gzopen64"))?true:false);
return (function_exists("gzopen") || function_exists("gzopen64"));
}

/**
* Check if users are allowed to browse ZIP content
* @static
* @return bool
*/
public static function zipBrowsingEnabled()
{
if(!self::zipEnabled()) return false;
return !ConfService::getCoreConf("DISABLE_ZIP_BROWSING");
}

/**
* Check if users are allowed to create ZIP archive
* @static
* @return bool
*/
public static function zipCreationEnabled()
{
if(!self::zipEnabled()) return false;
return ConfService::getCoreConf("ZIP_CREATION");
}


/**
* Get the list of all "conf" messages
* @static
Expand Down
8 changes: 4 additions & 4 deletions core/src/plugins/access.fs/fsActions.xml
Expand Up @@ -212,7 +212,7 @@
<processing>
<clientCallback prepareModal="true"><![CDATA[
var userSelection = ajaxplorer.getUserSelection();
if((userSelection.isUnique() && !userSelection.hasDir()) || (zipEnabled && multipleFilesDownloadEnabled))
if((userSelection.isUnique() && !userSelection.hasDir()) || multipleFilesDownloadEnabled)
{
if(gaTrackEvent){
fileNames = userSelection.getFileNames();
Expand Down Expand Up @@ -285,7 +285,7 @@
if(ajaxplorer){
var userSelection = ajaxplorer.getUserSelection();
var action = ajaxplorer.getActionBar().getActionByName("download");
if(zipEnabled && multipleFilesDownloadEnabled){
if(multipleFilesDownloadEnabled){
if(action){
if((userSelection.isUnique() && !userSelection.hasDir()) || userSelection.isEmpty()){
action.setIconSrc('download_manager.png');
Expand Down Expand Up @@ -336,7 +336,7 @@
<processing>
<clientCallback prepareModal="true"><![CDATA[
var userSelection = ajaxplorer.getUserSelection();
if((zipEnabled && multipleFilesDownloadEnabled))
if((multipleFilesDownloadEnabled))
{
var loadFunc = function(oForm){
var zipName;
Expand Down Expand Up @@ -372,7 +372,7 @@
if(ajaxplorer){
var userSelection = ajaxplorer.getUserSelection();
var action = ajaxplorer.getActionBar().getActionByName("compress");
if(!zipEnabled || !multipleFilesDownloadEnabled){
if(!multipleFilesDownloadEnabled){
if(action){
if(userSelection.isUnique()) action.selectionContext.multipleOnly = true;
else action.selectionContext.unique = true;
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/action.cart/class.CartManager.js
Expand Up @@ -129,7 +129,7 @@ Class.create("CartManager", FetchedResultPane, {

var h = this.getLocalSelectionForPosting();
if(h.size() == 0) return;
if((zipEnabled && multipleFilesDownloadEnabled))
if((window.multipleFilesDownloadEnabled))
{

var zipName = window.prompt(MessageHash['action.cart.14'], this.__label);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/action.powerfs/manifest.xml
Expand Up @@ -41,7 +41,7 @@
<processing>
<clientCallback prepareModal="true"><![CDATA[
var userSelection = ajaxplorer.getUserSelection();
if((userSelection.isUnique() && !userSelection.hasDir()) || (zipEnabled && multipleFilesDownloadEnabled))
if((userSelection.isUnique() && !userSelection.hasDir()) || multipleFilesDownloadEnabled)
{
if(gaTrackEvent){
fileNames = userSelection.getFileNames();
Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/core.ajaxplorer/manifest.xml
Expand Up @@ -31,10 +31,10 @@
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
<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=""/>
Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/gui.ajax/class.AJXP_ClientDriver.php
Expand Up @@ -271,8 +271,8 @@ public function computeBootConf()
} else {
$config["ajxpServerAccess"] = AJXP_SERVER_ACCESS;
}
$config["zipEnabled"] = ConfService::zipEnabled();
$config["multipleFilesDownloadEnabled"] = ConfService::getCoreConf("ZIP_CREATION");
$config["zipEnabled"] = ConfService::zipBrowsingEnabled();
$config["multipleFilesDownloadEnabled"] = ConfService::zipCreationEnabled();
$customIcon = $this->getFilteredOption("CUSTOM_ICON");
self::filterXml($customIcon);
$config["customWording"] = array(
Expand Down

0 comments on commit b350869

Please sign in to comment.