Project

General

Profile

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