1 |
c0914318
|
Scott Ullrich
|
#!/usr/local/bin/php
|
2 |
|
|
<?php
|
3 |
|
|
/*
|
4 |
c5d81585
|
Renato Botelho
|
* uploadconfig.php
|
5 |
191cb31d
|
Stephen Beaver
|
*
|
6 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
7 |
0b4c14a4
|
Steve Beaver
|
* Copyright (c) 2004-2019 Rubicon Communications, LLC (Netgate)
|
8 |
c5d81585
|
Renato Botelho
|
* All rights reserved.
|
9 |
191cb31d
|
Stephen Beaver
|
*
|
10 |
c5d81585
|
Renato Botelho
|
* originally based on m0n0wall (http://m0n0.ch/wall)
|
11 |
|
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
12 |
|
|
* All rights reserved.
|
13 |
191cb31d
|
Stephen Beaver
|
*
|
14 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
15 |
|
|
* you may not use this file except in compliance with the License.
|
16 |
|
|
* You may obtain a copy of the License at
|
17 |
191cb31d
|
Stephen Beaver
|
*
|
18 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
19 |
191cb31d
|
Stephen Beaver
|
*
|
20 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
21 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
22 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
23 |
|
|
* See the License for the specific language governing permissions and
|
24 |
|
|
* limitations under the License.
|
25 |
191cb31d
|
Stephen Beaver
|
*/
|
26 |
c0914318
|
Scott Ullrich
|
|
27 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
28 |
|
|
##|*IDENT=page-hidden-uploadconfiguration
|
29 |
5230f468
|
jim-p
|
##|*NAME=Hidden: Upload Configuration
|
30 |
6b07c15a
|
Matthew Grooms
|
##|*DESCR=Allow access to the 'Hidden: Upload Configuration' page.
|
31 |
|
|
##|*MATCH=uploadconfig.php*
|
32 |
|
|
##|-PRIV
|
33 |
|
|
|
34 |
|
|
|
35 |
c81ef6e2
|
Phil Davis
|
require_once("guiconfig.inc");
|
36 |
c0914318
|
Scott Ullrich
|
|
37 |
|
|
header("Content-Type: text/plain");
|
38 |
|
|
|
39 |
|
|
/* get config.xml in POST variable "config" */
|
40 |
|
|
if ($_POST['config']) {
|
41 |
|
|
$fd = @fopen("{$g['tmp_path']}/config.xml", "w");
|
42 |
|
|
if (!$fd) {
|
43 |
a697d396
|
Rafael Lucas
|
echo gettext("ERR Could not save configuration.")."\n";
|
44 |
c0914318
|
Scott Ullrich
|
exit(0);
|
45 |
|
|
}
|
46 |
|
|
fwrite($fd, $_POST['config']);
|
47 |
|
|
fclose($fd);
|
48 |
|
|
if (config_install("{$g['tmp_path']}/config.xml") == 0) {
|
49 |
65634b7e
|
Carlos Eduardo Ramos
|
echo gettext("OK")."\n";
|
50 |
c0914318
|
Scott Ullrich
|
system_reboot();
|
51 |
|
|
} else {
|
52 |
a697d396
|
Rafael Lucas
|
echo gettext("ERR Could not install configuration.")."\n";
|
53 |
c0914318
|
Scott Ullrich
|
}
|
54 |
|
|
} else {
|
55 |
a697d396
|
Rafael Lucas
|
echo gettext("ERR Invalid configuration received.")."\n";
|
56 |
c0914318
|
Scott Ullrich
|
}
|
57 |
|
|
|
58 |
|
|
exit(0);
|
59 |
|
|
?>
|