Project

General

Profile

Download (7.26 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
    system_firmware.php
5
    Copyright (C) 2004, 2005 Scott Ullrich and Colin Smith
6
    All rights reserved.
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
Header("Location: system_firmware.php");
31
exit;
32

    
33
require_once("guiconfig.inc");
34
require_once("xmlrpc.inc");
35

    
36
if(isset($config['system']['disablefirmwarecheck']))
37
	Header("Location: system_firmware.php");
38

    
39
$versions = check_firmware_version();
40
$pgtitle = array("System","Firmware","Auto Update");
41
include("head.inc");
42

    
43
?>
44
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
45
<?php include("fbegin.inc"); ?>
46
		<SCRIPT>
47
		<!--
48
			function toggleTable (table, img) {
49
				var table = document.getElementById(table);
50
				var img = document.getElementById(img);
51
				if (table.rows[0].style.display == 'none') {
52
					for (var r = 0; r < table.rows.length; r++)
53
						table.rows[r].style.display = '';
54
					img.src = "./themes/<?= $g['theme']; ?>/images/misc/tri_o_black.gif";
55
				} else {
56
					for (var r = 0; r < table.rows.length; r++)
57
						table.rows[r].style.display = 'none';
58
					img.src = "./themes/<?= $g['theme']; ?>/images/misc/tri_c_black.gif";
59
				}
60
			}
61
		//-->
62
		</SCRIPT>
63
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
64
			<tr>
65
				<td>
66
<?php
67
	$tab_array = array();
68
	$tab_array[0] = array("Manual Update", false, "system_firmware.php");
69
	$tab_array[1] = array("Auto Update", true, "system_firmware_check.php");
70
	$tab_array[2] = array("Updater Settings", false, "system_firmware_settings.php");
71
	display_top_tabs($tab_array);
72
?>
73
				</td>
74
			</tr>
75
			<tr>
76
				<td>
77
<?php
78
if(is_array($versions)) {
79
?>
80
					<div id="mainarea">
81
					<table align="center" width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont">
82
						<tr>
83
							<td width="10%" class="listhdrr">Act</td>
84
							<td width="30%" class="listhdrr">Category</td>
85
							<td width="30%" class="listhdrr">Installed</td>
86
							<td width="30%" class="listhdrr">Current<td>
87
						</tr>
88
<?php
89
	$currentvers = $versions['current'];
90
	foreach($versions as $key => $version) {
91
		if($key == "current") continue;
92
		$currentver = array_shift(explode('-', $currentvers[$key]['version']));
93
		if($version == 1) {
94
			$img = "./themes/".$g['theme']."/images/icons/icon_pass.gif";
95
			$pastlatest = true;
96
		} elseif( strcmp($currentver , $version[count($version) - 1]['version']) ){
97
			$img = "./themes/".$g['theme']."/images/icons/icon_pass.gif";
98
			$pastlatest = true;
99
		} else {
100
			$allinstall = true;
101
			$img = "./themes/".$g['theme']."/images/icons/icon_block.gif";
102
		}
103
?>
104
						<tr valign="top">
105
							<td class="listlr" nowrap align="middle"><img src="<?=$img;?>" width="11" height="11" align="absmiddle"></td>
106
							<td class="listlr"><?= ucfirst($key) ?></td>
107
							<td class="listlr"><?= $currentver ?></td>
108
<?php
109
		if($version == 1) {
110
?>
111
							<td class="listlr"><?= $currentver ?></td>
112
<?php
113
		} elseif($pastlatest) {
114
			$newver = $version[count($version) - 1]['version'];
115
?>
116
							<td class="listbggrey"><font color="#FFFFFF"><?= $newver ?></td>
117
<?php
118
		} else {
119
			$newver = $version[count($version) - 1]['version'];
120
?>
121
							<td class="listbg"><font color="#FFFFFF"><?= $newver ?></td>
122
<?php
123
		} 
124
		if(!$pastlatest) {
125
?>
126
							<td valign="middle" class="list" nowrap>
127
								<a href="system_firmware_auto.php?category=<?=$key;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a>
128
							</td>
129
<?php
130
		}
131
?>
132
						</tr>
133
<?php
134
	}
135
?>
136
					</table>
137
<?php
138
	if($allinstall) {
139
?>
140
					<br>
141
					<br>
142
					<table align="center" width="80%" border="0" cellpadding="0" cellspacing="0">
143
						<tr>
144
							<td align="center"><a href="javascript:toggleTable('updates', 'tri_updates')"><img src="./themes/<?= $g['theme']; ?>/images/misc/tri_c_black.gif" id="tri_updates" width="14" height="10" border="0"></a><strong><a href="javascript:toggleTable('updates', 'tri_updates')">Needed Updates</a></strong></td>
145
						</tr>
146
						<tr>
147
							<td>
148
								<br>
149
								<br>
150
								<table id="updates" align="center" width="100%" border="0" cellpadding="0" cellspacing="0">
151
									<tr>
152
										<td width="20%" class="listhdrr">Released</td>
153
										<td width="20%" class="listhdrr">Category</td>  
154
										<td width="20%" class="listhdrr">Version</td>
155
										<td width="20%" class="listhdrr">Size</td>
156
										<td width="20%" class="listhdr">Type</td>
157
									</tr>
158
<?php
159
		if(is_array($versions)) {
160
			foreach($versions as $key => $value) {
161
				if(($key == "current") or ($value == 1)) continue;
162
				if(is_array($value)) {
163
					foreach($value as $version) {
164
						if(!$version['time']) $version['time'] = "Unknown";
165
						if(!$version['size']) $version['size'] = "Unknown";
166
						if(!$version['type']) $version['type'] = "Unknown";
167
						$version['category'] = $key;
168
						$times[$version['time']][] = $version;
169
					}
170
				}
171
			}
172
		}
173
		asort($times);
174
		if(is_array($times)) {
175
			foreach($times as $time) {
176
				foreach($time as $version) {
177
?>
178
									<tr>
179
										<td class="listlr">
180
<?php
181
				if($version['time'] != "Unknown") {
182
					echo date("D M j G:i:s", $version['time']);
183
				} else {
184
					echo $version['time'];
185
				}
186
?>
187
										</td>
188
										<td class="listlr"><?= ucfirst($version['category']) ?></td>
189
										<td class="listlr"><?= $version['version'] ?></td>
190
										<td class="listlr"><?= $version['size'] ?></td>
191
										<td class="listlr"><?= ucfirst($version['type']) ?></td>
192
									</tr>
193
<?php
194
				}
195
			}
196
		}
197
?>
198
								</table>
199
								<br>
200
								<br>
201
								<script language="javascript">toggleTable('updates', 'tri_updates');</script>
202
							</td>
203
						</tr>
204
					</table>
205
					<table align="center">
206
						<tr>
207
							<td>
208
								<form action="system_firmware_auto.php" method="post" enctype="multipart/form-data">
209
									<input name="full" type="submit" class="formbtn" value="Begin Full Update">
210
								</form>
211
							</td>
212
						</tr>
213
					</table>
214
		</div>
215
<?php
216
	}
217
} else {
218
	print_info_box("Unable to receive version information.");
219
}
220
?>
221
				</td>
222
			</tr>
223
		</table>
224
<?php
225
include("fend.inc");
226
$versions['cachetime'] = time();
227
$fout = fopen("/tmp/versioncheck.cache", "w");
228
fwrite($fout, serialize($versions));
229
fclose($fout);
230
?>
231
	</body>
232
</html>
(150-150/192)