diff --git a/index.php b/index.php index 03b8075b5c..f449b5ffda 100755 --- a/index.php +++ b/index.php @@ -78,15 +78,7 @@ } if($GLOBALS['egw_info']['user']['preferences']['common']['default_app'] && !$hasupdates) { - /** Test if our default app is available else open about.php */ - if(is_file('./'.$GLOBALS['egw_info']['user']['preferences']['common']['default_app'].'/index.php')) - { - $GLOBALS['egw']->redirect_link('/'.$GLOBALS['egw_info']['user']['preferences']['common']['default_app'].'/index.php'); - } - else - { - $GLOBALS['egw']->redirect_link('/about.php'); - } + $GLOBALS['egw']->redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app'])); } else { @@ -112,8 +104,7 @@ $app = 'phpgwapi'; } - require_once(EGW_INCLUDE_ROOT.'/'.$app.'/inc/class.'.$class.'.inc.php'); - $GLOBALS[$class] = $obj = new $class(); + $obj = CreateObject($app.'.'.$class); if((is_array($obj->public_functions) && $obj->public_functions[$method]) && !$invalid_data) { $obj->$method(); diff --git a/phpgwapi/inc/common_functions.inc.php b/phpgwapi/inc/common_functions.inc.php index db4763644f..8c30a1a37a 100755 --- a/phpgwapi/inc/common_functions.inc.php +++ b/phpgwapi/inc/common_functions.inc.php @@ -675,10 +675,18 @@ function &CreateObject($class) { list($appname,$classname) = explode('.',$class); - if ($classname == 'datetime') $classname = 'egw_datetime'; // php5.2 fix - - include_once(EGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php'); - + if (!@include_once(EGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php')) + { + static $replace = array( + 'datetime' => 'egw_datetime', + 'uitimesheet' => 'timesheet_ui', + ); + if (isset($replace[$classname])) + { + $classname = $replace[$classname]; + include_once(EGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php'); + } + } if (class_exists($classname)) { $args = func_get_args();