Cleanup and abstraction of how default template set is retrieved
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 2 Oct 2006 11:02:27 +0000 (11:02 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 2 Oct 2006 11:02:27 +0000 (11:02 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11797 7612ce4b-ef26-0410-bec9-ea0150e637f0

include/load_prefs.php

index d86cf6cae78cd26ac8eccd8bc8b022568d23af78..5b5124fa50fcc3b3f1c5a4103cb2dbd66d488e17 100644 (file)
@@ -29,11 +29,11 @@ if( ! sqgetGlobalVar('username', $username, SQ_SESSION) ) {
 // TODO Get rid of "none" strings when NULL or false should be used, i hate them i hate them i hate them!!!.
 $custom_css = getPref($data_dir, $username, 'custom_css', 'none' );
 
 // TODO Get rid of "none" strings when NULL or false should be used, i hate them i hate them i hate them!!!.
 $custom_css = getPref($data_dir, $username, 'custom_css', 'none' );
 
-$aTemplateSet = (!isset($aTemplateSet) || !is_array($aTemplateSet) 
-                 ? array() : $aTemplateSet);
-$templateset_default = ( !isset($templateset_default) ? 0 : $templateset_default );
 
 
-$sTemplateID = getPref($data_dir, $username, 'sTemplateID', 'default');
+// template set setup
+//
+$sDefaultTemplateID = Template::get_default_template_set();
+$sTemplateID = getPref($data_dir, $username, 'sTemplateID', $sDefaultTemplateID);
 
 // check user prefs template selection against templates actually available
 //
 
 // check user prefs template selection against templates actually available
 //
@@ -48,21 +48,19 @@ for ($i = 0; $i < count($aTemplateSet); ++$i){
 // FIXME: do we need/want to check here for actual presence of template sets?
 // selected template not available, fall back to default template
 //
 // FIXME: do we need/want to check here for actual 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'] );
-}
+if (!$found_templateset) $sTemplateID = $sDefaultTemplateID;
 
 $chosen_theme = getPref($data_dir, $username, 'chosen_theme');
 
 
 $chosen_theme = getPref($data_dir, $username, 'chosen_theme');
 
-/*
+/* Steve, is this commented out because it is part of the old system being removed?
+   Let's just remove it then... no?
 $theme = ( !isset($theme) ? array() : $theme );
 $color = ( !isset($color) ? array() : $color );
 
 $chosen_theme = getPref($data_dir, $username, 'chosen_theme');
 $found_theme = false;
 
 $theme = ( !isset($theme) ? array() : $theme );
 $color = ( !isset($color) ? array() : $color );
 
 $chosen_theme = getPref($data_dir, $username, 'chosen_theme');
 $found_theme = false;
 
-// need to adjust $chosen_theme path with SM_PATH
+// need to adjust $chosen_theme path with SM_PATH */
 $chosen_theme = preg_replace("/(\.\.\/){1,}/", SM_PATH, $chosen_theme);
 
 for ($i = 0; $i < count($theme); ++$i){
 $chosen_theme = preg_replace("/(\.\.\/){1,}/", SM_PATH, $chosen_theme);
 
 for ($i = 0; $i < count($theme); ++$i){