diff --git a/list.php b/list.php
index 5cbff9c7..8d4fc1ba 100644
--- a/list.php
+++ b/list.php
@@ -35,13 +35,9 @@ function getFullName() {
-
-
-
-
@@ -66,14 +62,10 @@ function getFullName() {
-
Exact blocking
-
-
Regex & Wildcard blocking
-
diff --git a/scripts/pi-hole/js/list.js b/scripts/pi-hole/js/list.js
index 53d6b7e5..9a6644ca 100644
--- a/scripts/pi-hole/js/list.js
+++ b/scripts/pi-hole/js/list.js
@@ -43,12 +43,8 @@ function addListEntry(entry, index, list, button, type)
}
function refresh(fade) {
- var listw;
var list = $("#list");
- if(listType === "black")
- {
- listw = $("#list-regex");
- }
+ var listw = $("#list-regex");
if(fade) {
list.fadeOut(100);
if(listw)
@@ -69,9 +65,10 @@ function refresh(fade) {
if((listType === "black" &&
response.blacklist.length === 0 &&
- response.regex.length === 0) ||
+ response.regex_blacklist.length === 0) ||
(listType === "white" &&
- response.whitelist.length === 0))
+ response.whitelist.length === 0 &&
+ response.regex_whitelist.length === 0))
{
$("h3").hide();
list.html("Your " + fullName + " is empty!
");
@@ -82,12 +79,12 @@ function refresh(fade) {
if(listType === "white")
{
data = response.whitelist.sort();
- data2 = []; // No regex data, use empty array
+ data2 = response.regex_whitelist.sort();
}
else if(listType === "black")
{
data = response.blacklist.sort();
- data2 = response.regex.sort();
+ data2 = response.regex_blacklist.sort();
}
data.forEach(function (entry, index)
{
@@ -97,7 +94,7 @@ function refresh(fade) {
// Add regex domains if present in returned list data
data2.forEach(function (entry, index)
{
- addListEntry(entry, index, listw, "#list-regex", "regex");
+ addListEntry(entry, index, listw, "#list-regex", listType+"_regex");
});
}
list.fadeIn(100);
@@ -117,9 +114,9 @@ window.onload = refresh(false);
function sub(index, entry, arg) {
var domain = $("#list #"+index);
var locallistType = listType;
- if(arg === "regex")
+ if(arg === "black_regex" || arg === "white_regex")
{
- locallistType = "regex";
+ locallistType = arg;
domain = $("#list-regex #"+index);
}
domain.hide("highlight");
@@ -143,14 +140,12 @@ function sub(index, entry, arg) {
function add(arg) {
var locallistType = listType;
var domain = $("#domain");
- var wild = false;
if(domain.val().length === 0){
return;
}
- if(arg === "wild" || arg === "regex")
+ if(arg === "wild")
{
- locallistType = arg;
- wild = true;
+ locallistType = listType+"_wild";
}
var alInfo = $("#alInfo");
diff --git a/scripts/pi-hole/php/add.php b/scripts/pi-hole/php/add.php
index 68a7496d..9f3c1b0a 100644
--- a/scripts/pi-hole/php/add.php
+++ b/scripts/pi-hole/php/add.php
@@ -44,12 +44,18 @@ switch($type) {
echo shell_exec("sudo pihole -a audit ".$domains);
}
break;
- case "regex":
+ case "black_regex":
echo shell_exec("sudo pihole --regex --web ".$domains);
break;
- case "wild":
+ case "white_regex":
+ echo shell_exec("sudo pihole --whiteregex --web ".$domains);
+ break;
+ case "black_wild":
echo shell_exec("sudo pihole --wild --web ".$domains);
break;
+ case "white_wild":
+ echo shell_exec("sudo pihole --whitewild --web ".$domains);
+ break;
case "audit":
echo shell_exec("sudo pihole -a audit ".$domains);
break;
diff --git a/scripts/pi-hole/php/auth.php b/scripts/pi-hole/php/auth.php
index 69fe6b28..1ea6014d 100644
--- a/scripts/pi-hole/php/auth.php
+++ b/scripts/pi-hole/php/auth.php
@@ -11,7 +11,6 @@ $ERRORLOG = getenv('PHP_ERROR_LOG');
if (empty($ERRORLOG)) {
$ERRORLOG = '/var/log/lighttpd/error.log';
}
-$regexfile = "/etc/pihole/regex.list";
function pi_log($message) {
error_log(date('Y-m-d H:i:s') . ': ' . $message . "\n", 3, $GLOBALS['ERRORLOG']);
diff --git a/scripts/pi-hole/php/get.php b/scripts/pi-hole/php/get.php
index c84b991a..b38446bc 100644
--- a/scripts/pi-hole/php/get.php
+++ b/scripts/pi-hole/php/get.php
@@ -21,7 +21,7 @@ function getTableContent($listname) {
global $db;
$entries = array();
$querystr = implode(" ",array("SELECT ${listname}.*,\"group\".enabled as group_enabled",
- "FROM $listname",
+ "FROM ${listname}",
"LEFT JOIN ${listname}_by_group ON ${listname}_by_group.${listname}_id = ${listname}.id",
"LEFT JOIN \"group\" ON \"group\".id = ${listname}_by_group.group_id",
"GROUP BY domain;"));
@@ -54,13 +54,15 @@ function filterArray(&$inArray) {
switch ($listtype)
{
case "white":
- $list = getTableContent("whitelist");
+ $exact = getTableContent("whitelist");
+ $regex = getTableContent("regex_whitelist");
+ $list = array_merge($exact, $regex);
break;
case "black":
$exact = getTableContent("blacklist");
- $regex = getTableContent("regex");
- $list = array_merge($exact, $regex);
+ $regex = getTableContent("regex_blacklist");
+ $list = array_merge($exact, $regex);
break;
default:
diff --git a/scripts/pi-hole/php/sub.php b/scripts/pi-hole/php/sub.php
index 97c8f84b..4eae79c7 100644
--- a/scripts/pi-hole/php/sub.php
+++ b/scripts/pi-hole/php/sub.php
@@ -18,7 +18,7 @@ if (empty($api)) {
// Don't check if the added item is a valid domain for regex expressions.
// Regex filters are validated by FTL on import and skipped if invalid
-if($type !== "regex") {
+if($type !== "black_regex" && $type !== "white_regex") {
check_domain();
}
@@ -27,13 +27,16 @@ $domain = escapeshellcmd($_POST['domain']);
switch($type) {
case "white":
- exec("sudo pihole -w -q -d ".$domain);
+ echo shell_exec("sudo pihole -w -q -d ".$domain);
break;
case "black":
- exec("sudo pihole -b -q -d ".$domain);
+ echo shell_exec("sudo pihole -b -q -d ".$domain);
break;
- case "regex":
- exec("sudo pihole --regex -q -d ".$domain);
+ case "black_regex":
+ echo shell_exec("sudo pihole --regex -q -d ".$domain);
+ break;
+ case "white_regex":
+ echo shell_exec("sudo pihole --whiteregex -q -d ".$domain);
break;
}