diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/apps.php | 113 |
1 files changed, 59 insertions, 54 deletions
diff --git a/include/apps.php b/include/apps.php index 9c4fe826a..e08e6a6f5 100644 --- a/include/apps.php +++ b/include/apps.php @@ -83,35 +83,37 @@ function parse_app_description($f) { $ret['target'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['target']); if(array_key_exists('requires',$ret)) { - $require = trim(strtolower($ret['requires'])); - switch($require) { - case 'nologin': - if(local_user()) - unset($ret); - break; - case 'admin': - if(! is_site_admin()) - unset($ret); - break; - case 'local_user': - if(! local_user()) - unset($ret); - break; - case 'public_profile': - if(! is_public_profile()) - unset($ret); - break; - case 'observer': - if(! $observer) - unset($ret); - break; - default: - if(! local_user() && feature_enabled(local_user(),$require)) - unset($ret); - break; + $requires = explode(',',$ret['requires']); + foreach($requires as $require) { + $require = trim(strtolower($require)); + switch($require) { + case 'nologin': + if(local_user()) + unset($ret); + break; + case 'admin': + if(! is_site_admin()) + unset($ret); + break; + case 'local_user': + if(! local_user()) + unset($ret); + break; + case 'public_profile': + if(! is_public_profile()) + unset($ret); + break; + case 'observer': + if(! $observer) + unset($ret); + break; + default: + if(! (local_user() && feature_enabled(local_user(),$require))) + unset($ret); + break; + } } -// logger('require: ' . print_r($ret,true)); } if($ret) { translate_system_apps($ret); @@ -189,34 +191,37 @@ function app_render($papp,$mode = 'view') { $papp['desc'] = str_replace(array('\'','"'),array(''','&dquot;'),$papp['desc']); if($k === 'requires') { - $require = trim(strtolower($v)); - switch($require) { - case 'nologin': - if(local_user()) - return ''; - break; - case 'admin': - if(! is_site_admin()) - return ''; - break; - case 'local_user': - if(! local_user()) - return ''; - break; - case 'public_profile': - if(! is_public_profile()) - return ''; - break; - case 'observer': - $observer = get_app()->get_observer(); - if(! $observer) - return ''; - break; - default: - if(! local_user() && feature_enabled(local_user(),$require)) - return ''; - break; + $requires = explode(',',$v); + foreach($requires as $require) { + $require = trim(strtolower($require)); + switch($require) { + case 'nologin': + if(local_user()) + return ''; + break; + case 'admin': + if(! is_site_admin()) + return ''; + break; + case 'local_user': + if(! local_user()) + return ''; + break; + case 'public_profile': + if(! is_public_profile()) + return ''; + break; + case 'observer': + $observer = get_app()->get_observer(); + if(! $observer) + return ''; + break; + default: + if(! (local_user() && feature_enabled(local_user(),$require))) + return ''; + break; + } } } |