1
|
#!/usr/local/bin/php
|
2
|
<?php
|
3
|
/* $Id$ */
|
4
|
/*
|
5
|
system_advanced.php
|
6
|
part of pfSense
|
7
|
Copyright (C) 2005 Scott Ullrich
|
8
|
|
9
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
10
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11
|
All rights reserved.
|
12
|
|
13
|
Redistribution and use in source and binary forms, with or without
|
14
|
modification, are permitted provided that the following conditions are met:
|
15
|
|
16
|
1. Redistributions of source code must retain the above copyright notice,
|
17
|
this list of conditions and the following disclaimer.
|
18
|
|
19
|
2. Redistributions in binary form must reproduce the above copyright
|
20
|
notice, this list of conditions and the following disclaimer in the
|
21
|
documentation and/or other materials provided with the distribution.
|
22
|
|
23
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
27
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
POSSIBILITY OF SUCH DAMAGE.
|
33
|
*/
|
34
|
|
35
|
require("guiconfig.inc");
|
36
|
|
37
|
if ($_POST) {
|
38
|
/* input validation */
|
39
|
if($_POST['firmwareurl'] && !is_string($_POST['firmwareurl'])) {
|
40
|
$input_errors[] = "The base XMLRPC URL must be a string.";
|
41
|
}
|
42
|
if($_POST['firmwarepath'] && !is_string($_POST['firmwarepath'])) {
|
43
|
$input_errors[] = "The XMLRPC path must be a string.";
|
44
|
}
|
45
|
if (!$input_errors) {
|
46
|
$config['system']['firmware']['branch'] = $_POST['branch'];
|
47
|
if($_POST['alturlenable'] == "yes") {
|
48
|
$config['system']['firmware']['alturl']['enable'] = "";
|
49
|
$config['system']['firmware']['alturl']['firmwareurl'] = $_POST['firmwareurl'];
|
50
|
$config['system']['firmware']['alturl']['firmwarepath'] = $_POST['firmwarepath'];
|
51
|
} else {
|
52
|
unset($config['system']['firmware']['alturl']['enable']);
|
53
|
}
|
54
|
write_config();
|
55
|
}
|
56
|
}
|
57
|
|
58
|
$curcfg = $config['system']['firmware'];
|
59
|
|
60
|
$pgtitle = "System: Firmware: Settings";
|
61
|
include("head.inc");
|
62
|
|
63
|
?>
|
64
|
|
65
|
<script language="JavaScript">
|
66
|
<!--
|
67
|
var systemdescs=new Array(4);
|
68
|
systemdescs[0]="This patch system uses a combination of unified and binary diffs. This system requires the least bandwidth, but is less forgiving of errors.";
|
69
|
systemdescs[1]="This patch system uses tar files to update the system. This requires the most bandwidth, but is more reliable.";
|
70
|
systemdescs[2]="This patch system uses tar files for the kernel and base system, and unified diffs for other components.";
|
71
|
|
72
|
var branchinfo=new Array(4);
|
73
|
branchinfo[0]="The stable branch contains only those updates believed to be stable by the developers.";
|
74
|
branchinfo[1]="This branch contains both stable updates as well as those believed to be fairly stable.";
|
75
|
branchinfo[2]="This branch contains all released updates, regardless of stability.";
|
76
|
|
77
|
function update_description(itemnum) {
|
78
|
document.forms[0].branchinfo.value=branchinfo[itemnum];
|
79
|
}
|
80
|
|
81
|
function enable_altfirmwareurl(enable_over) {
|
82
|
if (document.iform.alturlenable.checked || enable_over) {
|
83
|
document.iform.firmwareurl.disabled = 0;
|
84
|
document.iform.firmwarepath.disabled = 0;
|
85
|
} else {
|
86
|
document.iform.firmwareurl.disabled = 1;
|
87
|
document.iform.firmwarepath.disabled = 1;
|
88
|
}
|
89
|
}
|
90
|
|
91
|
// -->
|
92
|
</script>
|
93
|
|
94
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
95
|
<?php include("fbegin.inc");?>
|
96
|
<p class="pgtitle"><?=$pgtitle?></p>
|
97
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
98
|
<form action="system_firmware_settings.php" method="post" name="iform" id="iform">
|
99
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
100
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
101
|
<tr>
|
102
|
<td>
|
103
|
<?php
|
104
|
$tab_array = array();
|
105
|
$tab_array[0] = array("Manual Update", false, "system_firmware.php");
|
106
|
$tab_array[1] = array("Auto Update", false, "system_firmware_check.php");
|
107
|
$tab_array[2] = array("Updater Settings", true, "system_firmware_settings.php");
|
108
|
display_top_tabs($tab_array);
|
109
|
?>
|
110
|
</td>
|
111
|
</tr>
|
112
|
<tr><td><div id=mainarea>
|
113
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
|
114
|
<tr>
|
115
|
<td colspan="2" valign="top" class="listtopic">Firmware Branch</td>
|
116
|
</tr>
|
117
|
<tr>
|
118
|
<td valign="top" class="vncell">Firmware Branch</td>
|
119
|
<td class="vtable">
|
120
|
<select onChange="update_description(this.selectedIndex);" name="branch" id="branch">
|
121
|
<option value="stable"<?php if($curcfg['branch']=="stable") echo " SELECTED"; ?>>Stable</option>
|
122
|
<option value="beta"<?php if($curcfg['branch']=="beta") echo " SELECTED"; ?>>Beta</option>
|
123
|
<option value="alpha"<?php if($curcfg['branch']=="alpha") echo " SELECTED"; ?>>Alpha</option>
|
124
|
</select>
|
125
|
<textarea cols="60" rows="2" id="branchinfo" name="branchinfo"style="border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;">
|
126
|
</textarea>
|
127
|
<script language="javascript">
|
128
|
update_description(document.forms[0].branch.selectedIndex);
|
129
|
</script>
|
130
|
<br><span class="vexpl">Select the update branch you would like this system to track.</td>
|
131
|
</tr>
|
132
|
<tr>
|
133
|
<td valign="top" class="vncell">Firmware XMLRPC URL</td>
|
134
|
<td class="vtable">
|
135
|
<input name="alturlenable" type="checkbox" id="alturlenable" value="yes" onClick="enable_altfirmwareurl()" <?php if(isset($curcfg['alturl']['enable'])) echo "checked"; ?>> Use a different XMLRPC server for firmware upgrades<br>
|
136
|
<table>
|
137
|
<tr><td>Base URL:</td><td><input name="firmwareurl" type="input" id="firmwareurl" size="64" value="<?php if($curcfg['alturl']['firmwareurl']) echo $curcfg['alturl']['firmwareurl']; else echo $g['xmlrpcbaseurl']; ?>"></td></tr>
|
138
|
<tr><td>Path:</td><td><input name="firmwarepath" type="input" id="firmwarepath" size="64" value="<?php if($curcfg['alturl']['firmwarepath']) echo $curcfg['alturl']['firmwarepath']; else echo $g['xmlrpcpath']; ?>"></td></tr>
|
139
|
</table>
|
140
|
<span class="vexpl">This is where pfSense will check for newer firmware versions when the <a href="system_firmware_check.php">System: Firmware: Auto Update</a> page is viewed.</span></td>
|
141
|
</tr>
|
142
|
<script>enable_altfirmwareurl();</script>
|
143
|
<!--
|
144
|
<tr>
|
145
|
<td width="22%" valign="top" class="vncell">Update Preference</td>
|
146
|
<td width="78%" class="vtable">
|
147
|
<select onChange="update_description(branchinfo, this.selectedIndex);" name="branch" id="branch">
|
148
|
<option value="patches"<?php if($curcfg['updates']=="diffs") echo " SELECTED"; ?>>Patches</option>
|
149
|
<option value="full"<?php if($curcfg['updates']=="full") echo " SELECTED"; ?>>Full Updates</option>
|
150
|
<option value="combination"<?php if($config['updates']=="combination") echo " SELECTED"; ?>>Combination</option>
|
151
|
</select>
|
152
|
<textarea cols="60" rows="2" id="info" name="info"style="border:1px dashed #000066; background-color: #ffffff; color: #000000; font-size: 8pt;">
|
153
|
</textarea>
|
154
|
<script language="javascript">
|
155
|
update_description(branchinfo, document.forms[0].optimization.selectedIndex);
|
156
|
</script>
|
157
|
<br><span class="vexpl"><b>Select the update branch you would like this system to track</b></td>
|
158
|
</tr>
|
159
|
-->
|
160
|
<tr>
|
161
|
<td width="22%" valign="top"> </td>
|
162
|
<td width="78%">
|
163
|
<input name="Submit" type="submit" class="formbtn" value="Save">
|
164
|
</td>
|
165
|
</tr>
|
166
|
</table></div></td></tr></table>
|
167
|
</form>
|
168
|
<?php include("fend.inc"); ?>
|
169
|
</body>
|
170
|
</html>
|