diff --git a/scripts/pi-hole/php/add.php b/scripts/pi-hole/php/add.php index ffffccec..62c930ef 100644 --- a/scripts/pi-hole/php/add.php +++ b/scripts/pi-hole/php/add.php @@ -13,6 +13,9 @@ switch($type) { case "black": echo exec("sudo pihole -b -q ${_POST['domain']}"); break; + case "wild": + echo exec("sudo pihole -wild -q ${_POST['domain']}"); + break; } ?> diff --git a/scripts/pi-hole/php/get.php b/scripts/pi-hole/php/get.php index fada75b9..41bfe56b 100644 --- a/scripts/pi-hole/php/get.php +++ b/scripts/pi-hole/php/get.php @@ -1,21 +1,55 @@ = 0; $i--) { + if($list[$i] == "") + unset($list[$i]); + } + + return $list; + +} + +function getWildcardListContent() { + $rawList = file_get_contents(checkfile("/etc/dnsmasq.d/03-pihole-wildcard.conf")); + $wclist = explode("\n", $rawList); + $list = []; + + foreach ($wclist as $entry) { + $expl = explode("/", $entry); + if(count($expl) == 3) + { + array_push($list,"*${expl[1]}*"); + } + } + + return array_unique($list); -// Get rid of empty lines -for($i = sizeof($list)-1; $i >= 0; $i--) { - if($list[$i] == "") - unset($list[$i]); } function filterArray(&$inArray) { diff --git a/scripts/pi-hole/php/sub.php b/scripts/pi-hole/php/sub.php index fb670f3a..e09f2d0a 100644 --- a/scripts/pi-hole/php/sub.php +++ b/scripts/pi-hole/php/sub.php @@ -13,6 +13,9 @@ switch($type) { case "black": exec("sudo pihole -b -q -d ${_POST['domain']}"); break; + case "wild": + exec("sudo pihole -wild -q -d ${_POST['domain']}"); + break; } ?>