require(SM_PATH . 'functions/plugin.php');
require(SM_PATH . 'include/constants.php');
require(SM_PATH . 'include/languages.php');
+require(SM_PATH . 'class/template/Template.class.php');
/**
* If magic_quotes_runtime is on, SquirrelMail breaks in new and creative ways.
// make sure given template actually is available
//
- $aTemplateSet = (!isset($aTemplateSet) || !is_array($aTemplateSet)
- ? array() : $aTemplateSet);
- $templateset_default = (!isset($templateset_default) ? 0 : $templateset_default);
$found_templateset = false;
for ($i = 0; $i < count($aTemplateSet); ++$i) {
if ($aTemplateSet[$i]['ID'] == $templateid) {
}
}
-// FIXME: do we need/want to check here for actual presence of template sets?
+// FIXME: do we need/want to check here for actual (physical) presence of template sets?
// selected template not available, fall back to default template
//
if (!$found_templateset) {
- $sTemplateID = (!isset($aTemplateSet[$templateset_default]['ID'])
- ? 'default' : $aTemplateSet[$templateset_default]['ID']);
+ $sTemplateID = Template::get_default_template_set();
} else {
$sTemplateID = $templateid;
}
* plugins use own pref files.
*/
require(SM_PATH . 'functions/prefs.php');
+ require(SM_PATH . 'functions/auth.php');
/* hook loads custom prefs backend plugins */
$prefs_backend = do_hook_function('prefs_backend');
if (isset($prefs_backend) && !empty($prefs_backend) && file_exists(SM_PATH . $prefs_backend)) {
require(SM_PATH . 'functions/display_messages.php' );
require(SM_PATH . 'functions/page_header.php');
require(SM_PATH . 'functions/html.php');
+
+ // reset template file cache
+ //
+ $sTemplateID = Template::get_default_template_set();
+ Template::cache_template_file_hierarchy(TRUE);
+
/**
* cleanup old cookies with a cookie path the same as the standard php.ini
* cookie path. All previous SquirrelMail version used the standard php.ini
/**
* Initialize the template object (logout_error uses it)
*/
- require(SM_PATH . 'class/template/Template.class.php');
/*
* $sTemplateID is not initialized when a user is not logged in, so we
* will use the config file defaults here. If the neccesary variables
* are net set, force a default value.
*/
- $aTemplateSet = (!isset($aTemplateSet) || !is_array($aTemplateSet)
- ? array() : $aTemplateSet);
- $templateset_default = ( !isset($templateset_default) ? 0 : $templateset_default );
-
- $sTemplateID = ( !isset($aTemplateSet[$templateset_default]['ID']) ?
- 'default' : $aTemplateSet[$templateset_default]['ID'] );
+ $sTemplateID = Template::get_default_template_set();
$oTemplate = Template::construct_template($sTemplateID);
set_up_language($squirrelmail_language, true);
break;
}
-/**
- * Initialize the template object
- */
-require(SM_PATH . 'class/template/Template.class.php');
-
/*
* $sTemplateID is not initialized when a user is not logged in, so we
* will use the config file defaults here. If the neccesary variables
* so we shouldn't change it here.
*/
if (!isset($sTemplateID)) {
- $aTemplateSet = (!isset($aTemplateSet) || !is_array($aTemplateSet)
- ? array() : $aTemplateSet);
- $templateset_default = ( !isset($templateset_default) ? 0 : $templateset_default );
-
- $sTemplateID = !isset($aTemplateSet[$templateset_default]['ID']) ? 'default' : $aTemplateSet[$templateset_default]['ID'];
+ $sTemplateID = Template::get_default_template_set();
$icon_theme_path = !$use_icons ? NULL : Template::calculate_template_images_directory($sTemplateID);
}
-$oTemplate = Template::construct_template($sTemplateID);
+
+// template object may have already been constructed in load_prefs.php
+//
+if (empty($oTemplate)) {
+ $oTemplate = Template::construct_template($sTemplateID);
+}
// We want some variables to always be available to the template
-$always_include = array('sTemplateID', 'icon_theme_path');
+$always_include = array('sTemplateID', 'icon_theme_path', 'javascript_on');
foreach ($always_include as $var) {
$oTemplate->assign($var, (isset($$var) ? $$var : NULL));
}