diff --git a/scripts/pi-hole/php/groups.php b/scripts/pi-hole/php/groups.php index 157fc50b3..da95aabbf 100644 --- a/scripts/pi-hole/php/groups.php +++ b/scripts/pi-hole/php/groups.php @@ -640,15 +640,9 @@ function verify_ID_array($arr) } } - if(isset($_POST['type']) && strlen($_POST['type']) === 2 && $_POST['type'][1] === 'W') - { - // Apply wildcard-style formatting - $domain = "(\\.|^)".str_replace(".","\\.",$domain)."$"; - } - - if($type === ListType::whitelist || $type === ListType::blacklist) + if( $_POST['type'] != '2' && $_POST['type'] != '3') { - // If adding to the exact lists, we convert the domain lower case and check whether it is valid + // If not adding a RegEx, we convert the domain lower case and check whether it is valid $domain = strtolower($domain); $msg = ""; if(!validDomain($domain, $msg)) @@ -664,6 +658,12 @@ function verify_ID_array($arr) } } + if(isset($_POST['type']) && strlen($_POST['type']) === 2 && $_POST['type'][1] === 'W') + { + // Apply wildcard-style formatting + $domain = "(\\.|^)".str_replace(".","\\.",$domain)."$"; + } + // First try to delete any occurrences of this domain if we're in // replace mode. Only do this when the domain to be replaced is in // the default group! Otherwise, we would shuffle group settings and @@ -996,7 +996,7 @@ function verify_ID_array($arr) if (!$stmt->execute()) { if ($db->lastErrorCode() == 19) { - // ErrorCode 19 is "Constraint violation", here the unique constraint of `address` + // ErrorCode 19 is "Constraint violation", here the unique constraint of `address` // is violated (https://www.sqlite.org/rescode.html#constraint). // If the list is already in database, add to ignored list, but don't throw error $ignored++;