router.php + process form before display
The webservers now need to send every request to router.php, which will call appropriate files. Forms will be treated before being displayed.
This commit is contained in:
parent
7a35ebccc5
commit
e3af4c946d
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
define("CONF", parse_ini_file(__DIR__ . "/../config.ini", true, INI_SCANNER_TYPED));
|
||||
|
||||
define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(CONF['common']['prefix']) + 1));
|
||||
define("PAGE", basename($_SERVER['PHP_SELF'], '.php'));
|
||||
define("DB_PATH", CONF['common']['root_path'] . "/db/niver.db"); // Niver's SQLite database
|
||||
|
||||
define("PLACEHOLDER_DOMAIN", "example"); // From RFC2606: Reserved Top Level DNS Names > 2. TLDs for Testing, & Documentation Examples
|
||||
define("PLACEHOLDER_IPV6", "2001:db8::3"); // From RFC3849: IPv6 Address Prefix Reserved for Documentation
|
||||
define("PLACEHOLDER_IPV4", "203.0.113.42"); // From RFC5737: IPv4 Address Blocks Reserved for Documentation
|
||||
|
||||
foreach (array_diff(scandir(CONF['common']['root_path'] . "/fn"), array('..', '.')) as $file)
|
||||
require CONF['common']['root_path'] . '/fn/' . $file;
|
||||
|
||||
// Page titles definition
|
||||
require "pages.php";
|
|
@ -21,14 +21,14 @@ function serverError($msg) {
|
|||
closeHTML();
|
||||
}
|
||||
|
||||
// For use in pages that first display a form and then process it
|
||||
function switchToFormProcess($requireLogin = true) {
|
||||
function processForm($requireLogin = true) {
|
||||
if (empty($_POST) AND $requireLogin AND !isset($_SESSION['username']))
|
||||
echo '<p>Ce formulaire ne sera pas accepté car il faut <a class="auth" href="' . redirUrl('auth/login') . '">se connecter</a> avant.</p>';
|
||||
if (empty($_POST))
|
||||
closeHTML();
|
||||
return false;
|
||||
if ($requireLogin AND !isset($_SESSION['username']))
|
||||
userError("Vous devez être connecté·e pour effectuer cette action.");
|
||||
return true;
|
||||
}
|
||||
|
||||
function query($action, $table, $conditions = [], $column = NULL) {
|
||||
|
@ -79,7 +79,7 @@ function displayIndex() { ?>
|
|||
|
||||
function redirUrl($pageId) {
|
||||
$currentPath = '';
|
||||
if (SERVICE !== '') $currentPath .= SERVICE . '/';
|
||||
if (SERVICE !== '.') $currentPath .= SERVICE . '/';
|
||||
if (PAGE !== 'index') $currentPath .= PAGE;
|
||||
return CONF['common']['prefix'] . "/$pageId?redir=$currentPath";
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
require "init.php";
|
||||
|
||||
// Session initialisation (with cookies)
|
||||
if (
|
||||
isset($_COOKIE['niver-session-key']) // Resume session
|
||||
|
@ -39,7 +37,7 @@ if (isset($page['service']))
|
|||
echo strip_tags(TITLES['index']);
|
||||
?></title>
|
||||
<?php
|
||||
foreach (array_diff(scandir(CONF['common']['root_path'] . "/public/css"), array('..', '.')) as $cssPath)
|
||||
foreach (array_diff(scandir(CONF['common']['root_path'] . "/css"), array('..', '.')) as $cssPath)
|
||||
echo ' <link type="text/css" rel="stylesheet" media="screen" href="' . CONF['common']['prefix'] . '/css/' . $cssPath . '">' . "\n";
|
||||
?>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
@ -92,9 +92,3 @@ define('DESCRIPTIONS', [
|
|||
],
|
||||
]
|
||||
);
|
||||
|
||||
if (SERVICE !== '') {
|
||||
$page['service'] = TITLES[SERVICE]['index'];
|
||||
if (PAGE !== 'index')
|
||||
$page['title'] = TITLES[SERVICE][PAGE];
|
||||
}
|
|
@ -1,5 +1 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<?php displayIndex(); ?>
|
||||
|
||||
<?php closeHTML(); ?>
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>Pas de compte ? <a class="auth" href="register">En créer un</a></p>
|
||||
|
||||
<form method="post">
|
||||
<label for="username">Identifiant</label><br>
|
||||
<input required="" minlength="4" maxlength="32" pattern="<?= USERNAME_REGEX ?>" id="username" name="username" type="text" placeholder="<?= PLACEHOLDER_USERNAME ?>">
|
||||
<br>
|
||||
|
||||
<label for="password">Clé de passe</label><br>
|
||||
<input required="" autocomplete="current-password" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" id="password" name="password" type="password" placeholder="<?= PLACEHOLDER_PASSWORD ?>">
|
||||
<br>
|
||||
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess(requireLogin: false);
|
||||
|
||||
if (processForm(false)) {
|
||||
checkPasswordFormat($_POST['password']);
|
||||
|
||||
checkUsernameFormat($_POST['username']);
|
||||
|
@ -36,3 +19,20 @@ if (outdatedPasswordHash($_SESSION['username']))
|
|||
redir();
|
||||
|
||||
success("Connecté·e.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>Pas de compte ? <a class="auth" href="register">En créer un</a></p>
|
||||
|
||||
<form method="post">
|
||||
<label for="username">Identifiant</label><br>
|
||||
<input required="" minlength="4" maxlength="32" pattern="<?= USERNAME_REGEX ?>" id="username" name="username" type="text" placeholder="<?= PLACEHOLDER_USERNAME ?>">
|
||||
<br>
|
||||
|
||||
<label for="password">Clé de passe</label><br>
|
||||
<input required="" autocomplete="current-password" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" id="password" name="password" type="password" placeholder="<?= PLACEHOLDER_PASSWORD ?>">
|
||||
<br>
|
||||
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<?php
|
||||
|
||||
if (session_status() === PHP_SESSION_ACTIVE)
|
||||
|
|
|
@ -1,4 +1,17 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (processForm()) {
|
||||
checkPasswordFormat($_POST['newPassword']);
|
||||
|
||||
if (checkPassword($_SESSION['username'], $_POST['currentPassword']) !== true)
|
||||
userError("Changement impossible : clé de passe invalide.");
|
||||
|
||||
changePassword($_SESSION['username'], $_POST['newPassword']);
|
||||
|
||||
success("Clé de passe changée.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
Vous pouvez ici changer la clé de passe permettant d'accéder à votre compte Niver.
|
||||
|
@ -13,16 +26,3 @@
|
|||
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
checkPasswordFormat($_POST['newPassword']);
|
||||
|
||||
if (checkPassword($_SESSION['username'], $_POST['currentPassword']) !== true)
|
||||
userError("Changement impossible : clé de passe invalide.");
|
||||
|
||||
changePassword($_SESSION['username'], $_POST['newPassword']);
|
||||
|
||||
success("Clé de passe changée.");
|
||||
|
|
|
@ -1,30 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>Déjà un compte ? <a class="auth" href="login">Se connecter</a></p>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<details>
|
||||
<summary><label for="username">Identifiant</label></summary>
|
||||
Uniquement composé de lettres minuscules.
|
||||
</details>
|
||||
<input id="username" maxlength="32" pattern="<?= USERNAME_REGEX ?>" required="" name="username" type="text" placeholder="<?= PLACEHOLDER_USERNAME ?>"><br>
|
||||
|
||||
<details>
|
||||
<summary><label for="password">Clé de passe</label></summary>
|
||||
<p>Une clé de passe sécurisée est trop compliquée à deviner pour une attaque qui testerais automatiquement plein de clés de passe tout en connaissant d'autres informations et secrets sur vous.</p>
|
||||
<p>Minimum 8 caractères si elle contient minuscule, majuscule et chiffre, ou minimum 10 caractères sinon.</p>
|
||||
</details>
|
||||
|
||||
<input autocomplete="new-password" id="password" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" required="" name="password" type="password" placeholder="<?= PLACEHOLDER_PASSWORD ?>"><br>
|
||||
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess(requireLogin: false);
|
||||
|
||||
if (processForm(false)) {
|
||||
checkPasswordFormat($_POST['password']);
|
||||
|
||||
checkUsernameFormat($_POST['username']);
|
||||
|
@ -64,3 +40,27 @@ $_SESSION['username'] = $_POST['username'];
|
|||
redir();
|
||||
|
||||
success("Compte créé.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>Déjà un compte ? <a class="auth" href="login">Se connecter</a></p>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<details>
|
||||
<summary><label for="username">Identifiant</label></summary>
|
||||
Uniquement composé de lettres minuscules.
|
||||
</details>
|
||||
<input id="username" maxlength="32" pattern="<?= USERNAME_REGEX ?>" required="" name="username" type="text" placeholder="<?= PLACEHOLDER_USERNAME ?>"><br>
|
||||
|
||||
<details>
|
||||
<summary><label for="password">Clé de passe</label></summary>
|
||||
<p>Une clé de passe sécurisée est trop compliquée à deviner pour une attaque qui testerais automatiquement plein de clés de passe tout en connaissant d'autres informations et secrets sur vous.</p>
|
||||
<p>Minimum 8 caractères si elle contient minuscule, majuscule et chiffre, ou minimum 10 caractères sinon.</p>
|
||||
</details>
|
||||
|
||||
<input autocomplete="new-password" id="password" minlength="8" maxlength="1024" pattern="<?= PASSWORD_REGEX ?>" required="" name="password" type="password" placeholder="<?= PLACEHOLDER_PASSWORD ?>"><br>
|
||||
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<form method="post">
|
||||
<input type="checkbox" name="delete" id="delete">
|
||||
<label for="delete">Supprimer mon compte et toutes ses données</label>
|
||||
<br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
if (!isset($_POST['delete']))
|
||||
userError("Il faut confirmer la suppression du compte");
|
||||
|
||||
|
@ -47,3 +37,13 @@ query('delete', 'users', ['username' => $_SESSION['username']]);
|
|||
redir();
|
||||
|
||||
success("Compte supprimé.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<form method="post">
|
||||
<input type="checkbox" name="delete" id="delete">
|
||||
<label for="delete">Supprimer mon compte et toutes ses données</label>
|
||||
<br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,41 +1,11 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>
|
||||
Ajouter un domaine sur un dossier de site<br>
|
||||
Le domaine doit pointer vers ces adresses IP :
|
||||
<br>IPv4 : <code><?= CONF['ht']['ipv4_address'] ?></code>
|
||||
<br>IPv6 : <code><?= CONF['ht']['ipv6_address'] ?></code>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<label for="domain">Domaine sur lequel répondre</label><br>
|
||||
<input required="" placeholder="site.<?= PLACEHOLDER_DOMAIN ?>" id="domain" name="domain" type="text"><br>
|
||||
<label for="dir">Dossier ciblé</label><br>
|
||||
<select required="" name="dir" id="dir">
|
||||
<option value="" disabled="" selected="">---</option>
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['username'])) {
|
||||
if (isset($_SESSION['username']))
|
||||
$dirsStatuses = dirsStatuses($_SESSION['username'], "dns", "http");
|
||||
else
|
||||
$dirsStatuses = [];
|
||||
|
||||
foreach ($dirsStatuses as $dir => $alreadyEnabled) {
|
||||
$disabled = $alreadyEnabled ? " disabled=''" : "";
|
||||
echo " <option" . $disabled . " value='" . $dir . "'>" . $dir . "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</select>
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
checkDomainFormat($_POST['domain']);
|
||||
|
||||
if ($dirsStatuses[$_POST['dir']] !== false)
|
||||
|
@ -75,3 +45,35 @@ if ($code !== 0)
|
|||
serverError("Failed to reload Nginx.");
|
||||
|
||||
success("Accès HTTP par domaine ajouté sur ce dossier !");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
Ajouter un domaine sur un dossier de site<br>
|
||||
Le domaine doit pointer vers ces adresses IP :
|
||||
<br>IPv4 : <code><?= CONF['ht']['ipv4_address'] ?></code>
|
||||
<br>IPv6 : <code><?= CONF['ht']['ipv6_address'] ?></code>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<label for="domain">Domaine sur lequel répondre</label><br>
|
||||
<input required="" placeholder="site.<?= PLACEHOLDER_DOMAIN ?>" id="domain" name="domain" type="text"><br>
|
||||
<label for="dir">Dossier ciblé</label><br>
|
||||
<select required="" name="dir" id="dir">
|
||||
<option value="" disabled="" selected="">---</option>
|
||||
|
||||
<?php
|
||||
|
||||
foreach ($dirsStatuses as $dir => $alreadyEnabled) {
|
||||
$disabled = $alreadyEnabled ? " disabled=''" : "";
|
||||
echo " <option" . $disabled . " value='" . $dir . "'>" . $dir . "</option>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</select>
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,35 +1,11 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<p>
|
||||
Ajouter un accès en .onion sur un dossier
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<label for="dir">Dossier ciblé</label><br>
|
||||
<select required="" name="dir" id="dir">
|
||||
<option value="" disabled="" selected="">---</option>
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['username'])) {
|
||||
if (isset($_SESSION['username']))
|
||||
$dirsStatuses = dirsStatuses($_SESSION['username'], "onion", "http");
|
||||
else
|
||||
$dirsStatuses = [];
|
||||
|
||||
foreach ($dirsStatuses as $dir => $alreadyEnabled) {
|
||||
$disabled = $alreadyEnabled ? "disabled='' " : "";
|
||||
echo " <option " . $disabled . "value='" . $dir . "'>" . $dir . "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</select>
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
if ($dirsStatuses[$_POST['dir']] !== false)
|
||||
userError("Wrong value for <code>dir</code>.");
|
||||
|
||||
|
@ -73,3 +49,30 @@ if ($code !== 0)
|
|||
|
||||
// Tell the user their site address
|
||||
success("L'adresse de votre service Onion HTTP est : <a href='http://" . $onion . "/'<code>http://" . $onion . "/</code></a>");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<p>
|
||||
Ajouter un accès en .onion sur un dossier
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<label for="dir">Dossier ciblé</label><br>
|
||||
<select required="" name="dir" id="dir">
|
||||
<option value="" disabled="" selected="">---</option>
|
||||
|
||||
<?php
|
||||
|
||||
foreach ($dirsStatuses as $dir => $alreadyEnabled) {
|
||||
$disabled = $alreadyEnabled ? "disabled='' " : "";
|
||||
echo " <option " . $disabled . "value='" . $dir . "'>" . $dir . "</option>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</select>
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['username']))
|
||||
$dirsStatuses = dirsStatuses($_SESSION['username'], "dns", "http");
|
||||
else
|
||||
$dirsStatuses = [];
|
||||
|
||||
if (processForm()) {
|
||||
if ($dirsStatuses[$_POST['dir']] !== true)
|
||||
userError("Wrong value for <code>dir</code>.");
|
||||
|
||||
htDeleteSite($_POST['dir'], domainType: 'dns', protocol: 'http');
|
||||
|
||||
success("Accès retiré.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
Retirer un accès DNS et TLS d'un dossier
|
||||
|
@ -11,14 +27,10 @@
|
|||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['username'])) {
|
||||
$dirsStatuses = dirsStatuses($_SESSION['username'], "dns", "http");
|
||||
|
||||
foreach ($dirsStatuses as $dir => $alreadyEnabled) {
|
||||
$disabled = $alreadyEnabled ? "" : "disabled='' ";
|
||||
echo " <option " . $disabled . "value='" . $dir . "'>" . $dir . "</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
@ -26,14 +38,3 @@ if (isset($_SESSION['username'])) {
|
|||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if ($dirsStatuses[$_POST['dir']] !== true)
|
||||
userError("Wrong value for <code>dir</code>.");
|
||||
|
||||
htDeleteSite($_POST['dir'], domainType: 'dns', protocol: 'http');
|
||||
|
||||
success("Accès retiré.");
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['username']))
|
||||
$dirsStatuses = dirsStatuses($_SESSION['username'], "onion", "http");
|
||||
else
|
||||
$dirsStatuses = [];
|
||||
|
||||
if (processForm()) {
|
||||
if ($dirsStatuses[$_POST['dir']] !== true)
|
||||
userError("Wrong value for <code>dir</code>.");
|
||||
|
||||
htDeleteSite($_POST['dir'], domainType: 'onion', protocol: 'http');
|
||||
|
||||
success("Accès retiré.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
Retirer un accès Onion d'un dossier
|
||||
|
@ -11,14 +27,10 @@
|
|||
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['username'])) {
|
||||
$dirsStatuses = dirsStatuses($_SESSION['username'], "onion", "http");
|
||||
|
||||
foreach ($dirsStatuses as $dir => $alreadyEnabled) {
|
||||
$disabled = $alreadyEnabled ? "" : "disabled='' ";
|
||||
echo " <option " . $disabled . "value='" . $dir . "'>" . $dir . "</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
@ -26,14 +38,3 @@ if (isset($_SESSION['username'])) {
|
|||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if ($dirsStatuses[$_POST['dir']] !== true)
|
||||
userError("Wrong value for <code>dir</code>.");
|
||||
|
||||
htDeleteSite($_POST['dir'], domainType: 'onion', protocol: 'http');
|
||||
|
||||
success("Accès retiré.");
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>
|
||||
Ce service permet d'envoyer des fichiers sur le serveur par <?= linkToDocs('sftp', 'SFTP') ?> afin de les rendre accessibles par <?= linkToDocs('http', 'HTTP') ?>.
|
||||
</p>
|
||||
|
@ -58,5 +56,3 @@
|
|||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<?php closeHTML(); ?>
|
||||
|
|
|
@ -1,4 +1,30 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (processForm()) {
|
||||
exec(CONF['ht']['sudo_path'] . " " . CONF['ht']['certbot_path'] . " certonly --dry-run --test-cert --webroot --webroot-path /srv/acme --register-unsafely-without-email --agree-tos --domain " . $_POST['domain'], $output, $returnCode);
|
||||
|
||||
// Abort if Certbot failed
|
||||
if ($returnCode !== 0)
|
||||
serverError("Certbot failed to get a Let's Encrypt certificate.");
|
||||
|
||||
// Replace self-signed certificate by Let's Encrypt certificate in Nginx configuration
|
||||
$conf = file_get_contents(CONF['ht']['nginx_config_path'] . "/" . $_POST['domain'] . ".conf");
|
||||
$conf = preg_replace("#/etc/ssl/certs/niver\.crt#", "/etc/letsencrypt/live/" . $_POST['domain'] . "/fullchain.pem", $conf);
|
||||
$conf = preg_replace("#/etc/ssl/private/niver\.key#", "/etc/letsencrypt/live/" . $_POST['domain'] . "/privkey.pem", $conf);
|
||||
file_put_contents(CONF['ht']['nginx_config_path'] . "/" . $_POST['domain'] . ".conf", $conf);
|
||||
|
||||
// Reload Nginx
|
||||
exec(CONF['ht']['sudo_path'] . " " . CONF['ht']['systemctl_path'] . " reload nginx", $output, $returnCode);
|
||||
|
||||
// Abort if Nginx reload failed
|
||||
if ($returnCode !== 0)
|
||||
serverError("Nginx configuration reload failed.");
|
||||
|
||||
success("La connexion avec votre site utilise désomais un certificat TLS émis par Let's Encrypt.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
Installer un certificat Let's Encrypt
|
||||
</p>
|
||||
|
@ -20,28 +46,3 @@ if (isset($_SESSION['username'])) {
|
|||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
exec(CONF['ht']['sudo_path'] . " " . CONF['ht']['certbot_path'] . " certonly --dry-run --test-cert --webroot --webroot-path /srv/acme --register-unsafely-without-email --agree-tos --domain " . $_POST['domain'], $output, $returnCode);
|
||||
|
||||
// Abort if Certbot failed
|
||||
if ($returnCode !== 0)
|
||||
serverError("Certbot failed to get a Let's Encrypt certificate.");
|
||||
|
||||
// Replace self-signed certificate by Let's Encrypt certificate in Nginx configuration
|
||||
$conf = file_get_contents(CONF['ht']['nginx_config_path'] . "/" . $_POST['domain'] . ".conf");
|
||||
$conf = preg_replace("#/etc/ssl/certs/niver\.crt#", "/etc/letsencrypt/live/" . $_POST['domain'] . "/fullchain.pem", $conf);
|
||||
$conf = preg_replace("#/etc/ssl/private/niver\.key#", "/etc/letsencrypt/live/" . $_POST['domain'] . "/privkey.pem", $conf);
|
||||
file_put_contents(CONF['ht']['nginx_config_path'] . "/" . $_POST['domain'] . ".conf", $conf);
|
||||
|
||||
// Reload Nginx
|
||||
exec(CONF['ht']['sudo_path'] . " " . CONF['ht']['systemctl_path'] . " reload nginx", $output, $returnCode);
|
||||
|
||||
// Abort if Nginx reload failed
|
||||
if ($returnCode !== 0)
|
||||
serverError("Nginx configuration reload failed.");
|
||||
|
||||
success("La connexion avec votre site utilise désomais un certificat TLS émis par Let's Encrypt.");
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<?php require "../common/html.php"; ?>
|
||||
|
||||
<nav>
|
||||
<dl>
|
||||
<dt><a class="auth" href="auth/"><?= TITLES['auth']['index'] ?></a></dt>
|
||||
|
@ -26,5 +24,3 @@
|
|||
<?php } ?>
|
||||
</dl>
|
||||
</nav>
|
||||
|
||||
<?php closeHTML(); ?>
|
||||
|
|
|
@ -1,34 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-caa', 'Documentation du type d\'enregistrement CAA') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
|
||||
<br>
|
||||
<label for="flag">Flag</label>
|
||||
<br>
|
||||
<input id="flag" min="0" max="127" placeholder="0" name="flag" type="number">
|
||||
<br>
|
||||
<label for="tag">Tag</label>
|
||||
<br>
|
||||
<input id="tag" minlenght="1" maxlength="128" pattern="^[a-z]{1,128}$" placeholder="issue" name="tag" type="text">
|
||||
<br>
|
||||
<label for="value">Valeur</label>
|
||||
<br>
|
||||
<input id="value" minlenght="3" maxlength="1024" pattern="^[a-z0-9.-]{3,1024}$" placeholder="letsencrypt.org" name="value" type="text">
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (!($_POST['flag'] >= 0 AND $_POST['flag'] <= 255))
|
||||
|
@ -50,3 +22,30 @@ knotcZoneExec($_POST['zone'], array(
|
|||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-caa', 'Documentation du type d\'enregistrement CAA') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<?php require "form.ns.php"; ?>
|
||||
|
||||
<br>
|
||||
<label for="flag">Flag</label>
|
||||
<br>
|
||||
<input id="flag" min="0" max="127" placeholder="0" name="flag" type="number">
|
||||
<br>
|
||||
<label for="tag">Tag</label>
|
||||
<br>
|
||||
<input id="tag" minlenght="1" maxlength="128" pattern="^[a-z]{1,128}$" placeholder="issue" name="tag" type="text">
|
||||
<br>
|
||||
<label for="value">Valeur</label>
|
||||
<br>
|
||||
<input id="value" minlenght="3" maxlength="1024" pattern="^[a-z0-9.-]{3,1024}$" placeholder="letsencrypt.org" name="value" type="text">
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-cname', 'Documentation du type d\'enregistrement CNAME') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
<br>
|
||||
<label for="cname">Nom canonique</label>
|
||||
<br>
|
||||
<input id="cname" placeholder="main.<?= PLACEHOLDER_DOMAIN ?>" name="cname" type="text">
|
||||
<br>
|
||||
<input value="Procéder" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
$_POST['cname'] = formatAbsoluteDomain($_POST['cname']);
|
||||
|
@ -30,3 +13,20 @@ knotcZoneExec($_POST['zone'], array(
|
|||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-cname', 'Documentation du type d\'enregistrement CNAME') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<?php require "form.ns.php"; ?>
|
||||
<br>
|
||||
<label for="cname">Nom canonique</label>
|
||||
<br>
|
||||
<input id="cname" placeholder="main.<?= PLACEHOLDER_DOMAIN ?>" name="cname" type="text">
|
||||
<br>
|
||||
<input value="Procéder" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-dname', 'Documentation du type d\'enregistrement DNAME') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
<br>
|
||||
<label for="dname">Nom délégué</label>
|
||||
<br>
|
||||
<input id="dname" placeholder="main.<?= PLACEHOLDER_DOMAIN ?>" name="dname" type="text">
|
||||
<br>
|
||||
<input value="Procéder" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
$_POST['dname'] = formatAbsoluteDomain($_POST['dname']);
|
||||
|
@ -30,3 +13,20 @@ knotcZoneExec($_POST['zone'], array(
|
|||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-dname', 'Documentation du type d\'enregistrement DNAME') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<?php require "form.ns.php"; ?>
|
||||
<br>
|
||||
<label for="dname">Nom délégué</label>
|
||||
<br>
|
||||
<input id="dname" placeholder="main.<?= PLACEHOLDER_DOMAIN ?>" name="dname" type="text">
|
||||
<br>
|
||||
<input value="Procéder" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<?php displayIndex(); ?>
|
||||
|
||||
<p>
|
||||
|
@ -12,4 +10,3 @@ foreach (CONF['ns']['servers'] as $server)
|
|||
</ul>
|
||||
</p>
|
||||
|
||||
<?php closeHTML(); ?>
|
||||
|
|
|
@ -1,20 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-txt', 'Documentation des types d\'enregistrements A et AAAA') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
<label for="ip">Adresse IP</label><br>
|
||||
<input required="" pattern="^[a-f0-9:.]+$" id="ip" name="ip" minlength="7" maxlength="39" size="40" type="text" placeholder="<?= PLACEHOLDER_IPV6 ?> ou <?= PLACEHOLDER_IPV4 ?>"><br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
$record = checkIpFormat($_POST['ip']);
|
||||
|
@ -27,3 +13,17 @@ knotcZoneExec($_POST['zone'], array(
|
|||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-txt', 'Documentation des types d\'enregistrements A et AAAA') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<?php require "form.ns.php"; ?>
|
||||
<label for="ip">Adresse IP</label><br>
|
||||
<input required="" pattern="^[a-f0-9:.]+$" id="ip" name="ip" minlength="7" maxlength="39" size="40" type="text" placeholder="<?= PLACEHOLDER_IPV6 ?> ou <?= PLACEHOLDER_IPV4 ?>"><br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,4 +1,77 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (empty($_POST['lat-min']))
|
||||
$_POST['lat-min'] = 0;
|
||||
if (empty($_POST['lat-sec']))
|
||||
$_POST['lat-sec'] = 0;
|
||||
if (empty($_POST['lon-min']))
|
||||
$_POST['lon-min'] = 0;
|
||||
if (empty($_POST['lon-sec']))
|
||||
$_POST['lon-sec'] = 0;
|
||||
if (empty($_POST['size']))
|
||||
$_POST['size'] = 1;
|
||||
if (empty($_POST['hp']))
|
||||
$_POST['hp'] = 10000;
|
||||
if (empty($_POST['vp']))
|
||||
$_POST['vp'] = 10;
|
||||
|
||||
if (!($_POST['lat-deg'] >= 0 AND $_POST['lat-deg'] <= 90))
|
||||
userError("Wrong value for <code>lat-deg</code>.");
|
||||
if (!($_POST['lat-min'] >= 0 AND $_POST['lat-min'] <= 59))
|
||||
userError("Wrong value for <code>lat-min</code>.");
|
||||
if (!($_POST['lat-sec'] >= 0 AND $_POST['lat-sec'] <= 59.999))
|
||||
userError("Wrong value for <code>lat-sec</code>.");
|
||||
|
||||
if ($_POST['lat-dir'] !== "N" AND $_POST['lat-dir'] !== "S")
|
||||
userError("Wrong value for <code>lat-dir</code>.");
|
||||
|
||||
if (!($_POST['lon-deg'] >= 0 AND $_POST['lon-deg'] <= 180))
|
||||
userError("Wrong value for <code>lon-deg</code>.");
|
||||
if (!($_POST['lon-min'] >= 0 AND $_POST['lon-min'] <= 59))
|
||||
userError("Wrong value for <code>lon-min</code>.");
|
||||
if (!($_POST['lon-sec'] >= 0 AND $_POST['lon-sec'] <= 59.999))
|
||||
userError("Wrong value for <code>lon-sec</code>.");
|
||||
|
||||
if ($_POST['lon-dir'] !== "E" AND $_POST['lon-dir'] !== "W")
|
||||
userError("Wrong value for <code>lon-dir</code>.");
|
||||
|
||||
if (!($_POST['alt'] >= -100000 AND $_POST['alt'] <= 42849672.95))
|
||||
userError("Wrong value for <code>alt</code>.");
|
||||
|
||||
if (!($_POST['size'] >= 0 AND $_POST['size'] <= 90000000))
|
||||
userError("Wrong value for <code>size</code>.");
|
||||
|
||||
if (!($_POST['hp'] >= 0 AND $_POST['hp'] <= 90000000))
|
||||
userError("Wrong value for <code>hp</code>.");
|
||||
|
||||
if (!($_POST['vp'] >= 0 AND $_POST['vp'] <= 90000000))
|
||||
userError("Wrong value for <code>vp</code>.");
|
||||
|
||||
knotcZoneExec($_POST['zone'], array(
|
||||
$values['domain'],
|
||||
$values['ttl'],
|
||||
"LOC",
|
||||
$_POST['lat-deg'],
|
||||
$_POST['lat-min'],
|
||||
$_POST['lat-sec'],
|
||||
$_POST['lat-dir'],
|
||||
$_POST['lon-deg'],
|
||||
$_POST['lon-min'],
|
||||
$_POST['lon-sec'],
|
||||
$_POST['lon-dir'],
|
||||
$_POST['alt'] . 'm',
|
||||
$_POST['size'] . 'm',
|
||||
$_POST['hp'] . 'm',
|
||||
$_POST['vp'] . 'm',
|
||||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-loc', 'Documentation du type d\'enregistrement LOC') ?>
|
||||
|
@ -6,7 +79,7 @@
|
|||
|
||||
<form method="post">
|
||||
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
<?php require "form.ns.php"; ?>
|
||||
|
||||
<fieldset>
|
||||
<legend>Latitude</legend>
|
||||
|
@ -82,76 +155,3 @@
|
|||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (empty($_POST['lat-min']))
|
||||
$_POST['lat-min'] = 0;
|
||||
if (empty($_POST['lat-sec']))
|
||||
$_POST['lat-sec'] = 0;
|
||||
if (empty($_POST['lon-min']))
|
||||
$_POST['lon-min'] = 0;
|
||||
if (empty($_POST['lon-sec']))
|
||||
$_POST['lon-sec'] = 0;
|
||||
if (empty($_POST['size']))
|
||||
$_POST['size'] = 1;
|
||||
if (empty($_POST['hp']))
|
||||
$_POST['hp'] = 10000;
|
||||
if (empty($_POST['vp']))
|
||||
$_POST['vp'] = 10;
|
||||
|
||||
if (!($_POST['lat-deg'] >= 0 AND $_POST['lat-deg'] <= 90))
|
||||
userError("Wrong value for <code>lat-deg</code>.");
|
||||
if (!($_POST['lat-min'] >= 0 AND $_POST['lat-min'] <= 59))
|
||||
userError("Wrong value for <code>lat-min</code>.");
|
||||
if (!($_POST['lat-sec'] >= 0 AND $_POST['lat-sec'] <= 59.999))
|
||||
userError("Wrong value for <code>lat-sec</code>.");
|
||||
|
||||
if ($_POST['lat-dir'] !== "N" AND $_POST['lat-dir'] !== "S")
|
||||
userError("Wrong value for <code>lat-dir</code>.");
|
||||
|
||||
if (!($_POST['lon-deg'] >= 0 AND $_POST['lon-deg'] <= 180))
|
||||
userError("Wrong value for <code>lon-deg</code>.");
|
||||
if (!($_POST['lon-min'] >= 0 AND $_POST['lon-min'] <= 59))
|
||||
userError("Wrong value for <code>lon-min</code>.");
|
||||
if (!($_POST['lon-sec'] >= 0 AND $_POST['lon-sec'] <= 59.999))
|
||||
userError("Wrong value for <code>lon-sec</code>.");
|
||||
|
||||
if ($_POST['lon-dir'] !== "E" AND $_POST['lon-dir'] !== "W")
|
||||
userError("Wrong value for <code>lon-dir</code>.");
|
||||
|
||||
if (!($_POST['alt'] >= -100000 AND $_POST['alt'] <= 42849672.95))
|
||||
userError("Wrong value for <code>alt</code>.");
|
||||
|
||||
if (!($_POST['size'] >= 0 AND $_POST['size'] <= 90000000))
|
||||
userError("Wrong value for <code>size</code>.");
|
||||
|
||||
if (!($_POST['hp'] >= 0 AND $_POST['hp'] <= 90000000))
|
||||
userError("Wrong value for <code>hp</code>.");
|
||||
|
||||
if (!($_POST['vp'] >= 0 AND $_POST['vp'] <= 90000000))
|
||||
userError("Wrong value for <code>vp</code>.");
|
||||
|
||||
knotcZoneExec($_POST['zone'], array(
|
||||
$values['domain'],
|
||||
$values['ttl'],
|
||||
"LOC",
|
||||
$_POST['lat-deg'],
|
||||
$_POST['lat-min'],
|
||||
$_POST['lat-sec'],
|
||||
$_POST['lat-dir'],
|
||||
$_POST['lon-deg'],
|
||||
$_POST['lon-min'],
|
||||
$_POST['lon-sec'],
|
||||
$_POST['lon-dir'],
|
||||
$_POST['alt'] . 'm',
|
||||
$_POST['size'] . 'm',
|
||||
$_POST['hp'] . 'm',
|
||||
$_POST['vp'] . 'm',
|
||||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-mx', 'Documentation du type d\'enregistrement MX') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
|
||||
<br>
|
||||
|
||||
<label for="priority">Priorité</label>
|
||||
<br>
|
||||
<input id="priority" min="0" max="65535" value="0" placeholder="0" name="priority" type="number">
|
||||
|
||||
<br>
|
||||
|
||||
<label for="host">Hôte</label>
|
||||
<br>
|
||||
<input id="host" placeholder="mail.<?= PLACEHOLDER_DOMAIN ?>." name="host" type="text">
|
||||
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (!($_POST['priority'] >= 0 AND $_POST['priority'] <= 255))
|
||||
|
@ -44,3 +17,30 @@ knotcZoneExec($_POST['zone'], array(
|
|||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-mx', 'Documentation du type d\'enregistrement MX') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<?php require "form.ns.php"; ?>
|
||||
|
||||
<br>
|
||||
|
||||
<label for="priority">Priorité</label>
|
||||
<br>
|
||||
<input id="priority" min="0" max="65535" value="0" placeholder="0" name="priority" type="number">
|
||||
|
||||
<br>
|
||||
|
||||
<label for="host">Hôte</label>
|
||||
<br>
|
||||
<input id="host" placeholder="mail.<?= PLACEHOLDER_DOMAIN ?>." name="host" type="text">
|
||||
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-ns', 'Documentation du type d\'enregistrement NS') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
<br>
|
||||
<label for="ns">Serveur de nom</label>
|
||||
<br>
|
||||
<input id="ns" placeholder="ns1.<?= PLACEHOLDER_DOMAIN ?>" name="ns" type="text">
|
||||
<br>
|
||||
<input value="Procéder" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
$_POST['ns'] = formatAbsoluteDomain($_POST['ns']);
|
||||
|
@ -30,3 +13,20 @@ knotcZoneExec($_POST['zone'], array(
|
|||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-ns', 'Documentation du type d\'enregistrement NS') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<?php require "form.ns.php"; ?>
|
||||
<br>
|
||||
<label for="ns">Serveur de nom</label>
|
||||
<br>
|
||||
<input id="ns" placeholder="ns1.<?= PLACEHOLDER_DOMAIN ?>" name="ns" type="text">
|
||||
<br>
|
||||
<input value="Procéder" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<form method="post">
|
||||
<input type="radio" name="print" id="table" value="table" checked="">
|
||||
|
@ -25,8 +24,7 @@ if (isset($_SESSION['username']))
|
|||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
nsCheckZonePossession($_POST['zone']);
|
||||
|
||||
$zoneContent = file_get_contents(CONF['ns']['knot_zones_path'] . '/' . $_POST['zone'] . 'zone');
|
||||
|
@ -100,4 +98,4 @@ if ($_POST['print'] === 'ds') {
|
|||
<?php
|
||||
success();
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
|
|
@ -1,4 +1,33 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (!($_POST['priority'] >= 0 AND $_POST['priority'] <= 65535))
|
||||
userError("Wrong value for <code>priority</code>.");
|
||||
|
||||
if (!($_POST['weight'] >= 0 AND $_POST['weight'] <= 65535))
|
||||
userError("Wrong value for <code>weight</code>.");
|
||||
|
||||
if (!($_POST['port'] >= 0 AND $_POST['port'] <= 65535))
|
||||
userError("Wrong value for <code>port</code>.");
|
||||
|
||||
$_POST['target'] = formatAbsoluteDomain($_POST['target']);
|
||||
|
||||
knotcZoneExec($_POST['zone'], array(
|
||||
$values['domain'],
|
||||
$values['ttl'],
|
||||
"SRV",
|
||||
$_POST['priority'],
|
||||
$_POST['weight'],
|
||||
$_POST['port'],
|
||||
$_POST['target']
|
||||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-srv', 'Documentation du type d\'enregistrement SRV') ?>
|
||||
|
@ -6,7 +35,7 @@
|
|||
|
||||
<form method="post">
|
||||
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
<?php require "form.ns.php"; ?>
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -35,32 +64,3 @@
|
|||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (!($_POST['priority'] >= 0 AND $_POST['priority'] <= 65535))
|
||||
userError("Wrong value for <code>priority</code>.");
|
||||
|
||||
if (!($_POST['weight'] >= 0 AND $_POST['weight'] <= 65535))
|
||||
userError("Wrong value for <code>weight</code>.");
|
||||
|
||||
if (!($_POST['port'] >= 0 AND $_POST['port'] <= 65535))
|
||||
userError("Wrong value for <code>port</code>.");
|
||||
|
||||
$_POST['target'] = formatAbsoluteDomain($_POST['target']);
|
||||
|
||||
knotcZoneExec($_POST['zone'], array(
|
||||
$values['domain'],
|
||||
$values['ttl'],
|
||||
"SRV",
|
||||
$_POST['priority'],
|
||||
$_POST['weight'],
|
||||
$_POST['port'],
|
||||
$_POST['target']
|
||||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
|
|
|
@ -1,4 +1,30 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (!($_POST['algo'] === "1" OR $_POST['algo'] === "3" OR $_POST['algo'] === "4"))
|
||||
userError("Wrong value for <code>algo</code>.");
|
||||
|
||||
if (!($_POST['type'] === "2"))
|
||||
userError("Wrong value for <code>type</code>.");
|
||||
|
||||
if (!(preg_match("/^[a-z0-9]{64}$/", $_POST['fp'])))
|
||||
userError("Wrong value for <code>fp</code>.");
|
||||
|
||||
knotcZoneExec($_POST['zone'], array(
|
||||
$values['domain'],
|
||||
$values['ttl'],
|
||||
"SSHFP",
|
||||
$_POST['algo'],
|
||||
$_POST['type'],
|
||||
$_POST['fp']
|
||||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-sshfp', 'Documentation du type d\'enregistrement SSHFP') ?>
|
||||
|
@ -6,7 +32,7 @@
|
|||
|
||||
<form method="post">
|
||||
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
<?php require "form.ns.php"; ?>
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -36,29 +62,3 @@
|
|||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (!($_POST['algo'] === "1" OR $_POST['algo'] === "3" OR $_POST['algo'] === "4"))
|
||||
userError("Wrong value for <code>algo</code>.");
|
||||
|
||||
if (!($_POST['type'] === "2"))
|
||||
userError("Wrong value for <code>type</code>.");
|
||||
|
||||
if (!(preg_match("/^[a-z0-9]{64}$/", $_POST['fp'])))
|
||||
userError("Wrong value for <code>fp</code>.");
|
||||
|
||||
knotcZoneExec($_POST['zone'], array(
|
||||
$values['domain'],
|
||||
$values['ttl'],
|
||||
"SSHFP",
|
||||
$_POST['algo'],
|
||||
$_POST['type'],
|
||||
$_POST['fp']
|
||||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
|
|
|
@ -1,4 +1,34 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (!($_POST['use'] >= 0 AND $_POST['use'] <= 3))
|
||||
userError("Wrong value for <code>use</code>.");
|
||||
|
||||
if (!($_POST['selector'] === "0" OR $_POST['selector'] === "1"))
|
||||
userError("Wrong value for <code>selector</code>.");
|
||||
|
||||
if (!($_POST['type'] >= 0 AND $_POST['type'] <= 2))
|
||||
userError("Wrong value for <code>type</code>.");
|
||||
|
||||
if (!(preg_match("/^[a-zA-Z0-9.-]{1,1024}$/", $_POST['content'])))
|
||||
userError("Wrong value for <code>content</code>.");
|
||||
|
||||
knotcZoneExec($_POST['zone'], array(
|
||||
$values['domain'],
|
||||
$values['ttl'],
|
||||
"TLSA",
|
||||
$_POST['use'],
|
||||
$_POST['selector'],
|
||||
$_POST['type'],
|
||||
$_POST['content']
|
||||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-tlsa', 'Documentation du type d\'enregistrement TLSA') ?>
|
||||
|
@ -6,7 +36,7 @@
|
|||
|
||||
<form method="post">
|
||||
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
<?php require "form.ns.php"; ?>
|
||||
|
||||
<br>
|
||||
<label for="use">Utilisation</label>
|
||||
|
@ -45,33 +75,3 @@
|
|||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (!($_POST['use'] >= 0 AND $_POST['use'] <= 3))
|
||||
userError("Wrong value for <code>use</code>.");
|
||||
|
||||
if (!($_POST['selector'] === "0" OR $_POST['selector'] === "1"))
|
||||
userError("Wrong value for <code>selector</code>.");
|
||||
|
||||
if (!($_POST['type'] >= 0 AND $_POST['type'] <= 2))
|
||||
userError("Wrong value for <code>type</code>.");
|
||||
|
||||
if (!(preg_match("/^[a-zA-Z0-9.-]{1,1024}$/", $_POST['content'])))
|
||||
userError("Wrong value for <code>content</code>.");
|
||||
|
||||
knotcZoneExec($_POST['zone'], array(
|
||||
$values['domain'],
|
||||
$values['ttl'],
|
||||
"TLSA",
|
||||
$_POST['use'],
|
||||
$_POST['selector'],
|
||||
$_POST['type'],
|
||||
$_POST['content']
|
||||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
|
|
|
@ -1,23 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-txt', 'Documentation du type d\'enregistrement TXT') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<?php require "../../form.ns.php"; ?>
|
||||
<br>
|
||||
<label for="txt">Texte</label>
|
||||
<br>
|
||||
<input id="txt" minlenght="5" maxlength="8192" pattern="^[a-zA-Z0-9 =:!%$+/\()[\]_-]{5,8192}$" placeholder="Du texte..." name="txt" type="text">
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
$values = nsParseCommonRequirements();
|
||||
|
||||
if (!(preg_match("/^[a-zA-Z0-9 =:!%$+\/\()[\]_-]{5,8192}$/", $_POST['txt'])))
|
||||
|
@ -31,3 +14,20 @@ knotcZoneExec($_POST['zone'], array(
|
|||
));
|
||||
|
||||
success("Enregistrement ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-txt', 'Documentation du type d\'enregistrement TXT') ?>
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<?php require "form.ns.php"; ?>
|
||||
<br>
|
||||
<label for="txt">Texte</label>
|
||||
<br>
|
||||
<input id="txt" minlenght="5" maxlength="8192" pattern="^[a-zA-Z0-9 =:!%$+/\()[\]_-]{5,8192}$" placeholder="Du texte..." name="txt" type="text">
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<form method="post">
|
||||
<label for="domain">Domaine</label><br>
|
||||
<input required="" placeholder="domain.<?= PLACEHOLDER_DOMAIN ?>." id="domain" name="domain" type="text"><br>
|
||||
<input value="Ajouter" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
$_POST['domain'] = formatAbsoluteDomain($_POST['domain']);
|
||||
|
||||
if (query('select', 'zones', ['zone' => $_POST['domain']], 'zone') !== [])
|
||||
|
@ -44,3 +35,12 @@ knotcConfExec([
|
|||
]);
|
||||
|
||||
success("La requête a été traitée.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<form method="post">
|
||||
<label for="domain">Domaine</label><br>
|
||||
<input required="" placeholder="domain.<?= PLACEHOLDER_DOMAIN ?>." id="domain" name="domain" type="text"><br>
|
||||
<input value="Ajouter" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (processForm()) {
|
||||
nsCheckZonePossession($_POST['zone']);
|
||||
|
||||
nsDeleteZone($_POST['zone']);
|
||||
|
||||
success("Zone effacée.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<form method="post">
|
||||
<label for="zone">Zone</label>
|
||||
|
@ -13,13 +23,3 @@ if (isset($_SESSION['username']))
|
|||
<br>
|
||||
<input value="Supprimer toutes les données liées à cette zone" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
nsCheckZonePossession($_POST['zone']);
|
||||
|
||||
nsDeleteZone($_POST['zone']);
|
||||
|
||||
success("Zone effacée.");
|
||||
|
|
|
@ -1,4 +1,44 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (isset($_SESSION['username']))
|
||||
$domains = regListUserDomains($_SESSION['username']);
|
||||
else
|
||||
$domains = [];
|
||||
|
||||
if (processForm()) {
|
||||
if (
|
||||
($_POST['algo'] !== "8")
|
||||
AND ($_POST['algo'] !== "13")
|
||||
AND ($_POST['algo'] !== "14")
|
||||
AND ($_POST['algo'] !== "15")
|
||||
AND ($_POST['algo'] !== "16")
|
||||
) userError("Wrong value for <code>algo</code>.");
|
||||
|
||||
$_POST['keytag'] = intval($_POST['keytag']);
|
||||
if ((!preg_match("/^[0-9]{1,6}$/", $_POST['keytag'])) OR !($_POST['keytag'] >= 1) OR !($_POST['keytag'] <= 65535))
|
||||
userError("Wrong value for <code>keytag</code>.");
|
||||
|
||||
if ($_POST['dt'] !== "2" AND $_POST['dt'] !== "4")
|
||||
userError("Wrong value for <code>dt</code>.");
|
||||
|
||||
regCheckDomainPossession($_POST['zone']);
|
||||
|
||||
$action = checkAction($_POST['action']);
|
||||
|
||||
knotcZoneExec(CONF['reg']['registry'], array(
|
||||
$_POST['zone'],
|
||||
CONF['reg']['ttl'],
|
||||
"DS",
|
||||
$_POST['keytag'],
|
||||
$_POST['algo'],
|
||||
$_POST['dt'],
|
||||
$_POST['key']
|
||||
));
|
||||
|
||||
success("La requête a été envoyée à Knot");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
Ici vous pouvez indiquer au registre l'enregistrement DS d'une zone afin de permettre de déléguer la confiance <?= linkToDocs('dnssec', 'DNSSEC') ?>.
|
||||
|
@ -16,12 +56,10 @@
|
|||
<select required="" name="zone" id="zone">
|
||||
<option value="" disabled="" selected="">---</option>
|
||||
<?php
|
||||
if (isset($_SESSION['username'])) {
|
||||
$domains = regListUserDomains($_SESSION['username']);
|
||||
|
||||
foreach($domains as $domain)
|
||||
echo " <option value='" . $domain . "'>" . $domain . "</option>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</select>
|
||||
|
@ -66,38 +104,3 @@ if (isset($_SESSION['username'])) {
|
|||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (
|
||||
($_POST['algo'] !== "8")
|
||||
AND ($_POST['algo'] !== "13")
|
||||
AND ($_POST['algo'] !== "14")
|
||||
AND ($_POST['algo'] !== "15")
|
||||
AND ($_POST['algo'] !== "16")
|
||||
) userError("Wrong value for <code>algo</code>.");
|
||||
|
||||
$_POST['keytag'] = intval($_POST['keytag']);
|
||||
if ((!preg_match("/^[0-9]{1,6}$/", $_POST['keytag'])) OR !($_POST['keytag'] >= 1) OR !($_POST['keytag'] <= 65535))
|
||||
userError("Wrong value for <code>keytag</code>.");
|
||||
|
||||
if ($_POST['dt'] !== "2" AND $_POST['dt'] !== "4")
|
||||
userError("Wrong value for <code>dt</code>.");
|
||||
|
||||
regCheckDomainPossession($_POST['zone']);
|
||||
|
||||
$action = checkAction($_POST['action']);
|
||||
|
||||
knotcZoneExec(CONF['reg']['registry'], array(
|
||||
$_POST['zone'],
|
||||
CONF['reg']['ttl'],
|
||||
"DS",
|
||||
$_POST['keytag'],
|
||||
$_POST['algo'],
|
||||
$_POST['dt'],
|
||||
$_POST['key']
|
||||
));
|
||||
|
||||
success("La requête a été envoyée à Knot");
|
||||
|
|
|
@ -1,4 +1,23 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (processform()) {
|
||||
regCheckDomainPossession($_POST['suffix']);
|
||||
|
||||
$domain = formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['suffix']);
|
||||
|
||||
$record = checkIpFormat($_POST['ip']);
|
||||
|
||||
knotcZoneExec(CONF['reg']['registry'], array(
|
||||
$domain,
|
||||
CONF['reg']['ttl'],
|
||||
$record,
|
||||
$_POST['ip']
|
||||
));
|
||||
|
||||
success("Glue record ajouté");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('glue-record', 'Documentation sur le glue record'); ?>
|
||||
|
@ -38,22 +57,3 @@ if (isset($_SESSION['username']))
|
|||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
regCheckDomainPossession($_POST['suffix']);
|
||||
|
||||
$domain = formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['suffix']);
|
||||
|
||||
$record = checkIpFormat($_POST['ip']);
|
||||
|
||||
knotcZoneExec(CONF['reg']['registry'], array(
|
||||
$domain,
|
||||
CONF['reg']['ttl'],
|
||||
$record,
|
||||
$_POST['ip']
|
||||
));
|
||||
|
||||
success("Glue record ajouté");
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<?php displayIndex(); ?>
|
||||
|
||||
<p>
|
||||
Ce registre permet d'obtenir un domaine se terminant par <code><?= CONF['reg']['registry'] ?></code>, par exemple <code><em>domaine</em>.<?= CONF['reg']['registry'] ?></code>.
|
||||
</p>
|
||||
|
||||
<?php closeHTML(); ?>
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (processForm()) {
|
||||
regCheckDomainPossession($_POST['domain']);
|
||||
$_POST['ns'] = formatAbsoluteDomain($_POST['ns']);
|
||||
|
||||
knotcZoneExec(CONF['reg']['registry'], array(
|
||||
$_POST['domain'],
|
||||
CONF['reg']['ttl'],
|
||||
"NS",
|
||||
$_POST['ns']
|
||||
));
|
||||
|
||||
success("Modification effectuée avec succès");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?= linkToDocs('record-ns', 'Documentation du type d\'enregistrement NS') ?>
|
||||
|
@ -29,19 +45,3 @@ if (isset($_SESSION['username']))
|
|||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
regCheckDomainPossession($_POST['domain']);
|
||||
$_POST['ns'] = formatAbsoluteDomain($_POST['ns']);
|
||||
|
||||
knotcZoneExec(CONF['reg']['registry'], array(
|
||||
$_POST['domain'],
|
||||
CONF['reg']['ttl'],
|
||||
"NS",
|
||||
$_POST['ns']
|
||||
));
|
||||
|
||||
success("Modification effectuée avec succès");
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<form method="post">
|
||||
<label for="domain">Domaine</label>
|
||||
<select required="" name="domain" id="domain">
|
||||
|
@ -16,8 +14,7 @@ if (isset($_SESSION['username']))
|
|||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
regCheckDomainPossession($_POST['domain']);
|
||||
|
||||
$zoneContent = file_get_contents(CONF['reg']['registry_file']);
|
||||
|
@ -49,3 +46,4 @@ foreach(explode("\n", $zoneContent) as $zoneLine) {
|
|||
echo '</table>';
|
||||
|
||||
success();
|
||||
}
|
||||
|
|
|
@ -1,21 +1,6 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
|
||||
<p>
|
||||
Enregistrer un nouveau domaine sur son compte. Ce domaine doit être composé uniquement d'au moins 4 lettres latines non accentuées (a-z).
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<label for="subdomain">Sous-domaine</label>
|
||||
<br>
|
||||
<input id="subdomain" pattern="<?= CONF['reg']['subdomain_regex'] ?>" required="" placeholder="niver" name="subdomain" type="text">.<?= CONF['reg']['registry'] ?>
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
if (processForm()) {
|
||||
if (preg_match("/" . CONF['reg']['subdomain_regex'] . "/", $_POST['subdomain']) !== 1)
|
||||
userError("Erreur : Le nom de domaine doit être composé uniquement d'entre 4 et 63 lettres minuscules (a-z)");
|
||||
|
||||
|
@ -34,3 +19,18 @@ $stmt->bindValue(':last_renewal', date("Y-m-d H:i:s"));
|
|||
$stmt->execute();
|
||||
|
||||
success("Domaine ajouté au registre.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<p>
|
||||
Enregistrer un nouveau domaine sur son compte. Ce domaine doit être composé uniquement d'au moins 4 lettres latines non accentuées (a-z).
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
<label for="subdomain">Sous-domaine</label>
|
||||
<br>
|
||||
<input id="subdomain" pattern="<?= CONF['reg']['subdomain_regex'] ?>" required="" placeholder="niver" name="subdomain" type="text">.<?= CONF['reg']['registry'] ?>
|
||||
<br>
|
||||
<input value="Valider" type="submit">
|
||||
</form>
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
<?php require "../../common/html.php"; ?>
|
||||
<?php
|
||||
|
||||
if (processForm()) {
|
||||
regCheckDomainPossession($_POST['domain']);
|
||||
|
||||
regDeleteDomain($_POST['domain']);
|
||||
|
||||
success("Domaine effacé du registre.");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<form method="post">
|
||||
<label for="domain">Domaine</label>
|
||||
|
@ -15,13 +25,3 @@ if (isset($_SESSION['username']))
|
|||
<br>
|
||||
<input value="Effacer" type="submit">
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
switchToFormProcess();
|
||||
|
||||
regCheckDomainPossession($_POST['domain']);
|
||||
|
||||
regDeleteDomain($_POST['domain']);
|
||||
|
||||
success("Domaine effacé du registre.");
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
define("CONF", parse_ini_file(__DIR__ . "/config.ini", true, INI_SCANNER_TYPED));
|
||||
|
||||
foreach (array_diff(scandir(CONF['common']['root_path'] . "/fn"), array('..', '.')) as $file)
|
||||
require CONF['common']['root_path'] . '/fn/' . $file;
|
||||
|
||||
define("DB_PATH", CONF['common']['root_path'] . "/db/niver.db");
|
||||
|
||||
define("PLACEHOLDER_DOMAIN", "example"); // From RFC2606: Reserved Top Level DNS Names > 2. TLDs for Testing, & Documentation Examples
|
||||
define("PLACEHOLDER_IPV6", "2001:db8::3"); // From RFC3849: IPv6 Address Prefix Reserved for Documentation
|
||||
define("PLACEHOLDER_IPV4", "203.0.113.42"); // From RFC5737: IPv4 Address Blocks Reserved for Documentation
|
||||
|
||||
if ($_SERVER['REQUEST_URI'] === '/sftpgo-auth.php')
|
||||
return;
|
||||
|
||||
$pageAddress = substr($_SERVER['REQUEST_URI'], strlen(CONF['common']['prefix']) + 1);
|
||||
if (strpos($pageAddress, "?") !== false) {
|
||||
parse_str(substr($pageAddress, strpos($pageAddress, "?") + 1), $_GET);
|
||||
$pageAddress = substr($pageAddress, 0, strpos($pageAddress, "?"));
|
||||
}
|
||||
if (substr($pageAddress, -1) === '/' OR $pageAddress === '')
|
||||
$pageAddress .= 'index';
|
||||
define("PAGE_ADDRESS", $pageAddress);
|
||||
define("SERVICE", dirname(PAGE_ADDRESS));
|
||||
define("PAGE", basename(PAGE_ADDRESS, '.php'));
|
||||
|
||||
require "pages.php";
|
||||
|
||||
if (SERVICE !== '.') {
|
||||
if (!isset(TITLES[SERVICE]['index'])) {
|
||||
http_response_code(404);
|
||||
exit('Page not found.');
|
||||
}
|
||||
$page['service'] = TITLES[SERVICE]['index'];
|
||||
if (PAGE !== 'index') {
|
||||
if (!isset(TITLES[SERVICE][PAGE])) {
|
||||
http_response_code(404);
|
||||
exit('Page not found.');
|
||||
}
|
||||
$page['title'] = TITLES[SERVICE][PAGE];
|
||||
}
|
||||
}
|
||||
|
||||
require "html.php";
|
||||
|
||||
require "public/" . PAGE_ADDRESS . ".php";
|
||||
|
||||
closeHtml();
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
require "common/init.php";
|
||||
require "router.php";
|
||||
|
||||
$authData = json_decode(file_get_contents("php://input"), true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue