Project

General

Profile

Download (2.63 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-2020 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
		print('<pre>');
60
		system_halt();
61
		print('</pre>');
62
	}
63
} else {
64
?>
65

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

    
87

    
88

    
89
<?php
90
}
91

    
92
include("foot.inc");
(19-19/230)