Project

General

Profile

Download (1.71 KB) Statistics
| Branch: | Tag: | Revision:
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 38809d47 Renato Botelho do Couto
 * Copyright (c) 2004-2013 BSD Perimeter
8
 * Copyright (c) 2013-2016 Electric Sheep Fencing
9 402c98a2 Reid Linnemann
 * Copyright (c) 2014-2023 Rubicon Communications, LLC (Netgate)
10 c5d81585 Renato Botelho
 * All rights reserved.
11 191cb31d Stephen Beaver
 *
12 c5d81585 Renato Botelho
 * originally based on m0n0wall (http://m0n0.ch/wall)
13
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
14
 * All rights reserved.
15 191cb31d Stephen Beaver
 *
16 b12ea3fb Renato Botelho
 * 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 191cb31d Stephen Beaver
 *
20 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
21 191cb31d Stephen Beaver
 *
22 b12ea3fb Renato Botelho
 * 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 191cb31d Stephen Beaver
 */
28 c0914318 Scott Ullrich
29 6b07c15a Matthew Grooms
##|+PRIV
30
##|*IDENT=page-hidden-uploadconfiguration
31 5230f468 jim-p
##|*NAME=Hidden: Upload Configuration
32 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'Hidden: Upload Configuration' page.
33
##|*MATCH=uploadconfig.php*
34
##|-PRIV
35
36
37 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
38 c0914318 Scott Ullrich
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 a697d396 Rafael Lucas
		echo gettext("ERR Could not save configuration.")."\n";
46 c0914318 Scott Ullrich
		exit(0);
47
	}
48
	fwrite($fd, $_POST['config']);
49
	fclose($fd);
50
	if (config_install("{$g['tmp_path']}/config.xml") == 0) {
51 65634b7e Carlos Eduardo Ramos
		echo gettext("OK")."\n";
52 c0914318 Scott Ullrich
		system_reboot();
53
	} else {
54 a697d396 Rafael Lucas
		echo gettext("ERR Could not install configuration.")."\n";
55 c0914318 Scott Ullrich
	}
56
} else {
57 a697d396 Rafael Lucas
	echo gettext("ERR Invalid configuration received.")."\n";
58 c0914318 Scott Ullrich
}
59
60
exit(0);
61
?>