diff --git a/index.php b/index.php index 0040f0a8ab..4dc0182cce 100755 --- a/index.php +++ b/index.php @@ -1,15 +1,14 @@ redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app'])); + egw::redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app'])); } else { - $GLOBALS['egw']->redirect_link('/home/index.php'); + egw::redirect_link('/home/index.php'); } - } +} if($windowed && $_GET['cd'] == 'yes') { @@ -108,9 +107,8 @@ if($windowed && $_GET['cd'] == 'yes') 'nonavbar' => False, 'currentapp' => 'eGroupWare' ); - $GLOBALS['egw']->common->egw_header(); - $GLOBALS['egw']->common->egw_footer(); - + common::egw_header(); + common::egw_footer(); } else { @@ -166,6 +164,6 @@ else if(!isset($GLOBALS['egw_info']['nofooter'])) { - $GLOBALS['egw']->common->egw_footer(); + common::egw_footer(); } } diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index fbddda46b1..e47b2547af 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -644,8 +644,7 @@ class common * get template dir of an application * * @param $appname appication name optional can be derived from $GLOBALS['egw_info']['flags']['currentapp']; - * @static - * @return string/boolean dir or false if no dir is found + * @return string|boolean dir or false if no dir is found */ static function get_tpl_dir($appname = '') { @@ -675,7 +674,9 @@ class common { $GLOBALS['egw_info']['server']['template_set'] = $GLOBALS['egw_info']['user']['preferences']['common']['template_set']; } - if (!file_exists(EGW_SERVER_ROOT.'/phpgwapi/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/class.'. + if (!file_exists(EGW_SERVER_ROOT.'/phpgwapi/templates/'.basename($GLOBALS['egw_info']['server']['template_set']).'/class.'. + $GLOBALS['egw_info']['server']['template_set'].'_framework.inc.php') && + !file_exists(EGW_SERVER_ROOT.'/'.basename($GLOBALS['egw_info']['server']['template_set']).'/inc/class.'. $GLOBALS['egw_info']['server']['template_set'].'_framework.inc.php')) { $GLOBALS['egw_info']['server']['template_set'] = 'idots'; @@ -691,10 +692,7 @@ class common { return $tpldir_default; } - else - { - return False; - } + return False; } /** diff --git a/phpgwapi/inc/class.egw.inc.php b/phpgwapi/inc/class.egw.inc.php index 487c21df24..ba31b79131 100644 --- a/phpgwapi/inc/class.egw.inc.php +++ b/phpgwapi/inc/class.egw.inc.php @@ -618,10 +618,13 @@ class egw_minimal case 'framework': // setup the new eGW framework (template sets) $class = $GLOBALS['egw_info']['server']['template_set'].'_framework'; - require_once($file=EGW_INCLUDE_ROOT.'/phpgwapi/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/class.'.$class.'.inc.php'); - if (!in_array($file,(array)$_SESSION['egw_required_files'])) + if (!class_exists($class)) // first try to autoload the class { - $_SESSION['egw_required_files'][] = $file; // automatic load the used framework class, when the object get's restored + require_once($file=EGW_INCLUDE_ROOT.'/phpgwapi/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/class.'.$class.'.inc.php'); + if (!in_array($file,(array)$_SESSION['egw_required_files'])) + { + $_SESSION['egw_required_files'][] = $file; // automatic load the used framework class, when the object get's restored + } } break; case 'template': // need to be instancated for the current app diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index aed0ecc9ba..7b394b50fd 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -45,6 +45,13 @@ abstract class egw_framework */ var $template; + /** + * Path relative to EGW_SERVER_ROOT for the template directory + * + * @var string + */ + var $template_dir; + /** * true if $this->header() was called * @@ -73,6 +80,7 @@ abstract class egw_framework { $GLOBALS['egw']->framework = $this; } + $this->template_dir = '/phpgwapi/templates/'.$template; } /** @@ -647,14 +655,14 @@ abstract class egw_framework } } #_debug_array($GLOBALS['egw_info']['user']['preferences']['common']); - $theme_css = '/phpgwapi/templates/'.$this->template.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css'; + $theme_css = $this->template_dir.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css'; if(!file_exists(EGW_SERVER_ROOT.$theme_css)) { - $theme_css = '/phpgwapi/templates/'.$this->template.'/css/'.$this->template.'.css'; + $theme_css = $this->template_dir.'/css/'.$this->template.'.css'; } $theme_css = $GLOBALS['egw_info']['server']['webserver_url'] . $theme_css .'?'.filemtime(EGW_SERVER_ROOT.$theme_css); - $print_css = '/phpgwapi/templates/'.$this->template.'/print.css'; + $print_css = $this->template_dir.'/print.css'; if(!file_exists(EGW_SERVER_ROOT.$print_css)) { $print_css = '/phpgwapi/templates/idots/print.css';