Project

General

Profile

Download (2.74 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * diag_halt.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2024 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved.
10
 *
11
 * originally based on m0n0wall (http://m0n0.ch/wall)
12
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
13
 * All rights reserved.
14
 *
15
 * 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
 *
19
 * http://www.apache.org/licenses/LICENSE-2.0
20
 *
21
 * 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
 */
27

    
28
##|+PRIV
29
##|*IDENT=page-diagnostics-haltsystem
30
##|*NAME=Diagnostics: Halt system
31
##|*DESCR=Allow access to the 'Diagnostics: Halt system' page.
32
##|*MATCH=diag_halt.php*
33
##|-PRIV
34

    
35
// Set DEBUG to true to prevent the system_halt() function from being called
36
define("DEBUG", false);
37

    
38
require_once("guiconfig.inc");
39
require_once("functions.inc");
40
require_once("captiveportal.inc");
41

    
42
if ($_POST['save'] == 'No') {
43
	header("Location: index.php");
44
	exit;
45
}
46

    
47
$pgtitle = array(gettext("Diagnostics"), gettext("Halt System"));
48
include('head.inc');
49

    
50
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
51
?>
52
	<meta http-equiv="refresh" content="70;url=/">
53
<?php
54
	print_info_box(gettext("The system is halting now. This may take one minute or so."), 'success', false);
55

    
56
	if (DEBUG) {
57
	   printf(gettext("Not actually halting (DEBUG is set true)%s"), "<br />");
58
	} else {
59
		notify_all_remote(sprintf(gettext("%s will shutdown and halt system now."), g_get('product_label')));
60
		print('<pre>');
61
		system_halt();
62
		print('</pre>');
63
	}
64
} else {
65
?>
66

    
67
<div class="panel panel-default">
68
	<div class="panel-heading">
69
		<h2 class="panel-title"><?=gettext('System Halt Confirmation')?></h2>
70
	</div>
71
	<div class="panel-body">
72
		<div class="content">
73
			<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
			<form action="diag_halt.php" method="post">
75
				<button type="submit" class="btn btn-danger pull-center" name="save" value="<?=gettext("Halt")?>" title="<?=gettext("Halt the system and power off")?>">
76
					<i class="fa-solid fa-stop-circle"></i>
77
					<?=gettext("Halt")?>
78
				</button>
79
				<a href="/" class="btn btn-info">
80
					<i class="fa-solid fa-undo"></i>
81
					<?=gettext("Cancel")?>
82
				</a>
83
			</form>
84
		</div>
85
	</div>
86
</div>
87

    
88

    
89

    
90
<?php
91
}
92

    
93
include("foot.inc");
(20-20/232)