Fixed: FS#838 - DNS serial is updated by viewing records.
Changed: removed datalog update function in tform.inc.php and just left the stub function there for legacy support with a call to the new function in the db_mysql.inc.php.
| | |
| | | } |
| | | */ |
| | | |
| | | //** Function to fill the datalog with a full differential record. |
| | | public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new) { |
| | | global $app,$conf; |
| | | |
| | | // Insert backticks only for incomplete table names. |
| | | if(stristr($db_table,'.')) { |
| | | $escape = ''; |
| | | } else { |
| | | $escape = '`'; |
| | | } |
| | | |
| | | public function diffrec($record_old, $record_new) { |
| | | $diffrec_full = array(); |
| | | $diff_num = 0; |
| | | |
| | | if(is_array($record_old) && count($record_old) > 0) { |
| | | foreach($record_old as $key => $val) { |
| | | if(!isset($record_new[$key]) || $record_new[$key] != $val) { |
| | | // if(!isset($record_new[$key]) || $record_new[$key] != $val) { |
| | | if($record_new[$key] != $val) { |
| | | // Record has changed |
| | | $diffrec_full['old'][$key] = $val; |
| | | $diffrec_full['new'][$key] = $record_new[$key]; |
| | |
| | | } |
| | | } |
| | | |
| | | return array('diff_num' => $diff_num, 'diff_rec' => $diffrec_full); |
| | | |
| | | } |
| | | |
| | | //** Function to fill the datalog with a full differential record. |
| | | public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new) { |
| | | global $app,$conf; |
| | | |
| | | // Insert backticks only for incomplete table names. |
| | | if(stristr($db_table,'.')) { |
| | | $escape = ''; |
| | | } else { |
| | | $escape = '`'; |
| | | } |
| | | |
| | | $tmp = $this->diffrec($record_old, $record_new); |
| | | $diffrec_full = $tmp['diff_rec']; |
| | | $diff_num = $tmp['diff_num']; |
| | | unset($tmp); |
| | | |
| | | // Insert the server_id, if the record has a server_id |
| | | $server_id = (isset($record_old["server_id"]) && $record_old["server_id"] > 0)?$record_old["server_id"]:0; |
| | | if(isset($record_new["server_id"])) $server_id = $record_new["server_id"]; |
| | | |
| | | |
| | | if($diff_num > 0) { |
| | | //print_r($diff_num); |
| | | //print_r($diffrec_full); |
| | | $diffstr = $app->db->quote(serialize($diffrec_full)); |
| | | $username = $app->db->quote($_SESSION["s"]["user"]["username"]); |
| | | $dbidx = $primary_field.":".$primary_id; |
| | |
| | | |
| | | function datalogSave($action,$primary_id, $record_old, $record_new) { |
| | | global $app,$conf; |
| | | |
| | | |
| | | $app->db->datalogSave($this->formDef['db_table'], $action, $this->formDef['db_table_idx'], $primary_id, $record_old, $record_new); |
| | | return true; |
| | | |
| | | /* |
| | | // Add backticks for incomplete table names. |
| | | if(stristr($this->formDef['db_table'],'.')) { |
| | | $escape = ''; |
| | |
| | | } |
| | | |
| | | $this->diffrec = array(); |
| | | /* |
| | | if(is_array($record_new) && count($record_new) > 0) { |
| | | foreach($record_new as $key => $val) { |
| | | if(@$record_old[$key] != $val) { |
| | | // Record has changed |
| | | $diffrec[$key] = array('old' => @$record_old[$key], |
| | | 'new' => $val); |
| | | } |
| | | } |
| | | } elseif(is_array($record_old)) { |
| | | foreach($record_old as $key => $val) { |
| | | if($record_new[$key] != $val) { |
| | | // Record has changed |
| | | $diffrec[$key] = array('new' => $record_new[$key], |
| | | 'old' => $val); |
| | | } |
| | | } |
| | | } |
| | | $this->diffrec = $diffrec; |
| | | */ |
| | | |
| | | // Full diff records for ISPConfig, they have a different format then the simple diffrec |
| | | $diffrec_full = array(); |
| | |
| | | } |
| | | |
| | | return true; |
| | | */ |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /* |
| | | // Update the serial number of the SOA record |
| | | $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = ".$this->id); |
| | | $this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]); |
| | | */ |
| | | |
| | | |
| | | //* Check if soa, ns and mbox have a dot at the end |
| | |
| | | function onAfterUpdate() { |
| | | global $app, $conf; |
| | | |
| | | $tmp = $app->db->diffrec($this->oldDataRecord,$app->tform->getDataRecord($this->id)); |
| | | if($tmp['diff_num'] > 0) { |
| | | // Update the serial number of the SOA record |
| | | $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = ".$this->id); |
| | | $app->db->query("UPDATE dns_soa SET serial = '".$app->validate_dns->increase_serial($soa["serial"])."' WHERE id = ".$this->id); |
| | | } |
| | | |
| | | // make sure that the record belongs to the client group and not the admin group when a dmin inserts it |
| | | if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { |
| | | $client_group_id = intval($this->dataRecord["client_group_id"]); |