diff --git a/scripts/pi-hole/php/teleporter.php b/scripts/pi-hole/php/teleporter.php index 66c5db5e..8f0a46e3 100644 --- a/scripts/pi-hole/php/teleporter.php +++ b/scripts/pi-hole/php/teleporter.php @@ -43,7 +43,7 @@ function limit_length(&$item, $key) $item = substr($item, 0, 253); } -function process_file($contents) +function process_file($contents,$check=True) { $domains = array_filter(explode("\n",$contents)); @@ -51,8 +51,12 @@ function process_file($contents) // function to every member of the array of domains array_walk($domains, "limit_length"); - // Check validity of domains (after possible clipping) - check_domains($domains); + // Check validity of domains (don't do it for regex filters) + if($check) + { + check_domains($domains); + } + return $domains; } @@ -118,12 +122,12 @@ if(isset($_POST["action"])) $importedsomething = true; } - if(isset($_POST["wildlist"]) && $file->getFilename() === "wildcardblocking.txt") + if(isset($_POST["regexlist"]) && $file->getFilename() === "regex.list") { - $wildlist = process_file(file_get_contents($file)); - echo "Processing wildcardblocking.txt
\n"; - exec("sudo pihole -wild -nr --nuke"); - exec("sudo pihole -wild -q -nr ".implode(" ", $wildlist)); + $regexlist = process_file(file_get_contents($file),false); + echo "Processing regex.list
\n"; + exec("sudo pihole --regex -nr --nuke"); + exec("sudo pihole --regex -q -nr ".implode(" ", $regexlist)); $importedsomething = true; } if($importedsomething) diff --git a/settings.php b/settings.php index 902192e9..f824dcf2 100644 --- a/settings.php +++ b/settings.php @@ -1096,9 +1096,9 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "blocklists" Blacklist (exact)
- + Regex filters