diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index c1226fd5..b558bba7 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -137,12 +137,21 @@ function readAdlists() { while (($line = fgets($handle)) !== false) { - if(substr($line, 0, 5) === "#http") + if(strlen($line) < 3) { - // Commented list - array_push($list, [false,rtrim(substr($line, 1))]); + continue; } - elseif(substr($line, 0, 4) === "http") + elseif($line[0] === "#") + { + // Comments start either with "##" or "# " + if($line[1] !== "#" && + $line[1] !== " ") + { + // Commented list + array_push($list, [false,rtrim(substr($line, 1))]); + } + } + else { // Active list array_push($list, [true,rtrim($line)]);