From 798ac55a33437f3b754523943c0bf97053ae0e9b Mon Sep 17 00:00:00 2001 From: seek3r Date: Wed, 20 Dec 2000 07:45:05 +0000 Subject: [PATCH] testing out new hooks option --- phpgwapi/phpgw_common.inc.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/phpgwapi/phpgw_common.inc.php b/phpgwapi/phpgw_common.inc.php index 7ead665e35..542a039ff5 100644 --- a/phpgwapi/phpgw_common.inc.php +++ b/phpgwapi/phpgw_common.inc.php @@ -622,19 +622,32 @@ } - function hook($location = "") { + function hook($location = "", $order = ""){ global $phpgw, $phpgw_info; + if ($order == ""){$order[] = $phpgw_info["flags"]["currentapp"];} +// if ($order == ""){$order = Array();} /* First include the apps own hook file */ - $appname = $phpgw_info["flags"]["currentapp"]; + reset ($order); + while (list ($key, $appname) = each ($order)){ + $f = $phpgw_info["server"]["server_root"] . "/" . $appname . "/inc/hook_".$phpgw_info["flags"]["currentapp"]; + if ($location != ""){$f .= "_".$location.".inc.php";}else{$f .= ".inc.php"; } + if (file_exists($f)) {include($f);} + $processed .= '|| $appname != "'.$appname.'" '; + } + $processed = 'if ($appname != "" '.$processed.'){'; +echo "processed: ".$processed."
\n"; $f = $phpgw_info["server"]["server_root"] . "/" . $appname . "/inc/hook_".$phpgw_info["flags"]["currentapp"]; + + if ($location != ""){$f .= "_".$location.".inc.php";}else{$f .= ".inc.php";} if (file_exists($f)) {include($f);} /* Then add the rest */ reset ($phpgw_info["user"]["app_perms"]); while (list (, $appname) = each ($phpgw_info["user"]["app_perms"])){ - if ($appname != "" || $appname != $phpgw_info["flags"]["currentapp"]){ +if ($appname != "" ){ + //eval($processed); $f = $phpgw_info["server"]["server_root"] . "/" . $appname . "/inc/hook_".$phpgw_info["flags"]["currentapp"]; if ($location != ""){$f .= "_".$location.".inc.php";}else{$f .= ".inc.php"; } if (file_exists($f)) {include($f);}