$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;
// 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 );
$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(
'type' => SMOPT_TYPE_STRLIST,
'refresh' => SMOPT_REFRESH_NONE,
'posvals' => $temp,
- 'initial_value' => $value,
'save' => 'icon_theme_save'
);
}
* 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');