diff --git a/scripts/pi-hole/php/add.php b/scripts/pi-hole/php/add.php index 2d3601f8..d6f6d6c0 100644 --- a/scripts/pi-hole/php/add.php +++ b/scripts/pi-hole/php/add.php @@ -14,23 +14,6 @@ $type = $_POST['list']; // All of the verification for list editing list_verify($type); -function add_regex($regex) -{ - global $regexfile; - if(file_put_contents($regexfile, "\n".$regex, FILE_APPEND) === FALSE) - { - $err = error_get_last()["message"]; - echo "Unable to add regex \"".htmlspecialchars($regex)."\" to ${regexfile}
Error message: $err"; - } - else - { - // Send SIGHUP to pihole-FTL using a frontend command - // to force reloading of the regex domains - // This will also wipe the resolver's cache - echo exec("sudo pihole restartdns reload"); - } -} - switch($type) { case "white": if(!isset($_POST["auditlog"])) diff --git a/scripts/pi-hole/php/func.php b/scripts/pi-hole/php/func.php index bc353218..edd0cbcb 100644 --- a/scripts/pi-hole/php/func.php +++ b/scripts/pi-hole/php/func.php @@ -45,4 +45,21 @@ if(!function_exists('hash_equals')) { } } +function add_regex($regex) +{ + global $regexfile; + if(file_put_contents($regexfile, "\n".$regex, FILE_APPEND) === FALSE) + { + $err = error_get_last()["message"]; + echo "Unable to add regex \"".htmlspecialchars($regex)."\" to ${regexfile}
Error message: $err"; + } + else + { + // Send SIGHUP to pihole-FTL using a frontend command + // to force reloading of the regex domains + // This will also wipe the resolver's cache + echo exec("sudo pihole restartdns reload"); + } +} + ?>