Merge pull request #570 from pi-hole/gedetil-development

Add "poweroff" option to Web Interface
This commit is contained in:
DL6ER
2017-09-08 21:08:42 +02:00
committed by GitHub
3 changed files with 26 additions and 0 deletions
+16
View File
@@ -17,6 +17,22 @@ $(function () {
$("input[name=\"AddMAC\"]").val(mac);
});
});
$(".confirm-poweroff").confirm({
text: "Are you sure you want to send a poweroff command to your Pi-Hole?",
title: "Confirmation required",
confirm(button) {
$("#poweroffform").submit();
},
cancel(button) {
// nothing to do
},
confirmButton: "Yes, poweroff",
cancelButton: "No, go back",
post: true,
confirmButtonClass: "btn-danger",
cancelButtonClass: "btn-success",
dialogClass: "modal-dialog modal-mg" // Bootstrap classes for mid-size modal
});
$(".confirm-reboot").confirm({
text: "Are you sure you want to send a reboot command to your Pi-Hole?",
title: "Confirmation required",
+5
View File
@@ -420,6 +420,11 @@ function readAdlists()
$success .= "The webUI settings have been updated";
break;
case "poweroff":
exec("sudo pihole -a poweroff");
$success = "The system will poweroff in 5 seconds...";
break;
case "reboot":
exec("sudo pihole -a reboot");
$success = "The system will reboot in 5 seconds...";
+5
View File
@@ -842,10 +842,15 @@ readStaticLeasesFile();
<h3 class="box-title">System Administration</h3>
</div>
<div class="box-body">
<button type="button" class="btn btn-default confirm-poweroff">Power off system</button>
<button type="button" class="btn btn-default confirm-reboot">Restart system</button>
<button type="button" class="btn btn-default confirm-restartdns">Restart DNS server</button>
<button type="button" class="btn btn-default confirm-flushlogs">Flush logs</button>
<form role="form" method="post" id="poweroffform">
<input type="hidden" name="field" value="poweroff">
<input type="hidden" name="token" value="<?php echo $token ?>">
</form>
<form role="form" method="post" id="rebootform">
<input type="hidden" name="field" value="reboot">
<input type="hidden" name="token" value="<?php echo $token ?>">