Project

General

Profile

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

    
5
include("guiconfig.inc");
6

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

    
12

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

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

    
22

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

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

    
33
}else{
34

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

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

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

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

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

    
50
?>
51

    
52
<HTML>
53
<HEAD>
54

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

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

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

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

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

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

    
69
   <br>
70

    
71
   <table width="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
72
	<td width="5" height="15" background="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" align="top"></td>
73
	<td>
74
		<table WIDTH="100%" height="15" colspacing="0" cellpadding="0" cellspacing="0" border="0" align="top" nowrap>
75
			<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>
76
		</table>
77

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

    
82

    
83

    
84

    
85

    
86

    
87
   <br>
88

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

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

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

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

    
108
</BODY>
109
</HTML>
110

    
111
<?  } } ?>
112

    
113

    
(84-84/146)