1 |
8ccc8f1a
|
Scott Ullrich
|
<?php
|
2 |
5b237745
|
Scott Ullrich
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* diag_backup.php
|
4 |
9da2cf1c
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
81299b5c
|
Renato Botelho
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
7 |
c5d81585
|
Renato Botelho
|
* All rights reserved.
|
8 |
fd9ebcd5
|
Stephen Beaver
|
*
|
9 |
c5d81585
|
Renato Botelho
|
* originally based on m0n0wall (http://m0n0.ch/wall)
|
10 |
|
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11 |
|
|
* All rights reserved.
|
12 |
fd9ebcd5
|
Stephen Beaver
|
*
|
13 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
14 |
|
|
* you may not use this file except in compliance with the License.
|
15 |
|
|
* You may obtain a copy of the License at
|
16 |
fd9ebcd5
|
Stephen Beaver
|
*
|
17 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
18 |
fd9ebcd5
|
Stephen Beaver
|
*
|
19 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
20 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
21 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22 |
|
|
* See the License for the specific language governing permissions and
|
23 |
|
|
* limitations under the License.
|
24 |
fd9ebcd5
|
Stephen Beaver
|
*/
|
25 |
5b237745
|
Scott Ullrich
|
|
26 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
27 |
5d916fc7
|
Stephen Beaver
|
##|*IDENT=page-diagnostics-backup-restore
|
28 |
0f298138
|
k-paulius
|
##|*NAME=Diagnostics: Backup & Restore
|
29 |
|
|
##|*DESCR=Allow access to the 'Diagnostics: Backup & Restore' page.
|
30 |
57188e47
|
Phil Davis
|
##|*WARN=standard-warning-root
|
31 |
6b07c15a
|
Matthew Grooms
|
##|*MATCH=diag_backup.php*
|
32 |
|
|
##|-PRIV
|
33 |
|
|
|
34 |
47d11b79
|
Mark Crane
|
/* Allow additional execution time 0 = no limit. */
|
35 |
3420028c
|
Scott Ullrich
|
ini_set('max_execution_time', '0');
|
36 |
|
|
ini_set('max_input_time', '0');
|
37 |
47d11b79
|
Mark Crane
|
|
38 |
5b237745
|
Scott Ullrich
|
/* omit no-cache headers because it confuses IE with file downloads */
|
39 |
|
|
$omit_nocacheheaders = true;
|
40 |
c81ef6e2
|
Phil Davis
|
require_once("guiconfig.inc");
|
41 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
42 |
|
|
require_once("filter.inc");
|
43 |
|
|
require_once("shaper.inc");
|
44 |
5b237745
|
Scott Ullrich
|
|
45 |
8bdb6879
|
Darren Embry
|
$rrddbpath = "/var/db/rrd";
|
46 |
|
|
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
|
47 |
|
|
|
48 |
|
|
function rrd_data_xml() {
|
49 |
|
|
global $rrddbpath;
|
50 |
|
|
global $rrdtool;
|
51 |
73ed069b
|
Renato Botelho
|
|
52 |
8bdb6879
|
Darren Embry
|
$result = "\t<rrddata>\n";
|
53 |
|
|
$rrd_files = glob("{$rrddbpath}/*.rrd");
|
54 |
|
|
$xml_files = array();
|
55 |
|
|
foreach ($rrd_files as $rrd_file) {
|
56 |
|
|
$basename = basename($rrd_file);
|
57 |
|
|
$xml_file = preg_replace('/\.rrd$/', ".xml", $rrd_file);
|
58 |
|
|
exec("$rrdtool dump '{$rrd_file}' '{$xml_file}'");
|
59 |
|
|
$xml_data = file_get_contents($xml_file);
|
60 |
|
|
unlink($xml_file);
|
61 |
|
|
if ($xml_data !== false) {
|
62 |
|
|
$result .= "\t\t<rrddatafile>\n";
|
63 |
|
|
$result .= "\t\t\t<filename>{$basename}</filename>\n";
|
64 |
|
|
$result .= "\t\t\t<xmldata>" . base64_encode(gzdeflate($xml_data)) . "</xmldata>\n";
|
65 |
|
|
$result .= "\t\t</rrddatafile>\n";
|
66 |
|
|
}
|
67 |
|
|
}
|
68 |
|
|
$result .= "\t</rrddata>\n";
|
69 |
|
|
return $result;
|
70 |
|
|
}
|
71 |
|
|
|
72 |
754b75d0
|
Darren Embry
|
function restore_rrddata() {
|
73 |
7eead1fc
|
Darren Embry
|
global $config, $g, $rrdtool, $input_errors;
|
74 |
5f601060
|
Phil Davis
|
foreach ($config['rrddata']['rrddatafile'] as $rrd) {
|
75 |
754b75d0
|
Darren Embry
|
if ($rrd['xmldata']) {
|
76 |
|
|
$rrd_file = "{$g['vardb_path']}/rrd/{$rrd['filename']}";
|
77 |
|
|
$xml_file = preg_replace('/\.rrd$/', ".xml", $rrd_file);
|
78 |
08877746
|
Darren Embry
|
if (file_put_contents($xml_file, gzinflate(base64_decode($rrd['xmldata']))) === false) {
|
79 |
ff30e319
|
bruno
|
log_error(sprintf(gettext("Cannot write %s"), $xml_file));
|
80 |
08877746
|
Darren Embry
|
continue;
|
81 |
|
|
}
|
82 |
|
|
$output = array();
|
83 |
|
|
$status = null;
|
84 |
|
|
exec("$rrdtool restore -f '{$xml_file}' '{$rrd_file}'", $output, $status);
|
85 |
|
|
if ($status) {
|
86 |
f757431d
|
Darren Embry
|
log_error("rrdtool restore -f '{$xml_file}' '{$rrd_file}' failed returning {$status}.");
|
87 |
08877746
|
Darren Embry
|
continue;
|
88 |
|
|
}
|
89 |
754b75d0
|
Darren Embry
|
unlink($xml_file);
|
90 |
5f601060
|
Phil Davis
|
} else if ($rrd['data']) {
|
91 |
7eead1fc
|
Darren Embry
|
$rrd_file = "{$g['vardb_path']}/rrd/{$rrd['filename']}";
|
92 |
|
|
$rrd_fd = fopen($rrd_file, "w");
|
93 |
08877746
|
Darren Embry
|
if (!$rrd_fd) {
|
94 |
ff30e319
|
bruno
|
log_error(sprintf(gettext("Cannot write %s"), $rrd_file));
|
95 |
08877746
|
Darren Embry
|
continue;
|
96 |
|
|
}
|
97 |
754b75d0
|
Darren Embry
|
$data = base64_decode($rrd['data']);
|
98 |
|
|
/* Try to decompress the data. */
|
99 |
|
|
$dcomp = @gzinflate($data);
|
100 |
|
|
if ($dcomp) {
|
101 |
|
|
/* If the decompression worked, write the decompressed data */
|
102 |
08877746
|
Darren Embry
|
if (fwrite($rrd_fd, $dcomp) === false) {
|
103 |
ff30e319
|
bruno
|
log_error(sprintf(gettext("fwrite %s failed"), $rrd_file));
|
104 |
08877746
|
Darren Embry
|
continue;
|
105 |
|
|
}
|
106 |
754b75d0
|
Darren Embry
|
} else {
|
107 |
|
|
/* If the decompression failed, it wasn't compressed, so write raw data */
|
108 |
08877746
|
Darren Embry
|
if (fwrite($rrd_fd, $data) === false) {
|
109 |
ff30e319
|
bruno
|
log_error(sprintf(gettext("fwrite %s failed"), $rrd_file));
|
110 |
08877746
|
Darren Embry
|
continue;
|
111 |
|
|
}
|
112 |
|
|
}
|
113 |
|
|
if (fclose($rrd_fd) === false) {
|
114 |
ff30e319
|
bruno
|
log_error(sprintf(gettext("fclose %s failed"), $rrd_file));
|
115 |
08877746
|
Darren Embry
|
continue;
|
116 |
754b75d0
|
Darren Embry
|
}
|
117 |
|
|
}
|
118 |
|
|
}
|
119 |
|
|
}
|
120 |
|
|
|
121 |
645ec835
|
Scott Ullrich
|
function remove_bad_chars($string) {
|
122 |
699737d9
|
Phil Davis
|
return preg_replace('/[^a-z_0-9]/i', '', $string);
|
123 |
645ec835
|
Scott Ullrich
|
}
|
124 |
|
|
|
125 |
b3277798
|
Scott Ullrich
|
function check_and_returnif_section_exists($section) {
|
126 |
|
|
global $config;
|
127 |
5f601060
|
Phil Davis
|
if (is_array($config[$section])) {
|
128 |
b3277798
|
Scott Ullrich
|
return true;
|
129 |
5f601060
|
Phil Davis
|
}
|
130 |
b3277798
|
Scott Ullrich
|
return false;
|
131 |
|
|
}
|
132 |
|
|
|
133 |
da17d77e
|
Ermal Lu?i
|
if ($_POST['apply']) {
|
134 |
73ed069b
|
Renato Botelho
|
ob_flush();
|
135 |
|
|
flush();
|
136 |
c9a19238
|
Darren Embry
|
clear_subsystem_dirty("restore");
|
137 |
73ed069b
|
Renato Botelho
|
exit;
|
138 |
da17d77e
|
Ermal Lu?i
|
}
|
139 |
|
|
|
140 |
5b237745
|
Scott Ullrich
|
if ($_POST) {
|
141 |
|
|
unset($input_errors);
|
142 |
9a7e1c95
|
Phil Davis
|
if ($_POST['restore']) {
|
143 |
5b237745
|
Scott Ullrich
|
$mode = "restore";
|
144 |
9a7e1c95
|
Phil Davis
|
} else if ($_POST['reinstallpackages']) {
|
145 |
8ccc8f1a
|
Scott Ullrich
|
$mode = "reinstallpackages";
|
146 |
9a7e1c95
|
Phil Davis
|
} else if ($_POST['clearpackagelock']) {
|
147 |
039cb920
|
jim-p
|
$mode = "clearpackagelock";
|
148 |
9a7e1c95
|
Phil Davis
|
} else if ($_POST['download']) {
|
149 |
5b237745
|
Scott Ullrich
|
$mode = "download";
|
150 |
5f601060
|
Phil Davis
|
}
|
151 |
|
|
if ($_POST["nopackages"] <> "") {
|
152 |
528cad39
|
Colin Smith
|
$options = "nopackages";
|
153 |
5f601060
|
Phil Davis
|
}
|
154 |
|
|
if ($_POST["ver"] <> "") {
|
155 |
7cf03119
|
Bill Marquette
|
$ver2restore = $_POST["ver"];
|
156 |
5f601060
|
Phil Davis
|
}
|
157 |
5b237745
|
Scott Ullrich
|
if ($mode) {
|
158 |
|
|
if ($mode == "download") {
|
159 |
8ff5ffcc
|
Matthew Grooms
|
if ($_POST['encrypt']) {
|
160 |
76d6d925
|
Stephen Beaver
|
if (!$_POST['encrypt_password']) {
|
161 |
89854d71
|
NewEraCracker
|
$input_errors[] = gettext("A password for encryption must be supplied and confirmed.");
|
162 |
5f601060
|
Phil Davis
|
}
|
163 |
528cad39
|
Colin Smith
|
}
|
164 |
73ed069b
|
Renato Botelho
|
|
165 |
8ff5ffcc
|
Matthew Grooms
|
if (!$input_errors) {
|
166 |
73ed069b
|
Renato Botelho
|
|
167 |
07b1797b
|
sullrich
|
//$lockbckp = lock('config');
|
168 |
73ed069b
|
Renato Botelho
|
|
169 |
8ff5ffcc
|
Matthew Grooms
|
$host = "{$config['system']['hostname']}.{$config['system']['domain']}";
|
170 |
|
|
$name = "config-{$host}-".date("YmdHis").".xml";
|
171 |
|
|
$data = "";
|
172 |
73ed069b
|
Renato Botelho
|
|
173 |
5f601060
|
Phil Davis
|
if ($options == "nopackages") {
|
174 |
|
|
if (!$_POST['backuparea']) {
|
175 |
4195c967
|
sullrich
|
/* backup entire configuration */
|
176 |
|
|
$data = file_get_contents("{$g['conf_path']}/config.xml");
|
177 |
|
|
} else {
|
178 |
|
|
/* backup specific area of configuration */
|
179 |
|
|
$data = backup_config_section($_POST['backuparea']);
|
180 |
|
|
$name = "{$_POST['backuparea']}-{$name}";
|
181 |
|
|
}
|
182 |
da17d77e
|
Ermal Lu?i
|
$sfn = "{$g['tmp_path']}/config.xml.nopkg";
|
183 |
4195c967
|
sullrich
|
file_put_contents($sfn, $data);
|
184 |
|
|
exec("sed '/<installedpackages>/,/<\/installedpackages>/d' {$sfn} > {$sfn}-new");
|
185 |
a250f179
|
Renato Botelho
|
$data = file_get_contents($sfn . "-new");
|
186 |
8ff5ffcc
|
Matthew Grooms
|
} else {
|
187 |
5f601060
|
Phil Davis
|
if (!$_POST['backuparea']) {
|
188 |
8ff5ffcc
|
Matthew Grooms
|
/* backup entire configuration */
|
189 |
|
|
$data = file_get_contents("{$g['conf_path']}/config.xml");
|
190 |
7eead1fc
|
Darren Embry
|
} else if ($_POST['backuparea'] === "rrddata") {
|
191 |
|
|
$data = rrd_data_xml();
|
192 |
|
|
$name = "{$_POST['backuparea']}-{$name}";
|
193 |
8ff5ffcc
|
Matthew Grooms
|
} else {
|
194 |
|
|
/* backup specific area of configuration */
|
195 |
|
|
$data = backup_config_section($_POST['backuparea']);
|
196 |
|
|
$name = "{$_POST['backuparea']}-{$name}";
|
197 |
|
|
}
|
198 |
181462b5
|
Scott Ullrich
|
}
|
199 |
73ed069b
|
Renato Botelho
|
|
200 |
07b1797b
|
sullrich
|
//unlock($lockbckp);
|
201 |
73ed069b
|
Renato Botelho
|
|
202 |
a250f179
|
Renato Botelho
|
/*
|
203 |
0e834fc5
|
Stephen Beaver
|
* Backup RRD Data
|
204 |
1390b049
|
Scott Ullrich
|
*/
|
205 |
7eead1fc
|
Darren Embry
|
if ($_POST['backuparea'] !== "rrddata" && !$_POST['donotbackuprrd']) {
|
206 |
8bdb6879
|
Darren Embry
|
$rrd_data_xml = rrd_data_xml();
|
207 |
|
|
$closing_tag = "</" . $g['xml_rootobj'] . ">";
|
208 |
|
|
$data = str_replace($closing_tag, $rrd_data_xml . $closing_tag, $data);
|
209 |
1390b049
|
Scott Ullrich
|
}
|
210 |
73ed069b
|
Renato Botelho
|
|
211 |
4cfd2390
|
Renato Botelho
|
if ($_POST['encrypt']) {
|
212 |
|
|
$data = encrypt_data($data, $_POST['encrypt_password']);
|
213 |
|
|
tagfile_reformat($data, $data, "config.xml");
|
214 |
|
|
}
|
215 |
|
|
|
216 |
8ff5ffcc
|
Matthew Grooms
|
$size = strlen($data);
|
217 |
|
|
header("Content-Type: application/octet-stream");
|
218 |
|
|
header("Content-Disposition: attachment; filename={$name}");
|
219 |
a8c35980
|
Scott Ullrich
|
header("Content-Length: $size");
|
220 |
e77ea573
|
jim-p
|
if (isset($_SERVER['HTTPS'])) {
|
221 |
|
|
header('Pragma: ');
|
222 |
|
|
header('Cache-Control: ');
|
223 |
|
|
} else {
|
224 |
|
|
header("Pragma: private");
|
225 |
|
|
header("Cache-Control: private, must-revalidate");
|
226 |
|
|
}
|
227 |
8ff5ffcc
|
Matthew Grooms
|
echo $data;
|
228 |
73ed069b
|
Renato Botelho
|
|
229 |
8ff5ffcc
|
Matthew Grooms
|
exit;
|
230 |
|
|
}
|
231 |
|
|
}
|
232 |
73ed069b
|
Renato Botelho
|
|
233 |
8ff5ffcc
|
Matthew Grooms
|
if ($mode == "restore") {
|
234 |
|
|
if ($_POST['decrypt']) {
|
235 |
76d6d925
|
Stephen Beaver
|
if (!$_POST['decrypt_password']) {
|
236 |
89854d71
|
NewEraCracker
|
$input_errors[] = gettext("A password for decryption must be supplied and confirmed.");
|
237 |
5f601060
|
Phil Davis
|
}
|
238 |
8ff5ffcc
|
Matthew Grooms
|
}
|
239 |
73ed069b
|
Renato Botelho
|
|
240 |
8ff5ffcc
|
Matthew Grooms
|
if (!$input_errors) {
|
241 |
|
|
if (is_uploaded_file($_FILES['conffile']['tmp_name'])) {
|
242 |
73ed069b
|
Renato Botelho
|
|
243 |
8ff5ffcc
|
Matthew Grooms
|
/* read the file contents */
|
244 |
|
|
$data = file_get_contents($_FILES['conffile']['tmp_name']);
|
245 |
5f601060
|
Phil Davis
|
if (!$data) {
|
246 |
dae4c487
|
Carlos Eduardo Ramos
|
log_error(sprintf(gettext("Warning, could not read file %s"), $_FILES['conffile']['tmp_name']));
|
247 |
8ff5ffcc
|
Matthew Grooms
|
return 1;
|
248 |
9fd18b1f
|
Scott Ullrich
|
}
|
249 |
73ed069b
|
Renato Botelho
|
|
250 |
8ff5ffcc
|
Matthew Grooms
|
if ($_POST['decrypt']) {
|
251 |
|
|
if (!tagfile_deformat($data, $data, "config.xml")) {
|
252 |
205da5a0
|
Neriberto C.Prado
|
$input_errors[] = gettext("The uploaded file does not appear to contain an encrypted pfsense configuration.");
|
253 |
8ff5ffcc
|
Matthew Grooms
|
return 1;
|
254 |
|
|
}
|
255 |
|
|
$data = decrypt_data($data, $_POST['decrypt_password']);
|
256 |
|
|
}
|
257 |
73ed069b
|
Renato Botelho
|
|
258 |
5f601060
|
Phil Davis
|
if (stristr($data, "<m0n0wall>")) {
|
259 |
205da5a0
|
Neriberto C.Prado
|
log_error(gettext("Upgrading m0n0wall configuration to pfsense."));
|
260 |
8ff5ffcc
|
Matthew Grooms
|
/* m0n0wall was found in config. convert it. */
|
261 |
|
|
$data = str_replace("m0n0wall", "pfsense", $data);
|
262 |
|
|
$m0n0wall_upgrade = true;
|
263 |
|
|
}
|
264 |
5f601060
|
Phil Davis
|
if ($_POST['restorearea']) {
|
265 |
8ff5ffcc
|
Matthew Grooms
|
/* restore a specific area of the configuration */
|
266 |
5f601060
|
Phil Davis
|
if (!stristr($data, "<" . $_POST['restorearea'] . ">")) {
|
267 |
b6078bed
|
NOYB
|
$input_errors[] = gettext("An area to restore was selected but the correct xml tag could not be located.");
|
268 |
8ff5ffcc
|
Matthew Grooms
|
} else {
|
269 |
8dcca9b5
|
Darren Embry
|
if (!restore_config_section($_POST['restorearea'], $data)) {
|
270 |
b6078bed
|
NOYB
|
$input_errors[] = gettext("An area to restore was selected but the correct xml tag could not be located.");
|
271 |
8dcca9b5
|
Darren Embry
|
} else {
|
272 |
|
|
if ($config['rrddata']) {
|
273 |
|
|
restore_rrddata();
|
274 |
|
|
unset($config['rrddata']);
|
275 |
|
|
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
276 |
919a43a7
|
doktornotor
|
write_config(sprintf(gettext("Unset RRD data from configuration after restoring %s configuration area"), $_POST['restorearea']));
|
277 |
8dcca9b5
|
Darren Embry
|
convert_config();
|
278 |
|
|
}
|
279 |
|
|
filter_configure();
|
280 |
b6078bed
|
NOYB
|
$savemsg = gettext("The configuration area has been restored. The firewall may need to be rebooted.");
|
281 |
7eead1fc
|
Darren Embry
|
}
|
282 |
8ff5ffcc
|
Matthew Grooms
|
}
|
283 |
181462b5
|
Scott Ullrich
|
} else {
|
284 |
5f601060
|
Phil Davis
|
if (!stristr($data, "<" . $g['xml_rootobj'] . ">")) {
|
285 |
b6078bed
|
NOYB
|
$input_errors[] = sprintf(gettext("A full configuration restore was selected but a %s tag could not be located."), $g['xml_rootobj']);
|
286 |
8ff5ffcc
|
Matthew Grooms
|
} else {
|
287 |
|
|
/* restore the entire configuration */
|
288 |
|
|
file_put_contents($_FILES['conffile']['tmp_name'], $data);
|
289 |
|
|
if (config_install($_FILES['conffile']['tmp_name']) == 0) {
|
290 |
|
|
/* this will be picked up by /index.php */
|
291 |
da17d77e
|
Ermal Lu?i
|
mark_subsystem_dirty("restore");
|
292 |
e6068346
|
Phil Davis
|
touch("/conf/needs_package_sync_after_reboot");
|
293 |
8ff5ffcc
|
Matthew Grooms
|
/* remove cache, we will force a config reboot */
|
294 |
5f601060
|
Phil Davis
|
if (file_exists("{$g['tmp_path']}/config.cache")) {
|
295 |
da17d77e
|
Ermal Lu?i
|
unlink("{$g['tmp_path']}/config.cache");
|
296 |
5f601060
|
Phil Davis
|
}
|
297 |
8ff5ffcc
|
Matthew Grooms
|
$config = parse_config(true);
|
298 |
0174c480
|
Ermal LUÇI
|
if (file_exists("/boot/loader.conf")) {
|
299 |
|
|
$loaderconf = file_get_contents("/boot/loader.conf");
|
300 |
08af94cb
|
Chris Buechler
|
if (strpos($loaderconf, "console=\"comconsole")) {
|
301 |
4ff3adec
|
Luiz Souza
|
$config['system']['enableserial'] = true;
|
302 |
|
|
write_config(gettext("Restore serial console enabling in configuration."));
|
303 |
|
|
}
|
304 |
|
|
unset($loaderconf);
|
305 |
|
|
}
|
306 |
|
|
if (file_exists("/boot/loader.conf.local")) {
|
307 |
|
|
$loaderconf = file_get_contents("/boot/loader.conf.local");
|
308 |
|
|
if (strpos($loaderconf, "console=\"comconsole")) {
|
309 |
0174c480
|
Ermal LUÇI
|
$config['system']['enableserial'] = true;
|
310 |
ff30e319
|
bruno
|
write_config(gettext("Restore serial console enabling in configuration."));
|
311 |
0174c480
|
Ermal LUÇI
|
}
|
312 |
5d4b8830
|
Ermal LUÇI
|
unset($loaderconf);
|
313 |
0174c480
|
Ermal LUÇI
|
}
|
314 |
67bc955d
|
Chris Buechler
|
/* extract out rrd items, unset from $config when done */
|
315 |
5f601060
|
Phil Davis
|
if ($config['rrddata']) {
|
316 |
754b75d0
|
Darren Embry
|
restore_rrddata();
|
317 |
a2b8f7b2
|
Scott Ullrich
|
unset($config['rrddata']);
|
318 |
da17d77e
|
Ermal Lu?i
|
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
319 |
919a43a7
|
doktornotor
|
write_config(gettext("Unset RRD data from configuration after restoring full configuration"));
|
320 |
d442e4e2
|
Scott Ullrich
|
convert_config();
|
321 |
1390b049
|
Scott Ullrich
|
}
|
322 |
5f601060
|
Phil Davis
|
if ($m0n0wall_upgrade == true) {
|
323 |
|
|
if ($config['system']['gateway'] <> "") {
|
324 |
8ff5ffcc
|
Matthew Grooms
|
$config['interfaces']['wan']['gateway'] = $config['system']['gateway'];
|
325 |
5f601060
|
Phil Davis
|
}
|
326 |
8ff5ffcc
|
Matthew Grooms
|
unset($config['shaper']);
|
327 |
|
|
/* optional if list */
|
328 |
80fe8369
|
Phil Davis
|
$ifdescrs = get_configured_interface_list(true);
|
329 |
8ff5ffcc
|
Matthew Grooms
|
/* remove special characters from interface descriptions */
|
330 |
5f601060
|
Phil Davis
|
if (is_array($ifdescrs)) {
|
331 |
|
|
foreach ($ifdescrs as $iface) {
|
332 |
8ff5ffcc
|
Matthew Grooms
|
$config['interfaces'][$iface]['descr'] = remove_bad_chars($config['interfaces'][$iface]['descr']);
|
333 |
5f601060
|
Phil Davis
|
}
|
334 |
|
|
}
|
335 |
b6db8ea3
|
sullrich
|
/* check for interface names with an alias */
|
336 |
5f601060
|
Phil Davis
|
if (is_array($ifdescrs)) {
|
337 |
|
|
foreach ($ifdescrs as $iface) {
|
338 |
|
|
if (is_alias($config['interfaces'][$iface]['descr'])) {
|
339 |
b6db8ea3
|
sullrich
|
$origname = $config['interfaces'][$iface]['descr'];
|
340 |
24807bfe
|
Phil Davis
|
update_alias_name($origname . "Alias", $origname);
|
341 |
b6db8ea3
|
sullrich
|
}
|
342 |
|
|
}
|
343 |
|
|
}
|
344 |
da17d77e
|
Ermal Lu?i
|
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
345 |
888e7a27
|
Scott Ullrich
|
// Reset configuration version to something low
|
346 |
a250f179
|
Renato Botelho
|
// in order to force the config upgrade code to
|
347 |
888e7a27
|
Scott Ullrich
|
// run through with all steps that are required.
|
348 |
|
|
$config['system']['version'] = "1.0";
|
349 |
798cb31a
|
Scott Ullrich
|
// Deal with descriptions longer than 63 characters
|
350 |
|
|
for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) {
|
351 |
5f601060
|
Phil Davis
|
if (count($config['filter']['rule'][$i]['descr']) > 63) {
|
352 |
798cb31a
|
Scott Ullrich
|
$config['filter']['rule'][$i]['descr'] = substr($config['filter']['rule'][$i]['descr'], 0, 63);
|
353 |
5f601060
|
Phil Davis
|
}
|
354 |
798cb31a
|
Scott Ullrich
|
}
|
355 |
|
|
// Move interface from ipsec to enc0
|
356 |
|
|
for ($i = 0; isset($config["filter"]["rule"][$i]); $i++) {
|
357 |
5f601060
|
Phil Davis
|
if ($config['filter']['rule'][$i]['interface'] == "ipsec") {
|
358 |
798cb31a
|
Scott Ullrich
|
$config['filter']['rule'][$i]['interface'] = "enc0";
|
359 |
5f601060
|
Phil Davis
|
}
|
360 |
798cb31a
|
Scott Ullrich
|
}
|
361 |
|
|
// Convert icmp types
|
362 |
|
|
// http://www.openbsd.org/cgi-bin/man.cgi?query=icmp&sektion=4&arch=i386&apropos=0&manpath=OpenBSD+Current
|
363 |
0ce1667b
|
stilez
|
$convert = array('echo' => 'echoreq', 'timest' => 'timereq', 'timestrep' => 'timerep');
|
364 |
|
|
foreach ($config["filter"]["rule"] as $ruleid => &$ruledata) {
|
365 |
|
|
if ($convert[$ruledata['icmptype']]) {
|
366 |
|
|
$ruledata['icmptype'] = $convert[$ruledata['icmptype']];
|
367 |
798cb31a
|
Scott Ullrich
|
}
|
368 |
dec5cb85
|
Scott Ullrich
|
}
|
369 |
|
|
$config['diag']['ipv6nat'] = true;
|
370 |
919a43a7
|
doktornotor
|
write_config(gettext("Imported m0n0wall configuration"));
|
371 |
d442e4e2
|
Scott Ullrich
|
convert_config();
|
372 |
205da5a0
|
Neriberto C.Prado
|
$savemsg = gettext("The m0n0wall configuration has been restored and upgraded to pfSense.");
|
373 |
da17d77e
|
Ermal Lu?i
|
mark_subsystem_dirty("restore");
|
374 |
8ff5ffcc
|
Matthew Grooms
|
}
|
375 |
5f601060
|
Phil Davis
|
if (is_array($config['captiveportal'])) {
|
376 |
|
|
foreach ($config['captiveportal'] as $cp) {
|
377 |
2e19a683
|
Renato Botelho
|
if (isset($cp['enable'])) {
|
378 |
|
|
/* for some reason ipfw doesn't init correctly except on bootup sequence */
|
379 |
|
|
mark_subsystem_dirty("restore");
|
380 |
|
|
break;
|
381 |
|
|
}
|
382 |
|
|
}
|
383 |
8ff5ffcc
|
Matthew Grooms
|
}
|
384 |
|
|
setup_serial_port();
|
385 |
5f601060
|
Phil Davis
|
if (is_interface_mismatch() == true) {
|
386 |
8ff5ffcc
|
Matthew Grooms
|
touch("/var/run/interface_mismatch_reboot_needed");
|
387 |
da17d77e
|
Ermal Lu?i
|
clear_subsystem_dirty("restore");
|
388 |
f5a57bb0
|
Scott Ullrich
|
convert_config();
|
389 |
8ff5ffcc
|
Matthew Grooms
|
header("Location: interfaces_assign.php");
|
390 |
bafaf123
|
Scott Ullrich
|
exit;
|
391 |
8ff5ffcc
|
Matthew Grooms
|
}
|
392 |
66bcba1b
|
Ermal
|
if (is_interface_vlan_mismatch() == true) {
|
393 |
|
|
touch("/var/run/interface_mismatch_reboot_needed");
|
394 |
|
|
clear_subsystem_dirty("restore");
|
395 |
|
|
convert_config();
|
396 |
|
|
header("Location: interfaces_assign.php");
|
397 |
|
|
exit;
|
398 |
|
|
}
|
399 |
8ff5ffcc
|
Matthew Grooms
|
} else {
|
400 |
205da5a0
|
Neriberto C.Prado
|
$input_errors[] = gettext("The configuration could not be restored.");
|
401 |
db3996df
|
Scott Ullrich
|
}
|
402 |
9c72b993
|
Scott Ullrich
|
}
|
403 |
181462b5
|
Scott Ullrich
|
}
|
404 |
8ff5ffcc
|
Matthew Grooms
|
} else {
|
405 |
205da5a0
|
Neriberto C.Prado
|
$input_errors[] = gettext("The configuration could not be restored (file upload error).");
|
406 |
db3996df
|
Scott Ullrich
|
}
|
407 |
5b237745
|
Scott Ullrich
|
}
|
408 |
8ff5ffcc
|
Matthew Grooms
|
}
|
409 |
73ed069b
|
Renato Botelho
|
|
410 |
8ff5ffcc
|
Matthew Grooms
|
if ($mode == "reinstallpackages") {
|
411 |
8ccc8f1a
|
Scott Ullrich
|
header("Location: pkg_mgr_install.php?mode=reinstallall");
|
412 |
|
|
exit;
|
413 |
039cb920
|
jim-p
|
} else if ($mode == "clearpackagelock") {
|
414 |
|
|
clear_subsystem_dirty('packagelock');
|
415 |
8545adde
|
k-paulius
|
$savemsg = "Package lock cleared.";
|
416 |
5b237745
|
Scott Ullrich
|
}
|
417 |
|
|
}
|
418 |
|
|
}
|
419 |
6a1e6651
|
Bill Marquette
|
|
420 |
02e1170d
|
Scott Ullrich
|
$id = rand() . '.' . time();
|
421 |
|
|
|
422 |
|
|
$mth = ini_get('upload_progress_meter.store_method');
|
423 |
|
|
$dir = ini_get('upload_progress_meter.file.filename_template');
|
424 |
|
|
|
425 |
a4af095c
|
Renato Botelho
|
function build_area_list($showall) {
|
426 |
|
|
global $config;
|
427 |
b63695db
|
Scott Ullrich
|
|
428 |
0e834fc5
|
Stephen Beaver
|
$areas = array(
|
429 |
|
|
"aliases" => gettext("Aliases"),
|
430 |
a4af095c
|
Renato Botelho
|
"captiveportal" => gettext("Captive Portal"),
|
431 |
|
|
"voucher" => gettext("Captive Portal Vouchers"),
|
432 |
|
|
"dnsmasq" => gettext("DNS Forwarder"),
|
433 |
|
|
"unbound" => gettext("DNS Resolver"),
|
434 |
|
|
"dhcpd" => gettext("DHCP Server"),
|
435 |
|
|
"dhcpdv6" => gettext("DHCPv6 Server"),
|
436 |
|
|
"filter" => gettext("Firewall Rules"),
|
437 |
|
|
"interfaces" => gettext("Interfaces"),
|
438 |
|
|
"ipsec" => gettext("IPSEC"),
|
439 |
|
|
"nat" => gettext("NAT"),
|
440 |
|
|
"openvpn" => gettext("OpenVPN"),
|
441 |
|
|
"installedpackages" => gettext("Package Manager"),
|
442 |
|
|
"rrddata" => gettext("RRD Data"),
|
443 |
|
|
"cron" => gettext("Scheduled Tasks"),
|
444 |
|
|
"syslog" => gettext("Syslog"),
|
445 |
|
|
"system" => gettext("System"),
|
446 |
|
|
"staticroutes" => gettext("Static routes"),
|
447 |
|
|
"sysctl" => gettext("System tunables"),
|
448 |
|
|
"snmpd" => gettext("SNMP Server"),
|
449 |
|
|
"shaper" => gettext("Traffic Shaper"),
|
450 |
|
|
"vlans" => gettext("VLANS"),
|
451 |
7ca42d47
|
k-paulius
|
"wol" => gettext("Wake-on-LAN")
|
452 |
a4af095c
|
Renato Botelho
|
);
|
453 |
0e834fc5
|
Stephen Beaver
|
|
454 |
|
|
$list = array("" => gettext("All"));
|
455 |
|
|
|
456 |
288a2a0f
|
Phil Davis
|
if ($showall) {
|
457 |
0e834fc5
|
Stephen Beaver
|
return($list + $areas);
|
458 |
288a2a0f
|
Phil Davis
|
} else {
|
459 |
a4af095c
|
Renato Botelho
|
foreach ($areas as $area => $areaname) {
|
460 |
|
|
if ($area === "rrddata" || check_and_returnif_section_exists($area) == true) {
|
461 |
|
|
$list[$area] = $areaname;
|
462 |
|
|
}
|
463 |
|
|
}
|
464 |
8ff5ffcc
|
Matthew Grooms
|
|
465 |
0e834fc5
|
Stephen Beaver
|
return($list);
|
466 |
5f601060
|
Phil Davis
|
}
|
467 |
8ff5ffcc
|
Matthew Grooms
|
}
|
468 |
|
|
|
469 |
0f298138
|
k-paulius
|
$pgtitle = array(gettext("Diagnostics"), htmlspecialchars(gettext("Backup & Restore")), htmlspecialchars(gettext("Backup & Restore")));
|
470 |
edcd7535
|
Phil Davis
|
$pglinks = array("", "@self", "@self");
|
471 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
472 |
|
|
|
473 |
947141fd
|
Phil Davis
|
if ($input_errors) {
|
474 |
a4af095c
|
Renato Botelho
|
print_input_errors($input_errors);
|
475 |
947141fd
|
Phil Davis
|
}
|
476 |
0e834fc5
|
Stephen Beaver
|
|
477 |
947141fd
|
Phil Davis
|
if ($savemsg) {
|
478 |
a4af095c
|
Renato Botelho
|
print_info_box($savemsg, 'success');
|
479 |
947141fd
|
Phil Davis
|
}
|
480 |
0e834fc5
|
Stephen Beaver
|
|
481 |
a4af095c
|
Renato Botelho
|
if (is_subsystem_dirty('restore')):
|
482 |
5b237745
|
Scott Ullrich
|
?>
|
483 |
a4af095c
|
Renato Botelho
|
<br/>
|
484 |
1af5edbf
|
Stephen Beaver
|
<form action="diag_reboot.php" method="post">
|
485 |
7d5b007c
|
Sjon Hortensius
|
<input name="Submit" type="hidden" value="Yes" />
|
486 |
f6aebbcc
|
NewEraCracker
|
<?php print_info_box(gettext("The firewall configuration has been changed.") . "<br />" . gettext("The firewall is now rebooting.")); ?>
|
487 |
a4af095c
|
Renato Botelho
|
<br />
|
488 |
7d5b007c
|
Sjon Hortensius
|
</form>
|
489 |
0e834fc5
|
Stephen Beaver
|
<?php
|
490 |
a4af095c
|
Renato Botelho
|
endif;
|
491 |
|
|
|
492 |
|
|
$tab_array = array();
|
493 |
0f298138
|
k-paulius
|
$tab_array[] = array(htmlspecialchars(gettext("Backup & Restore")), true, "diag_backup.php");
|
494 |
a4af095c
|
Renato Botelho
|
$tab_array[] = array(gettext("Config History"), false, "diag_confbak.php");
|
495 |
|
|
display_top_tabs($tab_array);
|
496 |
|
|
|
497 |
|
|
$form = new Form(false);
|
498 |
3beeb66a
|
Stephen Beaver
|
$form->setMultipartEncoding(); // Allow file uploads
|
499 |
a4af095c
|
Renato Botelho
|
|
500 |
5f88f964
|
k-paulius
|
$section = new Form_Section('Backup Configuration');
|
501 |
a4af095c
|
Renato Botelho
|
|
502 |
|
|
$section->addInput(new Form_Select(
|
503 |
|
|
'backuparea',
|
504 |
|
|
'Backup area',
|
505 |
|
|
'',
|
506 |
|
|
build_area_list(false)
|
507 |
|
|
));
|
508 |
|
|
|
509 |
|
|
$section->addInput(new Form_Checkbox(
|
510 |
|
|
'nopackages',
|
511 |
|
|
'Skip packages',
|
512 |
|
|
'Do not backup package information.',
|
513 |
|
|
false
|
514 |
|
|
));
|
515 |
|
|
|
516 |
|
|
$section->addInput(new Form_Checkbox(
|
517 |
|
|
'donotbackuprrd',
|
518 |
|
|
'Skip RRD data',
|
519 |
|
|
'Do not backup RRD data (NOTE: RRD Data can consume 4+ megabytes of config.xml space!)',
|
520 |
|
|
true
|
521 |
|
|
));
|
522 |
|
|
|
523 |
|
|
$section->addInput(new Form_Checkbox(
|
524 |
|
|
'encrypt',
|
525 |
|
|
'Encryption',
|
526 |
|
|
'Encrypt this configuration file.',
|
527 |
|
|
false
|
528 |
7c0f116b
|
Jared Dillard
|
));
|
529 |
a4af095c
|
Renato Botelho
|
|
530 |
76d6d925
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
531 |
a4af095c
|
Renato Botelho
|
'encrypt_password',
|
532 |
c8b10b4c
|
Stephen Beaver
|
'Password',
|
533 |
a4af095c
|
Renato Botelho
|
'password',
|
534 |
c8b10b4c
|
Stephen Beaver
|
null
|
535 |
7c0f116b
|
Jared Dillard
|
));
|
536 |
a4af095c
|
Renato Botelho
|
|
537 |
|
|
$group = new Form_Group('');
|
538 |
1d80d714
|
NOYB
|
// Note: ID attribute of each element created is to be unique. Not being used, suppressing it.
|
539 |
a4af095c
|
Renato Botelho
|
$group->add(new Form_Button(
|
540 |
9a7e1c95
|
Phil Davis
|
'download',
|
541 |
faab522f
|
Renato Botelho
|
'Download configuration as XML',
|
542 |
37676f4e
|
jim-p
|
null,
|
543 |
|
|
'fa-download'
|
544 |
|
|
))->setAttribute('id')->addClass('btn-primary');
|
545 |
a4af095c
|
Renato Botelho
|
|
546 |
|
|
$section->add($group);
|
547 |
|
|
$form->add($section);
|
548 |
|
|
|
549 |
5f88f964
|
k-paulius
|
$section = new Form_Section('Restore Backup');
|
550 |
a4af095c
|
Renato Botelho
|
|
551 |
|
|
$section->addInput(new Form_StaticText(
|
552 |
|
|
null,
|
553 |
52e416cc
|
Phil Davis
|
sprintf(gettext("Open a %s configuration XML file and click the button below to restore the configuration."), $g['product_name'])
|
554 |
a4af095c
|
Renato Botelho
|
));
|
555 |
|
|
|
556 |
|
|
$section->addInput(new Form_Select(
|
557 |
|
|
'restorearea',
|
558 |
|
|
'Restore area',
|
559 |
|
|
'',
|
560 |
ce3eca6e
|
Phil Davis
|
build_area_list(true)
|
561 |
a4af095c
|
Renato Botelho
|
));
|
562 |
|
|
|
563 |
|
|
$section->addInput(new Form_Input(
|
564 |
|
|
'conffile',
|
565 |
|
|
'Configuration file',
|
566 |
|
|
'file',
|
567 |
|
|
null
|
568 |
|
|
));
|
569 |
|
|
|
570 |
|
|
$section->addInput(new Form_Checkbox(
|
571 |
7c0f116b
|
Jared Dillard
|
'decrypt',
|
572 |
a4af095c
|
Renato Botelho
|
'Encryption',
|
573 |
7c0f116b
|
Jared Dillard
|
'Configuration file is encrypted.',
|
574 |
a4af095c
|
Renato Botelho
|
false
|
575 |
7c0f116b
|
Jared Dillard
|
));
|
576 |
a4af095c
|
Renato Botelho
|
|
577 |
76d6d925
|
Stephen Beaver
|
$section->addInput(new Form_Input(
|
578 |
a4af095c
|
Renato Botelho
|
'decrypt_password',
|
579 |
c8b10b4c
|
Stephen Beaver
|
'Password',
|
580 |
a4af095c
|
Renato Botelho
|
'password',
|
581 |
|
|
null,
|
582 |
|
|
['placeholder' => 'Password']
|
583 |
7c0f116b
|
Jared Dillard
|
));
|
584 |
a4af095c
|
Renato Botelho
|
|
585 |
|
|
$group = new Form_Group('');
|
586 |
1d80d714
|
NOYB
|
// Note: ID attribute of each element created is to be unique. Not being used, suppressing it.
|
587 |
a4af095c
|
Renato Botelho
|
$group->add(new Form_Button(
|
588 |
9a7e1c95
|
Phil Davis
|
'restore',
|
589 |
faab522f
|
Renato Botelho
|
'Restore Configuration',
|
590 |
37676f4e
|
jim-p
|
null,
|
591 |
|
|
'fa-undo'
|
592 |
|
|
))->setHelp('The firewall will reboot after restoring the configuration.')->addClass('btn-danger restore')->setAttribute('id');
|
593 |
a4af095c
|
Renato Botelho
|
|
594 |
|
|
$section->add($group);
|
595 |
|
|
|
596 |
|
|
$form->add($section);
|
597 |
|
|
|
598 |
|
|
if (($config['installedpackages']['package'] != "") || (is_subsystem_dirty("packagelock"))) {
|
599 |
5f88f964
|
k-paulius
|
$section = new Form_Section('Package Functions');
|
600 |
0e834fc5
|
Stephen Beaver
|
|
601 |
a4af095c
|
Renato Botelho
|
if ($config['installedpackages']['package'] != "") {
|
602 |
|
|
$group = new Form_Group('');
|
603 |
1d80d714
|
NOYB
|
// Note: ID attribute of each element created is to be unique. Not being used, suppressing it.
|
604 |
a4af095c
|
Renato Botelho
|
$group->add(new Form_Button(
|
605 |
9a7e1c95
|
Phil Davis
|
'reinstallpackages',
|
606 |
faab522f
|
Renato Botelho
|
'Reinstall Packages',
|
607 |
37676f4e
|
jim-p
|
null,
|
608 |
|
|
'fa-retweet'
|
609 |
|
|
))->setHelp('Click this button to reinstall all system packages. This may take a while.')->addClass('btn-success')->setAttribute('id');
|
610 |
0e834fc5
|
Stephen Beaver
|
|
611 |
a4af095c
|
Renato Botelho
|
$section->add($group);
|
612 |
7eead1fc
|
Darren Embry
|
}
|
613 |
0e834fc5
|
Stephen Beaver
|
|
614 |
a4af095c
|
Renato Botelho
|
if (is_subsystem_dirty("packagelock")) {
|
615 |
|
|
$group = new Form_Group('');
|
616 |
1d80d714
|
NOYB
|
// Note: ID attribute of each element created is to be unique. Not being used, suppressing it.
|
617 |
a4af095c
|
Renato Botelho
|
$group->add(new Form_Button(
|
618 |
9a7e1c95
|
Phil Davis
|
'clearpackagelock',
|
619 |
faab522f
|
Renato Botelho
|
'Clear Package Lock',
|
620 |
37676f4e
|
jim-p
|
null,
|
621 |
|
|
'fa-wrench'
|
622 |
|
|
))->setHelp('Click this button to clear the package lock if a package fails to reinstall properly after an upgrade.')->addClass('btn-warning')->setAttribute('id');
|
623 |
0e834fc5
|
Stephen Beaver
|
|
624 |
a4af095c
|
Renato Botelho
|
$section->add($group);
|
625 |
|
|
}
|
626 |
0e834fc5
|
Stephen Beaver
|
|
627 |
a4af095c
|
Renato Botelho
|
$form->add($section);
|
628 |
a1003d57
|
Ermal Lu?i
|
}
|
629 |
a4af095c
|
Renato Botelho
|
|
630 |
|
|
print($form);
|
631 |
7c0f116b
|
Jared Dillard
|
?>
|
632 |
|
|
<script type="text/javascript">
|
633 |
|
|
//<![CDATA[
|
634 |
947141fd
|
Phil Davis
|
events.push(function() {
|
635 |
7c0f116b
|
Jared Dillard
|
|
636 |
|
|
// ------- Show/hide sections based on checkbox settings --------------------------------------
|
637 |
0da0d43e
|
Phil Davis
|
|
638 |
7c0f116b
|
Jared Dillard
|
function hideSections(hide) {
|
639 |
|
|
hidePasswords();
|
640 |
|
|
}
|
641 |
|
|
|
642 |
|
|
function hidePasswords() {
|
643 |
3beeb66a
|
Stephen Beaver
|
|
644 |
7c0f116b
|
Jared Dillard
|
encryptHide = !($('input[name="encrypt"]').is(':checked'));
|
645 |
|
|
decryptHide = !($('input[name="decrypt"]').is(':checked'));
|
646 |
|
|
|
647 |
|
|
hideInput('encrypt_password', encryptHide);
|
648 |
c8b10b4c
|
Stephen Beaver
|
hideInput('encrypt_password_confirm', encryptHide);
|
649 |
7c0f116b
|
Jared Dillard
|
hideInput('decrypt_password', decryptHide);
|
650 |
c8b10b4c
|
Stephen Beaver
|
hideInput('decrypt_password_confirm', decryptHide);
|
651 |
7c0f116b
|
Jared Dillard
|
}
|
652 |
|
|
|
653 |
ff59b884
|
Stephen Beaver
|
// ---------- Click handlers ------------------------------------------------------------------
|
654 |
7c0f116b
|
Jared Dillard
|
|
655 |
|
|
$('input[name="encrypt"]').on('change', function() {
|
656 |
|
|
hidePasswords();
|
657 |
|
|
});
|
658 |
|
|
|
659 |
|
|
$('input[name="decrypt"]').on('change', function() {
|
660 |
|
|
hidePasswords();
|
661 |
3beeb66a
|
Stephen Beaver
|
});
|
662 |
7c0f116b
|
Jared Dillard
|
|
663 |
947141fd
|
Phil Davis
|
$('#conffile').change(function () {
|
664 |
40f146c5
|
Phil Davis
|
if (document.getElementById("conffile").value) {
|
665 |
|
|
$('.restore').prop('disabled', false);
|
666 |
|
|
} else {
|
667 |
|
|
$('.restore').prop('disabled', true);
|
668 |
|
|
}
|
669 |
ff59b884
|
Stephen Beaver
|
});
|
670 |
eef93144
|
Jared Dillard
|
// ---------- On initial page load ------------------------------------------------------------
|
671 |
|
|
|
672 |
7c0f116b
|
Jared Dillard
|
hideSections();
|
673 |
ff59b884
|
Stephen Beaver
|
$('.restore').prop('disabled', true);
|
674 |
7c0f116b
|
Jared Dillard
|
});
|
675 |
|
|
//]]>
|
676 |
|
|
</script>
|
677 |
|
|
|
678 |
|
|
<?php
|
679 |
a4af095c
|
Renato Botelho
|
include("foot.inc");
|
680 |
7a7f3af1
|
sullrich
|
|
681 |
5f601060
|
Phil Davis
|
if (is_subsystem_dirty('restore')) {
|
682 |
cf9a4467
|
jim-p
|
system_reboot();
|
683 |
c9d46a8e
|
Renato Botelho
|
}
|