From 6658968950dcf8f077a6bd9fb309c0aae352b2e0 Mon Sep 17 00:00:00 2001 From: gedetil Date: Tue, 11 Apr 2017 12:21:39 -0500 Subject: [PATCH 1/4] Update settings.php Implement "Halt system" button, next to "Restart system" button, on admin/settings page. Useful for doing clean shutdown before powering off. Gilbert Detillieux 2017-04-11 --- settings.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/settings.php b/settings.php index d74069b4..1c66ca4c 100644 --- a/settings.php +++ b/settings.php @@ -838,10 +838,15 @@ if(isset($_POST["submit"])) {

System Administration

+ +
+ + +
From aac1b1ba05e5bad8f07b58f42aabd66a0ec95160 Mon Sep 17 00:00:00 2001 From: gedetil Date: Tue, 11 Apr 2017 13:40:27 -0500 Subject: [PATCH 2/4] Update settings.js Implement "Halt system" button, next to "Restart system" button, on admin/settings page. Useful for doing clean shutdown before powering off. Gilbert Detillieux 2017-04-11 --- scripts/pi-hole/js/settings.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 74991352..dea9b775 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-halt").confirm({ + text: "Are you sure you want to send a halt command to your Pi-Hole?", + title: "Confirmation required", + confirm(button) { + $("#haltform").submit(); + }, + cancel(button) { + // nothing to do + }, + confirmButton: "Yes, halt", + 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", From 08f40722c1d591cc9f320aad197f88a0bd6a05ec Mon Sep 17 00:00:00 2001 From: gedetil Date: Tue, 11 Apr 2017 13:44:18 -0500 Subject: [PATCH 3/4] Update savesettings.php Implement "Halt system" button, next to "Restart system" button, on admin/settings page. Useful for doing clean shutdown before powering off. Gilbert Detillieux 2017-04-11 --- scripts/pi-hole/php/savesettings.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index da339526..850177c8 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 "halt": + exec("sudo pihole -a halt"); + $success = "The system will halt in 5 seconds..."; + break; + case "reboot": exec("sudo pihole -a reboot"); $success = "The system will reboot in 5 seconds..."; From 5ab4430ef01ff4247c84e98f3a5758b501a4996d Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 8 Sep 2017 20:30:59 +0200 Subject: [PATCH 4/4] halt -> poweroff Signed-off-by: DL6ER --- scripts/pi-hole/js/settings.js | 8 ++++---- scripts/pi-hole/php/savesettings.php | 6 +++--- settings.php | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index dea9b775..73c1dfab 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -17,16 +17,16 @@ $(function () { $("input[name=\"AddMAC\"]").val(mac); }); }); -$(".confirm-halt").confirm({ - text: "Are you sure you want to send a halt command to your Pi-Hole?", +$(".confirm-poweroff").confirm({ + text: "Are you sure you want to send a poweroff command to your Pi-Hole?", title: "Confirmation required", confirm(button) { - $("#haltform").submit(); + $("#poweroffform").submit(); }, cancel(button) { // nothing to do }, - confirmButton: "Yes, halt", + confirmButton: "Yes, poweroff", cancelButton: "No, go back", post: true, confirmButtonClass: "btn-danger", diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index 850177c8..c5876b51 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -420,9 +420,9 @@ function readAdlists() $success .= "The webUI settings have been updated"; break; - case "halt": - exec("sudo pihole -a halt"); - $success = "The system will halt in 5 seconds..."; + case "poweroff": + exec("sudo pihole -a poweroff"); + $success = "The system will poweroff in 5 seconds..."; break; case "reboot": diff --git a/settings.php b/settings.php index efc4dbf0..9bfcae55 100644 --- a/settings.php +++ b/settings.php @@ -842,13 +842,13 @@ readStaticLeasesFile();

System Administration

- + - - + +