Project

General

Profile

Download (3.1 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php?php
2
/* $Id$ */
3

    
4
include("guiconfig.inc");
5

    
6
if($config['theme'] <> "")
7
	$g['theme'] = $config['theme'];
8
else
9
	$g['theme'] = "pfsense";
10

    
11

    
12
$url = 'progress.php?UPLOAD_IDENTIFIER='.  $_GET["UPLOAD_IDENTIFIER"] .'&e=1';
13

    
14
function nice_value($x) {
15
   if ($x < 100)  $x;
16
   if ($x < 10000)  return sprintf("%.2fKB", $x/1000);
17
   if ($x < 900000) return sprintf("%dKB", $x/1000);
18
   return sprintf("%.2fMB", $x/1000/1000);
19
}
20

    
21

    
22
$X = upload_progress_meter_get_info( $_GET["UPLOAD_IDENTIFIER"] );
23
if (!$X) {
24

    
25
   if ( array_key_exists( "e", $_GET ) ) {
26
      echo "<HTML><BODY onLoad='window.close();'>Invalid Meter ID! {$_GET["UPLOAD_IDENTIFIER"]}";
27
      echo ('</BODY></HTML>');
28
   }else{
29
      echo ('<HTML><meta HTTP-EQUIV="Refresh" CONTENT="1; url='. $url .'"><BODY></BODY></HTML>');
30
   }
31

    
32
}else{
33

    
34
   $meter = sprintf("%.2f", $X['bytes_uploaded'] / $X['bytes_total'] * 100);
35

    
36
   $sp = $X['speed_last'];
37
   if ($sp < 10000) $speed  = sprintf("%.2f", $sp / 1000);
38
   else $speed  = sprintf("%d", $sp / 1000);
39

    
40
   $eta = sprintf("%02d:%02d", $X['est_sec'] / 60, $X['est_sec'] % 60 );
41

    
42
   $upl   = nice_value($X['bytes_uploaded']);
43
   $total = nice_value($X['bytes_total']);
44

    
45
   if ($X['bytes_total'] > 1 && $X['bytes_uploaded'] >= $X['bytes_total'] && $X['est_sec'] == 0) {
46
      echo ('<HTML><BODY onLoad="window.close()"> UPLOAD completed!</BODY></HTML>');
47
   }else{
48

    
49
?>
50

    
51
<HTML>
52
<HEAD>
53

    
54
<meta HTTP-EQUIV="Refresh" CONTENT="1; url=<?=$url?>">
55

    
56
<TITLE>Uploading Files... Please wait ...</TITLE>
57

    
58
<style type='text/css'> td {font-size: 10pt }</style>
59

    
60
</HEAD>
61
<BODY BGCOLOR="#FFFFFF">
62

    
63
<table height="100%" width="100%" cellPadding="4" cellSpacing="4" style="border:1px solid #990000;">
64
<tr><td>
65

    
66
   <font face="arial"><b><center>Uploading files...</b></center>
67

    
68
   <br>
69

    
70
   <table width="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
71
	<td width="5" height="15" background="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" align="top"></td>
72
	<td>
73
		<table WIDTH="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
74
			<td background="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif"><?echo("<img src='./themes/".$g['theme']."/images/misc/bar_blue.gif' height='15' WIDTH='$meter%'>");?></td>
75
		</table>
76

    
77
	</td>
78
	<td width="5" height="15" background="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" align="top"></td>
79
   </table>
80

    
81

    
82

    
83

    
84

    
85

    
86
   <br>
87

    
88
   <TABLE WIDTH="100%">
89
   <tr>
90
   <td align="right"><font face="arial"><b>Time Remaining:</td><td><font face="arial"><?=$eta?></td>
91
   <td align="right"><font face="arial"><b>Speed:</td><td><font face="arial"><font face="arial"><?=$speed?>KB/sec</td>
92
   </tr>
93

    
94
   <tr>
95
   <td align="right"><font face="arial"><b>Uploaded:</td><td><font face="arial"><?=$upl?></td>
96
   <td align="right"><font face="arial"><b>File Size:</td><td><font face="arial"><?=$total?></td>
97
   </tr>
98

    
99
   <tr>
100
   <td align="right"><font face="arial"><b>Completed:</td><td><font face="arial"><?=$meter?>%</td>
101
   <td align="right"><font face="arial"><b></td><td><font face="arial"></td>
102
   </tr>
103

    
104
</td></tr>
105
</table>
106

    
107
</BODY>
108
</HTML>
109

    
110

    
111

    
(88-88/159)