ht: Allow domains ending with a dot
This commit is contained in:
parent
35d1c6ea09
commit
f06e42645a
2 changed files with 8 additions and 2 deletions
|
@ -3,7 +3,13 @@
|
|||
function checkDomainFormat($domain) {
|
||||
// If the domain must end without a dot
|
||||
if (!filter_var($domain, FILTER_VALIDATE_DOMAIN) OR !preg_match("/^([a-z0-9_-]{1,63}\.){1,126}[a-z0-9]{1,63}$/", $domain))
|
||||
userError("Wrong domain.");
|
||||
userError("Domain malformed.");
|
||||
}
|
||||
|
||||
function formatDomain($domain) {
|
||||
$domain = rtrim(strtolower($domain), '.');
|
||||
checkDomainFormat($domain);
|
||||
return $domain;
|
||||
}
|
||||
|
||||
function listFsDirs($username) {
|
||||
|
|
|
@ -6,7 +6,7 @@ else
|
|||
$dirsStatuses = [];
|
||||
|
||||
if (processForm()) {
|
||||
checkDomainFormat($_POST['domain']);
|
||||
$_POST['domain'] = formatDomain($_POST['domain']);
|
||||
|
||||
if ($dirsStatuses[$_POST['dir']] !== false)
|
||||
userError("Wrong value for <code>dir</code>.");
|
||||
|
|
Loading…
Reference in a new issue