Esempio n. 1
0
                $masters = array_filter(explode(",", $_POST['master']));
                foreach ($masters as $m) {
                    if (!filter_var($m, FILTER_VALIDATE_IP)) {
                        $Result->show("danger", "Master must be an IP address" . " - " . $m, true);
                    }
                }
            } else {
                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);
Esempio n. 2
0
                break;
            }
        }
        // die if not existing
        if (!is_numeric($_POST['domain_id'])) {
            $Result->show("danger", _("Domain does not exist"), true, true);
        } else {
            $record = new StdClass();
            $record->ttl = 3600;
            $record->name = $post['domain_id'];
            $record->content = $_POST['id'];
        }
    }
}
// get domain
$domain = $PowerDNS->fetch_domain($_POST['domain_id']);
$domain !== false ?: $Result->show("danger", _("Invalid ID"), true, true);
// default
if (!isset($record)) {
    $record = new StdClass();
    $record->ttl = 3600;
    $record->name = $domain->name;
}
# disable edit on delete
$readonly = $_POST['action'] == "delete" ? "readonly" : "";
?>


<!-- header -->
<div class="pHeader"><?php 
print ucwords(_("{$_POST['action']}"));