浏览代码

use new function to get POST variables

Erin Schnabel 22 年之前
父节点
当前提交
5ec388426b
共有 1 个文件被更改,包括 4 次插入7 次删除
  1. 4 7
      functions/options.php

+ 4 - 7
functions/options.php

@@ -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 ( !check_php_version(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);
 }