Project

General

Profile

Download (2.74 KB) Statistics
| Branch: | Tag: | Revision:
1 8a3be31a Scott Ullrich
<?php
2 56977a25 Scott Ullrich
/*
3 c5d81585 Renato Botelho
 * diag_halt.php
4 9da2cf1c Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 38809d47 Renato Botelho do Couto
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8 a68f7a3d Luiz Otavio O Souza
 * Copyright (c) 2014-2024 Rubicon Communications, LLC (Netgate)
9 c5d81585 Renato Botelho
 * All rights reserved.
10 fd9ebcd5 Stephen Beaver
 *
11 c5d81585 Renato Botelho
 * originally based on m0n0wall (http://m0n0.ch/wall)
12
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
13
 * All rights reserved.
14 fd9ebcd5 Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
16
 * you may not use this file except in compliance with the License.
17
 * You may obtain a copy of the License at
18 fd9ebcd5 Stephen Beaver
 *
19 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
20 fd9ebcd5 Stephen Beaver
 *
21 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
22
 * distributed under the License is distributed on an "AS IS" BASIS,
23
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
 * See the License for the specific language governing permissions and
25
 * limitations under the License.
26 fd9ebcd5 Stephen Beaver
 */
27 56977a25 Scott Ullrich
28 6b07c15a Matthew Grooms
##|+PRIV
29
##|*IDENT=page-diagnostics-haltsystem
30 5230f468 jim-p
##|*NAME=Diagnostics: Halt system
31 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'Diagnostics: Halt system' page.
32 1af5edbf Stephen Beaver
##|*MATCH=diag_halt.php*
33 6b07c15a Matthew Grooms
##|-PRIV
34
35 68951763 sbeaver
// Set DEBUG to true to prevent the system_halt() function from being called
36 b191b7b1 Stephen Beaver
define("DEBUG", false);
37 68951763 sbeaver
38 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
39
require_once("functions.inc");
40
require_once("captiveportal.inc");
41 56977a25 Scott Ullrich
42 45d6ada5 Sjon Hortensius
if ($_POST['save'] == 'No') {
43 9cf11774 jim-p
	header("Location: index.php");
44
	exit;
45 56977a25 Scott Ullrich
}
46 f726d710 Bill Marquette
47 a6a6ee00 k-paulius
$pgtitle = array(gettext("Diagnostics"), gettext("Halt System"));
48 f726d710 Bill Marquette
include('head.inc');
49 68951763 sbeaver
50 bef0adce sbeaver
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
51
?>
52
	<meta http-equiv="refresh" content="70;url=/">
53
<?php
54 7c945f74 k-paulius
	print_info_box(gettext("The system is halting now. This may take one minute or so."), 'success', false);
55
56 ea1bbc43 Stephen Beaver
	if (DEBUG) {
57 607e7686 NewEraCracker
	   printf(gettext("Not actually halting (DEBUG is set true)%s"), "<br />");
58 947141fd Phil Davis
	} else {
59 2568e151 Christian McDonald
		notify_all_remote(sprintf(gettext("%s will shutdown and halt system now."), g_get('product_label')));
60 ea1bbc43 Stephen Beaver
		print('<pre>');
61 68951763 sbeaver
		system_halt();
62 ea1bbc43 Stephen Beaver
		print('</pre>');
63
	}
64 68951763 sbeaver
} else {
65 45d6ada5 Sjon Hortensius
?>
66 6e69ebef sbeaver
67 68951763 sbeaver
<div class="panel panel-default">
68 45d6ada5 Sjon Hortensius
	<div class="panel-heading">
69 34ee6639 NOYB
		<h2 class="panel-title"><?=gettext('System Halt Confirmation')?></h2>
70 45d6ada5 Sjon Hortensius
	</div>
71
	<div class="panel-body">
72 9239f765 Jared Dillard
		<div class="content">
73 a11064ea Jared Dillard
			<p><?=gettext('Click "Halt" to halt the system immediately, or "Cancel" to go to the system dashboard. (There will be a brief delay before the dashboard appears.)')?></p>
74 1af5edbf Stephen Beaver
			<form action="diag_halt.php" method="post">
75 37676f4e jim-p
				<button type="submit" class="btn btn-danger pull-center" name="save" value="<?=gettext("Halt")?>" title="<?=gettext("Halt the system and power off")?>">
76 e0cb987c Marcos Mendoza
					<i class="fa-solid fa-stop-circle"></i>
77 37676f4e jim-p
					<?=gettext("Halt")?>
78
				</button>
79 6400975d jim-p
				<a href="/" class="btn btn-info">
80 e0cb987c Marcos Mendoza
					<i class="fa-solid fa-undo"></i>
81 6400975d jim-p
					<?=gettext("Cancel")?>
82 37676f4e jim-p
				</a>
83 9239f765 Jared Dillard
			</form>
84
		</div>
85 68951763 sbeaver
	</div>
86
</div>
87
88 9239f765 Jared Dillard
89
90 68951763 sbeaver
<?php
91
}
92 56977a25 Scott Ullrich
93 bef0adce sbeaver
include("foot.inc");