2021-02-19 12:23:26 +00:00
|
|
|
<?php
|
|
|
|
|
2021-05-16 14:55:39 +00:00
|
|
|
function nsCommonRequirements() {
|
2022-05-22 15:47:00 +00:00
|
|
|
return (isset($_POST['action'])
|
2022-04-18 14:05:00 +00:00
|
|
|
AND isset($_POST['zone'])
|
|
|
|
AND isset($_POST['ttl-value'])
|
|
|
|
AND isset($_POST['ttl-multiplier'])
|
|
|
|
AND isset($_SESSION['username'])
|
2022-05-22 15:47:00 +00:00
|
|
|
);
|
2021-05-16 14:55:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function nsParseCommonRequirements() {
|
2022-04-18 14:05:00 +00:00
|
|
|
nsCheckZonePossession($_POST['zone']);
|
2021-07-15 13:36:34 +00:00
|
|
|
|
2022-04-18 14:05:00 +00:00
|
|
|
if (($_POST['subdomain'] === "") OR ($_POST['subdomain'] === "@"))
|
|
|
|
$values['domain'] = $_POST['zone'];
|
|
|
|
else
|
2022-06-15 13:30:18 +00:00
|
|
|
$values['domain'] = formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['zone']);
|
2021-05-16 14:55:39 +00:00
|
|
|
|
2022-04-18 14:05:00 +00:00
|
|
|
$values['ttl'] = $_POST['ttl-value'] * $_POST['ttl-multiplier'];
|
2021-03-02 21:56:38 +00:00
|
|
|
|
2022-04-18 14:05:00 +00:00
|
|
|
if (!($values['ttl'] >= 300 AND $values['ttl'] <= 432000))
|
2022-05-20 00:19:45 +00:00
|
|
|
userError("Le TTL doit être compris entre 5 minutes et 5 jours (entre 300 et 432000 secondes).");
|
2021-03-02 21:56:38 +00:00
|
|
|
|
2022-04-18 14:05:00 +00:00
|
|
|
return $values;
|
2021-03-02 21:56:38 +00:00
|
|
|
}
|
|
|
|
|
2021-04-14 12:56:02 +00:00
|
|
|
function nsListUserZones($username) {
|
2022-06-11 21:42:48 +00:00
|
|
|
return query('select', 'zones', ['username' => $username], 'zone');
|
2021-04-14 12:56:02 +00:00
|
|
|
}
|
|
|
|
|
2022-06-15 13:30:18 +00:00
|
|
|
function nsCheckZonePossession($zone) {
|
|
|
|
checkAbsoluteDomainFormat($zone);
|
2021-02-19 12:23:26 +00:00
|
|
|
|
2022-06-15 13:30:18 +00:00
|
|
|
if (!in_array($zone, query('select', 'zones', ['username' => $_SESSION['username']], 'zone'), true))
|
2022-06-11 21:42:48 +00:00
|
|
|
userError("You don't own this zone on the nameserver.");
|
2021-02-19 12:23:26 +00:00
|
|
|
}
|