diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 74991352..73c1dfab 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -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", diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index da339526..c5876b51 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -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..."; diff --git a/settings.php b/settings.php index ff129f4d..9bfcae55 100644 --- a/settings.php +++ b/settings.php @@ -842,10 +842,15 @@ readStaticLeasesFile();

System Administration

+ +
+ + +