Commit 2f8d5912de5fe573e6812222fe1cc48b4e0875e6

Authored by root
1 parent b3fe75a4

sorting problem

lib/smbind.class.php
@@ -1093,15 +1093,16 @@ @@ -1093,15 +1093,16 @@
1093 $this->record['pri'] = 0; 1093 $this->record['pri'] = 0;
1094 } 1094 }
1095 if ((is_numeric($this->record['id'])) && ($this->record['id'] > 0)) { 1095 if ((is_numeric($this->record['id'])) && ($this->record['id'] > 0)) {
1096 - $res = $this->db->query("UPDATE records SET " . 1096 + $sq = "UPDATE records SET " .
1097 "zone = " . $this->record['zone'] . ", " . 1097 "zone = " . $this->record['zone'] . ", " .
1098 "host = '" . $this->record['host'] . "', " . 1098 "host = '" . $this->record['host'] . "', " .
1099 "ttl = " . $this->record['ttl'] . ", " . 1099 "ttl = " . $this->record['ttl'] . ", " .
1100 "type = '" . $this->record['type'] . "', " . 1100 "type = '" . $this->record['type'] . "', " .
1101 "pri = " . $this->record['pri'] . ", " . 1101 "pri = " . $this->record['pri'] . ", " .
1102 "destination = '" . $this->record['destination'] . 1102 "destination = '" . $this->record['destination'] .
1103 - "' WHERE id = " . $this->record['id']  
1104 - ); 1103 + "' WHERE id = " . $this->record['id'];
  1104 + $res = $this->db->query($sq);
  1105 +// error_log($sq);
1105 if (MDB2::isError($res)) { 1106 if (MDB2::isError($res)) {
1106 $this->err .= $res->getMessage() . "\n" . $res->getDebugInfo(); 1107 $this->err .= $res->getMessage() . "\n" . $res->getDebugInfo();
1107 error_log($this->err); 1108 error_log($this->err);
@@ -1115,14 +1116,15 @@ @@ -1115,14 +1116,15 @@
1115 $this->record['id'] = $id; 1116 $this->record['id'] = $id;
1116 return true; 1117 return true;
1117 } else { 1118 } else {
1118 - $res = $this->db->query("INSERT INTO records (zone, host, ttl, type, pri, destination) VALUES (" . 1119 + $sq = "INSERT INTO records (zone, host, ttl, type, pri, destination) VALUES (" .
1119 $this->record['zone'] . ", '" . 1120 $this->record['zone'] . ", '" .
1120 $this->record['host'] . "', " . 1121 $this->record['host'] . "', " .
1121 $this->record['ttl'] . ", '" . 1122 $this->record['ttl'] . ", '" .
1122 $this->record['type'] . "', " . 1123 $this->record['type'] . "', " .
1123 $this->record['pri'] . ", '" . 1124 $this->record['pri'] . ", '" .
1124 - $this->record['destination'] . "')"  
1125 - ); 1125 + $this->record['destination'] . "')";
  1126 + $res = $this->db->query($sq);
  1127 +// error_log($sq);
1126 if (MDB2::isError($res)) { 1128 if (MDB2::isError($res)) {
1127 $this->err .= $res->getMessage() . "\n" . $res->getDebugInfo(); 1129 $this->err .= $res->getMessage() . "\n" . $res->getDebugInfo();
1128 error_log($this->err); 1130 error_log($this->err);
@@ -1155,7 +1157,9 @@ @@ -1155,7 +1157,9 @@
1155 1157
1156 public function eraseRecord() { 1158 public function eraseRecord() {
1157 if ($this->is_identified()) { 1159 if ($this->is_identified()) {
1158 - $res = $this->db->query("DELETE FROM records WHERE id = " . $this->record['id']); 1160 + $sq = "DELETE FROM records WHERE id = " . $this->record['id'];
  1161 +// error_log($sq);
  1162 + $res = $this->db->query($sq);
1159 if (MDB2::isError($res)) { 1163 if (MDB2::isError($res)) {
1160 $this->err .= $res->getMessage() . "\n" . $res->getDebugInfo(); 1164 $this->err .= $res->getMessage() . "\n" . $res->getDebugInfo();
1161 error_log($this->err); 1165 error_log($this->err);
src/recordread.php
@@ -31,6 +31,7 @@ if ($znum) { @@ -31,6 +31,7 @@ if ($znum) {
31 $smarty->assign("zone", $zonerec); 31 $smarty->assign("zone", $zonerec);
32 $smarty->assign("pagetitle", "Editing master zone"); 32 $smarty->assign("pagetitle", "Editing master zone");
33 $smarty->assign("rcount", sizeof($rec)); 33 $smarty->assign("rcount", sizeof($rec));
  34 +// error_log(sizeof($rec));
34 $smarty->assign("record",$rec); 35 $smarty->assign("record",$rec);
35 $smarty->assign("types", $types); 36 $smarty->assign("types", $types);
36 $smarty->assign("userlist", $users); 37 $smarty->assign("userlist", $users);
src/recordwrite.php
@@ -29,11 +29,14 @@ if ($znum) { @@ -29,11 +29,14 @@ if ($znum) {
29 $nrec[$key] = (($key == 'host') && ($nrec[$key] == '')) ? '@' :$nrec[$key]; 29 $nrec[$key] = (($key == 'host') && ($nrec[$key] == '')) ? '@' :$nrec[$key];
30 $nrec[$key] = (($key == 'destination') && ($nrec[$key] == '')) ? '@' :$nrec[$key]; 30 $nrec[$key] = (($key == 'destination') && ($nrec[$key] == '')) ? '@' :$nrec[$key];
31 } 31 }
32 - if ($nrec['host'] != $nrec['destination']) {  
33 - $urec = new masterRecord(intval($_POST['host_id'][$x]));  
34 - $urec->loadRecord();  
35 - $urec->setRecord($nrec);  
36 - $xrec = $urec->getRecordRaw(); 32 + if (strtoupper($nrec['type']) != 'MX') $nrec['pri'] = '0';
  33 + $urec = new masterRecord(intval($_POST['host_id'][$x]));
  34 + $urec->loadRecord();
  35 + $xrec = serialize($urec->getRecordRaw());
  36 + $urec->setRecord($nrec);
  37 + $yrec = serialize($urec->getRecordRaw());
  38 + if ($xrec != $yrec) {
  39 +// error_log($yrec . "#" . $xrec);
37 $urec->saveRecord(); 40 $urec->saveRecord();
38 } 41 }
39 } 42 }
templates/recordread.tpl
@@ -96,7 +96,7 @@ @@ -96,7 +96,7 @@
96 </tr> 96 </tr>
97 {/section} 97 {/section}
98 </table>{else}<p>There are no other records in this zone at the moment.</p>{/if} 98 </table>{else}<p>There are no other records in this zone at the moment.</p>{/if}
99 -<input type=hidden name=total value="{$smarty.section.i.total}"> 99 +<input type=hidden name=total value="{$rcount}">
100 </div></div> 100 </div></div>
101 <div class=submit><input class=submit-button type=submit name=Submit value="Save">&nbsp;<input type=button class=submit-button id=cancel value="Cancel" name ="cancel"></div> 101 <div class=submit><input class=submit-button type=submit name=Submit value="Save">&nbsp;<input type=button class=submit-button id=cancel value="Cancel" name ="cancel"></div>
102 </form> 102 </form>