From 86d886986760d802e063fd1c5b07f85113c0016d Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Fri, 31 Mar 2017 18:42:00 -0400 Subject: [PATCH] Handle deletion of list in savesettings.php --- scripts/pi-hole/php/savesettings.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index 9f902d5b..7f4fc8c7 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -401,16 +401,21 @@ function readAdlists() case "adlists": foreach ($adlist as $key => $value) { - if(isset($_POST["adlist-".$key]) && !$value[0]) + if(isset($_POST["adlist-del-".$key])) + { + // Delete list + exec("sudo pihole -a adlist del ".escapeshellcmd($value[1])); + } + elseif(isset($_POST["adlist-".$key]) && !$value[0]) { // Is not enabled, but should be - exec("sudo pihole -a adlist enable ".escapeshellcmd ($value[1])); + exec("sudo pihole -a adlist enable ".escapeshellcmd($value[1])); } elseif(!isset($_POST["adlist-".$key]) && $value[0]) { // Is enabled, but shouldn't be - exec("sudo pihole -a adlist disable ".escapeshellcmd ($value[1])); + exec("sudo pihole -a adlist disable ".escapeshellcmd($value[1])); } }