Improve logic

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-08-08 21:17:10 +02:00
parent 8b1313b864
commit 2df4a0d052

View File

@@ -137,17 +137,21 @@ function readAdlists()
{
while (($line = fgets($handle)) !== false)
{
if(substr($line, 0, 1) === "#")
if(strlen($line) < 3)
{
continue;
}
elseif($line[0] === "#")
{
// Comments start either with "##" or "# "
if(substr($line, 1, 1) !== "#" &&
substr($line, 1, 1) !== " ")
if($line[1] !== "#" &&
$line[1] !== " ")
{
// Commented list
array_push($list, [false,rtrim(substr($line, 1))]);
}
}
elseif(strlen($line) > 1)
else
{
// Active list
array_push($list, [true,rtrim($line)]);