Project

General

Profile

Download (4.28 KB) Statistics
| Branch: | Tag: | Revision:
1 0045dfd1 Scott Ullrich
<?php
2
/* $Id$ */
3
/*
4
	upload_progress.php
5
	Copyright (C) 2008 Scott Ullrich <sullrich@gmail.com>
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
/* DISABLE_PHP_LINT_CHECKING */
31
32
##|+PRIV
33
##|*IDENT=page-upload_progress
34
##|*NAME=System: Firmware: Manual Update page (progress bar)
35
##|*DESCR=Allow access to the 'System: Firmware: Manual Update: Progress bar' page.
36
##|*MATCH=upload_progress*
37
##|-PRIV
38
39
include("guiconfig.inc");
40
41
// sanitize the ID value
42 8999038a Scott Ullrich
$id = $_SESSION['uploadid'];
43
if (!$id) {
44 ee0b88a6 Scott Ullrich
	echo "Sorry, we could not find a uploadid code.";
45 0045dfd1 Scott Ullrich
	exit;
46
}
47
48
// retrieve the upload data from APC
49 8999038a Scott Ullrich
$info = uploadprogress_get_info($id);
50 0045dfd1 Scott Ullrich
51
// false is returned if the data isn't found
52 8999038a Scott Ullrich
if (!$info) {
53 34047b62 Scott Ullrich
	echo <<<EOF
54
	<html>
55
		<meta http-equiv="Refresh" CONTENT="1; url=upload_progress.php?uploadid={$id}">
56
		<body>
57
			Could not locate progress {$id}.  Trying again...
58
		</body>
59
	</html>
60
EOF;
61 8999038a Scott Ullrich
	exit;
62 ee0b88a6 Scott Ullrich
}
63 0045dfd1 Scott Ullrich
64 af44f9c2 Scott Ullrich
if ($info['bytes_uploaded'] >= $info['bytes_total']) {
65 34047b62 Scott Ullrich
	echo <<<EOF1
66
	<html>
67
		<body onLoad="window.close();">
68
			&nbsp;<p>
69
			&nbsp;<p>
70
			<center>
71
				<b>
72
					UPLOAD completed!
73
				</b>
74
			</center>
75
		</body>
76
	</html>
77
EOF1;
78 ee0b88a6 Scott Ullrich
	exit;
79
}
80 0045dfd1 Scott Ullrich
81
?>
82
83
<html>
84
<head>
85
	<meta http-equiv="Refresh" content="1; url=<?=$url?>">
86
	<title>Uploading Files... Please wait ...</title>
87
	<style type='text/css'>
88
		td {font-size: 10pt }
89
	</style>
90
</head>
91
<body bgcolor="#FFFFFF">
92
	<table height="100%" width="100%" cellPadding="4" cellSpacing="4" style="border:1px solid #990000;">
93
	<tr>
94
		<td>
95 f5811c1b Scott Ullrich
			<font face="arial"><b><center>Uploading file...</b></center>
96 0045dfd1 Scott Ullrich
			<br>
97
			<table width="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
98
			<tr>
99 f5811c1b Scott Ullrich
				<td width="5" height="15" background="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" align="top">
100
				</td>
101 0045dfd1 Scott Ullrich
				<td>
102
					<table WIDTH="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
103 e1142a0c Scott Ullrich
					<tr>
104
						<td background="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif">
105
							<?php
106
							$meter = sprintf("%.2f", $info['bytes_uploaded'] / $info['bytes_total'] * 100);
107
							echo "<img src='./themes/{$g['theme']}/images/misc/bar_blue.gif' height='15' WIDTH='{$meter}%'>";
108
							?>
109
						</td>
110
					</tr>
111 0045dfd1 Scott Ullrich
					</table>
112
				</td>
113 f5811c1b Scott Ullrich
				<td width="5" height="15" background="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" align="top">
114
				</td>
115
			</tr>
116 0045dfd1 Scott Ullrich
			</table>
117
			<br>
118
			<table width="100%">
119 e1142a0c Scott Ullrich
			<tr>
120
				<td align="right">
121
					<font face="arial">
122
					<b>
123
					Uploaded:
124
				</td>
125
				<td>
126
					<font face="arial">
127
					<b>
128
					<?=$info['bytes_uploaded']?>
129
				</td>
130
				<td align="right">
131
					<font face="arial">
132
					<b>
133
					File Size:
134
				</td>
135
				<td>
136
					<font face="arial">
137
					<b>
138
					<?=$info['bytes_total']?>
139
				</td>
140
			</tr>
141
   			<tr>
142
   				<td align="right">
143
					<font face="arial">
144
					<b>
145
					Completed:
146
				</td>
147
				<td>
148
					<font face="arial">
149
					<b>
150
					<?=$info['bytes_total']-$info['bytes_uploaded']?>%
151
				</td>
152
   				<td align="right">
153
					<font face="arial">
154
					<b>
155
					Estimated:
156
				</td>
157
				<td>
158
					<font face="arial">
159
					<b>
160
					<?=$info['est_sec']?>
161
				</td>
162
   			</tr>
163 8999038a Scott Ullrich
			</table>
164
		</td>
165
	</tr>
166 e1142a0c Scott Ullrich
	</table>
167 0045dfd1 Scott Ullrich
</body>
168
</html>