Revision 47b051eb
Added by sbeaver about 10 years ago
usr/local/www/reboot.php | ||
---|---|---|
1 |
<?php
|
|
1 |
<?php |
|
2 | 2 |
/* $Id$ */ |
3 | 3 |
/* |
4 | 4 |
reboot.php |
5 | 5 |
part of m0n0wall (http://m0n0.ch/wall) |
6 |
|
|
6 |
|
|
7 | 7 |
Copyright (C) 2013-2015 Electric Sheep Fencing, LP |
8 | 8 |
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. |
9 | 9 |
All rights reserved. |
10 |
|
|
10 |
|
|
11 | 11 |
Redistribution and use in source and binary forms, with or without |
12 | 12 |
modification, are permitted provided that the following conditions are met: |
13 |
|
|
13 |
|
|
14 | 14 |
1. Redistributions of source code must retain the above copyright notice, |
15 | 15 |
this list of conditions and the following disclaimer. |
16 |
|
|
16 |
|
|
17 | 17 |
2. Redistributions in binary form must reproduce the above copyright |
18 | 18 |
notice, this list of conditions and the following disclaimer in the |
19 | 19 |
documentation and/or other materials provided with the distribution. |
20 |
|
|
20 |
|
|
21 | 21 |
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
22 | 22 |
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
23 | 23 |
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
... | ... | |
37 | 37 |
##|*MATCH=reboot.php* |
38 | 38 |
##|-PRIV |
39 | 39 |
|
40 |
// Set DEBUG to true to prevent the system_reboot() function from being called |
|
41 |
define("DEBUG", false); |
|
42 |
|
|
40 | 43 |
require("guiconfig.inc"); |
41 | 44 |
require("functions.inc"); |
42 | 45 |
require("captiveportal.inc"); |
... | ... | |
49 | 52 |
$pgtitle = array(gettext("Diagnostics"),gettext("Reboot System")); |
50 | 53 |
include("head.inc"); |
51 | 54 |
|
52 |
?> |
|
53 |
<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> |
|
54 |
<?php include("fbegin.inc"); ?> |
|
55 |
<?php if ($_POST['Submit'] == " " . gettext("Yes") . " "): ?> |
|
56 |
<meta http-equiv=\"refresh\" content=\"70;url=/\"> |
|
57 |
<?php print_info_box(gettext("The system is rebooting now. This may take one minute.")); ?> |
|
58 |
<pre> |
|
59 |
<?php system_reboot(); ?> |
|
60 |
</pre> |
|
61 |
<?php else: ?> |
|
62 |
<form action="reboot.php" method="post"> |
|
63 |
<p><strong><?=gettext("Are you sure you want to reboot the system?");?></strong></p> |
|
64 |
<p> |
|
65 |
<input name="Submit" type="submit" class="formbtn" value=" <?=gettext("Yes");?> " /> |
|
66 |
<input name="Submit" type="submit" class="formbtn" value=" <?=gettext("No");?> " /> |
|
67 |
</p> |
|
68 |
</form> |
|
69 |
<?php endif; ?> |
|
70 |
<?php include("fend.inc"); ?> |
|
71 |
</body> |
|
72 |
</html> |
|
55 |
if ($_POST['Submit'] == " " . gettext("Yes") . " ") { |
|
56 |
?><meta http-equiv=\"refresh\" content=\"70;url=/\"> <?php |
|
57 |
print('<div class="alert alert-success" role="alert">'.gettext("The system is rebooting now. This may take one minute or so.").'</div>'); |
|
58 |
|
|
59 |
if(DEBUG) |
|
60 |
print("Not actually rebooting (DEBUG is set true)<br>"); |
|
61 |
else |
|
62 |
system_reboot(); |
|
63 |
} else { |
|
64 |
|
|
65 |
require('classes/Form.class.php'); |
|
66 |
|
|
67 |
$form = new Form(new Form_Button( |
|
68 |
'Submit', |
|
69 |
' Yes ' |
|
70 |
)); |
|
71 |
|
|
72 |
$section = new Form_Section('Reboot'); |
|
73 |
|
|
74 |
$section->addInput(new Form_StaticText( |
|
75 |
'', |
|
76 |
'Click "Yes" to reboot the system imediately.<br />Click "No" to go to the system dashboard without rebooting. There will be a brief delay before the dashboard appears' |
|
77 |
)); |
|
78 |
|
|
79 |
$form->addGlobal(new Form_Button( |
|
80 |
'Submit', |
|
81 |
' No ' |
|
82 |
))->removeClass('btn-primary')->addClass('btn-default'); |
|
83 |
|
|
84 |
$form->add($section); |
|
85 |
print $form; |
|
86 |
} |
|
87 |
|
|
88 |
include("foot.inc"); ?> |
|
89 |
|
Also available in: Unified diff
Converted to Bootstrap
Converted
Added DEBUG define to allow testing without actually rebooting
Cleaned up spaces/tabs etc