formatting

This commit is contained in:
Miles Lott 2001-09-23 19:23:49 +00:00
parent 121e9072fc
commit cc3247e481
2 changed files with 23 additions and 28 deletions

View File

@ -39,15 +39,14 @@
*/ */
function read() function read()
{ {
global $phpgw; $db = $GLOBALS['phpgw']->db;
$db = $phpgw->db;
$db->query("select * from phpgw_hooks"); $db->query('select * from phpgw_hooks');
while ($db->next_record()) while ($db->next_record())
{ {
$return_array[$db->f("hook_id")]["app"] = $db->f("hook_appname"); $return_array[$db->f('hook_id')]['app'] = $db->f('hook_appname');
$return_array[$db->f("hook_id")]["location"] = $db->f("hook_location"); $return_array[$db->f('hook_id')]['location'] = $db->f('hook_location');
$return_array[$db->f("hook_id")]["filename"] = $db->f("hook_filename"); $return_array[$db->f('hook_id')]['filename'] = $db->f('hook_filename');
} }
if(isset($return_array)) if(isset($return_array))
{ {
@ -66,14 +65,12 @@
@param \$type @param \$type
@param \$where @param \$where
*/ */
function process($type,$where = "") function process($type,$where='')
{ {
global $phpgw_info, $phpgw; $currentapp = $GLOBALS['phpgw_info']['flags']['currentapp'];
$currentapp = $phpgw_info["flags"]["currentapp"];
$type = strtolower($type); $type = strtolower($type);
if ($type != "location" && $type != "app") if ($type != 'location' && $type != 'app')
{ {
return False; return False;
} }
@ -81,15 +78,15 @@
// Add a check to see if that location/app has a hook // Add a check to see if that location/app has a hook
// This way it doesn't have to loop everytime // This way it doesn't have to loop everytime
while ($hook = each($phpgw_info["hooks"])) while ($hook = each($GLOBALS['phpgw_info']['hooks']))
{ {
if ($type == "app") if ($type == 'app')
{ {
if ($hook[1]["app"] == $currentapp) if ($hook[1]['app'] == $currentapp)
{ {
$include_file = $phpgw_info["server"]["server_root"] . "/" $include_file = $GLOBALS['phpgw_info']['server']['server_root'] . '/'
. $currentapp . "/hooks/" . $currentapp . '/hooks/'
. $hook[1]["app"] . $hook[1]["filename"]; . $hook[1]['app'] . $hook[1]['filename'];
include($include_file); include($include_file);
} }
} }
@ -97,12 +94,12 @@
{ {
if ($hook[1]["location"] == $where) if ($hook[1]["location"] == $where)
{ {
$include_file = $phpgw_info["server"]["server_root"] . "/" $include_file = $GLOBALS['phpgw_info']['server']['server_root'] . '/'
. $hook[1]["app"] . "/hooks/" . $hook[1]['app'] . '/hooks/'
. $hook[1]["filename"]; . $hook[1]['filename'];
if (! is_file($include_file)) if (! is_file($include_file))
{ {
$phpgw->common->phpgw_error("Failed to include hook: $include_file"); $GLOBALS['phpgw']->common->phpgw_error('Failed to include hook: ' . $include_file);
} }
else else
{ {

View File

@ -1,10 +1,8 @@
<?php <?php
if (empty ($GLOBALS['phpgw_info']['server']['file_repository']))
{
$GLOBALS['phpgw_info']['server']['file_repository'] = 'sql';
}
if (empty ($phpgw_info['server']['file_repository'])) include (PHPGW_API_INC . '/class.vfs_' . $GLOBALS['phpgw_info']['server']['file_repository'] . '.inc.php');
{
$phpgw_info['server']['file_repository'] = 'sql';
}
include (PHPGW_API_INC . '/class.vfs_' . $phpgw_info['server']['file_repository'] . '.inc.php');
?> ?>