110 return false; |
110 return false; |
111 } |
111 } |
112 global $db; |
112 global $db; |
113 // TODO: no need to check for numeric-ness of zone id if we check with validate_input as well? |
113 // TODO: no need to check for numeric-ness of zone id if we check with validate_input as well? |
114 if (is_numeric($record['zid'])) { |
114 if (is_numeric($record['zid'])) { |
115 validate_input($record['zid'], $record['type'], $record['content'], $record['name'], $record['prio'], $record['ttl']); |
115 if (validate_input($record['zid'], $record['type'], $record['content'], $record['name'], $record['prio'], $record['ttl'])) { |
116 $query = "UPDATE records |
116 $query = "UPDATE records |
117 SET name=".$db->quote($record['name']).", |
117 SET name=".$db->quote($record['name']).", |
118 type=".$db->quote($record['type']).", |
118 type=".$db->quote($record['type']).", |
119 content=".$db->quote($record['content']).", |
119 content=".$db->quote($record['content']).", |
120 ttl=".$db->quote($record['ttl']).", |
120 ttl=".$db->quote($record['ttl']).", |
121 prio=".$db->quote($record['prio']).", |
121 prio=".$db->quote($record['prio']).", |
122 change_date=".$db->quote(time())." |
122 change_date=".$db->quote(time())." |
123 WHERE id=".$db->quote($record['rid']); |
123 WHERE id=".$db->quote($record['rid']); |
124 $result = $db->Query($query); |
124 $result = $db->Query($query); |
125 if (PEAR::isError($result)) { |
125 if (PEAR::isError($result)) { |
126 error($result->getMessage()); |
126 error($result->getMessage()); |
127 return false; |
127 return false; |
128 } elseif ($record['type'] != 'SOA') { |
128 } elseif ($record['type'] != 'SOA') { |
129 update_soa_serial($record['zid']); |
129 update_soa_serial($record['zid']); |
|
130 } |
|
131 return true; |
130 } |
132 } |
131 return true; |
133 return false; |
132 } |
134 } |
133 else |
135 else |
134 { |
136 { |
135 // TODO change to error style as above (returning directly) |
137 // TODO change to error style as above (returning directly) |
136 error(sprintf(ERR_INV_ARGC, "edit_record", "no zoneid given")); |
138 error(sprintf(ERR_INV_ARGC, "edit_record", "no zoneid given")); |