37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
function nsCommonRequirements() {
|
|
return (isset($_POST['action'])
|
|
AND isset($_POST['zone'])
|
|
AND isset($_POST['ttl-value'])
|
|
AND isset($_POST['ttl-multiplier'])
|
|
AND isset($_SESSION['username'])
|
|
);
|
|
}
|
|
|
|
function nsParseCommonRequirements() {
|
|
nsCheckZonePossession($_POST['zone']);
|
|
|
|
if (($_POST['subdomain'] === "") OR ($_POST['subdomain'] === "@"))
|
|
$values['domain'] = $_POST['zone'];
|
|
else
|
|
$values['domain'] = formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['zone']);
|
|
|
|
$values['ttl'] = $_POST['ttl-value'] * $_POST['ttl-multiplier'];
|
|
|
|
if (!($values['ttl'] >= 300 AND $values['ttl'] <= 432000))
|
|
userError("Le TTL doit être compris entre 5 minutes et 5 jours (entre 300 et 432000 secondes).");
|
|
|
|
return $values;
|
|
}
|
|
|
|
function nsListUserZones($username) {
|
|
return query('select', 'zones', ['username' => $username], 'zone');
|
|
}
|
|
|
|
function nsCheckZonePossession($zone) {
|
|
checkAbsoluteDomainFormat($zone);
|
|
|
|
if (!in_array($zone, query('select', 'zones', ['username' => $_SESSION['username']], 'zone'), true))
|
|
userError("You don't own this zone on the nameserver.");
|
|
}
|