function update_serial($id_domain) { log_write("debug", "api_namedmanager", "Executing update_serial ( {$id_domain} )"); if ($this->auth_admin) { $obj_domain = new domain(); // validate domain ID input $id_domain = @security_script_input_predefined("int", $id_domain); if (!$id_domain || $id_domain == "error") { throw new SoapFault("Sender", "INVALID_INPUT"); } // verify domain ID $obj_domain->id = $id_domain; if (!$obj_domain->verify_id()) { throw new SoapFault("Sender", "INVALID_ID"); } // apply changes $obj_domain->load_data(); if ($serial = $obj_domain->action_update_serial()) { return $serial; } else { throw new SoapFault("Sender", "UNKNOWN_ERROR"); } } else { throw new SoapFault("Sender", "ACCESS_DENIED"); } }
/* Update record */ log_write("debug", "process", "Updating record " . $record["id"] . " due to changed details"); $obj_record->data_record["name"] = $record["name"]; $obj_record->data_record["type"] = $record["type"]; $obj_record->data_record["content"] = $record["content"]; $obj_record->data_record["ttl"] = $record["ttl"]; $obj_record->data_record["prio"] = $record["prio"]; $obj_record->action_update_record(); } // end for records /* Update domain serial */ $obj_domain->action_update_serial(); // clear messages & replace with custom one $_SESSION["notification"]["message"] = array("Domain imported successfully, configured nameservers will recieve the new configuration shortly."); if (!error_check()) { $sql_obj->trans_commit(); } else { // error encountered log_write("error", "process", "An unexpected error occured, the domain remains unchanged"); $sql_obj->trans_rollback(); } /* Handle Processing Errors */ if (error_check()) { $_SESSION["error"]["form"]["domain_import"] = "failed"; header("Location: ../index.php?page=domains/import.php&mode=2");
$_SESSION["notification"]["message"] = array("Domain updated successfully - name servers scheduled to reload with new domain configuration"); // clear the form_session as the update has been successfully updated $_SESSION['form']['domain_records']['form_session'] = 0; /* Update reverse domains (if appropiate) If there are any reverse domain PTR records set, we will need to update the serial on the domain to reflect the changes. */ log_write("debug", "process", "Updating serials for reverse domains"); if ($data["reverse"]) { foreach ($data["reverse"] as $id_domain) { $obj_reverse = new domain(); $obj_reverse->id = $id_domain; $obj_reverse->load_data(); $obj_reverse->action_update_serial(); log_write("notification", "process", "Updating serials for reverse domain " . $obj_reverse->data["domain_name"] . ""); } } $data["reverse"][] = $obj_record->id; if (!error_check()) { $sql_obj->trans_commit(); } else { // error encountered log_write("error", "process", "An unexpected error occured, the domain remains unchanged"); $sql_obj->trans_rollback(); } // display updated details header("Location: ../index.php?page=domains/records.php&id=" . $obj_domain->id); exit(0); } else {
function action_delete() { log_debug("name_server", "Executing action_delete()"); /* Start Transaction */ $sql_obj = new sql_query(); $sql_obj->trans_begin(); /* Delete Name Server */ $sql_obj->string = "DELETE FROM name_servers WHERE id='" . $this->id . "' LIMIT 1"; $sql_obj->execute(); $sql_obj->string = "DELETE FROM cloud_zone_map WHERE id='" . $this->id . "'"; $sql_obj->execute(); /* Un-associated any matched log entries */ $sql_obj->string = "UPDATE logs SET id_server='0' WHERE id_server='" . $this->id . "'"; $sql_obj->execute(); /* Update NS records We need to run through all the domains and update the records - if the nameserver was an automated entry for all the domains, after deleting the name server we should remove it from all the domains. */ $obj_domain = new domain(); $obj_domain->load_data_all(); foreach ($obj_domain->data as $data_domain) { $obj_domain_sub = new domain(); $obj_domain_sub->id = $data_domain["id"]; $obj_domain_sub->load_data(); $obj_domain_sub->action_update_ns(); $obj_domain_sub->action_update_serial(); } /* Commit */ if (error_check()) { $sql_obj->trans_rollback(); log_write("error", "name_server", "An error occured whilst trying to delete the name server."); return 0; } else { $sql_obj->trans_commit(); log_write("notification", "name_server", "Name server has been successfully deleted."); return 1; } }