Add button for pihole arpflush on Pi-hole settings page

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-05-30 22:05:13 +02:00
parent 4ed39ff8d2
commit 72abc5dad4
3 changed files with 17 additions and 11 deletions

View File

@@ -82,19 +82,19 @@ $(".confirm-flushlogs").confirm({
dialogClass: "modal-dialog modal-mg"
});
$(".confirm-disablelogging").confirm({
text: "Are you sure you want to disable logging and flush your Pi-hole logs?",
$(".confirm-flusharp").confirm({
text: "Are you sure you want to flush your network table?",
title: "Confirmation required",
confirm(button) {
$("#disablelogsform").submit();
$("#flusharpform").submit();
},
cancel(button) {
// nothing to do
},
confirmButton: "Yes, disable logs and flush my logs",
confirmButton: "Yes, flush my network table",
cancelButton: "No, go back",
post: true,
confirmButtonClass: "btn-danger",
confirmButtonClass: "btn-warning",
cancelButtonClass: "btn-success",
dialogClass: "modal-dialog modal-mg"
});

View File

@@ -735,6 +735,15 @@ function readAdlists()
$error .= "Invalid privacy level (".$level.")!";
}
break;
// Flush network table
case "flusharp":
exec("sudo pihole arpflush quiet", $output);
$error = implode($output, "<br>");
if(strlen($error) == 0)
{
$success .= "The network table has been flushed";
}
break;
default:
// Option not found

View File

@@ -1331,9 +1331,7 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "blocklists"
</div>
<p class="hidden-md hidden-lg"></p>
<div class="col-md-4">
<?php if ($piHoleLogging) { ?>
<button type="button" class="btn btn-danger confirm-disablelogging form-control">Disable query logging and flush logs</button>
<?php } ?>
<button type="button" class="btn btn-warning confirm-flusharp form-control">Flush network table</button>
</div>
<p class="hidden-md hidden-lg"></p>
<div class="col-md-4">
@@ -1359,9 +1357,8 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "blocklists"
<input type="hidden" name="field" value="flushlogs">
<input type="hidden" name="token" value="<?php echo $token ?>">
</form>
<form role="form" method="post" id="disablelogsform">
<input type="hidden" name="field" value="Logging">
<input type="hidden" name="action" value="Disable">
<form role="form" method="post" id="flusharpform">
<input type="hidden" name="field" value="flusharp">
<input type="hidden" name="token" value="<?php echo $token ?>">
</form>
<form role="form" method="post" id="disablelogsform-noflush">