Project

General

Profile

Download (1.71 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/*
4
 * uploadconfig.php
5
 *
6
 * part of pfSense (https://www.pfsense.org)
7
 * Copyright (c) 2004-2013 BSD Perimeter
8
 * Copyright (c) 2013-2016 Electric Sheep Fencing
9
 * Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
10
 * All rights reserved.
11
 *
12
 * originally based on m0n0wall (http://m0n0.ch/wall)
13
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
14
 * All rights reserved.
15
 *
16
 * Licensed under the Apache License, Version 2.0 (the "License");
17
 * you may not use this file except in compliance with the License.
18
 * You may obtain a copy of the License at
19
 *
20
 * http://www.apache.org/licenses/LICENSE-2.0
21
 *
22
 * Unless required by applicable law or agreed to in writing, software
23
 * distributed under the License is distributed on an "AS IS" BASIS,
24
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
 * See the License for the specific language governing permissions and
26
 * limitations under the License.
27
 */
28

    
29
##|+PRIV
30
##|*IDENT=page-hidden-uploadconfiguration
31
##|*NAME=Hidden: Upload Configuration
32
##|*DESCR=Allow access to the 'Hidden: Upload Configuration' page.
33
##|*MATCH=uploadconfig.php*
34
##|-PRIV
35

    
36

    
37
require_once("guiconfig.inc");
38

    
39
header("Content-Type: text/plain");
40

    
41
/* get config.xml in POST variable "config" */
42
if ($_POST['config']) {
43
	$fd = @fopen("{$g['tmp_path']}/config.xml", "w");
44
	if (!$fd) {
45
		echo gettext("ERR Could not save configuration.")."\n";
46
		exit(0);
47
	}
48
	fwrite($fd, $_POST['config']);
49
	fclose($fd);
50
	if (config_install("{$g['tmp_path']}/config.xml") == 0) {
51
		echo gettext("OK")."\n";
52
		system_reboot();
53
	} else {
54
		echo gettext("ERR Could not install configuration.")."\n";
55
	}
56
} else {
57
	echo gettext("ERR Invalid configuration received.")."\n";
58
}
59

    
60
exit(0);
61
?>
(215-215/230)