feature: reg: allow multiple suffixes
This commit is contained in:
parent
4b54038c63
commit
312292d06a
21 changed files with 173 additions and 91 deletions
|
@ -13,8 +13,10 @@ kdig_path = "/usr/bin/kdig"
|
||||||
|
|
||||||
[reg]
|
[reg]
|
||||||
enabled = true
|
enabled = true
|
||||||
registry = "niver.test."
|
suffixes_path = "/srv/niver/reg"
|
||||||
registry_file = "/srv/niver/reg/niver.test.zone"
|
suffixes[niver.test.] = "approved"
|
||||||
|
suffixes[test.niver.test.] = "all"
|
||||||
|
suffixes[old.niver.test.] = "none"
|
||||||
ttl = 86400
|
ttl = 86400
|
||||||
; A local address to query the registry nameserver
|
; A local address to query the registry nameserver
|
||||||
address = "[::1]:42053"
|
address = "[::1]:42053"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
function parseZoneFile($zone_content, $types, $filter_domain = false) {
|
function parseZoneFile($zone_content, $types, $filter_domain = false) {
|
||||||
$parsed_zone_content = [];
|
$parsed_zone_content = [];
|
||||||
foreach(explode(LF, $zone_content) as $zone_line) {
|
foreach (explode(LF, $zone_content) as $zone_line) {
|
||||||
if ($zone_line === '' OR str_starts_with($zone_line, ';'))
|
if ($zone_line === '' OR str_starts_with($zone_line, ';'))
|
||||||
continue; // Ignore empty lines and comments
|
continue; // Ignore empty lines and comments
|
||||||
$elements = preg_split('/[\t ]+/', $zone_line, 4);
|
$elements = preg_split('/[\t ]+/', $zone_line, 4);
|
||||||
|
|
25
fn/reg.php
25
fn/reg.php
|
@ -15,11 +15,12 @@ function regCheckDomainPossession($domain) {
|
||||||
|
|
||||||
function regDeleteDomain($domain) {
|
function regDeleteDomain($domain) {
|
||||||
// Delete domain from registry file
|
// Delete domain from registry file
|
||||||
$regFile = file_get_contents(CONF['reg']['registry_file']);
|
$path = CONF['reg']['suffixes_path'] . '/' . regParseDomain($domain)['suffix'] . 'zone';
|
||||||
if ($regFile === false)
|
$content = file_get_contents($path);
|
||||||
output(500, 'Failed to read current registry File.');
|
if ($content === false)
|
||||||
$regFile = preg_replace('/^(?:[a-z0-9._-]+\.)' . preg_quote($domain, '/') . '[\t ]+.+$/Dm', '', $regFile);
|
output(500, 'Failed to read current registry file.');
|
||||||
if (file_put_contents(CONF['reg']['registry_file'], $regFile) === false)
|
$content = preg_replace('/^(?:[a-z0-9._-]+\.)' . preg_quote($domain, '/') . '[\t ]+.+$/Dm', '', $content);
|
||||||
|
if (file_put_contents($path, $content) === false)
|
||||||
output(500, 'Failed to write new registry file.');
|
output(500, 'Failed to write new registry file.');
|
||||||
|
|
||||||
// Delete from Niver's database
|
// Delete from Niver's database
|
||||||
|
@ -28,3 +29,17 @@ function regDeleteDomain($domain) {
|
||||||
'username' => $_SESSION['id'],
|
'username' => $_SESSION['id'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function regParseDomain($domain) {
|
||||||
|
$parts = explode('.', $domain, 2);
|
||||||
|
$subdomain = $parts[0];
|
||||||
|
$suffix = $parts[1];
|
||||||
|
|
||||||
|
if (array_key_exists($suffix, CONF['reg']['suffixes']) !== true)
|
||||||
|
output(403, 'This suffix doesn\'t exist.');
|
||||||
|
|
||||||
|
return [
|
||||||
|
'subdomain' => $subdomain,
|
||||||
|
'suffix' => $suffix,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Language: fr\n"
|
||||||
|
|
||||||
#: pages.php:9
|
#: pages.php:9
|
||||||
msgid "Authentication"
|
msgid "Authentication"
|
||||||
msgstr "Authentification"
|
msgstr "Authentification"
|
||||||
|
@ -267,11 +272,11 @@ msgstr "Supprimer un accès"
|
||||||
msgid "Delete an existing HTTP access from a subdirectory of the SFTP space"
|
msgid "Delete an existing HTTP access from a subdirectory of the SFTP space"
|
||||||
msgstr "Retirer un accès HTTP existant d'un sous-dossier de l'espace SFTP"
|
msgstr "Retirer un accès HTTP existant d'un sous-dossier de l'espace SFTP"
|
||||||
|
|
||||||
#: router.php:120
|
#: router.php:134
|
||||||
msgid "You need to be logged in to do this."
|
msgid "You need to be logged in to do this."
|
||||||
msgstr "Vous devez être connecté·e à un compte pour faire cela."
|
msgstr "Vous devez être connecté·e à un compte pour faire cela."
|
||||||
|
|
||||||
#: router.php:122
|
#: router.php:136
|
||||||
msgid "This account doesn't exist anymore. Log out to end this ghost session."
|
msgid "This account doesn't exist anymore. Log out to end this ghost session."
|
||||||
msgstr "Ce compte n'existe plus. Déconnectez-vous pour terminer cette session fantôme."
|
msgstr "Ce compte n'existe plus. Déconnectez-vous pour terminer cette session fantôme."
|
||||||
|
|
||||||
|
@ -424,7 +429,7 @@ msgstr "Accès retiré."
|
||||||
#: pg-act/ns/ip.php:14 pg-act/ns/loc.php:70 pg-act/ns/mx.php:18
|
#: pg-act/ns/ip.php:14 pg-act/ns/loc.php:70 pg-act/ns/mx.php:18
|
||||||
#: pg-act/ns/ns.php:14 pg-act/ns/srv.php:26 pg-act/ns/sshfp.php:23
|
#: pg-act/ns/ns.php:14 pg-act/ns/srv.php:26 pg-act/ns/sshfp.php:23
|
||||||
#: pg-act/ns/tlsa.php:27 pg-act/ns/txt.php:15 pg-act/reg/ds.php:30
|
#: pg-act/ns/tlsa.php:27 pg-act/ns/txt.php:15 pg-act/reg/ds.php:30
|
||||||
#: pg-act/reg/glue.php:16 pg-act/reg/ns.php:13
|
#: pg-act/reg/glue.php:12 pg-act/reg/ns.php:12
|
||||||
msgid "Modification done."
|
msgid "Modification done."
|
||||||
msgstr "Modification effectuée."
|
msgstr "Modification effectuée."
|
||||||
|
|
||||||
|
@ -454,7 +459,7 @@ msgstr "Cette zone existe déjà sur ce service."
|
||||||
msgid "Parent zone's name servers not found."
|
msgid "Parent zone's name servers not found."
|
||||||
msgstr "Serveurs de nom de la zone parente introuvables."
|
msgstr "Serveurs de nom de la zone parente introuvables."
|
||||||
|
|
||||||
#: pg-act/ns/zone-add.php:16 pg-act/reg/transfer.php:13
|
#: pg-act/ns/zone-add.php:16 pg-act/reg/transfer.php:16
|
||||||
msgid "NS authentication record not found."
|
msgid "NS authentication record not found."
|
||||||
msgstr "Enregistrement d'authentification NS introuvable."
|
msgstr "Enregistrement d'authentification NS introuvable."
|
||||||
|
|
||||||
|
@ -466,27 +471,27 @@ msgstr "Zone créée."
|
||||||
msgid "Zone deleted."
|
msgid "Zone deleted."
|
||||||
msgstr "Zone supprimée."
|
msgstr "Zone supprimée."
|
||||||
|
|
||||||
#: pg-act/reg/register.php:4
|
#: pg-act/reg/register.php:4 pg-act/reg/transfer.php:4
|
||||||
msgid "This format of subdomain is not allowed."
|
msgid "This format of subdomain is not allowed."
|
||||||
msgstr "Ce format de sous-domaine n'est pas autorisé."
|
msgstr "Ce format de sous-domaine n'est pas autorisé."
|
||||||
|
|
||||||
#: pg-act/reg/register.php:9
|
#: pg-act/reg/register.php:21
|
||||||
msgid "This domain is already registered."
|
msgid "This domain is already registered."
|
||||||
msgstr "Ce domain est déjà enregistré."
|
msgstr "Ce domain est déjà enregistré."
|
||||||
|
|
||||||
#: pg-act/reg/register.php:12
|
#: pg-act/reg/register.php:24
|
||||||
msgid "This domain is reserved."
|
msgid "This domain is reserved."
|
||||||
msgstr "Ce domain est réservé."
|
msgstr "Ce domain est réservé."
|
||||||
|
|
||||||
#: pg-act/reg/register.php:22
|
#: pg-act/reg/register.php:34
|
||||||
msgid "Domain registered."
|
msgid "Domain registered."
|
||||||
msgstr "Domaine enregistré."
|
msgstr "Domaine enregistré."
|
||||||
|
|
||||||
#: pg-act/reg/transfer.php:9
|
#: pg-act/reg/transfer.php:12
|
||||||
msgid "The current account already owns this domain."
|
msgid "The current account already owns this domain."
|
||||||
msgstr "Le compte actuel possède déjà ce domaine."
|
msgstr "Le compte actuel possède déjà ce domaine."
|
||||||
|
|
||||||
#: pg-act/reg/transfer.php:26
|
#: pg-act/reg/transfer.php:29
|
||||||
msgid "The domain has been transferred to the current account ; the NS authentication record has been automatically deleted."
|
msgid "The domain has been transferred to the current account ; the NS authentication record has been automatically deleted."
|
||||||
msgstr "Le domaine a été transféré vers le compte actuel ; l'enregistrement d'authentification NS a été automatiquement supprimé."
|
msgstr "Le domaine a été transféré vers le compte actuel ; l'enregistrement d'authentification NS a été automatiquement supprimé."
|
||||||
|
|
||||||
|
@ -569,11 +574,11 @@ msgid "Stable Let's Encrypt certificates"
|
||||||
msgstr "Vrai certificat Let's Encrypt"
|
msgstr "Vrai certificat Let's Encrypt"
|
||||||
|
|
||||||
#: pg-view/auth/login.php:1
|
#: pg-view/auth/login.php:1
|
||||||
msgid "Need an accout?"
|
msgid "New?"
|
||||||
msgstr "Nouvele ?"
|
msgstr "Nouvele ?"
|
||||||
|
|
||||||
#: pg-view/auth/login.php:1 pg-view/reg/register.php:10
|
#: pg-view/auth/login.php:1 pg-view/auth/register.php:14
|
||||||
msgid "Register"
|
msgid "Create an account"
|
||||||
msgstr "Créer un compte"
|
msgstr "Créer un compte"
|
||||||
|
|
||||||
#: pg-view/auth/login.php:4 pg-view/auth/register.php:4 pg-view/ht/index.php:94
|
#: pg-view/auth/login.php:4 pg-view/auth/register.php:4 pg-view/ht/index.php:94
|
||||||
|
@ -605,10 +610,6 @@ msgstr "Déjà un compte ?"
|
||||||
msgid "Minimum %1$s characters, or %2$s characters if it contains lowercase, uppercase and digit."
|
msgid "Minimum %1$s characters, or %2$s characters if it contains lowercase, uppercase and digit."
|
||||||
msgstr "Minimum %1$s caractères, ou %2$s caractères si elle contient minuscule, majuscule et chiffre."
|
msgstr "Minimum %1$s caractères, ou %2$s caractères si elle contient minuscule, majuscule et chiffre."
|
||||||
|
|
||||||
#: pg-view/auth/register.php:14
|
|
||||||
msgid "Create an account"
|
|
||||||
msgstr "Se créer un nouveau compte"
|
|
||||||
|
|
||||||
#: pg-view/auth/unregister.php:2
|
#: pg-view/auth/unregister.php:2
|
||||||
msgid "This will delete every resource managed by the current account, including registered domains, hosted DNS records, websites files and cryptographic keys for Onion services and DNSSEC."
|
msgid "This will delete every resource managed by the current account, including registered domains, hosted DNS records, websites files and cryptographic keys for Onion services and DNSSEC."
|
||||||
msgstr "Ceci supprimera toutes les ressources gérées par le compte actuel, y compris les domaines enregistrés, les enregistrements DNS hébergés, les fichiers des sites et les clés cryptographiques des services Onion et de DNSSEC."
|
msgstr "Ceci supprimera toutes les ressources gérées par le compte actuel, y compris les domaines enregistrés, les enregistrements DNS hébergés, les fichiers des sites et les clés cryptographiques des services Onion et de DNSSEC."
|
||||||
|
@ -641,7 +642,8 @@ msgstr "Le domaine doit avoir les enregistrements suivant pendant le traitement
|
||||||
#: pg-view/ht/add-dns.php:25 pg-view/ns/form.ns.php:8 pg-view/ns/print.php:32
|
#: pg-view/ht/add-dns.php:25 pg-view/ns/form.ns.php:8 pg-view/ns/print.php:32
|
||||||
#: pg-view/ns/zone-add.php:6 pg-view/reg/ds.php:8 pg-view/reg/glue.php:8
|
#: pg-view/ns/zone-add.php:6 pg-view/reg/ds.php:8 pg-view/reg/glue.php:8
|
||||||
#: pg-view/reg/glue.php:15 pg-view/reg/ns.php:8 pg-view/reg/print.php:2
|
#: pg-view/reg/glue.php:15 pg-view/reg/ns.php:8 pg-view/reg/print.php:2
|
||||||
#: pg-view/reg/print.php:16 pg-view/reg/unregister.php:6
|
#: pg-view/reg/print.php:16 pg-view/reg/register.php:7
|
||||||
|
#: pg-view/reg/unregister.php:6
|
||||||
msgid "Domain"
|
msgid "Domain"
|
||||||
msgstr "Domaine"
|
msgstr "Domaine"
|
||||||
|
|
||||||
|
@ -656,7 +658,8 @@ msgid "Setup access"
|
||||||
msgstr "Créer l'accès"
|
msgstr "Créer l'accès"
|
||||||
|
|
||||||
#: pg-view/ht/add-subdomain.php:2 pg-view/ns/form.ns.php:10
|
#: pg-view/ht/add-subdomain.php:2 pg-view/ns/form.ns.php:10
|
||||||
#: pg-view/reg/glue.php:10 pg-view/reg/register.php:6
|
#: pg-view/reg/glue.php:10 pg-view/reg/register.php:9
|
||||||
|
#: pg-view/reg/transfer.php:9
|
||||||
msgid "Subdomain"
|
msgid "Subdomain"
|
||||||
msgstr "Sous-domaine"
|
msgstr "Sous-domaine"
|
||||||
|
|
||||||
|
@ -1072,16 +1075,24 @@ msgstr "Domaines actuellement enregistrés"
|
||||||
msgid "Register a new domain on your account. It must consist of between 4 and 63 letters and digits."
|
msgid "Register a new domain on your account. It must consist of between 4 and 63 letters and digits."
|
||||||
msgstr "Enregistrer un nouveau domaine sur son compte. Il doit être composé d'entre 4 et 63 lettres et chiffres."
|
msgstr "Enregistrer un nouveau domaine sur son compte. Il doit être composé d'entre 4 et 63 lettres et chiffres."
|
||||||
|
|
||||||
|
#: pg-view/reg/register.php:14 pg-view/reg/transfer.php:14
|
||||||
|
msgid "Suffix"
|
||||||
|
msgstr "Suffixe"
|
||||||
|
|
||||||
|
#: pg-view/reg/register.php:28
|
||||||
|
msgid "Register"
|
||||||
|
msgstr "Enregistrer"
|
||||||
|
|
||||||
#: pg-view/reg/transfer.php:2
|
#: pg-view/reg/transfer.php:2
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "To prove that you are allowed to receive the domain by its current owner, the domain must have an NS record equal to %s when the form is being processed. The NS record will be automatically deleted once validated."
|
msgid "To prove that you are allowed to receive the domain by its current owner, the domain must have an NS record equal to %s when the form is being processed. The NS record will be automatically deleted once validated."
|
||||||
msgstr "Pour prouver que vous êtes autorisé à recevoir le domaine par san possessaire actuele, ledit domaine doit posséder un enregistrement NS égal à %s lors du traitement de ce formulaire. Cet enregistrement sera automatiquement retiré une fois validé."
|
msgstr "Pour prouver que vous êtes autorisé à recevoir le domaine par san possessaire actuele, ledit domaine doit posséder un enregistrement NS égal à %s lors du traitement de ce formulaire. Cet enregistrement sera automatiquement retiré une fois validé."
|
||||||
|
|
||||||
#: pg-view/reg/transfer.php:6
|
#: pg-view/reg/transfer.php:7
|
||||||
msgid "Subdomain that will be transferred to this account"
|
msgid "Domain that will be transferred to this account"
|
||||||
msgstr "Sous-domaine à transférer vers ce compte"
|
msgstr "Domaine à transférer vers ce compte"
|
||||||
|
|
||||||
#: pg-view/reg/transfer.php:10
|
#: pg-view/reg/transfer.php:26
|
||||||
msgid "Receive the domain"
|
msgid "Receive the domain"
|
||||||
msgstr "Recevoir le domaine"
|
msgstr "Recevoir le domaine"
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
|
||||||
#: pages.php:9
|
#: pages.php:9
|
||||||
msgid "Authentication"
|
msgid "Authentication"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -267,11 +271,11 @@ msgstr ""
|
||||||
msgid "Delete an existing HTTP access from a subdirectory of the SFTP space"
|
msgid "Delete an existing HTTP access from a subdirectory of the SFTP space"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: router.php:120
|
#: router.php:134
|
||||||
msgid "You need to be logged in to do this."
|
msgid "You need to be logged in to do this."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: router.php:122
|
#: router.php:136
|
||||||
msgid "This account doesn't exist anymore. Log out to end this ghost session."
|
msgid "This account doesn't exist anymore. Log out to end this ghost session."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -424,7 +428,7 @@ msgstr ""
|
||||||
#: pg-act/ns/ip.php:14 pg-act/ns/loc.php:70 pg-act/ns/mx.php:18
|
#: pg-act/ns/ip.php:14 pg-act/ns/loc.php:70 pg-act/ns/mx.php:18
|
||||||
#: pg-act/ns/ns.php:14 pg-act/ns/srv.php:26 pg-act/ns/sshfp.php:23
|
#: pg-act/ns/ns.php:14 pg-act/ns/srv.php:26 pg-act/ns/sshfp.php:23
|
||||||
#: pg-act/ns/tlsa.php:27 pg-act/ns/txt.php:15 pg-act/reg/ds.php:30
|
#: pg-act/ns/tlsa.php:27 pg-act/ns/txt.php:15 pg-act/reg/ds.php:30
|
||||||
#: pg-act/reg/glue.php:16 pg-act/reg/ns.php:13
|
#: pg-act/reg/glue.php:12 pg-act/reg/ns.php:12
|
||||||
msgid "Modification done."
|
msgid "Modification done."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -454,7 +458,7 @@ msgstr ""
|
||||||
msgid "Parent zone's name servers not found."
|
msgid "Parent zone's name servers not found."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-act/ns/zone-add.php:16 pg-act/reg/transfer.php:13
|
#: pg-act/ns/zone-add.php:16 pg-act/reg/transfer.php:16
|
||||||
msgid "NS authentication record not found."
|
msgid "NS authentication record not found."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -466,27 +470,27 @@ msgstr ""
|
||||||
msgid "Zone deleted."
|
msgid "Zone deleted."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-act/reg/register.php:4
|
#: pg-act/reg/register.php:4 pg-act/reg/transfer.php:4
|
||||||
msgid "This format of subdomain is not allowed."
|
msgid "This format of subdomain is not allowed."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-act/reg/register.php:9
|
#: pg-act/reg/register.php:21
|
||||||
msgid "This domain is already registered."
|
msgid "This domain is already registered."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-act/reg/register.php:12
|
#: pg-act/reg/register.php:24
|
||||||
msgid "This domain is reserved."
|
msgid "This domain is reserved."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-act/reg/register.php:22
|
#: pg-act/reg/register.php:34
|
||||||
msgid "Domain registered."
|
msgid "Domain registered."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-act/reg/transfer.php:9
|
#: pg-act/reg/transfer.php:12
|
||||||
msgid "The current account already owns this domain."
|
msgid "The current account already owns this domain."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-act/reg/transfer.php:26
|
#: pg-act/reg/transfer.php:29
|
||||||
msgid "The domain has been transferred to the current account ; the NS authentication record has been automatically deleted."
|
msgid "The domain has been transferred to the current account ; the NS authentication record has been automatically deleted."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -569,11 +573,11 @@ msgid "Stable Let's Encrypt certificates"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-view/auth/login.php:1
|
#: pg-view/auth/login.php:1
|
||||||
msgid "Need an accout?"
|
msgid "New?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-view/auth/login.php:1 pg-view/reg/register.php:10
|
#: pg-view/auth/login.php:1 pg-view/auth/register.php:14
|
||||||
msgid "Register"
|
msgid "Create an account"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-view/auth/login.php:4 pg-view/auth/register.php:4 pg-view/ht/index.php:94
|
#: pg-view/auth/login.php:4 pg-view/auth/register.php:4 pg-view/ht/index.php:94
|
||||||
|
@ -605,10 +609,6 @@ msgstr ""
|
||||||
msgid "Minimum %1$s characters, or %2$s characters if it contains lowercase, uppercase and digit."
|
msgid "Minimum %1$s characters, or %2$s characters if it contains lowercase, uppercase and digit."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-view/auth/register.php:14
|
|
||||||
msgid "Create an account"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: pg-view/auth/unregister.php:2
|
#: pg-view/auth/unregister.php:2
|
||||||
msgid "This will delete every resource managed by the current account, including registered domains, hosted DNS records, websites files and cryptographic keys for Onion services and DNSSEC."
|
msgid "This will delete every resource managed by the current account, including registered domains, hosted DNS records, websites files and cryptographic keys for Onion services and DNSSEC."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -641,7 +641,8 @@ msgstr ""
|
||||||
#: pg-view/ht/add-dns.php:25 pg-view/ns/form.ns.php:8 pg-view/ns/print.php:32
|
#: pg-view/ht/add-dns.php:25 pg-view/ns/form.ns.php:8 pg-view/ns/print.php:32
|
||||||
#: pg-view/ns/zone-add.php:6 pg-view/reg/ds.php:8 pg-view/reg/glue.php:8
|
#: pg-view/ns/zone-add.php:6 pg-view/reg/ds.php:8 pg-view/reg/glue.php:8
|
||||||
#: pg-view/reg/glue.php:15 pg-view/reg/ns.php:8 pg-view/reg/print.php:2
|
#: pg-view/reg/glue.php:15 pg-view/reg/ns.php:8 pg-view/reg/print.php:2
|
||||||
#: pg-view/reg/print.php:16 pg-view/reg/unregister.php:6
|
#: pg-view/reg/print.php:16 pg-view/reg/register.php:7
|
||||||
|
#: pg-view/reg/unregister.php:6
|
||||||
msgid "Domain"
|
msgid "Domain"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -656,7 +657,8 @@ msgid "Setup access"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-view/ht/add-subdomain.php:2 pg-view/ns/form.ns.php:10
|
#: pg-view/ht/add-subdomain.php:2 pg-view/ns/form.ns.php:10
|
||||||
#: pg-view/reg/glue.php:10 pg-view/reg/register.php:6
|
#: pg-view/reg/glue.php:10 pg-view/reg/register.php:9
|
||||||
|
#: pg-view/reg/transfer.php:9
|
||||||
msgid "Subdomain"
|
msgid "Subdomain"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1072,16 +1074,24 @@ msgstr ""
|
||||||
msgid "Register a new domain on your account. It must consist of between 4 and 63 letters and digits."
|
msgid "Register a new domain on your account. It must consist of between 4 and 63 letters and digits."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: pg-view/reg/register.php:14 pg-view/reg/transfer.php:14
|
||||||
|
msgid "Suffix"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: pg-view/reg/register.php:28
|
||||||
|
msgid "Register"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: pg-view/reg/transfer.php:2
|
#: pg-view/reg/transfer.php:2
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "To prove that you are allowed to receive the domain by its current owner, the domain must have an NS record equal to %s when the form is being processed. The NS record will be automatically deleted once validated."
|
msgid "To prove that you are allowed to receive the domain by its current owner, the domain must have an NS record equal to %s when the form is being processed. The NS record will be automatically deleted once validated."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-view/reg/transfer.php:6
|
#: pg-view/reg/transfer.php:7
|
||||||
msgid "Subdomain that will be transferred to this account"
|
msgid "Domain that will be transferred to this account"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pg-view/reg/transfer.php:10
|
#: pg-view/reg/transfer.php:26
|
||||||
msgid "Receive the domain"
|
msgid "Receive the domain"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -43,12 +43,12 @@ define('PAGES', [
|
||||||
],
|
],
|
||||||
'reg' => [
|
'reg' => [
|
||||||
'index' => [
|
'index' => [
|
||||||
'title' => '<span aria-hidden="true">🏷️ </span>' . sprintf(_('%s registry'), '<code>' . CONF['reg']['registry'] . '</code>'),
|
'title' => '<span aria-hidden="true">🏷️ </span>' . sprintf(_('%s registry'), '<code>' . key(CONF['reg']['suffixes']) . '</code>'),
|
||||||
'description' => sprintf(_('Register and delegate a %s subdomain'), '<code>' . CONF['reg']['registry'] . '</code>'),
|
'description' => sprintf(_('Register and delegate a %s subdomain'), '<code>' . key(CONF['reg']['suffixes']) . '</code>'),
|
||||||
],
|
],
|
||||||
'register' => [
|
'register' => [
|
||||||
'title' => _('Register domain'),
|
'title' => _('Register domain'),
|
||||||
'description' => sprintf(_('Get a %s subdomain'), '<code>' . CONF['reg']['registry'] . '</code>'),
|
'description' => sprintf(_('Get a %s subdomain'), '<code>' . key(CONF['reg']['suffixes']) . '</code>'),
|
||||||
'tokens_account_cost' => 3600,
|
'tokens_account_cost' => 3600,
|
||||||
],
|
],
|
||||||
'unregister' => [
|
'unregister' => [
|
||||||
|
@ -61,7 +61,7 @@ define('PAGES', [
|
||||||
],
|
],
|
||||||
'ns' => [
|
'ns' => [
|
||||||
'title' => sprintf(_('%s records'), '<abbr title="Name Server">NS</abbr>'),
|
'title' => sprintf(_('%s records'), '<abbr title="Name Server">NS</abbr>'),
|
||||||
'description' => sprintf(_('Indicate the name servers of a %s subdomain'), '<code>' . CONF['reg']['registry'] . '</code>'),
|
'description' => sprintf(_('Indicate the name servers of a %s subdomain'), '<code>' . key(CONF['reg']['suffixes']) . '</code>'),
|
||||||
],
|
],
|
||||||
'ds' => [
|
'ds' => [
|
||||||
'title' => sprintf(_('%s records'), '<abbr title="Delegation Signer">DS</abbr>'),
|
'title' => sprintf(_('%s records'), '<abbr title="Delegation Signer">DS</abbr>'),
|
||||||
|
|
|
@ -68,7 +68,7 @@ if ($zone_content === false)
|
||||||
output(500, 'Unable to read zone file.');
|
output(500, 'Unable to read zone file.');
|
||||||
|
|
||||||
$data['zone_content'] = '';
|
$data['zone_content'] = '';
|
||||||
foreach(explode(LF, $zone_content) as $zone_line) {
|
foreach (explode(LF, $zone_content) as $zone_line) {
|
||||||
if (empty($zone_line) OR str_starts_with($zone_line, ';'))
|
if (empty($zone_line) OR str_starts_with($zone_line, ';'))
|
||||||
continue;
|
continue;
|
||||||
if (preg_match('/^(?:(?:[a-z0-9_-]{1,63}\.){1,127})?' . preg_quote($_POST['zone'], '/') . '[\t ]+[0-9]{1,8}[\t ]+(?<type>[A-Z]{1,16})[\t ]+.+$/D', $zone_line, $matches)) {
|
if (preg_match('/^(?:(?:[a-z0-9_-]{1,63}\.){1,127})?' . preg_quote($_POST['zone'], '/') . '[\t ]+[0-9]{1,8}[\t ]+(?<type>[A-Z]{1,16})[\t ]+.+$/D', $zone_line, $matches)) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ if ($_POST['dt'] !== '2' AND $_POST['dt'] !== '4')
|
||||||
|
|
||||||
regCheckDomainPossession($_POST['zone']);
|
regCheckDomainPossession($_POST['zone']);
|
||||||
|
|
||||||
knotcZoneExec(CONF['reg']['registry'], [
|
knotcZoneExec(regParseDomain($_POST['zone'])['suffix'], [
|
||||||
$_POST['zone'],
|
$_POST['zone'],
|
||||||
CONF['reg']['ttl'],
|
CONF['reg']['ttl'],
|
||||||
'DS',
|
'DS',
|
||||||
|
|
|
@ -2,14 +2,10 @@
|
||||||
|
|
||||||
regCheckDomainPossession($_POST['suffix']);
|
regCheckDomainPossession($_POST['suffix']);
|
||||||
|
|
||||||
$domain = formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['suffix']);
|
knotcZoneExec(regParseDomain($_POST['suffix'])['suffix'], [
|
||||||
|
formatAbsoluteDomain(formatEndWithDot($_POST['subdomain']) . $_POST['suffix']),
|
||||||
$record = checkIpFormat($_POST['ip']);
|
|
||||||
|
|
||||||
knotcZoneExec(CONF['reg']['registry'], [
|
|
||||||
$domain,
|
|
||||||
CONF['reg']['ttl'],
|
CONF['reg']['ttl'],
|
||||||
$record,
|
checkIpFormat($_POST['ip']),
|
||||||
$_POST['ip']
|
$_POST['ip']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
regCheckDomainPossession($_POST['domain']);
|
regCheckDomainPossession($_POST['domain']);
|
||||||
$_POST['ns'] = formatAbsoluteDomain($_POST['ns']);
|
|
||||||
|
|
||||||
knotcZoneExec(CONF['reg']['registry'], [
|
knotcZoneExec(regParseDomain($_POST['domain'])['suffix'], [
|
||||||
$_POST['domain'],
|
$_POST['domain'],
|
||||||
CONF['reg']['ttl'],
|
CONF['reg']['ttl'],
|
||||||
'NS',
|
'NS',
|
||||||
$_POST['ns']
|
formatAbsoluteDomain($_POST['ns'])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
output(200, _('Modification done.'));
|
output(200, _('Modification done.'));
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
regCheckDomainPossession($_POST['domain']);
|
regCheckDomainPossession($_POST['domain']);
|
||||||
|
|
||||||
$zone_content = file_get_contents(CONF['reg']['registry_file']);
|
$zone_content = file_get_contents(CONF['reg']['suffixes_path'] . '/' . regParseDomain($_POST['domain'])['suffix'] . 'zone');
|
||||||
if ($zone_content === false)
|
if ($zone_content === false)
|
||||||
output(500, 'Unable to read registry file.');
|
output(500, 'Unable to read registry file.');
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,19 @@
|
||||||
if (preg_match('/' . SUBDOMAIN_REGEX . '/D', $_POST['subdomain']) !== 1)
|
if (preg_match('/' . SUBDOMAIN_REGEX . '/D', $_POST['subdomain']) !== 1)
|
||||||
output(403, _('This format of subdomain is not allowed.'));
|
output(403, _('This format of subdomain is not allowed.'));
|
||||||
|
|
||||||
$domain = formatAbsoluteDomain($_POST['subdomain'] . '.' . CONF['reg']['registry']);
|
if (array_key_exists($_POST['suffix'], CONF['reg']['suffixes']) !== true)
|
||||||
|
output(403, 'This suffix doesn\'t exist.');
|
||||||
|
|
||||||
|
match (CONF['reg']['suffixes'][$_POST['suffix']]) {
|
||||||
|
'all' => NULL,
|
||||||
|
'approved' => match ($_SESSION['type']) {
|
||||||
|
'approved' => NULL,
|
||||||
|
default => output(403, 'The current account type is not allowed to register in this suffix.'),
|
||||||
|
},
|
||||||
|
default => output(403, 'This suffix is not open to registration.'),
|
||||||
|
};
|
||||||
|
|
||||||
|
$domain = formatAbsoluteDomain($_POST['subdomain'] . '.' . $_POST['suffix']);
|
||||||
|
|
||||||
if (query('select', 'registry', ['domain' => $domain], 'domain') !== [])
|
if (query('select', 'registry', ['domain' => $domain], 'domain') !== [])
|
||||||
output(403, _('This domain is already registered.'));
|
output(403, _('This domain is already registered.'));
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (preg_match('/' . SUBDOMAIN_REGEX . '/D', $_POST['domain']) !== 1)
|
if (preg_match('/' . SUBDOMAIN_REGEX . '/D', $_POST['subdomain']) !== 1)
|
||||||
output(403, 'Wrong domain name format.');
|
output(403, _('This format of subdomain is not allowed.'));
|
||||||
|
|
||||||
$domain = $_POST['domain'] . '.' . CONF['reg']['registry'];
|
if (array_key_exists($_POST['suffix'], CONF['reg']['suffixes']) !== true)
|
||||||
|
output(403, 'This suffix doesn\'t exist.');
|
||||||
|
|
||||||
|
$domain = formatAbsoluteDomain($_POST['subdomain'] . '.' . $_POST['suffix']);
|
||||||
|
|
||||||
if (query('select', 'registry', ['username' => $_SESSION['id'], 'domain' => $domain], 'domain') !== [])
|
if (query('select', 'registry', ['username' => $_SESSION['id'], 'domain' => $domain], 'domain') !== [])
|
||||||
output(403, _('The current account already owns this domain.'));
|
output(403, _('The current account already owns this domain.'));
|
||||||
|
@ -17,7 +20,7 @@ checkAuthToken($matches['salt'], $matches['hash']);
|
||||||
DB->prepare('UPDATE registry SET username = :username WHERE domain = :domain')
|
DB->prepare('UPDATE registry SET username = :username WHERE domain = :domain')
|
||||||
->execute([':username' => $_SESSION['id'], ':domain' => $domain]);
|
->execute([':username' => $_SESSION['id'], ':domain' => $domain]);
|
||||||
|
|
||||||
knotcZoneExec(CONF['reg']['registry'], [
|
knotcZoneExec($_POST['suffix'], [
|
||||||
$domain,
|
$domain,
|
||||||
'NS',
|
'NS',
|
||||||
$matches['salt'] . '-' . $matches['hash'] . '._transfer-verification.' . SERVER_NAME . '.'
|
$matches['salt'] . '-' . $matches['hash'] . '._transfer-verification.' . SERVER_NAME . '.'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<p><?= _('Need an accout?') ?> <a href="register"><?= _('Register') ?></a></p>
|
<p><?= _('New?') ?> <a href="register"><?= _('Create an account') ?></a></p>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<label for="username"><?= _('Username') ?></label><br>
|
<label for="username"><?= _('Username') ?></label><br>
|
||||||
|
|
|
@ -4,19 +4,19 @@
|
||||||
<dd>
|
<dd>
|
||||||
<?= PAGES['auth']['index']['description'] ?>
|
<?= PAGES['auth']['index']['description'] ?>
|
||||||
</dd>
|
</dd>
|
||||||
<?php if(CONF['reg']['enabled'] === true) { ?>
|
<?php if (CONF['reg']['enabled'] === true) { ?>
|
||||||
<dt><a class="reg" href="reg/"><?= PAGES['reg']['index']['title'] ?></code></a></dt>
|
<dt><a class="reg" href="reg/"><?= PAGES['reg']['index']['title'] ?></code></a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<?= PAGES['reg']['index']['description'] ?>
|
<?= PAGES['reg']['index']['description'] ?>
|
||||||
</dd>
|
</dd>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if(CONF['ns']['enabled'] === true) { ?>
|
<?php if (CONF['ns']['enabled'] === true) { ?>
|
||||||
<dt><a class="ns" href="ns/"><?= PAGES['ns']['index']['title'] ?></a></dt>
|
<dt><a class="ns" href="ns/"><?= PAGES['ns']['index']['title'] ?></a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<?= PAGES['ns']['index']['description'] ?>
|
<?= PAGES['ns']['index']['description'] ?>
|
||||||
</dd>
|
</dd>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if(CONF['ht']['enabled'] === true) { ?>
|
<?php if (CONF['ht']['enabled'] === true) { ?>
|
||||||
<dt><a class="ht" href="ht/"><?= PAGES['ht']['index']['title'] ?></a></dt>
|
<dt><a class="ht" href="ht/"><?= PAGES['ht']['index']['title'] ?></a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<?= PAGES['ht']['index']['description'] ?>
|
<?= PAGES['ht']['index']['description'] ?>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<select required="" name="suffix" id="suffix">
|
<select required="" name="suffix" id="suffix">
|
||||||
<option value="" disabled="" selected="">—</option>
|
<option value="" disabled="" selected="">—</option>
|
||||||
<?php
|
<?php
|
||||||
foreach(regListUserDomains() as $suffix)
|
foreach (regListUserDomains() as $suffix)
|
||||||
echo ' <option value="' . $suffix . '">' . $suffix . '</option>' . LF;
|
echo ' <option value="' . $suffix . '">' . $suffix . '</option>' . LF;
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<p>
|
<p>
|
||||||
<?= sprintf(_('This domain name registry allows to register domains ending with <code>%1$s</code>, for instance <code><em>domain</em>%1$s</code>.'), '.' . CONF['reg']['registry']) ?>
|
<?= sprintf(_('This domain name registry allows to register domains ending with <code>%1$s</code>, for instance <code><em>domain</em>%1$s</code>.'), '.' . key(CONF['reg']['suffixes'])) ?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<?php displayIndex(); ?>
|
<?php displayIndex(); ?>
|
||||||
|
|
|
@ -3,9 +3,27 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<label for="subdomain"><?= _('Subdomain') ?></label>
|
<fieldset>
|
||||||
<br>
|
<legend><?= _('Domain') ?></legend>
|
||||||
<code><input id="subdomain" pattern="<?= SUBDOMAIN_REGEX ?>" required="" placeholder="niver" name="subdomain" type="text">.<?= CONF['reg']['registry'] ?></code>
|
<div>
|
||||||
<br>
|
<label for="subdomain"><?= _('Subdomain') ?></label>
|
||||||
|
<br>
|
||||||
|
<input id="subdomain" pattern="<?= SUBDOMAIN_REGEX ?>" required="" placeholder="niver" name="subdomain" type="text">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="suffix"><?= _('Suffix') ?></label>
|
||||||
|
<br>
|
||||||
|
<select required="" name="suffix" id="suffix">
|
||||||
|
<?php
|
||||||
|
foreach (CONF['reg']['suffixes'] as $suffix => $availability) {
|
||||||
|
if ($availability === 'none')
|
||||||
|
continue;
|
||||||
|
echo ' <option' . (($availability === 'approved' AND ($_SESSION['type'] ?? '') !== 'approved') ? ' disabled=""' : '') . ' value="' . $suffix . '">.' . $suffix . '</option>' . LF;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<input type="submit" value="<?= _('Register') ?>">
|
<input type="submit" value="<?= _('Register') ?>">
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -3,9 +3,25 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<label for="subdomain"><?= _('Subdomain that will be transferred to this account') ?></label>
|
<fieldset>
|
||||||
<br>
|
<legend><?= _('Domain that will be transferred to this account') ?></legend>
|
||||||
<code><input required="" pattern="<?= SUBDOMAIN_REGEX ?>" placeholder="subdomain" id="subdomain" name="subdomain" type="text">.<?= CONF['reg']['registry'] ?></code>
|
<div>
|
||||||
<br>
|
<label for="subdomain"><?= _('Subdomain') ?></label>
|
||||||
|
<br>
|
||||||
|
<input id="subdomain" pattern="<?= SUBDOMAIN_REGEX ?>" required="" placeholder="niver" name="subdomain" type="text">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="suffix"><?= _('Suffix') ?></label>
|
||||||
|
<br>
|
||||||
|
<select required="" name="suffix" id="suffix">
|
||||||
|
<?php
|
||||||
|
foreach (CONF['reg']['suffixes'] as $suffix => $availability) {
|
||||||
|
echo ' <option value="' . $suffix . '">.' . $suffix . '</option>' . LF;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<input type="submit" value="<?= _('Receive the domain') ?>">
|
<input type="submit" value="<?= _('Receive the domain') ?>">
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<select required="" name="domain" id="domain">
|
<select required="" name="domain" id="domain">
|
||||||
<option value="" disabled="" selected="">—</option>
|
<option value="" disabled="" selected="">—</option>
|
||||||
<?php
|
<?php
|
||||||
foreach(regListUserDomains() as $domain)
|
foreach (regListUserDomains() as $domain)
|
||||||
echo ' <option value="' . $domain . '">' . $domain . '</option>' . LF;
|
echo ' <option value="' . $domain . '">' . $domain . '</option>' . LF;
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
|
2
view.php
2
view.php
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title><?php
|
<title><?php
|
||||||
foreach(array_reverse(TITLES_LINEAGE) as $id => $title)
|
foreach (array_reverse(TITLES_LINEAGE) as $id => $title)
|
||||||
echo strip_tags($title) . (array_key_last(TITLES_LINEAGE) === $id ? '' : ' < ');
|
echo strip_tags($title) . (array_key_last(TITLES_LINEAGE) === $id ? '' : ' < ');
|
||||||
?></title>
|
?></title>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in a new issue