From c3e40ade99b68d54b2d8ec153f7227070fda175e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 7 Oct 2008 08:51:14 +0000 Subject: [PATCH] added an array of replacement names to ease the transition to the new class naming scheme: app_class --- index.php | 13 ++----------- phpgwapi/inc/common_functions.inc.php | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 15 deletions(-) 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();