Switch to local hook function to avoid catch_22/chicken-egg/cart-horse situation

This commit is contained in:
Miles Lott 2002-01-05 23:50:18 +00:00
parent a012283ba5
commit 0740e85b12
2 changed files with 27 additions and 3 deletions

View File

@ -158,12 +158,10 @@
var $accounts;
var $applications;
var $db;
var $hooks;
}
$GLOBALS['phpgw'] = new phpgw;
$GLOBALS['phpgw']->common = CreateObject('phpgwapi.common');
$GLOBALS['phpgw']->db = $phpgw_setup->db;
$GLOBALS['phpgw']->hooks = CreateObject('phpgwapi.hooks');
$cfg_apps = array('phpgwapi','admin','preferences');
while(list(,$cfg_app) = each($cfg_apps))
@ -179,7 +177,7 @@
$t->set_var('row_off', 'EEEEEE');
$vars = $t->get_undefined('body');
$GLOBALS['phpgw']->hooks->single('config',$cfg_app);
$phpgw_setup->hook('config',$cfg_app);
while (list($null,$value) = each($vars))
{

View File

@ -532,6 +532,32 @@
}
/*!
@function hook
@abstract call the hooks for a single application
@param $location hook location - required
@param $appname application name - optional
*/
function hook($location, $appname = '')
{
if (! $appname)
{
$appname = $GLOBALS['phpgw_info']['flags']['currentapp'];
}
$SEP = filesystem_separator();
$f = PHPGW_SERVER_ROOT . $SEP . $appname . $SEP . 'inc' . $SEP . 'hook_' . $location . '.inc.php';
if (file_exists($f))
{
include($f);
return True;
}
else
{
return False;
}
}
/*
@function alessthanb
@abstract phpgw version checking, is param 1 < param 2 in phpgw versionspeak?
@param $a phpgw version number to check if less than $b