Formatting

This commit is contained in:
Miles Lott 2001-05-06 13:40:04 +00:00
parent 32eeb8c49a
commit e7f38fb001

View File

@ -23,80 +23,94 @@
/* $Id$ */ /* $Id$ */
$d1 = strtolower(substr($phpgw_info["server"]["api_inc"],0,3)); $d1 = strtolower(substr($phpgw_info["server"]["api_inc"],0,3));
$d2 = strtolower(substr($phpgw_info["server"]["server_root"],0,3)); $d2 = strtolower(substr($phpgw_info["server"]["server_root"],0,3));
$d3 = strtolower(substr($phpgw_info["server"]["app_inc"],0,3)); $d3 = strtolower(substr($phpgw_info["server"]["app_inc"],0,3));
if($d1 == "htt" || $d1 == "ftp" || $d2 == "htt" || $d2 == "ftp" || $d3 == "htt" || $d3 == "ftp") { if($d1 == "htt" || $d1 == "ftp" || $d2 == "htt" || $d2 == "ftp" || $d3 == "htt" || $d3 == "ftp")
echo "Failed attempt to break in via an old Security Hole!<br>\n"; {
exit; echo "Failed attempt to break in via an old Security Hole!<br>\n";
} unset($d1);unset($d2);unset($d3); exit;
/*! }
@class hooks unset($d1);unset($d2);unset($d3);
@abstract class which gives ability for applications to set and use hooks to communicate with each other
@discussion Author: Seek3r
*/
class hooks
{
/*!
@function read()
@abstract currenlty not being used
*/
function read()
{
global $phpgw;
$db = $phpgw->db;
$db->query("select * from phpgw_hooks"); /*!
while ($db->next_record()) { @class hooks
$return_array[$db->f("hook_id")]["app"] = $db->f("hook_appname"); @abstract class which gives ability for applications to set and use hooks to communicate with each other
$return_array[$db->f("hook_id")]["location"] = $db->f("hook_location"); @discussion Author: Seek3r
$return_array[$db->f("hook_id")]["filename"] = $db->f("hook_filename"); */
} class hooks
return $return_array; {
}
/*! /*!
@function proccess @function read()
@abstract currently not being used
*/
function read()
{
global $phpgw;
$db = $phpgw->db;
$db->query("select * from phpgw_hooks");
while ($db->next_record())
{
$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")]["filename"] = $db->f("hook_filename");
}
return $return_array;
}
/*!
@function process
@abstract process the hooks @abstract process the hooks
@discussion not currently being used @discussion not currently being used
@param $type @param $type
@param $where @param $where
*/ */
function process($type,$where = "")
{
global $phpgw_info, $phpgw;
function proccess($type,$where = "") $currentapp = $phpgw_info["flags"]["currentapp"];
{ $type = strtolower($type);
global $phpgw_info, $phpgw;
$currentapp = $phpgw_info["flags"]["currentapp"]; if ($type != "location" && $type != "app")
$type = strtolower($type); {
return False;
}
if ($type != "location" && $type != "app") { // Add a check to see if that location/app has a hook
return False; // This way it doesn't have to loop everytime
}
// Add a check to see if that location/app has a hook while ($hook = each($phpgw_info["hooks"]))
// This way it doesn't have to loop everytime {
if ($type == "app")
while ($hook = each($phpgw_info["hooks"])) { {
if ($type == "app") { if ($hook[1]["app"] == $currentapp)
if ($hook[1]["app"] == $currentapp) { {
$include_file = $phpgw_info["server"]["server_root"] . "/" $include_file = $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);
} }
}
} else if ($type == "location") { elseif ($type == "location")
if ($hook[1]["location"] == $where) { {
$include_file = $phpgw_info["server"]["server_root"] . "/" if ($hook[1]["location"] == $where)
. $hook[1]["app"] . "/hooks/" {
. $hook[1]["filename"]; $include_file = $phpgw_info["server"]["server_root"] . "/"
if (! is_file($include_file)) { . $hook[1]["app"] . "/hooks/"
$phpgw->common->phpgw_error("Failed to include hook: $include_file"); . $hook[1]["filename"];
} else { if (! is_file($include_file))
include($include_file); {
} $phpgw->common->phpgw_error("Failed to include hook: $include_file");
} }
} else
} {
} include($include_file);
} }
}
}
}
}
}
?>