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>";
8 if ( $_SESSION["auto_refresh"] > 0 ) {
9 echo "<meta http-equiv=\"refresh\" content=\"", $_SESSION["auto_refresh"],
10 '; url=downloads.php', '">';
13 <style type
="text/css">
18 a
, a
:link
, a
:visited
{
20 text
-decoration
: none
;
25 text
-decoration
: none
;
28 .down
-header
, .down
-header
-left
, .down
-header
-right
,
29 .down
-line
, .down
-line
-good
, .down
-line
-left
, .down
-line
-good
-left
,
30 .down
-line
-right
, .down
-line
-good
-right
,
31 .up
-header
, .up
-header
-left
, .up
-line
, .up
-line
-left
,
32 .server
-header
, .server
-header
-left
, .server
-line
, .server
-line
-left
,
33 .shared
-header
, .shared
-header
-left
, .shared
-line
, .shared
-line
-changed
,
34 .shared
-line
-left
, .shared
-line
-left
-changed
,
35 .header
, .smallheader
, .commontext
,
36 .upqueue
-header
, .upqueue
-line
, .upqueue
-line
-left
,
37 .websearch
-header
, .websearch
-line
, .addserver
-header
, .addserver
-line
{
46 background
-color
: #1F76A5;
52 background
-color
: #0075B3;
63 background
-color
: #21719B;
69 background
-color
: #1D6083;
72 .down
-header
, .down
-line
, .down
-line
-good
, .up
-header
, .up
-line
,
73 .server
-header
, .server
-line
, .shared
-header
, .shared
-line
, .shared
-line
-changed
,
74 .upqueue
-header
, .upqueue
-line
,
75 .websearch
-header
, .websearch
-line
, .addserver
-header
, .addserver
-line
{
80 .down
-header
-left
, .down
-line
-left
, .down
-line
-good
-left
,
81 .server
-header
-left
, .server
-line
-left
, .shared
-header
-left
,
82 .up
-header
-left
, .up
-line
-left
, .shared
-line
-left
, .shared
-line
-left
-changed
, .upqueue
-line
-left
{
87 .down
-line
-right
, .down
-line
-good
-right
, .down
-header
-right
{
91 .down
-header
, .down
-header
-left
, .down
-header
-right
,
92 .up
-header
, .up
-header
-left
, .server
-header
, .server
-header
-left
,
93 .shared
-header
, .shared
-header
-left
, .upqueue
-header
,
94 .websearch
-header
, .addserver
-header
{
96 background
-color
: #1D6083;
100 background
-color
: #0046AC;
104 background
-color
: #003399;
109 background
-color
: #FFFFFF;
115 font
-family
: Tahoma
;
119 .down
-line
, .down
-line
-good
, .down
-line
-left
, .down
-line
-good
-left
,
120 .down
-line
-right
, .down
-line
-good
-right
,
121 .up
-line
, .up
-line
-left
, .server
-line
, .server
-line
-left
,
122 .shared
-line
, .shared
-line
-changed
, .shared
-line
-left
, .shared
-line
-left
-changed
,
123 .upqueue
-line
, .upqueue
-line
-left
,
124 .websearch
-line
, .addserver
-line
{
126 background
-color
: #1F76A5;
129 .down
-line
-good
, .down
-line
-good
-left
, .down
-line
-good
-right
,
130 .shared
-line
-changed
, .shared
-line
-left
-changed
{
136 border
:0px solid
#000000;
137 border
-collapse
: collapse
;
141 font
-family
: Tahoma
;
145 background
-color
: #1D6083;
155 <body background
="main_bg.gif" text
=white link
="#1F76A5" vlink
="#1F76A5" alink
="#1F76A5" marginwidth
=0 marginheight
=0 topmargin
=0 leftmargin
=0 style
="margin:0px">
156 <table border
="0" width
="100%" align
="center" cellpadding
="0" cellspacing
="0">
158 <td
class="tabs_three" background
="main_top_bg.gif" align
="left" colspan
="4">
160 <table border
="0" cellpadding
="4" cellspacing
="0" width
="100%">
162 <td
class="tabs_three" align
="center" width
="100">
165 <font face
="Tahoma" style
="font-size:13pt;" color
="#000000"><a href
="http://www.amule.org" target
="_blank">
166 <img src
="emule.gif" alt
="aMule | Web Control Panel">
169 <td
class="tabs_three" align
="center" width
="30">
172 <td align
="center" class="tabs_three" width
="95">
174 <a href
="servers.php">
175 <img src
="cp_servers.gif"><br
/>
179 <td align
="center" class="tabs_three" width
="96">
180 <a href
="downloads.php">
181 <img src
="cp_download.gif"><br
/>
186 <td align
="center" class="tabs_three" width
="96">
187 <a href
="search.php">
188 <img src
="cp_search.gif"><br
/>
192 <td align
="center" class="tabs_three" width
="96">
193 <a href
="shared.php">
195 <img src
="cp_shared.gif"><br
/>
198 <td align
="center" class="tabs_three" width
="110">
199 <a href
="stat_tree.php">
200 <img src
="cp_stats.gif"><br
/>
203 <font color
="#000000">|
</font
>
205 <a href
="stat_graphs.php">
209 <td align
="center" class="tabs_three" width
="95">
210 <a href
="preferences.php">
211 <img src
="cp_settings.gif"><br
/>
216 <td
class="tabs_three" align
="center">
219 <td align
="left" class="tabs_three" width
="95">
220 <img src
="log.gif" align
="absmiddle"> <a href
="index.php?serverinfo=1">Serverinfo
</a
><br
/>
221 <img src
="log.gif" align
="absmiddle"> <a href
="index.php?log=1">Log
</a
>
230 <td background
="main_topbar.gif" height
="49" class="tabs_four">
231  
; 
;<b
>Connection
:</b
>
233 function CastToXBytes($size)
235 if ( $size < 1024 ) {
236 $result = $size . " bytes";
237 } elseif ( $size < 1048576 ) {
238 $result = ($size / 1024.0) . "KB";
239 } elseif ( $size < 1073741824 ) {
240 $result = ($size / 1048576.0) . "MB";
242 $result = ($size / 1073741824.0) . "GB";
247 $stats = amule_get_stats();
248 if ( $stats["id"] == 0 ) {
249 echo "Not connected";
250 } elseif ( $stats["id"] == 0xffffffff ) {
251 echo "Connecting ...";
253 echo "Connected with ", (($stats["id"] < 16777216) ?
"low" : "high"), " ID to ",
254 $stats["serv_name"], " ", $stats["serv_addr"];
256 echo '<br> <b>Speed:</b> Up: ', CastToXBytes($stats["speed_up"]), 'ps',
257 ' | Down: ', CastToXBytes($stats["speed_down"]), 'ps',
258 '<small> (Limits: ', CastToXBytes($stats["speed_limit_up"]), 'ps/',
259 CastToXBytes($stats["speed_limit_down"]), 'ps)</small> ';
261 <font color
="#FFE471">
262 <script language
="javascript">
264 s
= "[ " + d
.getDate() +
"/" +
(d
.getMonth() +
1) +
"/" + d
.getFullYear() +
" " + d
.getHours() +
":" +
(d
.getMinutes() < 10 ?
"0" : "") + d
.getMinutes() +
":" +
(d
.getSeconds() < 10 ?
"0" : "") + d
.getSeconds() +
" ]";
269 <td background
="main_topbar.gif" align
="center" valign
="middle" class="tabs_four">
271 <a href
="index.php?links=1">
272 <img src
="arrow_right.gif" align
="absmiddle">
273  
; ed2k
:// ED2K Link(s)
276 <td background
="main_topbar.gif" align
="right">
278 <table border
="0" cellpadding
="0" cellspacing
="0" width
="8" height
="100%">
280 <td height
="49" background
="main_topbarseperator.gif">
288 <td background
="main_topbardarker.gif" align
="center" valign
="middle" class="tabs_five">
290 <img src
="arrow_down_logout.gif" align
="absmiddle">
296 </table
><font face
=Tahoma style
="font-size:8pt;">
298  
;<table border
=0 align
=center cellpadding
=4 cellspacing
=0 width
="95%">
300 <td align
=center valign
=middle
>
302 <script type
="text/javascript">
304 function GotoCat(cat
) {
305 window
.location
.href
="downloads.php?cmd=filter&status="+cat
;
310 <font face
=Tahoma style
="font-size:8pt;">
311 <table border
=0 align
=center cellpadding
=3 cellspacing
=0 width
="100%" bgcolor
="#99CCFF">
314 <td
class="smallheader" style
="background-color: #000000" colspan
="8"><img src
="arrow_down.gif">
317 $downloads = amule_load_vars("downloads");
318 echo ' (', count($downloads), ')';
321 <td align
="right" class="smallheader" style
="background-color: #000000">
323 <select name
="cat" size
="1" onchange
=GotoCat(this
.form
.cat
.options
[this
.form
.cat
.selectedIndex
].value
)>
325 $all_status = array("All", "Waiting", "Paused", "Downloading");
327 if ( $HTTP_GET_VARS["cmd"] == "filter") {
328 $_SESSION["filter_status"] = $HTTP_GET_VARS["status"];
330 if ( $_SESSION["filter_status"] == '') $_SESSION["filter_status"] = 'All';
331 foreach ($all_status as $s) {
332 echo (($s == $_SESSION["filter_status"]) ?
'<option selected>' : '<option>'), $s, '</option>';
340 <td valign
=middle
class="down-header-left"><a href
="downloads.php?sort=name"><b
>File Name
</b
></a
></td
>
342 <td valign
=middle
class="down-header"><a href
="downloads.php?sort=size"><b
>Size
</b
></a
></td
>
343 <td valign
=middle
class="down-header"><a href
="downloads.php?sort=size_done"><b
>Complete
</b
></a
></td
>
344 <td valign
=middle
class="down-header"><a href
="downloads.php?sort=size_xfer"><b
>Transferred
</b
></a
></td
>
345 <td valign
=middle
class="down-header"><a href
="downloads.php?sort=progress"><b
>Progress
</b
></a
></td
>
346 <td valign
=middle
class="down-header"><a href
="downloads.php?sort=speed"><b
>Speed
</b
></a
></td
>
347 <td valign
=middle
class="down-header"><b
>Sources
</b
></td
>
348 <td valign
=middle
class="down-header"><a href
="downloads.php?sort=prio"><b
>Priority
</b
></a
></td
>
349 <td valign
=middle
class="down-header"><b
>Actions
</b
></td
>
353 function CastToXBytes($size)
355 if ( $size < 1024 ) {
356 $result = $size . " byte";
357 } elseif ( $size < 1048576 ) {
358 $result = ($size / 1024.0) . "KB";
359 } elseif ( $size < 1073741824 ) {
360 $result = ($size / 1048576.0) . "MB";
362 $result = ($size / 1073741824.0) . "GB";
366 function PrioString($file)
368 $prionames = array(0 => "Low", 1 => "Normal", 2 => "High",
369 3 => "Very high", 4 => "Very low", 5=> "Auto", 6 => "Powershare");
370 $result = $prionames[$file->prio
];
371 if ( $file->prio_auto
== 1) {
372 $result = $result . "(auto)";
376 function StatusString($file)
378 if ( $file->status
== 7 ) {
380 } elseif ( $file->src_count_xfer
> 0 ) {
381 return "Downloading";
388 // declare it here, before any function reffered it in "global"
390 $sort_order;$sort_reverse;
392 function my_cmp($a, $b)
394 global $sort_order, $sort_reverse;
396 switch ( $sort_order) {
397 case "size": $result = $a->size
> $b->size
; break;
398 case "size_done": $result = $a->size_done
> $b->size_done
; break;
399 case "size_xfer": $result = $a->size_xfer
> $b->size_xfer
; break;
400 case "progress": $result = (((float)$a->size_done
)/((float)$a->size
)) > (((float)$b->size_done
)/((float)$b->size
)); break;
401 case "name": $result = $a->name
> $b->name
; break;
402 case "speed": $result = $a->speed
> $b->speed
; break;
403 case "scrcount": $result = $a->src_count
> $b->src_count
; break;
404 case "status": $result = StatusString($a) > StatusString($b); break;
405 case "prio": $result = PrioString($a) > PrioString($b); break;
408 if ( $sort_reverse ) {
411 //var_dump($sort_reverse);
415 if ( ($HTTP_GET_VARS["cmd"] != "") && ($_SESSION["guest_login"] == 0) ) {
416 $name = $HTTP_GET_VARS['file'];
417 if ( strlen($name) == 32 ) {
418 amule_do_download_cmd($name, $HTTP_GET_VARS["cmd"]);
422 $downloads = amule_load_vars("downloads");
424 $sort_order = $HTTP_GET_VARS["sort"];
426 if ( $sort_order == "" ) {
427 $sort_order = $_SESSION["download_sort"];
429 $reverse_sort_key = "download_sort_reverse" . $sort_order;
430 if ( $_SESSION[$reverse_sort_key] == "" ) {
431 $_SESSION[$reverse_sort_key] = 0;
433 if ( $HTTP_GET_VARS["sort"] != '') {
434 $_SESSION[$reverse_sort_key] = !$_SESSION[$reverse_sort_key];
438 //var_dump($_SESSION);
439 $sort_reverse = $_SESSION[$reverse_sort_key];
441 if ( $sort_order != "" ) {
442 $_SESSION["download_sort"] = $sort_order;
443 usort(&$downloads, "my_cmp");
446 foreach ($downloads as $file) {
447 $status = StatusString($file);
448 if ( ($_SESSION['filter_status'] == 'All') ||
($_SESSION['filter_status'] == $status) ) {
450 $mark = $file->speed
> 0 ?
1 : 0;
451 echo '<td valign=top class="', $mark ?
'down-line-good-left':'down-line-left',
452 '"><acronym title="', $file->name
, '">', $file->short_name
, '</acronym></td>';
453 echo '<td valign=top class="', $mark ?
'down-line-good-right':'down-line-right','">',
454 CastToXBytes($file->size
), '</td>';
455 echo '<td valign=top class="', $mark ?
'down-line-good-right':'down-line-right','">',
456 CastToXBytes($file->size_done
), '</td>';
457 echo '<td valign=top class="', $mark ?
'down-line-good-right':'down-line-right','">',
458 CastToXBytes($file->size_xfer
), '</td>';
460 echo '<td valign=middle class="', $mark ?
'down-line-right">':'down-line">';
461 echo '<table width=200 height=11 border=1 class="percent_table" cellpadding=0 cellspacing=0 bordercolor="#000000">';
462 echo '<tr><td><img src="greenpercent.gif" height=4 width=', (($file->size_done
* 1.0)/$file->size
)*200 +
1, '><br>';
463 echo $file->progress
, '</td></tr></table></td>';
465 echo '<td valign=middle class="', $mark ?
'down-line-good-right">':'down-line-right">',
466 $file->speed ?
(CastToXBytes($file->speed
) . '/s') : '-', '</td>';
469 echo '<td valign=middle class="', $mark ?
'down-line-good-right">':'down-line-right">';
470 if ( $file->src_count_not_curr
!= 0 ) {
471 echo $file->src_count
- $file->src_count_not_curr
, " / ";
473 echo $file->src_count
, " (", $file->src_count_xfer
, ")";
474 if ( $file->src_count_a4af
!= 0 ) {
475 echo "+", $file->src_count_a4af
;
479 echo '<td valign=middle class="', $mark ?
'down-line-good-right">':'down-line-right">',
480 PrioString($file), '</td>';
482 echo '<td valign=top class="down-line"><acronym title="', $status, '">';
483 echo '<img src="l_info.gif" alt="', $status, '"></acronym>';
486 echo '<acronym title="ED2K Link(s)"><a href="', $file->link
, '"><img src="l_ed2klink.gif" alt="ED2K Link(s)"></a></acronym>';
487 if ( $_SESSION["guest_login"] == 0 ) {
488 if ( $file->status
== 7 ) {
489 echo '<acronym title="Resume"><a href="?cmd=resume&file=', $file->hash
, '"><img src="l_resume.gif" alt="Resume"></a></acronym>';
491 echo '<acronym title="Pause"><a href="?cmd=pause&file=', $file->hash
, '"><img src="l_pause.gif" alt="Pause"></a></acronym>';
493 echo '<acronym title="Cancel"><a href="?cmd=cancel&file=', $file->hash
,
494 "\" onclick=\"return confirm('Are you sure that you want to cancel and delete this file?')\" ",
495 '><img src="l_cancel.gif" alt="Cancel"></a></acronym>';
496 echo '<acronym title="Increase priority"><a href="?cmd=prioup&file=', $file->hash
, '"><img src="l_up.gif" alt="Increase priority"></a></acronym>';
497 echo '<acronym title="Decrease priority"><a href="?cmd=priodown&file=', $file->hash
, '"><img src="l_down.gif" alt="Decrease priority"></a></acronym>';
500 echo '</td></tr>', "\n";
507 <table border
=0 align
=center cellpadding
=4 cellspacing
=0 width
="100%">
509 <td
class="smallheader" colspan
=4 style
="background-color: #000000"><img src
="arrow_up.gif">
512 $uploads = amule_load_vars("uploads");
513 echo ' (', count($uploads), ')';
518 <td
class="up-header-left"><b
>Username
</b
></td
>
519 <td
class="up-header"><b
>File Name
</b
></td
>
520 <td
class="up-header"><b
>Transferred
</b
></td
>
521 <td
class="up-header"><b
>Speed
</b
></td
>
526 function CastToXBytes($size)
528 if ( $size < 1024 ) {
529 $result = $size . " bytes";
530 } elseif ( $size < 1048576 ) {
531 $result = ($size / 1024.0) . "KB";
532 } elseif ( $size < 1073741824 ) {
533 $result = ($size / 1048576.0) . "MB";
535 $result = ($size / 1073741824.0) . "GB";
539 $uploads = amule_load_vars("uploads");
540 foreach ($uploads as $file) {
542 echo '<td valign=top class="up-line-left"><acronym title="', $file->user_name
, '">', $file->user_name
, '</acronym></td>';
543 echo '<td valign=top class="up-line-left"><acronym title="', $file->name
, '">', $file->short_name
, '</acronym></td>';
544 echo '<td valign=top class="up-line">', CastToXBytes($file->xfer_up
), " / ", CastToXBytes($file->xfer_down
), '</td>';
545 echo '<td valign=top class="up-line">', ($file->xfer_speed
> 0) ?
(CastToXBytes($file->xfer_speed
) . "/s") : "-", '</td>';