1
|
#!/usr/local/bin/php
|
2
|
<?php
|
3
|
/* $Id$ */
|
4
|
/*
|
5
|
system_firmware.php
|
6
|
Copyright (C) 2004, 2005 Scott Ullrich and Colin Smith
|
7
|
All rights reserved.
|
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
|
require_once("guiconfig.inc");
|
32
|
require_once("xmlparse_pkg.inc");
|
33
|
require_once("xmlrpc.inc");
|
34
|
|
35
|
?>
|
36
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
37
|
<html>
|
38
|
<head>
|
39
|
<title><?=gentitle("System: Firmware Update");?></title>
|
40
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
41
|
<link href="gui.css" rel="stylesheet" type="text/css">
|
42
|
</head>
|
43
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
44
|
<?php
|
45
|
include("fbegin.inc");
|
46
|
$versions = check_firmware_version();
|
47
|
?>
|
48
|
<p class="pgtitle">System: Firmware Update</p>
|
49
|
<br>
|
50
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td>
|
51
|
<ul id="tabnav">
|
52
|
<li class="tabinact"><a href="system_firmware.php">Manual Update</a></li>
|
53
|
<li class="tabact">Auto Update</a></li>
|
54
|
</ul>
|
55
|
</td></tr>
|
56
|
<tr>
|
57
|
<td class="tabcont">
|
58
|
<?php if(is_array($versions)) { ?>
|
59
|
<table align="center" width="60%" border="0" cellpadding="6" cellspacing="0">
|
60
|
<tr>
|
61
|
<td width="10%" class="listhdrr">Act</td>
|
62
|
<td width="30%" class="listhdrr">Category</td>
|
63
|
<td width="30%" class="listhdrr">Installed</td>
|
64
|
<td width="30%" class="listhdrr">Current<td>
|
65
|
</tr>
|
66
|
|
67
|
<?php
|
68
|
$currentvers = $versions['current'];
|
69
|
foreach($versions as $key => $version) {
|
70
|
if($key == "current") continue;
|
71
|
$currentver = array_shift(explode('-', $currentvers[$key]['version']));
|
72
|
if($version == 1) {
|
73
|
$img = "pass.gif";
|
74
|
$pastlatest = true;
|
75
|
} elseif($currentver > $version[count($version) - 1]['version']) {
|
76
|
$img = "pass.gif";
|
77
|
$pastlatest = true;
|
78
|
} else {
|
79
|
$allinstall = true;
|
80
|
$img = "block.gif";
|
81
|
}
|
82
|
?>
|
83
|
|
84
|
<tr valign="top">
|
85
|
<td class="listlr" nowrap align="middle"><img src="<?=$img;?>" width="11" height="11" align="absmiddle"></td>
|
86
|
<td class="listlr"><?= ucfirst($key) ?></td>
|
87
|
<td class="listlr"><?= $currentver ?></td>
|
88
|
<?php
|
89
|
if($version == 1) {
|
90
|
?>
|
91
|
<td class="listlr"><?= $currentver ?></td>
|
92
|
<?php
|
93
|
} elseif($pastlatest) {
|
94
|
$newver = $versions[$key]['version'];
|
95
|
?>
|
96
|
<td class="listbggrey"><font color="#FFFFFFF"><?= $newver ?></td>
|
97
|
<?php
|
98
|
} else {
|
99
|
$newver = $versions[$key]['version'];
|
100
|
?>
|
101
|
<td class="listbg"><font color="#FFFFFFF"><?= $newver['version'] ?></td>
|
102
|
<?php }
|
103
|
if(!$pastlatest) {
|
104
|
?>
|
105
|
<td valign="middle" class="list" nowrap>
|
106
|
<a href="system_firmware_auto.php?category=<?=$key;?>"><img src="plus.gif" width="17" height="17" border="0"></a>
|
107
|
</td>
|
108
|
<?php }
|
109
|
}
|
110
|
?>
|
111
|
</table>
|
112
|
<?php
|
113
|
if($allinstall == true) {
|
114
|
?>
|
115
|
<br><br><br><table align="center"><tr><td><form action="system_firmware_auto.php" method="post" enctype="multipart/form-data">
|
116
|
<input name="full" type="submit" class="formbtn" value="Begin Full Update">
|
117
|
</form></td></tr></table>
|
118
|
<?php } ?>
|
119
|
</tr>
|
120
|
<?php } else {
|
121
|
print_info_box("Unable to receive version information.");
|
122
|
} ?>
|
123
|
</td>
|
124
|
</tr>
|
125
|
</table>
|
126
|
<?php
|
127
|
include("fend.inc");
|
128
|
$versions['cachetime'] = time();
|
129
|
$fout = fopen("/tmp/versioncheck.cache", "w");
|
130
|
fwrite($fout, serialize($versions));
|
131
|
fclose($fout);
|
132
|
?>
|
133
|
</body>
|
134
|
</html>
|