diff --git a/scripts/pi-hole/js/auditlog.js b/scripts/pi-hole/js/auditlog.js index 52790602..7fe5e021 100644 --- a/scripts/pi-hole/js/auditlog.js +++ b/scripts/pi-hole/js/auditlog.js @@ -78,7 +78,7 @@ function add(domain,list) { $.ajax({ url: "scripts/pi-hole/php/add.php", method: "post", - data: {"domain":domain, "list":list, "token":token, "auditlog":1} + data: {"domain":domain, "list":list, "token":token} }); } @@ -91,6 +91,7 @@ $(document).ready(function() { var url = ($(this).parents("tr"))[0].innerText.split(" ")[0]; if($(this).context.innerText === " Blacklist") { + add(url,"audit"); add(url,"black"); $("#gravityBtn").prop("disabled", false); } @@ -104,6 +105,7 @@ $(document).ready(function() { var url = ($(this).parents("tr"))[0].innerText.split(" ")[0].split(" ")[0]; if($(this).context.innerText === " Whitelist") { + add(url,"audit"); add(url,"white"); $("#gravityBtn").prop("disabled", false); } diff --git a/scripts/pi-hole/php/add.php b/scripts/pi-hole/php/add.php index e733ef2b..895df011 100644 --- a/scripts/pi-hole/php/add.php +++ b/scripts/pi-hole/php/add.php @@ -33,14 +33,10 @@ $db = SQLite3_connect($GRAVITYDB, SQLITE3_OPEN_READWRITE); switch($list) { case "white": - if(isset($_POST["auditlog"])) - echo add_to_table($db, "domain_audit", $domains); echo add_to_table($db, "whitelist", $domains); break; case "black": - if(isset($_POST["auditlog"])) - echo add_to_table($db, "domain_audit", $domains); echo add_to_table($db, "blacklist", $domains); break; diff --git a/scripts/pi-hole/php/database.php b/scripts/pi-hole/php/database.php index d600e977..319a3260 100644 --- a/scripts/pi-hole/php/database.php +++ b/scripts/pi-hole/php/database.php @@ -82,7 +82,7 @@ function add_to_table($db, $table, $domains, $wildcardstyle=false, $returnnum=fa if($returnnum) return 0; else - return "Error, added: 0\n"; + return "Error, added: 0"; } // Loop over domains and inject the lines into the database @@ -102,7 +102,7 @@ function add_to_table($db, $table, $domains, $wildcardstyle=false, $returnnum=fa if($returnnum) return $num; else - return "Error, added: ".$num."\n"; + return "Error, added: ".$num; } } @@ -111,7 +111,7 @@ function add_to_table($db, $table, $domains, $wildcardstyle=false, $returnnum=fa if($returnnum) return $num; else - return "Success, added: ".$num."\n"; + return "Success, added: ".$num; } /** @@ -135,7 +135,7 @@ function remove_from_table($db, $table, $domains, $returnnum=false) if($returnnum) return 0; else - return "Error, added: 0\n"; + return "Error, added: 0"; } // Loop over domains and remove the lines from the database @@ -152,7 +152,7 @@ function remove_from_table($db, $table, $domains, $returnnum=false) if($returnnum) return $num; else - return "Error, removed: ".$num."\n"; + return "Error, removed: ".$num; } } @@ -161,7 +161,7 @@ function remove_from_table($db, $table, $domains, $returnnum=false) if($returnnum) return $num; else - return "Success, removed: ".$num."\n"; + return "Success, removed: ".$num; } ?>