Sfoglia il codice sorgente

bugfix: fixed editing of user bindings to mac or address

Dmitriev Roman 1 anno fa
parent
commit
3cc7b44
2 ha cambiato i file con 2 aggiunte e 3 eliminazioni
  1. 1 1
      html/admin/users/edit_rules.php
  2. 1 2
      html/inc/common.php

+ 1 - 1
html/admin/users/edit_rules.php

@@ -28,7 +28,7 @@ if (isset($_POST['s_save'])) {
         $len_all = is_array($_POST['n_id']) ? count($_POST['n_id']) : 0;
         for ($j = 0; $j < $len_all; $j ++) {
             if (intval($_POST['n_id'][$j]) != $save_id) { continue; }
-            $new['type'] = $_POST['s_type'][$j];
+            $new['type'] = $_POST['s_type'][$j]*1;
             $new['rule'] = trim($_POST['s_rule'][$j]);
             if ($new['type'] ==2) {
                 $new['rule'] = mac_dotted($new['rule']);

+ 1 - 2
html/inc/common.php

@@ -2117,11 +2117,10 @@ if (empty($auth_rules)) {
 return $rule_id;
 }
 
-function update_auth_rule($db,$rule,$type,$rule_id)
+function update_auth_rule($db,$rule,$type,$rule_id = 0)
 {
 $new['type']=$type;
 $new['rule']=$rule;
-$rule_id=0;
 $auth_rules = get_record_sql($db,"SELECT * FROM auth_rules WHERE rule='".$rule."' AND type=".$type." AND id<>".$rule_id);
 if (empty($auth_rules)) {
     $rule_id = update_record($db, "auth_rules", "id=".$rule_id, $new);