Extract domain in addition request for all domain types, not just the exact ones.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2020-02-15 07:35:37 +01:00
parent b2cc349abf
commit 268a6d9144

View File

@@ -372,13 +372,14 @@ if ($_POST['action'] == 'get_groups') {
}
$type = intval($_POST['type']);
$domain = $_POST['domain'];
if ($type === ListType::whitelist || $type === ListType::blacklist) {
// Convert domain name to IDNA ASCII form for international domains
$domain = idn_to_ascii($_POST['domain']);
// Convert domain name to IDNA ASCII form for international
// domains and convert the domain to lower case
$domain = strtolower(idn_to_ascii($domain));
// If adding to the exact lists, we convert the domain lower case and check whether it is valid
$domain = strtolower($domain);
// Check validity of domain
if(filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false)
{
throw new Exception('Domain ' . htmlentities(utf8_encode($domain)) . 'is not a valid domain.');