diff options
author | git-marijus <mario@mariovavti.com> | 2017-08-01 03:38:41 +0200 |
---|---|---|
committer | git-marijus <mario@mariovavti.com> | 2017-08-01 03:38:41 +0200 |
commit | 1f2482f6abf5986ebf4b9ee292ba229a4a3b6797 (patch) | |
tree | c4880c614a2b3cf53d6e71587436efe86abd6174 | |
parent | b66cd8363e19a05853876dd3146dd64bb7e683d2 (diff) | |
download | volse-hubzilla-1f2482f6abf5986ebf4b9ee292ba229a4a3b6797.tar.gz volse-hubzilla-1f2482f6abf5986ebf4b9ee292ba229a4a3b6797.tar.bz2 volse-hubzilla-1f2482f6abf5986ebf4b9ee292ba229a4a3b6797.zip |
correct the logic for configs in app requirement
-rw-r--r-- | Zotlabs/Lib/Apps.php | 31 | ||||
-rw-r--r-- | app/pubstream.apd | 2 |
2 files changed, 26 insertions, 7 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 7287bdd52..1fb841008 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -169,7 +169,15 @@ class Apps { $requires = explode(',',$ret['requires']); foreach($requires as $require) { $require = trim(strtolower($require)); + $config = false; + + if(substr($require, 0, 7) == 'config:') { + $config = true; + $require = ltrim($require, 'config:'); + } + $toggle = (($require[0] == '!') ? 0 : 1); + switch($require) { case 'nologin': if(local_channel()) @@ -192,9 +200,10 @@ class Apps { unset($ret); break; default: - $unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true); - $unset = ((get_config('system', ltrim($require, '!')) == $toggle) ? false : true); - + if($config) + $unset = ((get_config('system', ltrim($require, '!')) == $toggle) ? false : true); + else + $unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true); if($unset) unset($ret); break; @@ -308,9 +317,18 @@ class Apps { if($k === 'requires') { $requires = explode(',',$v); + foreach($requires as $require) { $require = trim(strtolower($require)); + $config = false; + + if(substr($require, 0, 7) == 'config:') { + $config = true; + $require = ltrim($require, 'config:'); + } + $toggle = (($require[0] == '!') ? 0 : 1); + switch($require) { case 'nologin': if(local_channel()) @@ -334,9 +352,10 @@ class Apps { return ''; break; default: - $unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true); - $unset = ((get_config('system', ltrim($require, '!')) == $toggle) ? false : true); - + if($config) + $unset = ((get_config('system', ltrim($require, '!')) == $toggle) ? false : true); + else + $unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true); if($unset) return ''; break; diff --git a/app/pubstream.apd b/app/pubstream.apd index 065be24bc..874e0a6cc 100644 --- a/app/pubstream.apd +++ b/app/pubstream.apd @@ -1,6 +1,6 @@ version: 1 url: $baseurl/pubstream -requires: !disable_discover_tab +requires: config:!disable_discover_tab name: Public Stream photo: icon:globe categories: Social |