Esempio n. 1
0
         print "\t<a class='btn btn-default btn-xs hidePopupsReload'>" . _('No') . "</a>";
         print "\t</div>";
         print _('Do you wish to delete DNS zone and all records') . "?<br>";
         print "\t&nbsp;&nbsp; DNS zone <strong>{$domain->name}</strong></li>";
         print " <form name='domainEdit' id='domainEdit'><input type='hidden' name='action' value='delete'><input type='hidden' name='id' value='{$domain->id}'></form>";
         print "\t<div class='domain-edit-result'></div>";
         print "</div>";
     }
 } elseif ($_POST['action'] == "add" && @$_POST['DNSrecursive'] == "1") {
     // if zone exists do nothing, otherwise create zone
     if ($domain === false) {
         // use default values
         $values = json_decode($User->settings->powerDNS, true);
         $values['name'] = $zone;
         // create domain
         $PowerDNS->domain_edit("add", array("name" => $zone, "type" => "NATIVE"));
         // create default records
         $PowerDNS->create_default_records($values);
     }
 } elseif ($_POST['action'] == "edit" && $_POST['DNSrecursive'] != $subnet_old_details['DNSrecursive']) {
     // remove domain
     if (!isset($_POST['DNSrecursive']) && $domain !== false) {
         print "<hr><p class='hidden alert-danger'></p>";
         print "<div class='alert alert-warning'>";
         print "\t<div class='btn-group pull-right'>";
         print "\t<a class='btn btn-danger btn-xs' id='editDomainSubmit'>" . _('Yes') . "</a>";
         print "\t<a class='btn btn-default btn-xs hidePopupsReload'>" . _('No') . "</a>";
         print "\t</div>";
         print _('Do you wish to delete DNS zone and all records') . "?<br>";
         print "\t&nbsp;&nbsp; DNS zone <strong>{$domain->name}</strong></li>";
         print " <form name='domainEdit' id='domainEdit'><input type='hidden' name='action' value='delete'><input type='hidden' name='id' value='{$domain->id}'></form>";
Esempio n. 2
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);
}