mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-18 20:08:34 +01:00
new type of hooks via methodes instead of separate files:
- allows to parse arguments ot the hook and return content - all access to the hook-table is now handled by the hook-class (for admin and setup too) - all existing hooks continue to work of cause
This commit is contained in:
parent
6b78fbbcfb
commit
4e1cd7d1f5
@ -13,10 +13,6 @@
|
|||||||
|
|
||||||
class boapplications
|
class boapplications
|
||||||
{
|
{
|
||||||
var $public_functions = array(
|
|
||||||
'register_all_hooks' => True
|
|
||||||
);
|
|
||||||
|
|
||||||
var $so;
|
var $so;
|
||||||
|
|
||||||
function boapplications()
|
function boapplications()
|
||||||
@ -58,39 +54,4 @@
|
|||||||
{
|
{
|
||||||
return $this->so->delete($app_name);
|
return $this->so->delete($app_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function register_hook($hook_app)
|
|
||||||
{
|
|
||||||
return $this->so->register_hook($hook_app);
|
|
||||||
}
|
|
||||||
|
|
||||||
function register_all_hooks()
|
|
||||||
{
|
|
||||||
$SEP = filesystem_separator();
|
|
||||||
$app_list = $this->get_list();
|
|
||||||
$hooks = CreateObject('phpgwapi.hooks');
|
|
||||||
while(list($app_name,$app) = each($app_list))
|
|
||||||
{
|
|
||||||
$f = PHPGW_SERVER_ROOT . $SEP . $app_name . $SEP . 'setup' . $SEP . 'setup.inc.php';
|
|
||||||
if(@file_exists($f))
|
|
||||||
{
|
|
||||||
include($f);
|
|
||||||
while(is_array($setup_info[$app_name]['hooks']) && list(,$hook) = @each($setup_info[$app_name]['hooks']))
|
|
||||||
{
|
|
||||||
if(!@$hooks->found_hooks[$app_name][$hook])
|
|
||||||
{
|
|
||||||
$this->register_hook(
|
|
||||||
Array(
|
|
||||||
'app_name' => $app_name,
|
|
||||||
'hook' => $hook
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Header('Location: '.$GLOBALS['phpgw']->link('/admin/index.php'));
|
|
||||||
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
'get_list' => True,
|
'get_list' => True,
|
||||||
'add' => True,
|
'add' => True,
|
||||||
'edit' => True,
|
'edit' => True,
|
||||||
'delete' => True
|
'delete' => True,
|
||||||
|
'register_all_hooks' => True
|
||||||
);
|
);
|
||||||
|
|
||||||
var $bo;
|
var $bo;
|
||||||
@ -338,5 +339,16 @@
|
|||||||
$GLOBALS['phpgw']->template->set_var('yes','<a href="' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.delete&app_name=' . urlencode($app_name) . "&confirm=True") . '">' . lang('Yes') . '</a>');
|
$GLOBALS['phpgw']->template->set_var('yes','<a href="' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.delete&app_name=' . urlencode($app_name) . "&confirm=True") . '">' . lang('Yes') . '</a>');
|
||||||
$GLOBALS['phpgw']->template->pparse('out','body');
|
$GLOBALS['phpgw']->template->pparse('out','body');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function register_all_hooks()
|
||||||
|
{
|
||||||
|
if (!is_object($GLOBALS['phpgw']->hooks))
|
||||||
|
{
|
||||||
|
$GLOBALS['phpgw']->hooks = CreateObject('phpgwapi.hooks');
|
||||||
|
}
|
||||||
|
$GLOBALS['phpgw']->hooks->register_all_hooks();
|
||||||
|
|
||||||
|
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
if (! $GLOBALS['phpgw']->acl->check('appreg_access',1,'admin'))
|
if (! $GLOBALS['phpgw']->acl->check('appreg_access',1,'admin'))
|
||||||
{
|
{
|
||||||
$file['Find and Register all Application Hooks'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.boapplications.register_all_hooks');
|
$file['Find and Register all Application Hooks'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.register_all_hooks');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $GLOBALS['phpgw']->acl->check('info_access',1,'admin'))
|
if (! $GLOBALS['phpgw']->acl->check('info_access',1,'admin'))
|
||||||
|
@ -34,13 +34,16 @@
|
|||||||
class hooks
|
class hooks
|
||||||
{
|
{
|
||||||
var $found_hooks = Array();
|
var $found_hooks = Array();
|
||||||
function hooks()
|
var $db = '';
|
||||||
|
|
||||||
|
function hooks($db='')
|
||||||
{
|
{
|
||||||
//$GLOBALS['phpgw']->db->query("SELECT hook_appname, hook_location, hook_filename FROM phpgw_hooks WHERE hook_location='".$location."'",__LINE__,__FILE__);
|
$this->db = $db ? $db : $GLOBALS['phpgw']->db; // this is to allow setup to set the db
|
||||||
$GLOBALS['phpgw']->db->query("SELECT hook_appname, hook_location, hook_filename FROM phpgw_hooks",__LINE__,__FILE__);
|
|
||||||
while( $GLOBALS['phpgw']->db->next_record() )
|
$this->db->query("SELECT hook_appname, hook_location, hook_filename FROM phpgw_hooks",__LINE__,__FILE__);
|
||||||
|
while( $this->db->next_record() )
|
||||||
{
|
{
|
||||||
$this->found_hooks[$GLOBALS['phpgw']->db->f('hook_appname')][$GLOBALS['phpgw']->db->f('hook_location')] = $GLOBALS['phpgw']->db->f('hook_filename');
|
$this->found_hooks[$this->db->f('hook_appname')][$this->db->f('hook_location')] = $this->db->f('hook_filename');
|
||||||
}
|
}
|
||||||
//echo '<pre>';
|
//echo '<pre>';
|
||||||
//print_r($this->found_hooks);
|
//print_r($this->found_hooks);
|
||||||
@ -49,94 +52,89 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function process
|
@function process
|
||||||
@abstract loads up all the hooks the user has rights to
|
@abstract executes all the hooks (the user has rights to) for a given location
|
||||||
@discussion Someone flesh this out please
|
@syntax process($args,$order='',$no_permission_check = False)
|
||||||
|
@param $args location-name as string or array:
|
||||||
|
@param $args['location'] location-name
|
||||||
|
@param $order or $args['order'] array of appnames (as value), which should be executes first
|
||||||
|
@param $args is passed to the hook, if its a new method-hook
|
||||||
|
@param $no_permission_check if True execute all hooks, not only the ones a user has rights to
|
||||||
|
@note $no_permission_check should *ONLY* be used when it *HAS* to be. (jengo)
|
||||||
|
@returns array with results of each hook call (with appname as key): \
|
||||||
|
False if no hook exists, True if old hook exists \
|
||||||
|
and whatever the new methode-hook returns (can be True or False too!).
|
||||||
*/
|
*/
|
||||||
// Note: $no_permission_check should *ONLY* be used when it *HAS* to be. (jengo)
|
function process($args, $order = '', $no_permission_check = False)
|
||||||
function process($location, $order = '', $no_permission_check = False)
|
|
||||||
{
|
{
|
||||||
|
//echo "<p>hooks::process("; print_r($args); echo ")</p>\n";
|
||||||
if ($order == '')
|
if ($order == '')
|
||||||
{
|
{
|
||||||
settype($order,'array');
|
$order = is_array($args) && isset($args['order']) ? $args['order'] :
|
||||||
$order[] = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
array($GLOBALS['phpgw_info']['flags']['currentapp']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First include the ordered apps hook file */
|
/* First include the ordered apps hook file */
|
||||||
reset ($order);
|
foreach($order as $appname)
|
||||||
while (list(,$appname) = each($order))
|
|
||||||
{
|
{
|
||||||
if (isset($this->found_hooks[$appname][$location]))
|
$results[$appname] = $this->single($args,$appname,$no_permission_check);
|
||||||
{
|
|
||||||
$f = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'inc' . SEP . $this->found_hooks[$appname][$location];
|
|
||||||
if (file_exists($f) &&
|
|
||||||
( $GLOBALS['phpgw_info']['user']['apps'][$appname] || (($no_permission_check || $appname == 'preferences') && $appname)) )
|
|
||||||
{
|
|
||||||
include($f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$completed_hooks[$appname] = True;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then add the rest */
|
/* Then add the rest */
|
||||||
|
|
||||||
if ($no_permission_check)
|
if ($no_permission_check)
|
||||||
{
|
{
|
||||||
reset($GLOBALS['phpgw_info']['apps']);
|
$apps = $GLOBALS['phpgw_info']['apps'];
|
||||||
while (list(,$p) = each($GLOBALS['phpgw_info']['apps']))
|
|
||||||
{
|
|
||||||
$appname = $p['name'];
|
|
||||||
if (! isset($completed_hooks[$appname]) || $completed_hooks[$appname] != True)
|
|
||||||
{
|
|
||||||
if (isset($this->found_hooks[$appname][$location]))
|
|
||||||
{
|
|
||||||
$f = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'inc' . SEP . $this->found_hooks[$appname][$location];
|
|
||||||
if (file_exists($f))
|
|
||||||
{
|
|
||||||
include($f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
reset ($GLOBALS['phpgw_info']['user']['apps']);
|
$apps = $GLOBALS['phpgw_info']['user']['apps'];
|
||||||
while (list(,$p) = each($GLOBALS['phpgw_info']['user']['apps']))
|
}
|
||||||
|
foreach($apps as $app)
|
||||||
{
|
{
|
||||||
$appname = $p['name'];
|
$appname = $app['name'];
|
||||||
if (! isset($completed_hooks[$appname]) || $completed_hooks[$appname] != True)
|
if (!isset($results[$appname]))
|
||||||
{
|
{
|
||||||
if (isset($this->found_hooks[$appname][$location]))
|
$results[$appname] = $this->single($args,$appname,$no_permission_check);
|
||||||
{
|
|
||||||
$f = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'inc' . SEP . $this->found_hooks[$appname][$location];
|
|
||||||
if (file_exists($f))
|
|
||||||
{
|
|
||||||
include($f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function single
|
@function single
|
||||||
@abstract call the hooks for a single application
|
@abstract executes a single hook of a given location and application
|
||||||
@param $location hook location - required
|
@syntax single($args,$appname='',$no_permission_check = False)
|
||||||
@param $appname application name - optional
|
@param $args location-name as string or array:
|
||||||
|
@param $args['location'] location-name
|
||||||
|
@param $appname or $args['appname'] name of the app, which's hook to execute, if empty the current app is used
|
||||||
|
@param $args is passed to the hook, if its a new method-hook
|
||||||
|
@param $no_permission_check if True execute all hooks, not only the ones a user has rights to
|
||||||
|
@note $no_permission_check should *ONLY* be used when it *HAS* to be. (jengo)
|
||||||
|
@returns False if no hook exists, True if an old hook exist and whatever the new method-hook returns
|
||||||
*/
|
*/
|
||||||
// Note: $no_permission_check should *ONLY* be used when it *HAS* to be. (jengo)
|
function single($args, $appname = '', $no_permission_check = False)
|
||||||
function single($location, $appname = '', $no_permission_check = False)
|
|
||||||
{
|
{
|
||||||
|
//echo "<p>hooks::single("; print_r($args); echo ",'$appname')</p>\n";
|
||||||
|
if (is_array($args))
|
||||||
|
{
|
||||||
|
$location = $args['location'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$location = $args;
|
||||||
|
}
|
||||||
if (!$appname)
|
if (!$appname)
|
||||||
{
|
{
|
||||||
$appname = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
$appname = is_array($args) && isset($args['appname']) ? $args['appname'] : $GLOBALS['phpgw_info']['flags']['currentapp'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First include the ordered apps hook file */
|
/* First include the ordered apps hook file */
|
||||||
if (isset($this->found_hooks[$appname][$location]))
|
if (isset($this->found_hooks[$appname][$location]))
|
||||||
{
|
{
|
||||||
$f = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'inc' . SEP . $this->found_hooks[$appname][$location];
|
$parts = explode('.',$method = $this->found_hooks[$appname][$location]);
|
||||||
|
|
||||||
|
if (count($parts) != 3 || ($parts[1] == 'inc' && $parts[2] == 'php'))
|
||||||
|
{
|
||||||
|
$f = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'inc' . SEP . $method;
|
||||||
if (file_exists($f) &&
|
if (file_exists($f) &&
|
||||||
( $GLOBALS['phpgw_info']['user']['apps'][$appname] || (($no_permission_check || $location == 'config' || $appname == 'phpgwapi') && $appname)) )
|
( $GLOBALS['phpgw_info']['user']['apps'][$appname] || (($no_permission_check || $location == 'config' || $appname == 'phpgwapi') && $appname)) )
|
||||||
{
|
{
|
||||||
@ -148,46 +146,17 @@
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // new style method-hook
|
||||||
|
{
|
||||||
|
return ExecMethod($method,$args);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
@function single_tpl
|
|
||||||
@abstract call the hooks for a single application, return output from the hook
|
|
||||||
@discussion This is a BROKEN function on php3... wcm is not using it anymore
|
|
||||||
@param $location hook location - required
|
|
||||||
@param $appname application name - optional
|
|
||||||
*/
|
|
||||||
function single_tpl($location, $appname='', $no_permission_check=False)
|
|
||||||
{
|
|
||||||
if(!$appname)
|
|
||||||
{
|
|
||||||
$appname = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(@isset($this->found_hooks[$appname][$location]))
|
|
||||||
{
|
|
||||||
$f = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'inc' . SEP . $this->found_hooks[$appname][$location];
|
|
||||||
if(@file_exists($f) &&
|
|
||||||
( $GLOBALS['phpgw_info']['user']['apps'][$appname] || (($no_permission_check || $location == 'config' || $appname == 'phpgwapi') && $appname)) )
|
|
||||||
{
|
|
||||||
eval('$retval = include(\$f);');
|
|
||||||
return $retval;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function count
|
@function count
|
||||||
@abstract loop through the applications and count the hooks
|
@abstract loop through the applications and count the hooks
|
||||||
@ -195,10 +164,9 @@
|
|||||||
function count($location)
|
function count($location)
|
||||||
{
|
{
|
||||||
$count = 0;
|
$count = 0;
|
||||||
reset($GLOBALS['phpgw_info']['user']['apps']);
|
foreach($GLOBALS['phpgw_info']['user']['apps'] as $appname => $data)
|
||||||
while ($permission = each($GLOBALS['phpgw_info']['user']['apps']))
|
|
||||||
{
|
{
|
||||||
if (isset($this->found_hooks[$permission[0]][$location]))
|
if (isset($this->found_hooks[$appname][$location]))
|
||||||
{
|
{
|
||||||
++$count;
|
++$count;
|
||||||
}
|
}
|
||||||
@ -218,5 +186,62 @@
|
|||||||
//}
|
//}
|
||||||
return $this->found_hooks;
|
return $this->found_hooks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@function register_hooks
|
||||||
|
@abstract Register and/or de-register an application's hooks
|
||||||
|
@syntax register_hooks($appname,$hooks='')
|
||||||
|
@param $appname Application 'name'
|
||||||
|
@param $hooks array with hooks to register, eg $setup_info[$app]['hooks'] or not used for only deregister the hooks
|
||||||
|
*/
|
||||||
|
function register_hooks($appname,$hooks='')
|
||||||
|
{
|
||||||
|
if(!$appname)
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
$db_appname = $this->db->db_addslashes($appname);
|
||||||
|
$this->db->query("DELETE FROM phpgw_hooks WHERE hook_appname='$db_appname'",__LINE__,__FILE__);
|
||||||
|
|
||||||
|
if (!is_array($hooks)) // only deregister
|
||||||
|
{
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
//echo "<p>ADDING hooks for: $appname</p>";
|
||||||
|
foreach($hooks as $key => $hook)
|
||||||
|
{
|
||||||
|
if (!is_numeric($key)) // new methode-hook
|
||||||
|
{
|
||||||
|
$location = $key;
|
||||||
|
$filename = $hook;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$location = $hook;
|
||||||
|
$filename = "hook_$hook.inc.php";
|
||||||
|
}
|
||||||
|
$this->db->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename)".
|
||||||
|
" VALUES ('$appname','$location','$filename');");
|
||||||
|
}
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@function register_all_hooks
|
||||||
|
@abstract Register the hooks of all applications (used by admin)
|
||||||
|
*/
|
||||||
|
function register_all_hooks()
|
||||||
|
{
|
||||||
|
foreach($GLOBALS['phpgw_info']['apps'] as $appname => $app)
|
||||||
|
{
|
||||||
|
$f = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP . 'setup.inc.php';
|
||||||
|
if(@file_exists($f))
|
||||||
|
{
|
||||||
|
include($f);
|
||||||
|
$this->register_hooks($appname,$setup_info[$appname]['hooks']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -559,27 +559,11 @@
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->query("SELECT COUNT(hook_appname) FROM phpgw_hooks WHERE hook_appname='".$appname."'");
|
if (!is_object($this->hooks))
|
||||||
$this->db->next_record();
|
|
||||||
if($this->db->f(0))
|
|
||||||
{
|
{
|
||||||
$this->deregister_hooks($appname);
|
$this->hooks = CreateObject('phpgwapi.hooks',$this->db);
|
||||||
}
|
|
||||||
|
|
||||||
//echo "ADDING hooks for: " . $setup_info[$appname]['name'];
|
|
||||||
if(is_array($setup_info[$appname]['hooks']))
|
|
||||||
{
|
|
||||||
while(list($key,$hook) = each($setup_info[$appname]['hooks']))
|
|
||||||
{
|
|
||||||
$this->db->query("INSERT INTO phpgw_hooks "
|
|
||||||
. "(hook_appname,hook_location,hook_filename) "
|
|
||||||
. "VALUES ("
|
|
||||||
. "'" . $setup_info[$appname]['name'] . "',"
|
|
||||||
. "'" . $hook . "',"
|
|
||||||
. "'" . "hook_" . $hook . ".inc.php" . "');"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
$this->hooks->register_hooks($appname,$setup_info[$appname]['hooks']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -589,35 +573,8 @@
|
|||||||
*/
|
*/
|
||||||
function update_hooks($appname)
|
function update_hooks($appname)
|
||||||
{
|
{
|
||||||
$setup_info = $GLOBALS['setup_info'];
|
|
||||||
|
|
||||||
if(!$appname)
|
|
||||||
{
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5'))
|
|
||||||
{
|
|
||||||
/* No phpgw_hooks table yet. */
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->query("SELECT COUNT(*) FROM phpgw_hooks WHERE hook_appname='".$appname."'");
|
|
||||||
$this->db->next_record();
|
|
||||||
if(!$this->db->f(0))
|
|
||||||
{
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($setup_info[$appname]['version'])
|
|
||||||
{
|
|
||||||
if(is_array($setup_info[$appname]['hooks']))
|
|
||||||
{
|
|
||||||
$this->deregister_hooks($appname);
|
|
||||||
$this->register_hooks($appname);
|
$this->register_hooks($appname);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function deregister_hooks
|
@function deregister_hooks
|
||||||
@ -638,7 +595,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//echo "DELETING hooks for: " . $setup_info[$appname]['name'];
|
//echo "DELETING hooks for: " . $setup_info[$appname]['name'];
|
||||||
$this->db->query("DELETE FROM phpgw_hooks WHERE hook_appname='". $appname ."'");
|
if (!is_object($this->hooks))
|
||||||
|
{
|
||||||
|
$this->hooks = CreateObject('phpgwapi.hooks',$this->db);
|
||||||
|
}
|
||||||
|
$this->hooks->register_hooks($appname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -649,22 +610,11 @@
|
|||||||
*/
|
*/
|
||||||
function hook($location, $appname='')
|
function hook($location, $appname='')
|
||||||
{
|
{
|
||||||
if(!$appname)
|
if (!is_object($this->hooks))
|
||||||
{
|
{
|
||||||
$appname = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
$this->hooks = CreateObject('phpgwapi.hooks',$this->db);
|
||||||
}
|
|
||||||
$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;
|
|
||||||
}
|
}
|
||||||
|
return $this->hooks->single($locaton,$appname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user