Project

General

Profile

Download (7.29 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 = "System: Firmware: Auto Update";
41
include("head.inc");
42

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