mirror of
https://github.com/pi-hole/web.git
synced 2026-05-02 14:42:23 +01:00
Revert empty domain dot replacement (#2314)
This commit is contained in:
@@ -12,6 +12,11 @@
|
||||
ini_set('pcre.recursion_limit', 1500);
|
||||
function validDomain($domain_name, &$message = null)
|
||||
{
|
||||
// special handling of the root zone `.`
|
||||
if ($domain_name == '.') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!preg_match('/^((-|_)*[a-z\\d]((-|_)*[a-z\\d])*(-|_)*)(\\.(-|_)*([a-z\\d]((-|_)*[a-z\\d])*))*$/i', $domain_name)) {
|
||||
if ($message !== null) {
|
||||
$message = 'it contains invalid characters';
|
||||
|
||||
@@ -510,11 +510,14 @@ if ($_POST['action'] == 'get_groups') {
|
||||
$res['groups'] = $groups;
|
||||
if ($res['type'] === ListType::whitelist || $res['type'] === ListType::blacklist) {
|
||||
// Convert domain name to international form
|
||||
$utf8_domain = convertIDNAToUnicode($res['domain']);
|
||||
// Skip this for the root zone `.`
|
||||
if ($res['domain'] != '.') {
|
||||
$utf8_domain = convertIDNAToUnicode($res['domain']);
|
||||
|
||||
// if domain and international form are different, show both
|
||||
if ($res['domain'] !== $utf8_domain) {
|
||||
$res['domain'] = $utf8_domain.' ('.$res['domain'].')';
|
||||
// if domain and international form are different, show both
|
||||
if ($res['domain'] !== $utf8_domain) {
|
||||
$res['domain'] = $utf8_domain.' ('.$res['domain'].')';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Prevent domain and comment fields from returning any arbitrary javascript code which could be executed on the browser.
|
||||
@@ -595,8 +598,10 @@ if ($_POST['action'] == 'get_groups') {
|
||||
|
||||
$input = $domain;
|
||||
// Convert domain name to IDNA ASCII form for international domains
|
||||
$domain = convertUnicodeToIDNA($domain);
|
||||
|
||||
// Skip this for the root zone `.`
|
||||
if ($domain != '.') {
|
||||
$domain = convertUnicodeToIDNA($domain);
|
||||
}
|
||||
if ($_POST['type'] != '2' && $_POST['type'] != '3') {
|
||||
// If not adding a RegEx, we convert the domain lower case and check whether it is valid
|
||||
$domain = strtolower($domain);
|
||||
|
||||
Reference in New Issue
Block a user