Project

General

Profile

Download (5.2 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	system_firmware_settings.php
5
        part of pfSense
6
        Copyright (C) 2005 Colin Smith
7

    
8
	Redistribution and use in source and binary forms, with or without
9
	modification, are permitted provided that the following conditions are met:
10

    
11
	1. Redistributions of source code must retain the above copyright notice,
12
	   this list of conditions and the following disclaimer.
13

    
14
	2. Redistributions in binary form must reproduce the above copyright
15
	   notice, this list of conditions and the following disclaimer in the
16
	   documentation and/or other materials provided with the distribution.
17

    
18
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
	POSSIBILITY OF SUCH DAMAGE.
28
*/
29

    
30
require("guiconfig.inc");
31

    
32
if ($_POST) {
33
	if (!$input_errors) {
34
		if($_POST['alturlenable'] == "yes") {
35
			$config['system']['firmware']['alturl']['enable'] = true;
36
			$config['system']['firmware']['alturl']['firmwareurl'] = $_POST['firmwareurl'];
37
		} else {
38
			unset($config['system']['firmware']['alturl']['enable']);
39
			unset($config['system']['firmware']['alturl']['firmwareurl']);
40
			unset($config['system']['firmware']['alturl']);
41
			unset($config['system']['firmware']);			
42
		}
43
		write_config();
44
	}
45
}
46

    
47
$curcfg = $config['system']['firmware'];
48

    
49
$pgtitle = array("System","Firmware","Settings");
50
include("head.inc");
51

    
52
exec("fetch -q -o /tmp/manifest \"{$g['update_manifest']}\"");
53
if(file_exists("/tmp/manifest")) {
54
	$preset_urls_split = split("\n", file_get_contents("/tmp/manifest"));
55
}
56

    
57
?>
58
<script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script>
59
<script language="JavaScript">
60
<!--
61

    
62

    
63
function enable_altfirmwareurl(enable_over) {  	 
64
	if (document.iform.alturlenable.checked || enable_over) { 	 
65
		document.iform.firmwareurl.disabled = 0; 	 
66
	} else { 	 
67
		document.iform.firmwareurl.disabled = 1;
68
		document.iform.firmwareurl.value = '';		
69
	} 	 
70
}
71

    
72
// -->
73
</script>
74

    
75
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
76
<?php include("fbegin.inc");?>
77
<?php if ($input_errors) print_input_errors($input_errors); ?>
78
<form action="system_firmware_settings.php" method="post" name="iform" id="iform">
79
            <?php if ($savemsg) print_info_box($savemsg); ?>
80
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
81
	<tr>
82
		<td>
83
<?php
84
	$tab_array = array();
85
	$tab_array[0] = array("Manual Update", false, "system_firmware.php");
86
	$tab_array[1] = array("Auto Update", false, "system_firmware_check.php");
87
	$tab_array[2] = array("Updater Settings", true, "system_firmware_settings.php");
88
	display_top_tabs($tab_array);
89
?>
90
		</td>
91
	</tr>
92
	<tr><td><div id=mainarea>
93
	      <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
94
	<tr>
95
		<td colspan="2" valign="top" class="listtopic">Firmware Branch</td>
96
	</tr>
97
<?php if(is_array($preset_urls_split)): ?>
98
	<tr>
99
		<td valign="top" class="vncell">Default Auto Update URLs</td>
100
		<td class="vtable">
101
			<select name='preseturls' id='preseturls' onChange="firmwareurl.value = preseturls.value; document.iform.firmwareurl.disabled = 0; alturlenable.checked=true;">
102
					<option></option>
103
				<?php 
104
					foreach($preset_urls_split as $pus) {
105
						$pus_text = split("\t", $pus);
106
						if($pus_text[0])
107
							echo "<option value='{$pus_text[1]}'>{$pus_text[0]}</option>";
108
					}
109
				?>
110
			</select>
111
		</td>
112
	</tr>
113
<?php endif; ?>
114
	<tr>
115
		<td valign="top" class="vncell">Firmware Auto Update URL</td>
116
		<td class="vtable">
117
			<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<br>
118
			<table>
119
			<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>
120
			</table>
121
			<span class="vexpl">
122
				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.
123
				<p/>
124
				<b>NOTE:</b> When a custom URL is enabled the system will not verify the digital signature from <?php echo $g['product_website'] ?>.
125
				</span>
126
				</td>
127
	</tr>
128
	<script>enable_altfirmwareurl();</script>
129
                <tr>
130
                  <td width="22%" valign="top">&nbsp;</td>
131
                  <td width="78%">
132
                    <input name="Submit" type="submit" class="formbtn" value="Save">
133
                  </td>
134
                </tr>
135
              </table></div></td></tr></table>
136
</form>
137
<?php include("fend.inc"); ?>
138
</body>
139
</html>
(151-151/193)