- slightly modified exception handler, to cover the situation when the egw object is not yet or only partially initialised

- somehow the baseclass stuff in __autoload was never working as intended (could not load the exceptions derived from egw_exception)
This commit is contained in:
Ralf Becker 2008-01-19 05:28:33 +00:00
parent 2722e59477
commit c25ba82735

View File

@ -1307,8 +1307,8 @@
function __autoload($class) function __autoload($class)
{ {
$components = explode('_',$class); $components = explode('_',$class);
$app =array_shift($components); $app = array_shift($components);
$baseclass = implode('_', $components); $baseclass = $components[0];
// classes using the new naming schema app_class_name, eg. admin_cmd // classes using the new naming schema app_class_name, eg. admin_cmd
if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$app.'/inc/class.'.$class.'.inc.php') || if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$app.'/inc/class.'.$class.'.inc.php') ||
// classes using the new naming schema app_class_name, eg. admin_cmd // classes using the new naming schema app_class_name, eg. admin_cmd
@ -1324,9 +1324,13 @@ function __autoload($class)
{ {
//error_log("autoloaded class $class from $file"); //error_log("autoloaded class $class from $file");
include_once($file); include_once($file);
} else { }
foreach($GLOBALS['egw_info']['apps'] as $lapp=>$appvalue){ else
if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$lapp.'/inc/class.'.$class.'.inc.php')){ {
foreach($GLOBALS['egw_info']['apps'] as $lapp => $appvalue)
{
if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$lapp.'/inc/class.'.$class.'.inc.php'))
{
#echo "$lapp,$class<br>"; #echo "$lapp,$class<br>";
include_once($file); include_once($file);
} }
@ -1355,13 +1359,22 @@ function egw_exception_handler(Exception $e)
{ {
$headline = lang('An error happend'); $headline = lang('An error happend');
} }
$GLOBALS['egw']->framework->render( $message = '<h3>'.$headline."</h3>\n".
'<h3>'.$headline."</h3>\n".
'<pre><b>'.$e->getMessage()."</b>\n\n". '<pre><b>'.$e->getMessage()."</b>\n\n".
$e->getTraceAsString()."</pre>\n". $e->getTraceAsString()."</pre>\n";
'<p><a href="'.$GLOBALS['egw']->link('/index.php').'">'.lang('Click here to resume your eGroupWare Session.').'</a>',
$headline);
if (is_object($GLOBALS['egw']) && is_object($GLOBALS['egw']->session))
{
'<p><a href="'.$GLOBALS['egw']->link('/index.php').'">'.lang('Click here to resume your eGroupWare Session.').'</a></p>';
}
if (is_object($GLOBALS['egw']) && is_object($GLOBALS['egw']->framework))
{
$GLOBALS['egw']->framework->render($message,$headline);
}
else
{
echo "<html>\n<head>\n<title>$headline</title>\n</head>\n<body>\n$message\n</body>\n</html>\n";
}
$GLOBALS['egw']->common->egw_exit(); $GLOBALS['egw']->common->egw_exit();
} }