Project

General

Profile

Download (5.58 KB) Statistics
| Branch: | Tag: | Revision:
1 0b2e3c64 Colin Smith
<?php
2
/* $Id$ */
3
/*
4 2094568a Colin Smith
	system_firmware_settings.php
5 1cecfbf7 Scott Ullrich
       	part of pfSense
6
		Copyright (C) 2008 Scott Ullrich <sullrich@gmail.com>
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 1d333258 Scott Ullrich
/*
31
	pfSense_BUILDER_BINARIES:	/usr/bin/fetch
32
	pfSense_MODULE:	firmware
33
*/
34 0b2e3c64 Colin Smith
35 6b07c15a Matthew Grooms
##|+PRIV
36
##|*IDENT=page-system-firmware-settings
37
##|*NAME=System: Firmware: Settings page
38
##|*DESCR=Allow access to the 'System: Firmware: Settings' page.
39
##|*MATCH=system_firmware_settings.php*
40
##|-PRIV
41
42 0b2e3c64 Colin Smith
require("guiconfig.inc");
43
44
if ($_POST) {
45 9471afe1 Colin Smith
	if (!$input_errors) {
46
		if($_POST['alturlenable'] == "yes") {
47 da55e467 Scott Ullrich
			$config['system']['firmware']['alturl']['enable'] = true;
48 9471afe1 Colin Smith
			$config['system']['firmware']['alturl']['firmwareurl'] = $_POST['firmwareurl'];
49
		} else {
50
			unset($config['system']['firmware']['alturl']['enable']);
51 da55e467 Scott Ullrich
			unset($config['system']['firmware']['alturl']['firmwareurl']);
52 52629104 Scott Ullrich
			unset($config['system']['firmware']['alturl']);
53
			unset($config['system']['firmware']);			
54 9471afe1 Colin Smith
		}
55
		write_config();
56
	}
57 0b2e3c64 Colin Smith
}
58
59
$curcfg = $config['system']['firmware'];
60
61 d88c6a9f Scott Ullrich
$pgtitle = array("System","Firmware","Settings");
62 52380979 Scott Ullrich
include("head.inc");
63
64 1d333258 Scott Ullrich
exec("/usr/bin/fetch -q -o /tmp/manifest \"{$g['update_manifest']}\"");
65 563f5b51 Scott Ullrich
if(file_exists("/tmp/manifest")) {
66
	$preset_urls_split = split("\n", file_get_contents("/tmp/manifest"));
67
}
68 52380979 Scott Ullrich
69 563f5b51 Scott Ullrich
?>
70 0b2e3c64 Colin Smith
<script language="JavaScript">
71
<!--
72
73
74 9471afe1 Colin Smith
function enable_altfirmwareurl(enable_over) {  	 
75
	if (document.iform.alturlenable.checked || enable_over) { 	 
76
		document.iform.firmwareurl.disabled = 0; 	 
77
	} else { 	 
78 53075520 Scott Ullrich
		document.iform.firmwareurl.disabled = 1;
79 5d5f69a2 Scott Ullrich
		document.iform.firmwareurl.value = '';
80 9471afe1 Colin Smith
	} 	 
81
}
82
83 0b2e3c64 Colin Smith
// -->
84
</script>
85
86
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
87 b30cacb2 Bill Marquette
<?php include("fbegin.inc");?>
88 9471afe1 Colin Smith
<?php if ($input_errors) print_input_errors($input_errors); ?>
89 fd3e7e5d Scott Ullrich
90 0b2e3c64 Colin Smith
<form action="system_firmware_settings.php" method="post" name="iform" id="iform">
91
            <?php if ($savemsg) print_info_box($savemsg); ?>
92 c03d45a2 Colin Smith
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
93 0b2e3c64 Colin Smith
	<tr>
94
		<td>
95 4820d297 Scott Ullrich
<?php
96
	$tab_array = array();
97
	$tab_array[0] = array("Manual Update", false, "system_firmware.php");
98
	$tab_array[1] = array("Auto Update", false, "system_firmware_check.php");
99
	$tab_array[2] = array("Updater Settings", true, "system_firmware_settings.php");
100
	display_top_tabs($tab_array);
101
?>
102 0b2e3c64 Colin Smith
		</td>
103
	</tr>
104 e12d98ea Bill Marquette
	<tr><td><div id=mainarea>
105
	      <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
106 0b2e3c64 Colin Smith
	<tr>
107
		<td colspan="2" valign="top" class="listtopic">Firmware Branch</td>
108
	</tr>
109 563f5b51 Scott Ullrich
<?php if(is_array($preset_urls_split)): ?>
110
	<tr>
111
		<td valign="top" class="vncell">Default Auto Update URLs</td>
112
		<td class="vtable">
113 5d5f69a2 Scott Ullrich
			<select name='preseturls' id='preseturls' onChange="firmwareurl.value = preseturls.value; document.iform.firmwareurl.disabled = 0; alturlenable.checked=true; new Effect.Highlight(this.parentNode, { startcolor: '#ffff99', endcolor: '#fffffff' });">
114 563f5b51 Scott Ullrich
					<option></option>
115
				<?php 
116
					foreach($preset_urls_split as $pus) {
117
						$pus_text = split("\t", $pus);
118 2dc44e89 Scott Ullrich
						if($pus_text[0])
119
							echo "<option value='{$pus_text[1]}'>{$pus_text[0]}</option>";
120 563f5b51 Scott Ullrich
					}
121
				?>
122
			</select>
123
		</td>
124
	</tr>
125
<?php endif; ?>
126 0b2e3c64 Colin Smith
	<tr>
127 da55e467 Scott Ullrich
		<td valign="top" class="vncell">Firmware Auto Update URL</td>
128 9471afe1 Colin Smith
		<td class="vtable">
129 070f23c0 Scott Ullrich
			<input name="alturlenable" type="checkbox" id="alturlenable" value="yes" onClick="enable_altfirmwareurl()" <?php if(isset($curcfg['alturl']['enable'])) echo "checked"; ?>> Use a different URL server for firmware upgrades other than <?php echo $g['product_website']; ?><br>
130 9471afe1 Colin Smith
			<table>
131 da55e467 Scott Ullrich
			<tr><td>Base URL:</td><td><input name="firmwareurl" type="input" class="formfld url" id="firmwareurl" size="64" value="<?php if($curcfg['alturl']['firmwareurl']) echo $curcfg['alturl']['firmwareurl']; else echo $g['']; ?>"></td></tr>
132 9471afe1 Colin Smith
			</table>
133 359f32dc Scott Ullrich
			<span class="vexpl">
134
				This is where <?php echo $g['product_name'] ?> will check for newer firmware versions when the <a href="system_firmware_check.php">System: Firmware: Auto Update</a> page is viewed.
135
				<p/>
136
				<b>NOTE:</b> When a custom URL is enabled the system will not verify the digital signature from <?php echo $g['product_website'] ?>.
137
				</span>
138
				</td>
139 9471afe1 Colin Smith
	</tr>
140
	<script>enable_altfirmwareurl();</script>
141 0b2e3c64 Colin Smith
                <tr>
142
                  <td width="22%" valign="top">&nbsp;</td>
143
                  <td width="78%">
144 2346d159 Colin Smith
                    <input name="Submit" type="submit" class="formbtn" value="Save">
145 0b2e3c64 Colin Smith
                  </td>
146
                </tr>
147 e12d98ea Bill Marquette
              </table></div></td></tr></table>
148 0b2e3c64 Colin Smith
</form>
149
<?php include("fend.inc"); ?>
150
</body>
151
</html>