Esempio n. 1
0
                if (!filter_var($_POST['master'], FILTER_VALIDATE_IP)) {
                    $Result->show("danger", "Master must be an IP address" . " - " . $_POST['master'], true);
                }
            }
        }
    }
    # if update sve old domain !
    if ($_POST['action'] == "edit") {
        $old_domain = $PowerDNS->fetch_domain($_POST['id']);
    }
}
# set update array
$values = array("id" => @$_POST['id'], "master" => @$_POST['master'], "type" => @$_POST['type']);
# name only on add
if ($_POST['action'] == "add") {
    $values['name'] = $_POST['name'];
}
# remove all references if delete
if ($_POST['action'] == "delete") {
    $PowerDNS->remove_all_records($values['id']);
}
# update
if (!$PowerDNS->domain_edit($_POST['action'], $values)) {
    $Result->show("danger", _("Failed to {$_POST['action']} domain") . '!', true);
} else {
    $Result->show("success", _("Domain {$_POST['action']} successfull") . '!', false);
}
# create default records
if ($_POST['action'] == "add" && !isset($_POST['manual'])) {
    $PowerDNS->create_default_records($_POST);
}