diff --git a/php/savesettings.php b/php/savesettings.php index 343befe6..f74a1639 100644 --- a/php/savesettings.php +++ b/php/savesettings.php @@ -328,15 +328,17 @@ function readAdlists(&$list, $listname) case "adlists": foreach ($adlistsdefault as $key => $value) { - if(isset($_POST["adlist-".$key])) + if(isset($_POST["adlist-".$key]) && !$value[0]) { - $action = "enable"; + // Is not enabled, but should be + exec("sudo pihole -a adlist enable ".escapeshellcmd ($value[1])); + } - else + elseif(!isset($_POST["adlist-".$key]) && $value[0]) { - $action = "disable"; + // Is enabled, but shouldn't be + exec("sudo pihole -a adlist disable ".escapeshellcmd ($value[1])); } - exec("sudo pihole -a adlist ".$action." ".escapeshellcmd ($value[1])); } if(strlen($_POST["newuserlists"]) > 1) diff --git a/settings.php b/settings.php index 3e451985..d049503e 100644 --- a/settings.php +++ b/settings.php @@ -494,7 +494,7 @@ $value) { ?>