Project

General

Profile

Download (1.62 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-2016 Rubicon Communications, LLC (Netgate)
8
 * All rights reserved.
9
 *
10
 * originally based on m0n0wall (http://m0n0.ch/wall)
11
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
12
 * All rights reserved.
13
 *
14
 * 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
 *
18
 * http://www.apache.org/licenses/LICENSE-2.0
19
 *
20
 * 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
 */
26

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

    
34

    
35
require_once("guiconfig.inc");
36

    
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
		echo gettext("ERR Could not save configuration.")."\n";
44
		exit(0);
45
	}
46
	fwrite($fd, $_POST['config']);
47
	fclose($fd);
48
	if (config_install("{$g['tmp_path']}/config.xml") == 0) {
49
		echo gettext("OK")."\n";
50
		system_reboot();
51
	} else {
52
		echo gettext("ERR Could not install configuration.")."\n";
53
	}
54
} else {
55
	echo gettext("ERR Invalid configuration received.")."\n";
56
}
57

    
58
exit(0);
59
?>
(210-210/225)