1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
system_firmware_settings.php
|
5
|
part of pfSense
|
6
|
Copyright (C) 2008 Scott Ullrich <sullrich@gmail.com>
|
7
|
Copyright (C) 2005 Colin Smith
|
8
|
|
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
|
pfSense_BUILDER_BINARIES: /usr/bin/fetch
|
32
|
pfSense_MODULE: firmware
|
33
|
*/
|
34
|
|
35
|
##|+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
|
require("guiconfig.inc");
|
43
|
|
44
|
if ($_POST) {
|
45
|
if (!$input_errors) {
|
46
|
if($_POST['alturlenable'] == "yes") {
|
47
|
$config['system']['firmware']['alturl']['enable'] = true;
|
48
|
$config['system']['firmware']['alturl']['firmwareurl'] = $_POST['firmwareurl'];
|
49
|
} else {
|
50
|
unset($config['system']['firmware']['alturl']['enable']);
|
51
|
unset($config['system']['firmware']['alturl']['firmwareurl']);
|
52
|
unset($config['system']['firmware']['alturl']);
|
53
|
unset($config['system']['firmware']);
|
54
|
}
|
55
|
if($_POST['allowinvalidsig'] == "yes")
|
56
|
$config['system']['firmware']['allowinvalidsig'] = true;
|
57
|
else
|
58
|
unset($config['system']['firmware']['allowinvalidsig']);
|
59
|
|
60
|
write_config();
|
61
|
}
|
62
|
}
|
63
|
|
64
|
$curcfg = $config['system']['firmware'];
|
65
|
|
66
|
$pgtitle = array(gettext("System"),gettext("Firmware"),gettext("Settings"));
|
67
|
include("head.inc");
|
68
|
|
69
|
exec("/usr/bin/fetch -q -o /tmp/manifest \"{$g['update_manifest']}\"");
|
70
|
if(file_exists("/tmp/manifest")) {
|
71
|
$preset_urls_split = split("\n", file_get_contents("/tmp/manifest"));
|
72
|
}
|
73
|
|
74
|
?>
|
75
|
<script language="JavaScript">
|
76
|
<!--
|
77
|
|
78
|
|
79
|
function enable_altfirmwareurl(enable_over) {
|
80
|
if (document.iform.alturlenable.checked || enable_over) {
|
81
|
document.iform.firmwareurl.disabled = 0;
|
82
|
} else {
|
83
|
document.iform.firmwareurl.disabled = 1;
|
84
|
document.iform.firmwareurl.value = '';
|
85
|
}
|
86
|
}
|
87
|
|
88
|
// -->
|
89
|
</script>
|
90
|
|
91
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
92
|
<?php include("fbegin.inc");?>
|
93
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
94
|
|
95
|
<form action="system_firmware_settings.php" method="post" name="iform" id="iform">
|
96
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
97
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
98
|
<tr>
|
99
|
<td>
|
100
|
<?php
|
101
|
$tab_array = array();
|
102
|
$tab_array[0] = array(gettext("Manual Update"), false, "system_firmware.php");
|
103
|
$tab_array[1] = array(gettext("Auto Update"), false, "system_firmware_check.php");
|
104
|
$tab_array[2] = array(gettext("Updater Settings"), true, "system_firmware_settings.php");
|
105
|
display_top_tabs($tab_array);
|
106
|
?>
|
107
|
</td>
|
108
|
</tr>
|
109
|
<tr><td><div id=mainarea>
|
110
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
|
111
|
<tr>
|
112
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Firmware Branch"); ?></td>
|
113
|
</tr>
|
114
|
<?php if(is_array($preset_urls_split)): ?>
|
115
|
<tr>
|
116
|
<td valign="top" class="vncell"><?=gettext("Default Auto Update URLs"); ?></td>
|
117
|
<td class="vtable">
|
118
|
<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' });">
|
119
|
<option></option>
|
120
|
<?php
|
121
|
foreach($preset_urls_split as $pus) {
|
122
|
$pus_text = split("\t", $pus);
|
123
|
if($pus_text[0])
|
124
|
echo "<option value='{$pus_text[1]}'>{$pus_text[0]}</option>";
|
125
|
}
|
126
|
?>
|
127
|
</select>
|
128
|
</td>
|
129
|
</tr>
|
130
|
<?php endif; ?>
|
131
|
<tr>
|
132
|
<td valign="top" class="vncell"><?=gettext("Firmware Auto Update URL"); ?></td>
|
133
|
<td class="vtable">
|
134
|
<input name="alturlenable" type="checkbox" id="alturlenable" value="yes" onClick="enable_altfirmwareurl()" <?php if(isset($curcfg['alturl']['enable'])) echo "checked"; ?>> <?=gettext("Use a URL server for firmware upgrades other than") . " " . $g['product_website']; ?><br>
|
135
|
<table>
|
136
|
<tr><td><?=gettext("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>
|
137
|
</table>
|
138
|
<span class="vexpl">
|
139
|
<?=gettext("This is where"); ?> <?php echo $g['product_name'] ?> <?=gettext("will check for newer firmware versions when the"); ?> <a href="system_firmware_check.php"><?=gettext("System: Firmware: Auto Update"); ?></a> <?=gettext("page is viewed."); ?>
|
140
|
<p/>
|
141
|
<b><?=gettext("NOTE"); ?>:</b> <?=gettext("When a custom URL is enabled, the system will not verify the digital signature from"); ?> <?php echo $g['product_website'] ?>.
|
142
|
</span>
|
143
|
</td>
|
144
|
</tr>
|
145
|
<tr>
|
146
|
<td colspan="2" class="list" height="12"> </td>
|
147
|
</tr>
|
148
|
<tr>
|
149
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Updates"); ?></td>
|
150
|
</tr>
|
151
|
<tr>
|
152
|
<td width="22%" valign="top" class="vncell"><?=gettext("Not signed images."); ?></td>
|
153
|
<td width="78%" class="vtable">
|
154
|
<input name="allowinvalidsig" type="checkbox" id="allowinvalidsig" value="yes" <?php if (isset($curcfg['allowinvalidsig'])) echo "checked"; ?> />
|
155
|
<br />
|
156
|
<?=gettext("Allow updating the system with auto-updater and images with no signature."); ?>
|
157
|
</td>
|
158
|
</tr>
|
159
|
<script>enable_altfirmwareurl();</script>
|
160
|
<tr>
|
161
|
<td width="22%" valign="top"> </td>
|
162
|
<td width="78%">
|
163
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>">
|
164
|
</td>
|
165
|
</tr>
|
166
|
</table></div></td></tr></table>
|
167
|
</form>
|
168
|
<?php include("fend.inc"); ?>
|
169
|
</body>
|
170
|
</html>
|