diff --git a/admin/index.php b/admin/index.php
index 108baa33fc..8b68e0408f 100755
--- a/admin/index.php
+++ b/admin/index.php
@@ -78,7 +78,7 @@
section_end();
}
- $phpgw->common->hook();
+ $phpgw->common->hook('admin');
$admin_tpl->pparse('out','list');
$phpgw->common->phpgw_footer();
diff --git a/index.php b/index.php
index 00e77816fd..32593297c8 100755
--- a/index.php
+++ b/index.php
@@ -185,9 +185,9 @@
';
//Uncomment the next line to enable the notify window. It will not work until a notifywindow app is added.
- //echo 'Open notify window';
+ echo 'Open notify window';
- $phpgw->common->hook('',array('email','calendar','news','addressbook'));
+ $phpgw->common->hook('home',array('email','calendar','news','addressbook'));
//$phpgw->common->debug_phpgw_info();
//$phpgw->common->debug_list_core_functions();
diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php
index 6a7319769b..842164f632 100644
--- a/phpgwapi/inc/class.common.inc.php
+++ b/phpgwapi/inc/class.common.inc.php
@@ -806,6 +806,7 @@
!$phpgw_info['flags']['navbar_target']))
{
echo parse_navbar();
+ $this->hook('after_navbar');
}
}
@@ -913,7 +914,7 @@
@abstract hooking function which allows applications to "hook" into each other
@discussion Someone flesh this out please
*/
- function hook($location = '', $order = '')
+ function hook($location, $order = '')
{
global $phpgw, $phpgw_info;
if ($order == '')
@@ -923,21 +924,10 @@
/* First include the ordered apps hook file */
reset ($order);
- while (list (, $appname) = each ($order))
+ while (list(,$appname) = each($order))
{
- $f = PHPGW_SERVER_ROOT . '/' . $appname . '/inc/hook_'.$phpgw_info['flags']['currentapp'];
- if ($location != '')
- {
- $f .= '_'.$location.'.inc.php';
- }
- else
- {
- $f .= '.inc.php';
- }
-
- if (file_exists($f) &&
- ((isset($phpgw_info['user']['apps'][$appname]) && $phpgw_info['user']['apps'][$appname])
- || $appname == 'preferences'))
+ $f = PHPGW_SERVER_ROOT . '/' . $appname . '/inc/hook_' . $location . '.inc.php';
+ if (file_exists($f) && $phpgw_info['user']['apps'][$appname])
{
include($f);
}
@@ -946,23 +936,13 @@
/* Then add the rest */
reset ($phpgw_info['user']['apps']);
- while ($permission = each($phpgw_info['user']['apps']))
+ while (list(,$p) = each($phpgw_info['user']['apps']))
{
- if (!isset($completed_hooks[$permission[0]]) ||
- $completed_hooks[$permission[0]] != True)
+ $appname = $p['name'];
+ if (! isset($completed_hooks[$appname]) || $completed_hooks[$appname] != True)
{
- $appname = $permission[0];
- $f = PHPGW_SERVER_ROOT . '/' . $permission[0] . '/inc/hook_'.$phpgw_info['flags']['currentapp'];
- if ($location != '')
- {
- $f .= '_'.$location.'.inc.php';
- }
- else
- {
- $f .= '.inc.php';
- }
-
- if (file_exists($f) && ($phpgw_info['user']['apps'][$appname] || $appname == 'preferences'))
+ $f = PHPGW_SERVER_ROOT . '/' . $appname . '/inc/hook_' . $location . '.inc.php';
+ if (file_exists($f))
{
include($f);
}
@@ -973,52 +953,61 @@
/*!
@function hook_single
@abstract call the hooks for a single application
- @param $location hook location - optional
+ @param $location hook location - required
@param $appname application name - optional
*/
- function hook_single($location = '', $appname = '')
- {
- global $phpgw, $phpgw_info, $PHP_VERSION;
- if (! $appname) {
- $appname = $phpgw_info['flags']['currentapp'];
- }
- $s = $phpgw->common->filesystem_separator();
- /* First include the ordered apps hook file */
- $f = PHPGW_SERVER_ROOT . $s . $appname . $s . 'inc' . $s . 'hook_'.$appname;
- if ($location != '') {
- $f .= '_'.$location.'.inc.php';
- } else {
- $f .= '.inc.php';
- }
- if (file_exists($f)) {
- include($f);
- return True;
- } else {
- return False;
- }
- }
+ function hook_single($location, $appname = '')
+ {
+ global $phpgw, $phpgw_info, $PHP_VERSION;
+ if (! $appname)
+ {
+ $appname = $phpgw_info['flags']['currentapp'];
+ }
+
+ /* First include the ordered apps hook file */
+ $f = PHPGW_SERVER_ROOT . sep . $appname . sep . 'inc' . sep . 'hook_' . $location . '.inc.php';
+ if (file_exists($f) && $phpgw_info['user']['apps'][$appname])
+ {
+ include($f);
+ return True;
+ }
+ else
+ {
+ return False;
+ }
+ }
/*!
@function hook_count
@abstract loop through the applications and count the hooks
*/
- function hook_count($location = ''){
- global $phpgw, $phpgw_info;
- $count = 0;
- reset($phpgw_info['user']['apps']);
- while ($permission = each($phpgw_info['user']['apps'])) {
- $f = PHPGW_SERVER_ROOT . '/' . $permission[0] . '/inc/hook_'.$phpgw_info['flags']['currentapp'];
- if ($location != ''){$f .= '_'.$location.'.inc.php';}else{$f .= '.inc.php'; }
- if (file_exists($f)) {++$count;}
- }
- return $count;
- }
+ function hook_count($location)
+ {
+ global $phpgw, $phpgw_info;
+ $count = 0;
+ reset($phpgw_info['user']['apps']);
+ while ($permission = each($phpgw_info['user']['apps']))
+ {
+ $f = PHPGW_SERVER_ROOT . sep . $permission[0] . sep . 'inc' . sep . 'hook_' . $location . '.inc.php';
+
+ if (file_exists($f))
+ {
+ ++$count;
+ }
+ }
+ return $count;
+ }
+
+ /* Wrapper to the session->appsession() */
+ function appsession($data = '##NOTHING##')
+ {
+ global $phpgw_info, $phpgw;
+ $this->debug_info[] = '$phpgw->common->appsession() is a depreciated function'
+ . ' - use $phpgw->session->appsession() instead';
+
+ return $phpgw->session->appsession('default','',$data);
+ }
- /* Wrapper to the session->appsession() */
- function appsession($data = '##NOTHING##') {
- global $phpgw_info, $phpgw;
- return $phpgw->session->appsession('default','',$data);
- }
/*!
@function show_date
@abstract show current date
diff --git a/preferences/index.php b/preferences/index.php
index a8ceaf458c..a9f16772e9 100755
--- a/preferences/index.php
+++ b/preferences/index.php
@@ -76,7 +76,7 @@
section_end();
}
- $phpgw->common->hook();
+ $phpgw->common->hook('preferences');
$pref_tpl->pparse('out','list');
$phpgw->common->phpgw_footer();
?>