/* Check for a new value. */
if ( !sqgetGlobalVar("new_$name", $this->new_value, SQ_POST ) ) {
- $this->new_value = '';
+ $this->new_value = NULL;
}
/* Set the default save function. */
global $color;
// Use new value if available
- if (!empty($this->new_value)) {
+ if (!is_null($this->new_value)) {
$tempValue = $this->value;
$this->value = $this->new_value;
}
$result .= $this->post_script;
// put correct value back if need be
- if (!empty($this->new_value)) {
+ if (!is_null($this->new_value)) {
$this->value = $tempValue;
}
} else if ($option->is_multiple_valued())
setPref($data_dir, $username, $option->name, serialize($option->new_value));
+ // Checkboxes, when unchecked, don't submit anything in
+ // the POST, so set to SMPREF_OFF if not found
+ //
+ else if (($option->type == SMOPT_TYPE_BOOLEAN
+ || $option->type == SMOPT_TYPE_BOOLEAN_CHECKBOX)
+ && empty($option->new_value))
+ setPref($data_dir, $username, $option->name, SMPREF_OFF);
+
else
setPref($data_dir, $username, $option->name, $option->new_value);