Changes on 18 August to functions.php were intended to correct issue with the $icon_t...
authorstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 22 Aug 2006 18:56:16 +0000 (18:56 +0000)
committerstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 22 Aug 2006 18:56:16 +0000 (18:56 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11623 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/options.php
include/load_prefs.php
include/options/display.php

index a8236919370cd4a2290b9c126cf8b4919fb312a0..7b60af67ea5b414d51ad394437ac07a85b677bf0 100644 (file)
@@ -175,20 +175,8 @@ class SquirrelOption {
         $this->script = '';
         $this->post_script = '';
 
         $this->script = '';
         $this->post_script = '';
 
-        /**
-         * Check for a current value.  If the $GLOBALS[] value exists, we also
-         * need to make sure it is the same data type as the initial value to
-         * make sure we are looking at the correct preference.
-         */
-        $var_type = NULL;        
-        if (!empty($initial_value)) {
-            $var_type = gettype($initial_value);
-        } elseif (is_array($possible_values)) {
-            list($index, $x) = each ($possible_values);
-            $var_type = gettype($index);
-        }
-        
-        if (isset($GLOBALS[$name]) && (is_null($var_type) ? true : $var_type == gettype($GLOBALS[$name]))) {
+        //Check for a current value.  
+        if (isset($GLOBALS[$name])) {
             $this->value = $GLOBALS[$name];
         } else if (!empty($initial_value)) {
             $this->value = $initial_value;
             $this->value = $GLOBALS[$name];
         } else if (!empty($initial_value)) {
             $this->value = $initial_value;
index fc54fdd1c31cbe800024f79c8db7736079fb3caa..f9e6346df7a54a69d08d0306f64ccc4988b27845 100644 (file)
@@ -83,15 +83,13 @@ if (isset($chosen_theme) && $found_theme && (file_exists($chosen_theme))) {
 
 // user's icon theme, if using icons
 $icon_theme = getPref($data_dir, $username, 'icon_theme', 'images/themes/xp/' );
 
 // user's icon theme, if using icons
 $icon_theme = getPref($data_dir, $username, 'icon_theme', 'images/themes/xp/' );
-if ($icon_theme == 'template') {
-    $icon_theme = $sTplDir . 'images/';
-}
+
 /*
  * NOTE: The $icon_theme_path var should contain the path to the icon
  *       theme to use.  If the admin has disabled icons, or the user has
  *       set the icon theme to "None," no icons will be used.
  */
 /*
  * NOTE: The $icon_theme_path var should contain the path to the icon
  *       theme to use.  If the admin has disabled icons, or the user has
  *       set the icon theme to "None," no icons will be used.
  */
-$icon_theme_path = (!$use_icons || $icon_theme=='none') ? NULL : $icon_theme;
+$icon_theme_path = (!$use_icons || $icon_theme=='none') ? NULL : ($icon_theme == 'template' ? $sTplDir . 'images/' : $icon_theme);
 
 // show (or not) flag and unflag buttons on mailbox list screen
 $show_flag_buttons = getPref($data_dir, $username, 'show_flag_buttons', SMPREF_ON );
 
 // show (or not) flag and unflag buttons on mailbox list screen
 $show_flag_buttons = getPref($data_dir, $username, 'show_flag_buttons', SMPREF_ON );
index 0a2db96fa36d025715e30527ad5e85a3ec43d182..2c93798e94b4a75326694f45bb94e9f448176bac 100644 (file)
@@ -228,12 +228,7 @@ function load_optpage_data_display() {
         $temp = array();
         $value = 0;
         for ($count = 0; $count < sizeof($icon_themes); $count++) {
         $temp = array();
         $value = 0;
         for ($count = 0; $count < sizeof($icon_themes); $count++) {
-            $temp[$count] = $icon_themes[$count]['NAME'];
-            if ($icon_theme == $icon_themes[$count]['PATH'] ||
-                (($icon_theme == $sTplDir.'images/') && ($icon_themes[$count]['PATH']=='template'))
-               ) {
-                $value = $count;
-            }
+            $temp[$icon_themes[$count]['PATH']] = $icon_themes[$count]['NAME'];
         }
         if (sizeof($icon_themes) > 0) {
             $optvals[SMOPT_GRP_GENERAL][] = array(
         }
         if (sizeof($icon_themes) > 0) {
             $optvals[SMOPT_GRP_GENERAL][] = array(
@@ -242,7 +237,6 @@ function load_optpage_data_display() {
                 'type'          => SMOPT_TYPE_STRLIST,
                 'refresh'       => SMOPT_REFRESH_NONE,
                 'posvals'       => $temp,
                 'type'          => SMOPT_TYPE_STRLIST,
                 'refresh'       => SMOPT_REFRESH_NONE,
                 'posvals'       => $temp,
-                'initial_value' => $value,
                 'save'          => 'icon_theme_save'
             );
         }
                 'save'          => 'icon_theme_save'
             );
         }
@@ -492,15 +486,19 @@ function save_option_javascript_autodetect($option) {
  * This function saves the user's icon theme setting
  */
 function icon_theme_save($option) {
  * This function saves the user's icon theme setting
  */
 function icon_theme_save($option) {
-
     global $icon_themes, $data_dir, $username;
 
 
     // Don't assume the new value is there, double check
     // and only save if found
     //
     global $icon_themes, $data_dir, $username;
 
 
     // Don't assume the new value is there, double check
     // and only save if found
     //
-    if (isset($icon_themes[$option->new_value]['PATH']))
-        setPref($data_dir, $username, 'icon_theme', $icon_themes[$option->new_value]['PATH']);
+    $found = false;
+    while (!$found && (list($index, $data) = each($icon_themes))) {
+        if ($data['PATH'] == $option->new_value)
+            $found = true;
+    }
+    if ($found)
+        setPref($data_dir, $username, 'icon_theme', $option->new_value);
     else
        setPref($data_dir, $username, 'icon_theme', 'none');
 
     else
        setPref($data_dir, $username, 'icon_theme', 'none');