Solving the "Disallow public access to addons listed in the apps menu" has no effect bug

Adding plugin_is_app function in include/plugin.php for checking if a plugin is an app or not (checking the existence of an 'app_menu' hook)

Populating the app menu conditionaly ( is the user logged or not, are apps private ) and dissalowing apps running if apps are private and the user not logged
This commit is contained in:
Zered 2013-07-24 03:45:22 +02:00
parent 7f36a6fcbd
commit a6fae9a0db
2 changed files with 34 additions and 6 deletions

View file

@ -185,6 +185,21 @@ function call_hooks($name, &$data = null) {
}
}}
//check if an app_menu hook exist for plugin $name.
//Return true if the plugin is an app
if(! function_exists('plugin_is_app')) {
function plugin_is_app($name) {
$a = get_app();
if(is_array($a->hooks) && (array_key_exists('app_menu',$a->hooks))) {
foreach($a->hooks['app_menu'] as $hook) {
if($hook[0] == 'addon/'.$name.'/'.$name.'.php')
return true;
}
}
return false;
}}
/*
* parse plugin comment in search of plugin infos.