mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
some additional performance improvements, including a switch to the hooks class which I finished up
This commit is contained in:
parent
70261207f3
commit
32306abaf6
@ -19,7 +19,7 @@
|
|||||||
$app = $HTTP_GET_VARS['app'];
|
$app = $HTTP_GET_VARS['app'];
|
||||||
if ($app)
|
if ($app)
|
||||||
{
|
{
|
||||||
$included = $GLOBALS['phpgw']->common->hook_single('about',$app);
|
$included = $GLOBALS['phpgw']->hooks->single('about',$app);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1001,7 +1001,7 @@
|
|||||||
|
|
||||||
$this->template->pfp('out','view_t');
|
$this->template->pfp('out','view_t');
|
||||||
|
|
||||||
$GLOBALS['phpgw']->common->hook('addressbook_view');
|
$GLOBALS['phpgw']->hooks->process('addressbook_view');
|
||||||
}
|
}
|
||||||
|
|
||||||
function html_1button_form($name,$lang,$link)
|
function html_1button_form($name,$lang,$link)
|
||||||
|
@ -141,13 +141,13 @@
|
|||||||
|
|
||||||
if($appname <> 'admin')
|
if($appname <> 'admin')
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->common->hook_single('deleteaccount', $appname);
|
$GLOBALS['phpgw']->hooks->single('deleteaccount', $appname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['phpgw']->common->hook_single('deleteaccount','preferences');
|
$GLOBALS['phpgw']->hooks->single('deleteaccount','preferences');
|
||||||
$GLOBALS['phpgw']->common->hook_single('deleteaccount','admin');
|
$GLOBALS['phpgw']->hooks->single('deleteaccount','admin');
|
||||||
|
|
||||||
$basedir = $GLOBALS['phpgw_info']['server']['files_dir'] . SEP . 'users' . SEP;
|
$basedir = $GLOBALS['phpgw_info']['server']['files_dir'] . SEP . 'users' . SEP;
|
||||||
|
|
||||||
@ -261,7 +261,7 @@
|
|||||||
{
|
{
|
||||||
if (!$t[($app_name=='admin'?'common':$app_name)])
|
if (!$t[($app_name=='admin'?'common':$app_name)])
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->common->hook_single('add_def_pref', $app_name);
|
$GLOBALS['phpgw']->hooks->single('add_def_pref', $app_name);
|
||||||
$docommit = True;
|
$docommit = True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -478,7 +478,7 @@
|
|||||||
{
|
{
|
||||||
if (!$t[($app_name=='admin'?'common':$app_name)])
|
if (!$t[($app_name=='admin'?'common':$app_name)])
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->common->hook_single('add_def_pref', $app_name);
|
$GLOBALS['phpgw']->hooks->single('add_def_pref', $app_name);
|
||||||
$docommit = True;
|
$docommit = True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,12 +96,12 @@
|
|||||||
/* if ($apps_after)
|
/* if ($apps_after)
|
||||||
{
|
{
|
||||||
$GLOBALS['pref'] = CreateObject('phpgwapi.preferences',$userData['account_id']);
|
$GLOBALS['pref'] = CreateObject('phpgwapi.preferences',$userData['account_id']);
|
||||||
$GLOBALS['phpgw']->common->hook_single('add_def_pref','admin');
|
$GLOBALS['phpgw']->hooks->single('add_def_pref','admin');
|
||||||
while ($apps = each($apps_after))
|
while ($apps = each($apps_after))
|
||||||
{
|
{
|
||||||
if (strcasecmp ($apps[0], 'admin') != 0)
|
if (strcasecmp ($apps[0], 'admin') != 0)
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->common->hook_single('add_def_pref', $apps[1]);
|
$GLOBALS['phpgw']->hooks->single('add_def_pref', $apps[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$GLOBALS['pref']->save_repository(False);
|
$GLOBALS['pref']->save_repository(False);
|
||||||
@ -116,7 +116,7 @@
|
|||||||
// start inlcuding other admin tools
|
// start inlcuding other admin tools
|
||||||
while($app = each($apps_after))
|
while($app = each($apps_after))
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->common->hook_single('add_user_data', $value);
|
$GLOBALS['phpgw']->hooks->single('add_user_data', $value);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
return $userData['account_id'];
|
return $userData['account_id'];
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
{
|
{
|
||||||
$this->common_header();
|
$this->common_header();
|
||||||
|
|
||||||
$GLOBALS['phpgw']->common->hook('acl_manager',array('preferences'));
|
$GLOBALS['phpgw']->hooks->process('acl_manager',array('preferences'));
|
||||||
|
|
||||||
$this->template->set_file(array(
|
$this->template->set_file(array(
|
||||||
'app_list' => 'acl_applist.tpl'
|
'app_list' => 'acl_applist.tpl'
|
||||||
@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
function access_form()
|
function access_form()
|
||||||
{
|
{
|
||||||
$GLOBALS['phpgw']->common->hook_single('acl_manager',$GLOBALS['acl_app']);
|
$GLOBALS['phpgw']->hooks->single('acl_manager',$GLOBALS['acl_app']);
|
||||||
$location = base64_decode($GLOBALS['location']);
|
$location = base64_decode($GLOBALS['location']);
|
||||||
|
|
||||||
$acl_manager = $GLOBALS['acl_manager'][$GLOBALS['acl_app']][$location];
|
$acl_manager = $GLOBALS['acl_manager'][$GLOBALS['acl_app']][$location];
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
if ($GLOBALS['HTTP_POST_VARS']['submit'])
|
if ($GLOBALS['HTTP_POST_VARS']['submit'])
|
||||||
{
|
{
|
||||||
/* Load hook file with functions to validate each config (one/none/all) */
|
/* Load hook file with functions to validate each config (one/none/all) */
|
||||||
$GLOBALS['phpgw']->common->hook_single('config_validate',$appname);
|
$GLOBALS['phpgw']->hooks->single('config_validate',$appname);
|
||||||
|
|
||||||
while (list($key,$config) = each($GLOBALS['HTTP_POST_VARS']['newsettings']))
|
while (list($key,$config) = each($GLOBALS['HTTP_POST_VARS']['newsettings']))
|
||||||
{
|
{
|
||||||
@ -145,7 +145,7 @@
|
|||||||
|
|
||||||
$vars = $t->get_undefined('body');
|
$vars = $t->get_undefined('body');
|
||||||
|
|
||||||
$GLOBALS['phpgw']->common->hook_single('config',$appname);
|
$GLOBALS['phpgw']->hooks->single('config',$appname);
|
||||||
|
|
||||||
while (list($null,$value) = each($vars))
|
while (list($null,$value) = each($vars))
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['phpgw']->common->hook($_hookname);
|
$GLOBALS['phpgw']->hooks->process($_hookname);
|
||||||
|
|
||||||
if (count($GLOBALS['menuData']) > 1)
|
if (count($GLOBALS['menuData']) > 1)
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
section_end();
|
section_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['phpgw']->common->hook('admin');
|
$GLOBALS['phpgw']->hooks->process('admin');
|
||||||
$GLOBALS['admin_tpl']->pparse('out','list');
|
$GLOBALS['admin_tpl']->pparse('out','list');
|
||||||
|
|
||||||
$GLOBALS['phpgw']->common->phpgw_footer();
|
$GLOBALS['phpgw']->common->phpgw_footer();
|
||||||
|
@ -323,7 +323,7 @@
|
|||||||
$returndoc['value']['file'][] = $fn;
|
$returndoc['value']['file'][] = $fn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($returndoc['value']) && is_array($returndoc['value']))
|
if (@isset($returndoc['value']) && is_array($returndoc['value']))
|
||||||
{
|
{
|
||||||
$doc_array[$startstop[$key]][0] = $returndoc['value'];
|
$doc_array[$startstop[$key]][0] = $returndoc['value'];
|
||||||
}
|
}
|
||||||
|
@ -506,7 +506,7 @@ if ($messages)
|
|||||||
if (!is_array ($GLOBALS['settings']))
|
if (!is_array ($GLOBALS['settings']))
|
||||||
{
|
{
|
||||||
$pref = CreateObject ('phpgwapi.preferences', $GLOBALS['userinfo']['username']);
|
$pref = CreateObject ('phpgwapi.preferences', $GLOBALS['userinfo']['username']);
|
||||||
$GLOBALS['phpgw']->common->hook_single ('add_def_pref', $GLOBALS['appname']);
|
$GLOBALS['phpgw']->hooks->single ('add_def_pref', $GLOBALS['appname']);
|
||||||
$pref->save_repository (True);
|
$pref->save_repository (True);
|
||||||
$pref_array = $pref->read_repository ();
|
$pref_array = $pref->read_repository ();
|
||||||
$GLOBALS['settings'] = $pref_array[$GLOBALS['appname']];
|
$GLOBALS['settings'] = $pref_array[$GLOBALS['appname']];
|
||||||
|
2
home.php
2
home.php
@ -239,7 +239,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
@reset($sorted_apps);
|
@reset($sorted_apps);
|
||||||
$GLOBALS['phpgw']->common->hook('home',$sorted_apps);
|
$GLOBALS['phpgw']->hooks->process('home',$sorted_apps);
|
||||||
|
|
||||||
if($GLOBALS['portal_order'])
|
if($GLOBALS['portal_order'])
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
}
|
}
|
||||||
rmdir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid']);
|
rmdir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid']);
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw']->common->hook('logout');
|
$GLOBALS['phpgw']->hooks->process('logout');
|
||||||
$GLOBALS['phpgw']->session->destroy($GLOBALS['sessionid'],$GLOBALS['kp3']);
|
$GLOBALS['phpgw']->session->destroy($GLOBALS['sessionid'],$GLOBALS['kp3']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr><td><a href="<?php echo $GLOBALS['phpgw']->link('/notify.php'); ?>">Check Now</a></td></tr>
|
<tr><td><a href="<?php echo $GLOBALS['phpgw']->link('/notify.php'); ?>">Check Now</a></td></tr>
|
||||||
<?php
|
<?php
|
||||||
$GLOBALS['phpgw']->common->hook('notifywindow',array('email'));
|
$GLOBALS['phpgw']->hooks->process('notifywindow',array('email'));
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
|
@ -20,6 +20,6 @@
|
|||||||
include('./header.inc.php');
|
include('./header.inc.php');
|
||||||
|
|
||||||
echo '<html><body>';
|
echo '<html><body>';
|
||||||
$GLOBALS['phpgw']->common->hook('simple',array('email'));
|
$GLOBALS['phpgw']->hooks->process('simple',array('email'));
|
||||||
echo '</body></html>';
|
echo '</body></html>';
|
||||||
?>
|
?>
|
||||||
|
@ -535,11 +535,11 @@
|
|||||||
$appdir = PHPGW_INCLUDE_ROOT . '/'.$appname;
|
$appdir = PHPGW_INCLUDE_ROOT . '/'.$appname;
|
||||||
$appdir_default = PHPGW_SERVER_ROOT . '/'.$appname;
|
$appdir_default = PHPGW_SERVER_ROOT . '/'.$appname;
|
||||||
|
|
||||||
if (is_dir ($appdir))
|
if (@is_dir ($appdir))
|
||||||
{
|
{
|
||||||
return $appdir;
|
return $appdir;
|
||||||
}
|
}
|
||||||
elseif (is_dir ($appdir_default))
|
elseif (@is_dir ($appdir_default))
|
||||||
{
|
{
|
||||||
return $appdir_default;
|
return $appdir_default;
|
||||||
}
|
}
|
||||||
@ -569,11 +569,11 @@
|
|||||||
$incdir = PHPGW_INCLUDE_ROOT . '/' . $appname . '/inc';
|
$incdir = PHPGW_INCLUDE_ROOT . '/' . $appname . '/inc';
|
||||||
$incdir_default = PHPGW_SERVER_ROOT . '/' . $appname . '/inc';
|
$incdir_default = PHPGW_SERVER_ROOT . '/' . $appname . '/inc';
|
||||||
|
|
||||||
if (is_dir ($incdir))
|
if (@is_dir ($incdir))
|
||||||
{
|
{
|
||||||
return $incdir;
|
return $incdir;
|
||||||
}
|
}
|
||||||
elseif (is_dir ($incdir_default))
|
elseif (@is_dir ($incdir_default))
|
||||||
{
|
{
|
||||||
return $incdir_default;
|
return $incdir_default;
|
||||||
}
|
}
|
||||||
@ -1113,116 +1113,33 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function hook
|
@function hook
|
||||||
@abstract hooking function which allows applications to 'hook' into each other
|
@abstract temp wrapper to new hooks class
|
||||||
@discussion Someone flesh this out please
|
|
||||||
*/
|
*/
|
||||||
// Note: $no_permission_check should *ONLY* be used when it *HAS* to be. (jengo)
|
function hook($location, $appname = '', $no_permission_check = False)
|
||||||
function hook($location, $order = '', $no_permission_check = False)
|
|
||||||
{
|
{
|
||||||
if ($order == '')
|
echo '$'."GLOBALS['phpgw']common->hook()".' has been replaced. Please change to the new $'."GLOBALS['phpgw']hooks->process()".'. For now this will act as a wrapper<br>';
|
||||||
{
|
return $GLOBALS['phpgw']->hooks->process($location, $order, $no_permission_check);
|
||||||
settype($order,'array');
|
|
||||||
$order[] = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* First include the ordered apps hook file */
|
|
||||||
reset ($order);
|
|
||||||
while (list(,$appname) = each($order))
|
|
||||||
{
|
|
||||||
$f = PHPGW_SERVER_ROOT . '/' . $appname . '/inc/hook_' . $location . '.inc.php';
|
|
||||||
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 */
|
|
||||||
|
|
||||||
if ($no_permission_check)
|
|
||||||
{
|
|
||||||
reset($GLOBALS['phpgw_info']['apps']);
|
|
||||||
while (list(,$p) = each($GLOBALS['phpgw_info']['apps']))
|
|
||||||
{
|
|
||||||
$appname = $p['name'];
|
|
||||||
if (! isset($completed_hooks[$appname]) || $completed_hooks[$appname] != True)
|
|
||||||
{
|
|
||||||
$f = PHPGW_SERVER_ROOT . '/' . $appname . '/inc/hook_' . $location . '.inc.php';
|
|
||||||
if (file_exists($f))
|
|
||||||
{
|
|
||||||
include($f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
reset ($GLOBALS['phpgw_info']['user']['apps']);
|
|
||||||
while (list(,$p) = each($GLOBALS['phpgw_info']['user']['apps']))
|
|
||||||
{
|
|
||||||
$appname = $p['name'];
|
|
||||||
if (! isset($completed_hooks[$appname]) || $completed_hooks[$appname] != True)
|
|
||||||
{
|
|
||||||
$f = PHPGW_SERVER_ROOT . '/' . $appname . '/inc/hook_' . $location . '.inc.php';
|
|
||||||
if (file_exists($f))
|
|
||||||
{
|
|
||||||
include($f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function hook_single
|
@function hook_single
|
||||||
@abstract call the hooks for a single application
|
@abstract temp wrapper to new hooks class
|
||||||
@param $location hook location - required
|
|
||||||
@param $appname application name - optional
|
|
||||||
*/
|
*/
|
||||||
// Note: $no_permission_check should *ONLY* be used when it *HAS* to be. (jengo)
|
// Note: $no_permission_check should *ONLY* be used when it *HAS* to be. (jengo)
|
||||||
function hook_single($location, $appname = '', $no_permission_check = False)
|
function hook_single($location, $appname = '', $no_permission_check = False)
|
||||||
{
|
{
|
||||||
if (! $appname)
|
echo '$'."GLOBALS['phpgw']common->hook_single()".' has been replaced. Please change to the new $'."GLOBALS['phpgw']hooks->single()".'. For now this will act as a wrapper<br>';
|
||||||
{
|
return $GLOBALS['phpgw']->hooks->single($location, $order, $no_permission_check);
|
||||||
$appname = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
|
||||||
}
|
|
||||||
$SEP = filesystem_separator();
|
|
||||||
|
|
||||||
/* First include the ordered apps hook file */
|
|
||||||
$f = PHPGW_SERVER_ROOT . $SEP . $appname . $SEP . 'inc' . $SEP . 'hook_' . $location . '.inc.php';
|
|
||||||
if (file_exists($f) &&
|
|
||||||
( $GLOBALS['phpgw_info']['user']['apps'][$appname] || (($no_permission_check || $location == 'config' || $appname == 'phpgwapi') && $appname)) )
|
|
||||||
{
|
|
||||||
include($f);
|
|
||||||
return True;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function hook_count
|
@function hook_count
|
||||||
@abstract loop through the applications and count the hooks
|
@abstract temp wrapper to new hooks class
|
||||||
*/
|
*/
|
||||||
function hook_count($location)
|
function hook_count($location)
|
||||||
{
|
{
|
||||||
$count = 0;
|
echo '$'."GLOBALS['phpgw']common->hook_count()".' has been replaced. Please change to the new $'."GLOBALS['phpgw']hooks->count()".'. For now this will act as a wrapper<br>';
|
||||||
reset($GLOBALS['phpgw_info']['user']['apps']);
|
return $GLOBALS['phpgw']->hooks->count($location);
|
||||||
$SEP = filesystem_separator();
|
|
||||||
while ($permission = each($GLOBALS['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() */
|
/* Wrapper to the session->appsession() */
|
||||||
|
@ -31,26 +31,125 @@
|
|||||||
@package phpgwapi
|
@package phpgwapi
|
||||||
@access public
|
@access public
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class hooks
|
class hooks
|
||||||
{
|
{
|
||||||
/*!
|
var $found_hooks = Array();
|
||||||
@function read()
|
function hooks()
|
||||||
@abstract currently not being used
|
|
||||||
*/
|
|
||||||
function read()
|
|
||||||
{
|
{
|
||||||
$db = $GLOBALS['phpgw']->db;
|
//$GLOBALS['phpgw']->db->query("SELECT hook_appname, hook_location, hook_filename FROM phpgw_hooks WHERE hook_location='".$location."'",__LINE__,__FILE__);
|
||||||
|
$GLOBALS['phpgw']->db->query("SELECT hook_appname, hook_location, hook_filename FROM phpgw_hooks",__LINE__,__FILE__);
|
||||||
$db->query('select * from phpgw_hooks');
|
while( $GLOBALS['phpgw']->db->next_record() )
|
||||||
while ($db->next_record())
|
|
||||||
{
|
{
|
||||||
$return_array[$db->f('hook_id')]['app'] = $db->f('hook_appname');
|
$this->found_hooks[$GLOBALS['phpgw']->db->f('hook_appname')][$GLOBALS['phpgw']->db->f('hook_location')] = $GLOBALS['phpgw']->db->f('hook_filename');
|
||||||
$return_array[$db->f('hook_id')]['location'] = $db->f('hook_location');
|
|
||||||
$return_array[$db->f('hook_id')]['filename'] = $db->f('hook_filename');
|
|
||||||
}
|
}
|
||||||
if(isset($return_array))
|
//echo '<pre>';
|
||||||
|
//print_r($this->found_hooks);
|
||||||
|
//echo '</pre>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@function process
|
||||||
|
@abstract loads up all the hooks the user has rights to
|
||||||
|
@discussion Someone flesh this out please
|
||||||
|
*/
|
||||||
|
// Note: $no_permission_check should *ONLY* be used when it *HAS* to be. (jengo)
|
||||||
|
function process($location, $order = '', $no_permission_check = False)
|
||||||
|
{
|
||||||
|
$SEP = filesystem_separator();
|
||||||
|
if ($order == '')
|
||||||
{
|
{
|
||||||
return $return_array;
|
settype($order,'array');
|
||||||
|
$order[] = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* First include the ordered apps hook file */
|
||||||
|
reset ($order);
|
||||||
|
while (list(,$appname) = each($order))
|
||||||
|
{
|
||||||
|
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 || $appname == 'preferences') && $appname)) )
|
||||||
|
{
|
||||||
|
include($f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$completed_hooks[$appname] = True;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Then add the rest */
|
||||||
|
|
||||||
|
if ($no_permission_check)
|
||||||
|
{
|
||||||
|
reset($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
|
||||||
|
{
|
||||||
|
reset ($GLOBALS['phpgw_info']['user']['apps']);
|
||||||
|
while (list(,$p) = each($GLOBALS['phpgw_info']['user']['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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@function single
|
||||||
|
@abstract call the hooks for a single application
|
||||||
|
@param $location hook location - required
|
||||||
|
@param $appname application name - optional
|
||||||
|
*/
|
||||||
|
// Note: $no_permission_check should *ONLY* be used when it *HAS* to be. (jengo)
|
||||||
|
function single($location, $appname = '', $no_permission_check = False)
|
||||||
|
{
|
||||||
|
if (! $appname)
|
||||||
|
{
|
||||||
|
$appname = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
||||||
|
}
|
||||||
|
$SEP = filesystem_separator();
|
||||||
|
|
||||||
|
/* First include the ordered apps hook file */
|
||||||
|
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)) )
|
||||||
|
{
|
||||||
|
include($f);
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -59,55 +158,36 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function process
|
@function count
|
||||||
@abstract process the hooks
|
@abstract loop through the applications and count the hooks
|
||||||
@discussion not currently being used
|
|
||||||
@param \$type
|
|
||||||
@param \$where
|
|
||||||
*/
|
*/
|
||||||
function process($type,$where='')
|
function count($location)
|
||||||
{
|
{
|
||||||
$currentapp = $GLOBALS['phpgw_info']['flags']['currentapp'];
|
$count = 0;
|
||||||
$type = strtolower($type);
|
reset($GLOBALS['phpgw_info']['user']['apps']);
|
||||||
|
$SEP = filesystem_separator();
|
||||||
if ($type != 'location' && $type != 'app')
|
while ($permission = each($GLOBALS['phpgw_info']['user']['apps']))
|
||||||
{
|
{
|
||||||
return False;
|
if (isset($this->found_hooks[$permission[0]][$location]))
|
||||||
}
|
|
||||||
|
|
||||||
// Add a check to see if that location/app has a hook
|
|
||||||
// This way it doesn't have to loop everytime
|
|
||||||
|
|
||||||
while ($hook = each($GLOBALS['phpgw_info']['hooks']))
|
|
||||||
{
|
|
||||||
if ($type == 'app')
|
|
||||||
{
|
{
|
||||||
if ($hook[1]['app'] == $currentapp)
|
++$count;
|
||||||
{
|
|
||||||
$include_file = $GLOBALS['phpgw_info']['server']['server_root'] . '/'
|
|
||||||
. $currentapp . '/hooks/'
|
|
||||||
. $hook[1]['app'] . $hook[1]['filename'];
|
|
||||||
include($include_file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif ($type == "location")
|
|
||||||
{
|
|
||||||
if ($hook[1]["location"] == $where)
|
|
||||||
{
|
|
||||||
$include_file = $GLOBALS['phpgw_info']['server']['server_root'] . '/'
|
|
||||||
. $hook[1]['app'] . '/hooks/'
|
|
||||||
. $hook[1]['filename'];
|
|
||||||
if (! is_file($include_file))
|
|
||||||
{
|
|
||||||
$GLOBALS['phpgw']->common->phpgw_error('Failed to include hook: ' . $include_file);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
include($include_file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@function read()
|
||||||
|
@abstract currently not being used
|
||||||
|
*/
|
||||||
|
function read()
|
||||||
|
{
|
||||||
|
//if (!is_array($this->found_hooks))
|
||||||
|
//{
|
||||||
|
$this->hooks();
|
||||||
|
//}
|
||||||
|
return $this->found_hooks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -120,7 +120,7 @@
|
|||||||
$GLOBALS[$class]->header();
|
$GLOBALS[$class]->header();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw']->common->hook('after_navbar');
|
$GLOBALS['phpgw']->hooks->process('after_navbar');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@
|
|||||||
'version' => $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']
|
'version' => $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']
|
||||||
);
|
);
|
||||||
$tpl->set_var($var);
|
$tpl->set_var($var);
|
||||||
$GLOBALS['phpgw']->common->hook('navbar_end');
|
$GLOBALS['phpgw']->hooks->process('navbar_end');
|
||||||
$tpl->pfp('out','footer');
|
$tpl->pfp('out','footer');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@
|
|||||||
$GLOBALS[$class]->header();
|
$GLOBALS[$class]->header();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw']->common->hook('after_navbar');
|
$GLOBALS['phpgw']->hooks->process('after_navbar');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,6 +241,6 @@
|
|||||||
$tpl->set_var('V_powered_bottom','');
|
$tpl->set_var('V_powered_bottom','');
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['phpgw']->common->hook('navbar_end');
|
$GLOBALS['phpgw']->hooks->process('navbar_end');
|
||||||
$tpl->pfp('out','footer');
|
$tpl->pfp('out','footer');
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,21 @@
|
|||||||
$var['messages'] = $api_messages . "<br>" . checkcode($cd);
|
$var['messages'] = $api_messages . "<br>" . checkcode($cd);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
function display_section($appname,$title,$file)
|
||||||
|
{
|
||||||
|
$GLOBALS['prefs'][$appname]['title'] = $title;
|
||||||
|
$GLOBALS['prefs'][$appname]['file'][] = $file;
|
||||||
|
}
|
||||||
|
$temp_common = CreateObject('phpgwapi.common');
|
||||||
|
|
||||||
|
$temp_hooks->process('preferences',array('preferences'));
|
||||||
|
*/
|
||||||
|
// echo '>prefs<pre>';
|
||||||
|
// print_r($GLOBALS['prefs']);
|
||||||
|
// echo '</pre>';
|
||||||
|
|
||||||
$tpl->set_var($var);
|
$tpl->set_var($var);
|
||||||
$tpl->pfp('out','navbar');
|
$tpl->pfp('out','navbar');
|
||||||
// If the application has a header include, we now include it
|
// If the application has a header include, we now include it
|
||||||
@ -124,7 +139,7 @@
|
|||||||
$GLOBALS[$class]->header();
|
$GLOBALS[$class]->header();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw']->common->hook('after_navbar');
|
$GLOBALS['phpgw']->hooks->process('after_navbar');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,6 +162,6 @@
|
|||||||
. $GLOBALS['phpgw']->common->show_date(time(),'d, Y')
|
. $GLOBALS['phpgw']->common->show_date(time(),'d, Y')
|
||||||
);
|
);
|
||||||
$tpl->set_var($var);
|
$tpl->set_var($var);
|
||||||
$GLOBALS['phpgw']->common->hook('navbar_end');
|
$GLOBALS['phpgw']->hooks->process('navbar_end');
|
||||||
echo $tpl->pfp('out','footer');
|
echo $tpl->pfp('out','footer');
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@
|
|||||||
$GLOBALS[$class]->header();
|
$GLOBALS[$class]->header();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw']->common->hook('after_navbar');
|
$GLOBALS['phpgw']->hooks->process('after_navbar');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +162,6 @@
|
|||||||
$tpl->set_var('V_powered_bottom','');
|
$tpl->set_var('V_powered_bottom','');
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['phpgw']->common->hook('navbar_end');
|
$GLOBALS['phpgw']->hooks->process('navbar_end');
|
||||||
$tpl->pfp('out','footer');
|
$tpl->pfp('out','footer');
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@
|
|||||||
$GLOBALS[$class]->header();
|
$GLOBALS[$class]->header();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$GLOBALS['phpgw']->common->hook('after_navbar');
|
$GLOBALS['phpgw']->hooks->process('after_navbar');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,6 +150,6 @@
|
|||||||
'version' => $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']
|
'version' => $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']
|
||||||
);
|
);
|
||||||
$tpl->set_var($var);
|
$tpl->set_var($var);
|
||||||
$GLOBALS['phpgw']->common->hook('navbar_end');
|
$GLOBALS['phpgw']->hooks->process('navbar_end');
|
||||||
echo $tpl->pfp('out','footer');
|
echo $tpl->pfp('out','footer');
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@
|
|||||||
section_end();
|
section_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
$phpgw->common->hook('preferences',array('preferences'));
|
$phpgw->hooks->process('preferences',array('preferences'));
|
||||||
$pref_tpl->pfp('out','list');
|
$pref_tpl->pfp('out','list');
|
||||||
$phpgw->common->phpgw_footer();
|
$phpgw->common->phpgw_footer();
|
||||||
?>
|
?>
|
||||||
|
@ -292,14 +292,14 @@
|
|||||||
|
|
||||||
if ($GLOBALS['HTTP_GET_VARS']['appname'] == 'preferences')
|
if ($GLOBALS['HTTP_GET_VARS']['appname'] == 'preferences')
|
||||||
{
|
{
|
||||||
if (! $GLOBALS['phpgw']->common->hook_single('settings','preferences',True))
|
if (! $GLOBALS['phpgw']->hooks->single('settings','preferences',True))
|
||||||
{
|
{
|
||||||
$error = True;
|
$error = True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (! $GLOBALS['phpgw']->common->hook_single('settings',$GLOBALS['HTTP_GET_VARS']['appname']))
|
if (! $GLOBALS['phpgw']->hooks->single('settings',$GLOBALS['HTTP_GET_VARS']['appname']))
|
||||||
{
|
{
|
||||||
$error = True;
|
$error = True;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@
|
|||||||
$t->set_var('row_off', 'EEEEEE');
|
$t->set_var('row_off', 'EEEEEE');
|
||||||
|
|
||||||
$vars = $t->get_undefined('body');
|
$vars = $t->get_undefined('body');
|
||||||
$GLOBALS['phpgw']->common->hook_single('config',$cfg_app);
|
$GLOBALS['phpgw']->hooks->single('config',$cfg_app);
|
||||||
|
|
||||||
while (list($null,$value) = each($vars))
|
while (list($null,$value) = each($vars))
|
||||||
{
|
{
|
||||||
|
@ -326,7 +326,7 @@
|
|||||||
@reset($s_apps);
|
@reset($s_apps);
|
||||||
while (list($key,$app) = each($s_apps))
|
while (list($key,$app) = each($s_apps))
|
||||||
{
|
{
|
||||||
$phpgw->common->hook_single('add_def_pref',$app);
|
$phpgw->hooks->single('add_def_pref',$app);
|
||||||
}
|
}
|
||||||
$pref->save_repository();
|
$pref->save_repository();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user