Does a small check to see if the requested class exists, before attempting to load and instantiate.

This commit is contained in:
skeeter 2001-10-21 10:53:33 +00:00
parent a446455ca4
commit 03a0fdd1a6

View File

@ -68,10 +68,19 @@
if (!isset($GLOBALS['phpgw_info']['flags']['included_classes'][$classname]) || if (!isset($GLOBALS['phpgw_info']['flags']['included_classes'][$classname]) ||
!$GLOBALS['phpgw_info']['flags']['included_classes'][$classname]) !$GLOBALS['phpgw_info']['flags']['included_classes'][$classname])
{
if(@file_exists(PHPGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php'))
{ {
include(PHPGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php'); include(PHPGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php');
$GLOBALS['phpgw_info']['flags']['included_classes'][$classname] = True; $GLOBALS['phpgw_info']['flags']['included_classes'][$classname] = True;
} }
else
{
$GLOBALS['phpgw_info']['flags']['included_classes'][$classname] = False;
}
}
if($GLOBALS['phpgw_info']['flags']['included_classes'][$classname])
{
if ($p1 == '_UNDEF_' && $p1 != 1) if ($p1 == '_UNDEF_' && $p1 != 1)
{ {
eval('$obj = new ' . $classname . ';'); eval('$obj = new ' . $classname . ';');
@ -99,6 +108,7 @@
/* error_reporting(E_ERROR | E_WARNING | E_PARSE); */ /* error_reporting(E_ERROR | E_WARNING | E_PARSE); */
return $obj; return $obj;
} }
}
/*! /*!
@function ExecObject @function ExecObject