Commit 2f8d5912de5fe573e6812222fe1cc48b4e0875e6
1 parent
b3fe75a4
sorting problem
Showing
4 changed files
with
21 additions
and
13 deletions
lib/smbind.class.php
... | ... | @@ -1093,15 +1093,16 @@ |
1093 | 1093 | $this->record['pri'] = 0; |
1094 | 1094 | } |
1095 | 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 | 1097 | "zone = " . $this->record['zone'] . ", " . |
1098 | 1098 | "host = '" . $this->record['host'] . "', " . |
1099 | 1099 | "ttl = " . $this->record['ttl'] . ", " . |
1100 | 1100 | "type = '" . $this->record['type'] . "', " . |
1101 | 1101 | "pri = " . $this->record['pri'] . ", " . |
1102 | 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 | 1106 | if (MDB2::isError($res)) { |
1106 | 1107 | $this->err .= $res->getMessage() . "\n" . $res->getDebugInfo(); |
1107 | 1108 | error_log($this->err); |
... | ... | @@ -1115,14 +1116,15 @@ |
1115 | 1116 | $this->record['id'] = $id; |
1116 | 1117 | return true; |
1117 | 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 | 1120 | $this->record['zone'] . ", '" . |
1120 | 1121 | $this->record['host'] . "', " . |
1121 | 1122 | $this->record['ttl'] . ", '" . |
1122 | 1123 | $this->record['type'] . "', " . |
1123 | 1124 | $this->record['pri'] . ", '" . |
1124 | - $this->record['destination'] . "')" | |
1125 | - ); | |
1125 | + $this->record['destination'] . "')"; | |
1126 | + $res = $this->db->query($sq); | |
1127 | +// error_log($sq); | |
1126 | 1128 | if (MDB2::isError($res)) { |
1127 | 1129 | $this->err .= $res->getMessage() . "\n" . $res->getDebugInfo(); |
1128 | 1130 | error_log($this->err); |
... | ... | @@ -1155,7 +1157,9 @@ |
1155 | 1157 | |
1156 | 1158 | public function eraseRecord() { |
1157 | 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 | 1163 | if (MDB2::isError($res)) { |
1160 | 1164 | $this->err .= $res->getMessage() . "\n" . $res->getDebugInfo(); |
1161 | 1165 | error_log($this->err); | ... | ... |
src/recordread.php
... | ... | @@ -31,6 +31,7 @@ if ($znum) { |
31 | 31 | $smarty->assign("zone", $zonerec); |
32 | 32 | $smarty->assign("pagetitle", "Editing master zone"); |
33 | 33 | $smarty->assign("rcount", sizeof($rec)); |
34 | +// error_log(sizeof($rec)); | |
34 | 35 | $smarty->assign("record",$rec); |
35 | 36 | $smarty->assign("types", $types); |
36 | 37 | $smarty->assign("userlist", $users); | ... | ... |
src/recordwrite.php
... | ... | @@ -29,11 +29,14 @@ if ($znum) { |
29 | 29 | $nrec[$key] = (($key == 'host') && ($nrec[$key] == '')) ? '@' :$nrec[$key]; |
30 | 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 | 40 | $urec->saveRecord(); |
38 | 41 | } |
39 | 42 | } | ... | ... |
templates/recordread.tpl
... | ... | @@ -96,7 +96,7 @@ |
96 | 96 | </tr> |
97 | 97 | {/section} |
98 | 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 | 100 | </div></div> |
101 | 101 | <div class=submit><input class=submit-button type=submit name=Submit value="Save"> <input type=button class=submit-button id=cancel value="Cancel" name ="cancel"></div> |
102 | 102 | </form> | ... | ... |