"fixed not always executed hooks for disabled applications (using app-names from existing hooks now, instead of egw_info[apps])"

This commit is contained in:
Ralf Becker 2009-05-26 11:55:52 +00:00
parent 39903fc957
commit 07825af683

View File

@ -48,7 +48,7 @@ class hooks
* *
* @param object $db=null database class, if null we use $GLOBALS['egw']->db * @param object $db=null database class, if null we use $GLOBALS['egw']->db
*/ */
function hooks($db=null) function __construct($db=null)
{ {
$this->db = $db ? $db : $GLOBALS['egw']->db; // this is to allow setup to set the db $this->db = $db ? $db : $GLOBALS['egw']->db; // this is to allow setup to set the db
@ -95,16 +95,14 @@ class hooks
/* Then add the rest */ /* Then add the rest */
if ($no_permission_check) if ($no_permission_check)
{ {
$apps = $GLOBALS['egw_info']['apps']; $apps = array_keys($this->found_hooks);
} }
else elseif(is_array($GLOBALS['egw_info']['user']['apps']))
{ {
$apps = $GLOBALS['egw_info']['user']['apps']; $apps = array_keys($GLOBALS['egw_info']['user']['apps']);
} }
settype($apps,'array'); foreach((array)$apps as $appname)
foreach($apps as $app)
{ {
$appname = $app['name'];
if (!isset($results[$appname])) if (!isset($results[$appname]))
{ {
$results[$appname] = $this->single($args,$appname,$no_permission_check); $results[$appname] = $this->single($args,$appname,$no_permission_check);
@ -203,7 +201,7 @@ class hooks
{ {
//if (!is_array($this->found_hooks)) //if (!is_array($this->found_hooks))
//{ //{
$this->hooks(); $this->__construct();
//} //}
return $this->found_hooks; return $this->found_hooks;
} }