1
|
<?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
|
$id = $_SESSION['uploadid'];
|
43
|
if (!$id) {
|
44
|
echo gettext("Sorry, we could not find an uploadid code.");
|
45
|
exit;
|
46
|
}
|
47
|
|
48
|
// retrieve the upload data from APC
|
49
|
$info = uploadprogress_get_info($id);
|
50
|
|
51
|
// false is returned if the data isn't found
|
52
|
if (!$info) {
|
53
|
echo <<<EOF
|
54
|
<html>
|
55
|
<meta http-equiv="Refresh" CONTENT="1; url=upload_progress.php?uploadid={$id}">
|
56
|
<body>
|
57
|
<?php printf(gettext("Could not locate progress %s. Trying again..."),$id);?>
|
58
|
</body>
|
59
|
</html>
|
60
|
EOF;
|
61
|
exit;
|
62
|
}
|
63
|
|
64
|
if ($info['bytes_uploaded'] >= $info['bytes_total']) {
|
65
|
echo <<<EOF1
|
66
|
<html>
|
67
|
<body onLoad="window.close();">
|
68
|
<p>
|
69
|
<p>
|
70
|
<center>
|
71
|
<b>
|
72
|
<?=gettext("UPLOAD completed!");?>
|
73
|
</b>
|
74
|
</center>
|
75
|
</body>
|
76
|
</html>
|
77
|
EOF1;
|
78
|
exit;
|
79
|
}
|
80
|
|
81
|
?>
|
82
|
|
83
|
<html>
|
84
|
<head>
|
85
|
<meta http-equiv="Refresh" content="1; url=<?=$url?>">
|
86
|
<title><?=gettext("Uploading Files"); ?>... <?=gettext("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
|
<font face="arial"><b><center><?=gettext("Uploading file");?>...</b></center>
|
96
|
<br>
|
97
|
<table width="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
|
98
|
<tr>
|
99
|
<td width="5" height="15" background="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" align="top">
|
100
|
</td>
|
101
|
<td>
|
102
|
<table WIDTH="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
|
103
|
<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
|
</table>
|
112
|
</td>
|
113
|
<td width="5" height="15" background="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" align="top">
|
114
|
</td>
|
115
|
</tr>
|
116
|
</table>
|
117
|
<br>
|
118
|
<table width="100%">
|
119
|
<tr>
|
120
|
<td align="right">
|
121
|
<font face="arial">
|
122
|
<b>
|
123
|
<?=gettext("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
|
<?=gettext("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
|
<?=gettext("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
|
<?=gettext("Estimated");?>:
|
156
|
</td>
|
157
|
<td>
|
158
|
<font face="arial">
|
159
|
<b>
|
160
|
<?=$info['est_sec']?>
|
161
|
</td>
|
162
|
</tr>
|
163
|
</table>
|
164
|
</td>
|
165
|
</tr>
|
166
|
</table>
|
167
|
</body>
|
168
|
</html>
|