Be able to enable/disable user lists and add multiple user lists at a time (one URL per line)

This commit is contained in:
DL6ER
2016-12-16 15:33:16 +01:00
parent 6e7020a8ba
commit c73c10f8a0
2 changed files with 18 additions and 4 deletions
+17 -3
View File
@@ -331,13 +331,27 @@ function readAdlists(&$list, $listname)
if(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 default ".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 default ".escapeshellcmd ($value[1]));
}
}
foreach ($adlistsuser as $key => $value)
{
if(isset($_POST["userlist-".$key]) && !$value[0])
{
// Is not enabled, but should be
exec("sudo pihole -a adlist enable user ".escapeshellcmd ($value[1]));
}
elseif(!isset($_POST["userlist-".$key]) && $value[0])
{
// Is enabled, but shouldn't be
exec("sudo pihole -a adlist disable user ".escapeshellcmd ($value[1]));
}
}
@@ -346,7 +360,7 @@ function readAdlists(&$list, $listname)
$domains = array_filter(preg_split('/\r\n|[\r\n]/', $_POST["newuserlists"]));
foreach($domains as $domain)
{
exec("sudo pihole -a adlist adduser ".escapeshellcmd($domain));
exec("sudo pihole -a adlist add user ".escapeshellcmd($domain));
}
}
+1 -1
View File
@@ -491,7 +491,7 @@
<div class="checkbox"><label style="word-break: break-word;"><input type="checkbox" name="adlist-<?php echo $key; ?>" <?php if($value[0]){ ?>checked<?php } ?>> <a href="<?php echo htmlentities ($value[1]); ?>" target="_new"><?php echo htmlentities($value[1]); ?></a></label></div>
</div>
<?php } ?>
<label>User defined lists</label>
<label>User defined list (preserved on updates)</label>
<?php foreach ($adlistsuser as $key => $value) { ?>
<div class="form-group">
<div class="checkbox"><label style="word-break: break-word;"><input type="checkbox" name="userlist-<?php echo $key; ?>" <?php if($value[0]){ ?>checked<?php } ?>> <a href="<?php echo htmlentities ($value[1]); ?>" target="_new"><?php echo htmlentities($value[1]); ?></a></label></div>