From 991c88e71dc934df78cc7db33bceac29e0343c98 Mon Sep 17 00:00:00 2001 From: stevetruckstuff Date: Tue, 22 Aug 2006 18:56:16 +0000 Subject: [PATCH] Changes on 18 August to functions.php were intended to correct issue with the $icon_theme preference not being grabbed correctly. Unfortunately, it has come to light that this change has broken several other preferences. This patch undoes the changes from 18 August and changes the handling of the $icon_theme pref so that it is handled correctly. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11623 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/options.php | 16 ++-------------- include/load_prefs.php | 6 ++---- include/options/display.php | 18 ++++++++---------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/functions/options.php b/functions/options.php index a8236919..7b60af67 100644 --- a/functions/options.php +++ b/functions/options.php @@ -175,20 +175,8 @@ class SquirrelOption { $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; diff --git a/include/load_prefs.php b/include/load_prefs.php index fc54fdd1..f9e6346d 100644 --- a/include/load_prefs.php +++ b/include/load_prefs.php @@ -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/' ); -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. */ -$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 ); diff --git a/include/options/display.php b/include/options/display.php index 0a2db96f..2c93798e 100644 --- a/include/options/display.php +++ b/include/options/display.php @@ -228,12 +228,7 @@ function load_optpage_data_display() { $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( @@ -242,7 +237,6 @@ function load_optpage_data_display() { 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_NONE, 'posvals' => $temp, - 'initial_value' => $value, '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) { - 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'); -- 2.25.1