added an array of replacement names to ease the transition to the new class naming scheme: app_class

This commit is contained in:
Ralf Becker 2008-10-07 08:51:14 +00:00
parent 1a8f6ed1bd
commit c3e40ade99
2 changed files with 14 additions and 15 deletions

View File

@ -78,15 +78,7 @@
} }
if($GLOBALS['egw_info']['user']['preferences']['common']['default_app'] && !$hasupdates) if($GLOBALS['egw_info']['user']['preferences']['common']['default_app'] && !$hasupdates)
{ {
/** Test if our default app is available else open about.php */ $GLOBALS['egw']->redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app']));
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');
}
} }
else else
{ {
@ -112,8 +104,7 @@
$app = 'phpgwapi'; $app = 'phpgwapi';
} }
require_once(EGW_INCLUDE_ROOT.'/'.$app.'/inc/class.'.$class.'.inc.php'); $obj = CreateObject($app.'.'.$class);
$GLOBALS[$class] = $obj = new $class();
if((is_array($obj->public_functions) && $obj->public_functions[$method]) && !$invalid_data) if((is_array($obj->public_functions) && $obj->public_functions[$method]) && !$invalid_data)
{ {
$obj->$method(); $obj->$method();

View File

@ -675,10 +675,18 @@ function &CreateObject($class)
{ {
list($appname,$classname) = explode('.',$class); list($appname,$classname) = explode('.',$class);
if ($classname == 'datetime') $classname = 'egw_datetime'; // php5.2 fix 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'); include_once(EGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php');
}
}
if (class_exists($classname)) if (class_exists($classname))
{ {
$args = func_get_args(); $args = func_get_args();