1 <!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
4 <meta http
-equiv
="content-type" content
="text/html; charset=UTF-8">
5 <meta http
-equiv
="pragmas" content
="no-cache">
7 echo "<title>aMule " , amule_get_version(), " - Web Control Panel</title>";
9 if ( $_SESSION["auto_refresh"] > 0 ) {
10 echo "<meta http-equiv=\"refresh\" content=\"", $_SESSION["auto_refresh"],
11 '; url=downloads.php', '">';
14 <style type
="text/css">
19 a
, a
:active
, a
:link
, a
:visited
23 .down
-header
, .down
-header
-left
, .down
-header
-right
,
24 .down
-line
, .down
-line
-good
, .down
-line
-left
, .down
-line
-good
-left
,
25 .down
-line
-right
, .down
-line
-good
-right
,
26 .up
-header
, .up
-header
-left
, .up
-line
, .up
-line
-left
,
27 .server
-header
, .server
-header
-left
, .server
-line
, .server
-line
-left
,
28 .shared
-header
, .shared
-header
-left
, .shared
-line
, .shared
-line
-changed
,
29 .shared
-line
-left
, .shared
-line
-left
-changed
,
30 .header
, .smallheader
, .commontext
,
31 .upqueue
-header
, .upqueue
-line
, .upqueue
-line
-left
,
32 .websearch
-header
, .websearch
-line
, .addserver
-header
, .addserver
-line
41 background
-color
: #3399FF;
43 .down
-header
, .down
-line
, .down
-line
-good
, .up
-header
, .up
-line
,
44 .server
-header
, .server
-line
, .shared
-header
, .shared
-line
, .shared
-line
-changed
,
45 .upqueue
-header
, .upqueue
-line
,
46 .websearch
-header
, .websearch
-line
, .addserver
-header
, .addserver
-line
50 .down
-header
-left
, .down
-line
-left
, .down
-line
-good
-left
,
51 .server
-header
-left
, .server
-line
-left
, .shared
-header
-left
,
52 .up
-header
-left
, .up
-line
-left
, .shared
-line
-left
, .shared
-line
-left
-changed
, .upqueue
-line
-left
56 .down
-line
-right
, .down
-line
-good
-right
, .down
-header
-right
60 .down
-header
, .down
-header
-left
, .down
-header
-right
,
61 .up
-header
, .up
-header
-left
, .server
-header
, .server
-header
-left
,
62 .shared
-header
, .shared
-header
-left
, .upqueue
-header
,
63 .websearch
-header
, .addserver
-header
65 background
-color
: #0066CC;
69 background
-color
: #0046AC;
73 background
-color
: #003399;
78 background
-color
: #FFFFFF;
81 .down
-line
, .down
-line
-good
, .down
-line
-left
, .down
-line
-good
-left
,
82 .down
-line
-right
, .down
-line
-good
-right
,
83 .up
-line
, .up
-line
-left
, .server
-line
, .server
-line
-left
,
84 .shared
-line
, .shared
-line
-changed
, .shared
-line
-left
, .shared
-line
-left
-changed
,
85 .upqueue
-line
, .upqueue
-line
-left
,
86 .websearch
-line
, .addserver
-line
88 background
-color
: #3399FF;
90 .down
-line
-good
, .down
-line
-good
-left
, .down
-line
-good
-right
, .shared
-line
-changed
, .shared
-line
-left
-changed
96 border
:0px solid
#000000;
97 border
-collapse
: collapse
;
112 <body bgcolor
="#FBDE9C" text
=white link
="#3399FF" vlink
="#3399FF" alink
="#3399FF" marginwidth
=0 marginheight
=0 topmargin
=0 leftmargin
=0 style
="margin:0px">
113 <table border
=0 width
="100%" align
=center cellpadding
=4 cellspacing
=0>
115 <td
class="tabs" align
="left" colspan
="2">
117 <table border
="0" cellpadding
="4" cellspacing
="0">
119 <td
class="tabs" align
="center">
120  
;<a href
="http://www.amule.org" target
="_blank"><img src
="emule.gif"></a
>
121 <font face
="Tahoma" style
="font-size:13pt;" color
="#000000">aMule
<br
>Web Control Panel
</font
>
123 <td
class="tabs" align
="center" width
="30"> 
; </td
>
125 <td align
="center" class="tabs" width
="95">
126 <a href
="servers.php">
127 <img src
="cp_servers.gif"><br
>
131 <td align
="center" class="tabs" width
="95">
132 <a href
="downloads.php">
133 <img src
="cp_download.gif"><br
>
137 <td align
="center" class="tabs" width
="95">
138 <a href
="search.php">
139 <img src
="cp_search.gif"><br
>
143 <td align
="center" class="tabs" width
="95">
144 <a href
="shared.php">
145 <img src
="cp_shared.gif"><br
>
148 <td align
="center" class="tabs" width
="110">
149 <a href
="stat_tree.php">
150 <img src
="cp_stats.gif"><br
>
152 <font color
="#000000">|
</font
>
154 <a href
="stat_graphs.php">Graphs
</a
>
157 <td align
="center" class="tabs" width
="95">
158 <a href
="preferences.php">
159 <img src
="cp_settings.gif"><br
>
164 <td
class="tabs" align
="center" width
="30"> 
;</td
>
165 <td align
="left" class="tabs" width
="95">
166 <img src
="log.gif"> <a href
="index.php?serverinfo=1">Serverinfo
</a
><br
>
167 <img src
="log.gif"> <a href
="index.php?log=1">Log
</a
>
175 <td style
="background-color: #000000; height: 1px" colspan
="2">
180  
; 
;<b
>Connection
:</b
>
182 function CastToXBytes($size)
184 if ( $size < 1024 ) {
185 $result = $size . " bytes";
186 } elseif ( $size < 1048576 ) {
187 $result = ($size / 1024.0) . "KB";
188 } elseif ( $size < 1073741824 ) {
189 $result = ($size / 1048576.0) . "MB";
191 $result = ($size / 1073741824.0) . "GB";
196 $stats = amule_get_stats();
197 if ( $stats["kad_connected"] == 1 ) {
199 if ( $stats["kad_firewalled"] == 1 ) {
200 echo " to KAD (firewalled), ";
205 echo "Not connected to KAD, ";
207 if ( $stats["id"] == 0 ) {
208 echo "not connected to ED2K";
209 } elseif ( $stats["id"] == 0xffffffff ) {
210 echo "connecting to ED2k";
212 echo "connected with ", (($stats["id"] < 16777216) ?
"low" : "high"), " ID to ",
213 $stats["serv_name"], " ", $stats["serv_addr"];
215 echo '<br> <b>Speed:</b> Up: ', CastToXBytes($stats["speed_up"]), 'ps',
216 ' | Down: ', CastToXBytes($stats["speed_down"]), 'ps',
217 '<small> (Limits: ', CastToXBytes($stats["speed_limit_up"]), 'ps/',
218 CastToXBytes($stats["speed_limit_down"]), 'ps)</small> ';
223 <script language
="javascript">
225 s
= "[ " + d
.getDate() +
"/" +
(d
.getMonth() +
1) +
"/" + d
.getFullYear() +
" " + d
.getHours() +
":" +
(d
.getMinutes() < 10 ?
"0" : "") + d
.getMinutes() +
":" +
(d
.getSeconds() < 10 ?
"0" : "") + d
.getSeconds() +
" ]";
230 <td align
=right
class=tabs
>
232 <input type
="button" value
="ed2k://Download" onClick
='self.location.href="index.php?links=1"'>
233 <input type
="button" value
="Logout" onClick
='self.location.href="login.php"'>
237 </table
><font face
=Tahoma style
="font-size:8pt;">
239  
;<table border
=0 align
=center cellpadding
=4 cellspacing
=0 width
="95%">
242 <td align
=center valign
=middle
>
244 <script type
="text/javascript">
245 function GotoCat(cat
) {
246 window
.location
.href
="downloads.php?cmd=filter&status="+cat
;
248 </script
><font face
=Tahoma style
="font-size:8pt;">
249 <table border
=0 align
=center cellpadding
=3 cellspacing
=0 width
="100%" bgcolor
="#99CCFF">
251 <td
class="smallheader" style
="background-color: #000000" colspan
="8"><img src
="arrow_down.gif">
254 $downloads = amule_load_vars("downloads");
255 echo ' (', count($downloads), ')';
258 <td align
="right" class="smallheader" style
="background-color: #000000">
260 <select name
="cat" size
="1"onchange
=GotoCat(this
.form
.cat
.options
[this
.form
.cat
.selectedIndex
].value
)>
262 $all_status = array("All", "Waiting", "Paused", "Downloading");
264 if ( $HTTP_GET_VARS["cmd"] == "filter") {
265 $_SESSION["filter_status"] = $HTTP_GET_VARS["status"];
267 if ( $_SESSION["filter_status"] == '') $_SESSION["filter_status"] = 'All';
268 foreach ($all_status as $s) {
269 echo (($s == $_SESSION["filter_status"]) ?
'<option selected>' : '<option>'), $s, '</option>';
278 <td valign
=middle
class="down-header-left"><a href
="?sort=name"><b
>File Name
</b
></a
></td
>
279 <td valign
=middle
class="down-header"><a href
="?sort=size"><b
>Size
</b
></a
></td
>
280 <td valign
=middle
class="down-header"><a href
="?sort=size_done"><b
>Complete
</b
></a
></td
>
281 <td valign
=middle
class="down-header"><a href
="?sort=size_xfer"><b
>Transferred
</b
></a
></td
>
282 <td valign
=middle
class="down-header"><a href
="?sort=progress"><b
>Progress
</b
></a
></td
>
284 <td valign
=middle
class="down-header"> 
; 
;<a href
="?sort=speed"><b
>Speed
</b
></a
> 
; 
; 
; 
;</td
>
285 <td valign
=middle
class="down-header"><b
>Sources
</b
></td
>
286 <td valign
=middle
class="down-header"><a href
="?sort=prio"><b
>Priority
</b
></a
></td
>
287 <td valign
=middle
class="down-header"><b
>Actions
</b
></td
>
291 function CastToXBytes($size)
293 if ( $size < 1024 ) {
294 $result = $size . " bytes";
295 } elseif ( $size < 1048576 ) {
296 $result = ($size / 1024.0) . "KB";
297 } elseif ( $size < 1073741824 ) {
298 $result = ($size / 1048576.0) . "MB";
300 $result = ($size / 1073741824.0) . "GB";
304 function PrioString($file)
306 $prionames = array(0 => "Low", 1 => "Normal", 2 => "High",
307 3 => "Very high", 4 => "Very low", 5=> "Auto", 6 => "Powershare");
308 $result = $prionames[$file->prio
];
309 if ( $file->prio_auto
== 1) {
310 $result = $result . "(auto)";
314 function StatusString($file)
316 if ( $file->status
== 7 ) {
318 } elseif ( $file->src_count_xfer
> 0 ) {
319 return "Downloading";
326 // declare it here, before any function reffered it in "global"
328 $sort_order;$sort_reverse;
330 function my_cmp($a, $b)
332 global $sort_order, $sort_reverse;
334 switch ( $sort_order) {
335 case "size": $result = $a->size
> $b->size
; break;
336 case "size_done": $result = $a->size_done
> $b->size_done
; break;
337 case "size_xfer": $result = $a->size_xfer
> $b->size_xfer
; break;
338 case "progress": $result = (((float)$a->size_done
)/((float)$a->size
)) > (((float)$b->size_done
)/((float)$b->size
)); break;
339 case "name": $result = $a->name
> $b->name
; break;
340 case "speed": $result = $a->speed
> $b->speed
; break;
341 case "scrcount": $result = $a->src_count
> $b->src_count
; break;
342 case "status": $result = StatusString($a) > StatusString($b); break;
343 case "prio": $result = PrioString($a) > PrioString($b); break;
346 if ( $sort_reverse ) {
349 //var_dump($sort_reverse);
353 if ( ($HTTP_GET_VARS["cmd"] != "") && ($_SESSION["guest_login"] == 0) ) {
354 $name = $HTTP_GET_VARS['file'];
355 if ( strlen($name) == 32 ) {
356 amule_do_download_cmd($name, $HTTP_GET_VARS["cmd"]);
360 $downloads = amule_load_vars("downloads");
362 $sort_order = $HTTP_GET_VARS["sort"];
364 if ( $sort_order == "" ) {
365 $sort_order = $_SESSION["download_sort"];
367 $reverse_sort_key = "download_sort_reverse" . $sort_order;
368 if ( $_SESSION[$reverse_sort_key] == "" ) {
369 $_SESSION[$reverse_sort_key] = 0;
371 if ( $HTTP_GET_VARS["sort"] != '') {
372 $_SESSION[$reverse_sort_key] = !$_SESSION[$reverse_sort_key];
376 //var_dump($_SESSION);
377 $sort_reverse = $_SESSION[$reverse_sort_key];
379 if ( $sort_order != "" ) {
380 $_SESSION["download_sort"] = $sort_order;
381 usort(&$downloads, "my_cmp");
384 foreach ($downloads as $file) {
385 echo '<td valign=top class="down-line-left"><acronym title="', $file->name
, '">', $file->short_name
, '</acronym></td>';
386 echo '<td valign=top class="down-line-right">', CastToXBytes($file->size
), '</td>';
387 echo '<td valign=top class="down-line-right">', CastToXBytes($file->size_done
), '</td>';
388 echo '<td valign=top class="down-line-right">', CastToXBytes($file->size_xfer
), '</td>';
390 echo '<td valign=middle class="down-line">';
391 echo '<table width=200 height=11 border=1 class="percent_table" cellpadding=0 cellspacing=0 bordercolor="#000000">';
392 echo '<tr><td><img src="greenpercent.gif" height=4 width=', (($file->size_done
* 1.0)/$file->size
)*200 +
1, '><br>';
393 echo $file->progress
, '</td></tr></table></td>';
395 echo '<td valign=top class="down-line-right">', CastToXBytes($file->speed
), '</td>';
398 echo '<td valign=top class="down-line">';
399 if ( $file->src_count_not_curr
!= 0 ) {
400 echo $file->src_count
- $file->src_count_not_curr
, " / ";
402 echo $file->src_count
, " (", $file->src_count_xfer
, ")";
403 if ( $file->src_count_a4af
!= 0 ) {
404 echo "+", $file->src_count_a4af
;
408 echo '<td valign=top class="down-line">', PrioString($file), '</td>';
410 $status = StatusString($file);
411 echo '<td valign=top class="down-line"><acronym title="', $status, '">';
412 echo '<img src="l_info.gif" alt="', $status, '"></acronym>';
415 echo '<acronym title="ED2K Link(s)"><a href="', $file->link
, '"><img src="l_ed2klink.gif" alt="ED2K Link(s)"></a></acronym>';
416 if ( $_SESSION["guest_login"] == 0 ) {
417 if ( $file->status
== 7 ) {
418 echo '<acronym title="Resume"><a href="?cmd=resume&file=', $file->hash
, '"><img src="l_resume.gif" alt="Resume"></a></acronym>';
420 echo '<acronym title="Pause"><a href="?cmd=pause&file=', $file->hash
, '"><img src="l_pause.gif" alt="Pause"></a></acronym>';
422 echo '<acronym title="Cancel"><a href="?cmd=cancel&file=', $file->hash
,
423 "\" onclick=\"return confirm('Are you sure that you want to cancel and delete this file?')\" ",
424 '><img src="l_cancel.gif" alt="Cancel"></a></acronym>';
425 echo '<acronym title="Increase priority"><a href="?cmd=prioup&file=', $file->hash
, '"><img src="l_up.gif" alt="Increase priority"></a></acronym>';
426 echo '<acronym title="Decrease priority"><a href="?cmd=priodown&file=', $file->hash
, '"><img src="l_down.gif" alt="Decrease priority"></a></acronym>';
435 <table border
=0 align
=center cellpadding
=4 cellspacing
=0 width
="100%">
438 <td
class="smallheader" colspan
=4 style
="background-color: #000000"><img src
="arrow_up.gif">
441 $uploads = amule_load_vars("uploads");
442 echo ' (', count($uploads), ')';
448 <td
class="up-header-left"><b
>Username
</b
></td
>
449 <td
class="up-header"><b
>File Name
</b
></td
>
450 <td
class="up-header"><b
>Transferred
</b
></td
>
451 <td
class="up-header"><b
>Speed
</b
></td
>
454 function CastToXBytes($size)
456 if ( $size < 1024 ) {
457 $result = $size . " bytes";
458 } elseif ( $size < 1048576 ) {
459 $result = ($size / 1024.0) . "KB";
460 } elseif ( $size < 1073741824 ) {
461 $result = ($size / 1048576.0) . "MB";
463 $result = ($size / 1073741824.0) . "GB";
467 $uploads = amule_load_vars("uploads");
468 foreach ($uploads as $file) {
470 echo '<td valign=top class="up-line-left"><acronym title="', $file->user_name
, '">', $file->user_name
, '</acronym></td>';
471 echo '<td valign=top class="up-line-left"><acronym title="', $file->name
, '">', $file->short_name
, '</acronym></td>';
472 echo '<td valign=top class="up-line">', CastToXBytes($file->xfer_up
), " / ", CastToXBytes($file->xfer_down
), '</td>';
473 echo '<td valign=top class="up-line">', ($file->xfer_speed
> 0) ?
(CastToXBytes($file->xfer_speed
) . "/s") : "-", '</td>';
480 <p align
=center
> 
;