Example #1
0
require "../include/config.php";
require "../include/amberphplib/main.php";
require "../include/application/main.php";
if (user_permissions_get('namedadmins')) {
    /*
    	Form Input
    */
    $obj_domain = new domain();
    $obj_domain->id = security_form_input_predefined("int", "id_domain", 0, "");
    // are we editing an existing domain or adding a new one?
    if ($obj_domain->id) {
        if (!$obj_domain->verify_id()) {
            log_write("error", "process", "The domain you have attempted to edit - " . $obj_name_server->id . " - does not exist in this system.");
        } else {
            // load existing data
            $obj_domain->load_data();
            // fetch domain data
            $obj_domain->data["domain_name"] = security_form_input_predefined("any", "domain_name", 1, "");
            $obj_domain->data["domain_description"] = security_form_input_predefined("any", "domain_description", 0, "");
        }
    } else {
        // new domain, can have some special input like IPV4 reverse
        $obj_domain->data["domain_type"] = security_form_input_predefined("any", "domain_type", 1, "");
        if ($obj_domain->data["domain_type"] == "domain_standard") {
            $obj_domain->data["domain_name"] = security_form_input_predefined("any", "domain_name", 1, "");
            $obj_domain->data["domain_description"] = security_form_input_predefined("any", "domain_description", 0, "");
        } elseif ($obj_domain->data["domain_type"] == "domain_reverse_ipv4") {
            // fetch domain data
            $obj_domain->data["ipv4_network"] = security_form_input_predefined("ipv4_cidr", "ipv4_network", 1, "Must supply full IPv4 network address");
            $obj_domain->data["ipv4_autofill"] = security_form_input_predefined("checkbox", "ipv4_autofill", 0, "");
            $obj_domain->data["ipv4_autofill_forward"] = security_form_input_predefined("checkbox", "ipv4_autofill_forward", 0, "");
Example #2
0
 // clear messages & replace with custom one
 $_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);
Example #3
0
 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");
     }
 }
Example #4
0
 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;
     }
 }