Project

General

Profile

Download (2.14 KB) Statistics
| Branch: | Tag: | Revision:
1 c0914318 Scott Ullrich
#!/usr/local/bin/php
2
<?php
3
/*
4
	uploadconfig.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6
7
	Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
8 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
9 c0914318 Scott Ullrich
	All rights reserved.
10
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13
14
	1. Redistributions of source code must retain the above copyright notice,
15
	this list of conditions and the following disclaimer.
16
17
	2. Redistributions in binary form must reproduce the above copyright
18
	notice, this list of conditions and the following disclaimer in the
19
	documentation and/or other materials provided with the distribution.
20
21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32
33 6b07c15a Matthew Grooms
##|+PRIV
34
##|*IDENT=page-hidden-uploadconfiguration
35
##|*NAME=Hidden: Upload Configuration page
36
##|*DESCR=Allow access to the 'Hidden: Upload Configuration' page.
37
##|*MATCH=uploadconfig.php*
38
##|-PRIV
39
40
41 c0914318 Scott Ullrich
require("guiconfig.inc");
42
43
header("Content-Type: text/plain");
44
45
/* get config.xml in POST variable "config" */
46
if ($_POST['config']) {
47
	$fd = @fopen("{$g['tmp_path']}/config.xml", "w");
48
	if (!$fd) {
49 a697d396 Rafael Lucas
		echo gettext("ERR Could not save configuration.")."\n";
50 c0914318 Scott Ullrich
		exit(0);
51
	}
52
	fwrite($fd, $_POST['config']);
53
	fclose($fd);
54
	if (config_install("{$g['tmp_path']}/config.xml") == 0) {
55 65634b7e Carlos Eduardo Ramos
		echo gettext("OK")."\n";
56 c0914318 Scott Ullrich
		system_reboot();
57
	} else {
58 a697d396 Rafael Lucas
		echo gettext("ERR Could not install configuration.")."\n";
59 c0914318 Scott Ullrich
	}
60
} else {
61 a697d396 Rafael Lucas
	echo gettext("ERR Invalid configuration received.")."\n";
62 c0914318 Scott Ullrich
}
63
64
exit(0);
65
?>