Upstream tarball 20080304
[amule.git] / src / webserver / chicane / index.php
blob2843523b8ce62397c59d381007ba7281fbb4d406
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
5 <META HTTP-EQUIV="PRAGMAS" CONTENT="NO-CACHE">
6 <title>
7 aMule CVS - Web Control Panel
8 </title>
10 <style type="text/css">
11 img {
12 border : 0px;
15 a, a:link, a:visited {
16 color : white;
17 text-decoration: none;
20 a:hover {
21 color: #FFC412;
22 text-decoration: none;
25 .down-header, .down-header-left, .down-header-right,
26 .down-line, .down-line-good, .down-line-left, .down-line-good-left,
27 .down-line-right, .down-line-good-right,
28 .up-header, .up-header-left, .up-line, .up-line-left,
29 .server-header, .server-header-left, .server-line, .server-line-left,
30 .shared-header, .shared-header-left, .shared-line, .shared-line-changed,
31 .shared-line-left, .shared-line-left-changed,
32 .header, .smallheader, .commontext,
33 .upqueue-header, .upqueue-line, .upqueue-line-left,
34 .websearch-header, .websearch-line, .addserver-header, .addserver-line {
36 font-family : Tahoma;
37 font-size : 8pt;
40 .tabs {
41 font-family : Tahoma;
42 font-size : 10pt;
43 background-color : #1F76A5;
46 .tabs_too {
47 font-family : Tahoma;
48 font-size : 10pt;
49 background-color : #0075B3;
52 .tabs_three {
53 font-family : Tahoma;
54 font-size : 10pt;
57 .tabs_four {
58 font-family : Tahoma;
59 font-size : 10pt;
60 background-color : #21719B;
63 .tabs_five {
64 font-family : Tahoma;
65 font-size : 10pt;
66 background-color : #1D6083;
69 .down-header, .down-line, .down-line-good, .up-header, .up-line,
70 .server-header, .server-line, .shared-header, .shared-line, .shared-line-changed,
71 .upqueue-header, .upqueue-line,
72 .websearch-header, .websearch-line, .addserver-header, .addserver-line {
74 text-align : center;
77 .down-header-left, .down-line-left, .down-line-good-left,
78 .server-header-left, .server-line-left, .shared-header-left,
79 .up-header-left, .up-line-left, .shared-line-left, .shared-line-left-changed, .upqueue-line-left {
81 text-align : left;
84 .down-line-right, .down-line-good-right, .down-header-right {
85 text-align : right;
88 .down-header, .down-header-left, .down-header-right,
89 .up-header, .up-header-left, .server-header, .server-header-left,
90 .shared-header, .shared-header-left, .upqueue-header,
91 .websearch-header, .addserver-header {
93 background-color : #1D6083;
96 .header {
97 background-color : #0046AC;
100 .smallheader {
101 background-color : #003399;
102 color : #FFFFFF;
105 .commontext {
106 background-color : #FFFFFF;
107 color : #000000;
110 .commontext_too {
111 color : #FFFFFF;
112 font-family : Tahoma;
113 font-size : 8pt;
116 .down-line, .down-line-good, .down-line-left, .down-line-good-left,
117 .down-line-right, .down-line-good-right,
118 .up-line, .up-line-left, .server-line, .server-line-left,
119 .shared-line, .shared-line-changed, .shared-line-left, .shared-line-left-changed,
120 .upqueue-line, .upqueue-line-left,
121 .websearch-line, .addserver-line {
123 background-color : #1F76A5;
126 .down-line-good, .down-line-good-left, .down-line-good-right,
127 .shared-line-changed, .shared-line-left-changed {
129 color : #F0F000;
132 .percent_table {
133 border:0px solid #000000;
134 border-collapse: collapse;
137 .message {
138 font-family : Tahoma;
139 font-size : 8pt;
140 font-weight: bold;
141 color: #FFFFFF;
142 background-color: #1D6083;
145 .dinput {
146 border-width: 1px;
147 border-color: black;
149 </style>
151 </head>
152 <body background="main_bg.gif" text=white link="#1F76A5" vlink="#1F76A5" alink="#1F76A5" marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 style="margin:0px">
153 <table border="0" width="100%" align="center" cellpadding="0" cellspacing="0">
154 <tr>
155 <td class="tabs_three" background="main_top_bg.gif" align="left" colspan="4">
157 <table border="0" cellpadding="4" cellspacing="0" width="100%">
158 <tr>
159 <td class="tabs_three" align="center" width="100">
161 &nbsp;
162 <font face="Tahoma" style="font-size:13pt;" color="#000000"><a href="http://www.amule.org" target="_blank">
163 <img src="emule.gif" alt="aMule | Web Control Panel">
164 </a>
165 </td>
166 <td class="tabs_three" align="center" width="30">
167 &nbsp;
168 </td>
169 <td align="center" class="tabs_three" width="95">
171 <a href="servers.php">
172 <img src="cp_servers.gif"><br />
173 Server list
174 </a>
175 </td>
176 <td align="center" class="tabs_three" width="96">
177 <a href="downloads.php">
178 <img src="cp_download.gif"><br />
179 Transfer
180 </a>
182 </td>
183 <td align="center" class="tabs_three" width="96">
184 <a href="search.php">
185 <img src="cp_search.gif"><br />
186 Search
187 </a>
188 </td>
189 <td align="center" class="tabs_three" width="96">
190 <a href="shared.php">
192 <img src="cp_shared.gif"><br />
193 Shared Files
194 </a>
195 <td align="center" class="tabs_three" width="110">
196 <a href="stat_tree.php">
197 <img src="cp_stats.gif"><br />
198 Statistics
199 </a>
200 <font color="#000000">|</font>
202 <a href="stat_graphs.php">
203 Graphs
204 </a>
205 </td>
206 <td align="center" class="tabs_three" width="95">
207 <a href="preferences.php">
208 <img src="cp_settings.gif"><br />
209 Preferences
210 </a>
211 </td>
213 <td class="tabs_three" align="center">
214 &nbsp;
215 </td>
216 <td align="left" class="tabs_three" width="95">
217 <img src="log.gif" align="absmiddle"> <a href="index.php?serverinfo=1">Serverinfo</a><br />
218 <img src="log.gif" align="absmiddle"> <a href="index.php?log=1">Log</a>
219 </td>
221 </tr>
222 </table>
224 </td>
225 </tr>
226 <tr>
227 <td background="main_topbar.gif" height="49" class="tabs_four">
228 &nbsp;&nbsp;<b>Connection:</b>
229 <?php
230 function CastToXBytes($size)
232 if ( $size < 1024 ) {
233 $result = $size . " bytes";
234 } elseif ( $size < 1048576 ) {
235 $result = ($size / 1024.0) . "KB";
236 } elseif ( $size < 1073741824 ) {
237 $result = ($size / 1048576.0) . "MB";
238 } else {
239 $result = ($size / 1073741824.0) . "GB";
241 return $result;
244 $stats = amule_get_stats();
245 if ( $stats["id"] == 0 ) {
246 echo "Not connected";
247 } elseif ( $stats["id"] == 0xffffffff ) {
248 echo "Connecting ...";
249 } else {
250 echo "Connected with ", (($stats["id"] < 16777216) ? "low" : "high"), " ID to ",
251 $stats["serv_name"], " ", $stats["serv_addr"];
253 echo '<br>&nbsp;&nbsp;<b>Speed:</b> Up: ', CastToXBytes($stats["speed_up"]), 'ps',
254 ' | Down: ', CastToXBytes($stats["speed_down"]), 'ps',
255 '<small> (Limits: ', CastToXBytes($stats["speed_limit_up"]), 'ps/',
256 CastToXBytes($stats["speed_limit_down"]), 'ps)</small>&nbsp;';
258 <font color="#FFE471">
259 <script language="javascript">
260 var d = new Date();
261 s = "[ " + d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear() + " " + d.getHours() + ":" + (d.getMinutes() < 10 ? "0" : "") + d.getMinutes() + ":" + (d.getSeconds() < 10 ? "0" : "") + d.getSeconds() + " ]";
262 document.write(s);
263 </script>
264 </font>
265 </td>
266 <td background="main_topbar.gif" align="center" valign="middle" class="tabs_four">
268 <a href="index.php?links=1">
269 <img src="arrow_right.gif" align="absmiddle">
270 &nbsp; ed2k:// ED2K Link(s)
271 </a>
272 </td>
273 <td background="main_topbar.gif" align="right">
275 <table border="0" cellpadding="0" cellspacing="0" width="8" height="100%">
276 <tr>
277 <td height="49" background="main_topbarseperator.gif">
279 &nbsp;
280 </td>
281 </tr>
282 </table>
284 </td>
285 <td background="main_topbardarker.gif" align="center" valign="middle" class="tabs_five">
286 <a href="login.php">
287 <img src="arrow_down_logout.gif" align="absmiddle">
288 &nbsp; Logout
289 </a>
291 </td>
292 </tr>
293 </table>
294 &nbsp;
296 <?php
297 function cat2idx($cat)
299 $cats = amule_get_categories();
300 $result = 0;
301 foreach($cats as $i => $c) {
302 if ( $cat == $c) $result = $i;
304 return $result;
307 if (($HTTP_GET_VARS['cmd'] == 'download' ) && ($_SESSION["guest_login"] == 0)) {
308 $link = $HTTP_GET_VARS['ed2klink'];
309 $target_cat_idx = cat2idx($HTTP_GET_VARS['cat']);
310 if ( strlen($link) > 0 ) {
311 amule_do_ed2k_download_cmd($link, $target_cat_idx);
315 if ( $HTTP_GET_VARS['links'] == 1) {
316 echo '
317 <table align=center border=0 cellpadding=4 cellspacing=0 width="80%">
318 <tr>
319 <td align=center class="shared-header">
320 <p><font face=Tahoma style="font-size:10pt;"><b>Download Selected</b></font></p>
321 </td>
322 </tr>
323 <tr>
324 <td align=center valign=top class=tabs>
325 <form action="/" method="GET">
326 <input type="hidden" name="cmd" value="download">
327 <font face=Tahoma style="font-size:10pt;">&nbsp;<br>ED2K Link(s)<br><br>
328 <textarea name="ed2klink" cols="94" rows="7" class=dinput></textarea>
329 <br><br>
330 <input type=submit value="Start"></font><img src="arrow_right.gif" align="absmiddle">
331 <select name="cat" size="1">';
333 $cats = amule_get_categories();
334 foreach($cats as $c) {
335 echo "<option>", $c, "</option>";
338 echo '
339 </select>
340 </form><br>
341 </td>
342 </tr>
343 </table>';
344 } elseif ( $HTTP_GET_VARS['serverinfo'] == 1 ) {
345 $strinfo = amule_get_serverinfo($HTTP_GET_VARS['rst']);
346 echo '<table border=0 align=center cellpadding=4 cellspacing=0 width="80%">
347 <tr><td align=left valign=middle class="commontext">
348 <font color="#000000" face="Lucida Console"><pre>';
349 echo $strinfo;
350 echo '</pre></font></td></tr><tr><td align=left valign=middle>
351 <form action="index.php" method="GET">
352 <input type="hidden" name=rst value=1>
353 <input type="hidden" name=serverinfo value=1>
354 <input type=submit value="Reset"></form>
355 </td></tr></table>';
356 } elseif ( $HTTP_GET_VARS['log'] == 1) {
357 $strinfo = amule_get_log($HTTP_GET_VARS['rst']);
358 echo '<table border=0 align=center cellpadding=4 cellspacing=0 width="80%">
359 <tr><td align=left valign=middle class="commontext">
360 <font color="#000000" face="Lucida Console"><pre>';
361 echo $strinfo;
362 echo '</pre></font></td></tr><tr><td align=left valign=middle>
363 <form action="index.php" method="GET">
364 <input type="hidden" name=rst value=1>
365 <input type="hidden" name=log value=1>
366 <input type=submit value="Reset"></form>
367 </td></tr></table>';
371 </body>
372 </html>