Supress PHP errors because we catch them ourselves.
[squirrelmail.git] / functions / options.php
index 1828271598096f724798f3f91bcfcffaeec97ab8..fd6e2fd6dac937052655af4e914a5157fca67f3f 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * options.php
  *
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Functions needed to display the options pages.
@@ -91,9 +91,7 @@ class SquirrelOption {
         }
 
         /* Check for a new value. */
-        if (isset($_POST["new_$name"])) {
-            $this->new_value = $_POST["new_$name"];
-        } else {
+       if ( !sqgetGlobalVar("new_$name", $this->new_value, SQ_POST ) ) {
             $this->new_value = '';
         }
 
@@ -330,12 +328,11 @@ class SquirrelOption {
 }
 
 function save_option($option) {
-    if ( (float)substr(PHP_VERSION,0,3) < 4.1 ) {
-        global $_SESSION;
+    if ( !sqgetGlobalVar('username', $username, SQ_SESSION ) ) {
+        /* Can't save the pref if we don't have the username */
+        return;
     }
     global $data_dir;
-    $username = $_SESSION['username'];
-
     setPref($data_dir, $username, $option->name, $option->new_value);
 }