Upstream tarball 20080304
[amule.git] / src / webserver / chicane / preferences.php
blobdbd1e8c720eab49635d5d613685afd72569627ac
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 <?php
7 echo "<title>aMule " , amule_get_version(), " - Web Control Panel</title>";
8 ?>
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 <script language="JavaScript" type="text/JavaScript">
153 var initvals = new Object;
155 <?php
156 // apply new options before proceeding
157 //var_dump($HTTP_GET_VARS);
158 if ( ($HTTP_GET_VARS["cmd"] == "apply") && ($_SESSION["guest_login"] == 0) ) {
159 $file_opts = array(
160 "upload_full_chunks", "first_last_chunks_prio"
162 $conn_opts = array("max_line_up_cap","max_up_limit",
163 "max_line_down_cap","max_down_limit",
164 "max_file_src","max_conn_total");
165 $webserver_opts = array("use_gzip", "autorefresh_time");
167 $all_opts;
168 foreach ($conn_opts as $i) {
169 $curr_value = $HTTP_GET_VARS[$i];
170 if ( $curr_value == "on") $curr_value = 1;
171 if ( $curr_value == "") $curr_value = 0;
173 $all_opts["connection"][$i] = $curr_value;
175 foreach ($file_opts as $i) {
176 $curr_value = $HTTP_GET_VARS[$i];
177 if ( $curr_value == "on") $curr_value = 1;
178 if ( $curr_value == "") $curr_value = 0;
180 $all_opts["files"][$i] = $curr_value;
182 foreach ($webserver_opts as $i) {
183 $curr_value = $HTTP_GET_VARS[$i];
184 if ( $curr_value == "on") $curr_value = 1;
185 if ( $curr_value == "") $curr_value = 0;
187 $all_opts["webserver"][$i] = $curr_value;
189 //var_dump($all_opts);
190 amule_set_options($all_opts);
193 $opts = amule_get_options();
194 //var_dump($opts);
195 $opt_groups = array("connection", "files", "webserver", "coretweaks");
196 //var_dump($opt_groups);
197 foreach ($opt_groups as $group) {
198 $curr_opts = $opts[$group];
199 //var_dump($curr_opts);
200 foreach ($curr_opts as $opt_name => $opt_val) {
201 echo 'initvals["', $opt_name, '"] = "', $opt_val, '";', "\n";
206 function init_data()
208 var frm = document.forms.mainform
210 var str_param_names = new Array(
211 "max_line_down_cap", "max_line_up_cap",
212 "max_up_limit", "max_down_limit", "max_file_src",
213 "max_conn_total",
214 "autorefresh_time"
216 for(i = 0; i < str_param_names.length; i++) {
217 frm[str_param_names[i]].value = initvals[str_param_names[i]];
219 var check_param_names = new Array(
220 "use_gzip", "upload_full_chunks", "first_last_chunks_prio"
222 for(i = 0; i < check_param_names.length; i++) {
223 frm[check_param_names[i]].checked = initvals[check_param_names[i]] == "1" ? true : false;
228 </script>
230 </head>
231 <body onload="init_data();" background="main_bg.gif" text=white link="#1F76A5" vlink="#1F76A5" alink="#1F76A5" marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 style="margin:0px">
232 <table border="0" width="100%" align="center" cellpadding="0" cellspacing="0">
233 <tr>
234 <td class="tabs_three" background="main_top_bg.gif" align="left" colspan="4">
236 <table border="0" cellpadding="4" cellspacing="0" width="100%">
237 <tr>
238 <td class="tabs_three" align="center" width="100">
240 &nbsp;
241 <font face="Tahoma" style="font-size:13pt;" color="#000000"><a href="http://www.amule.org" target="_blank">
242 <img src="emule.gif" alt="aMule | Web Control Panel">
243 </a>
244 </td>
245 <td class="tabs_three" align="center" width="30">
246 &nbsp;
247 </td>
248 <td align="center" class="tabs_three" width="95">
250 <a href="servers.php">
251 <img src="cp_servers.gif"><br />
252 Server list
253 </a>
254 </td>
255 <td align="center" class="tabs_three" width="96">
256 <a href="downloads.php">
257 <img src="cp_download.gif"><br />
258 Transfer
259 </a>
261 </td>
262 <td align="center" class="tabs_three" width="96">
263 <a href="search.php">
264 <img src="cp_search.gif"><br />
265 Search
266 </a>
267 </td>
268 <td align="center" class="tabs_three" width="96">
269 <a href="shared.php">
271 <img src="cp_shared.gif"><br />
272 Shared Files
273 </a>
274 <td align="center" class="tabs_three" width="110">
275 <a href="stat_tree.php">
276 <img src="cp_stats.gif"><br />
277 Statistics
278 </a>
279 <font color="#000000">|</font>
281 <a href="stat_graphs.php">
282 Graphs
283 </a>
284 </td>
285 <td align="center" class="tabs_three" width="95">
286 <a href="preferences.php">
287 <img src="cp_settings.gif"><br />
288 Preferences
289 </a>
290 </td>
292 <td class="tabs_three" align="center">
293 &nbsp;
294 </td>
295 <td align="left" class="tabs_three" width="95">
296 <img src="log.gif" align="absmiddle"> <a href="index.php?serverinfo=1">Serverinfo</a><br />
297 <img src="log.gif" align="absmiddle"> <a href="index.php?log=1">Log</a>
298 </td>
300 </tr>
301 </table>
303 </td>
304 </tr>
305 <tr>
306 <td background="main_topbar.gif" height="49" class="tabs_four">
307 &nbsp;&nbsp;<b>Connection:</b>
308 <?php
309 function CastToXBytes($size)
311 if ( $size < 1024 ) {
312 $result = $size . " bytes";
313 } elseif ( $size < 1048576 ) {
314 $result = ($size / 1024.0) . "KB";
315 } elseif ( $size < 1073741824 ) {
316 $result = ($size / 1048576.0) . "MB";
317 } else {
318 $result = ($size / 1073741824.0) . "GB";
320 return $result;
323 $stats = amule_get_stats();
324 if ( $stats["id"] == 0 ) {
325 echo "Not connected";
326 } elseif ( $stats["id"] == 0xffffffff ) {
327 echo "Connecting ...";
328 } else {
329 echo "Connected with ", (($stats["id"] < 16777216) ? "low" : "high"), " ID to ",
330 $stats["serv_name"], " ", $stats["serv_addr"];
332 echo '<br>&nbsp;&nbsp;<b>Speed:</b> Up: ', CastToXBytes($stats["speed_up"]), 'ps',
333 ' | Down: ', CastToXBytes($stats["speed_down"]), 'ps',
334 '<small> (Limits: ', CastToXBytes($stats["speed_limit_up"]), 'ps/',
335 CastToXBytes($stats["speed_limit_down"]), 'ps)</small>&nbsp;';
337 <font color="#FFE471">
338 <script language="javascript">
339 var d = new Date();
340 s = "[ " + d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear() + " " + d.getHours() + ":" + (d.getMinutes() < 10 ? "0" : "") + d.getMinutes() + ":" + (d.getSeconds() < 10 ? "0" : "") + d.getSeconds() + " ]";
341 document.write(s);
342 </script>
343 </font>
344 </td>
345 <td background="main_topbar.gif" align="center" valign="middle" class="tabs_four">
347 <a href="index.php?links=1">
348 <img src="arrow_right.gif" align="absmiddle">
349 &nbsp; ed2k:// ED2K Link(s)
350 </a>
351 </td>
352 <td background="main_topbar.gif" align="right">
354 <table border="0" cellpadding="0" cellspacing="0" width="8" height="100%">
355 <tr>
356 <td height="49" background="main_topbarseperator.gif">
358 &nbsp;
359 </td>
360 </tr>
361 </table>
363 </td>
364 <td background="main_topbardarker.gif" align="center" valign="middle" class="tabs_five">
365 <a href="login.php">
366 <img src="arrow_down_logout.gif" align="absmiddle">
367 &nbsp; Logout
368 </a>
370 </td>
371 </tr>
372 </table>
373 &nbsp;
375 <form name="mainform" action="preferences.php" method="post">
377 <input type="hidden" name="cmd" value="apply">
378 <table border=0 align=center cellpadding=4 cellspacing=0 width="90%">
379 <tr><td><font face=Tahoma style="font-size:10pt;" color=black>Web Control Panel</font></td></tr>
380 <tr>
381 <td align=left valign=middle bgcolor="#0066CC">
382 <font face=Tahoma style="font-size:8pt;"><b>Gzip Compression</b></font>
383 <input type="checkbox" name="use_gzip" id="use_gzip">
384 </td>
385 </tr>
386 <tr>
387 <td align=left valign=top bgcolor="#3399FF">
388 <font face=Tahoma style="font-size:8pt;">
389 &nbsp;&nbsp;&nbsp;&nbsp;Save traffic, especially in graphs.
390 </font>
392 <br>
393 </td></tr>
395 <tr>
396 <td align=left valign=middle bgcolor="#0066CC">
397 <font face=Tahoma style="font-size:8pt;"><b>Refresh-Time of Pages</b></font>
398 </td>
399 </tr>
400 <tr>
401 <td align=left valign=top bgcolor="#3399FF">
402 <font face=Tahoma style="font-size:8pt;">
403 &nbsp;&nbsp;&nbsp;&nbsp;Time in seconds (zero=disabled): <input type="text" name="autorefresh_time" id="autorefresh_time" size="5" class=dinput><br>
404 </font>
405 </td>
406 </tr>
409 <tr><td><br><font face=Tahoma style="font-size:10pt;" color=black>aMule</font></td></tr>
410 <tr>
411 <td align=left valign=middle bgcolor="#0066CC">
412 <font face=Tahoma style="font-size:8pt;"><b>Speed Limits</b></font>
413 </td>
414 </tr>
415 <tr>
417 <td align=left valign=top bgcolor="#3399FF">
418 <font face=Tahoma style="font-size:8pt;">
419 &nbsp;&nbsp;&nbsp;&nbsp;Download: <input type="text" name="max_down_limit" id="max_down_limit" size="5" class=dinput> kB/s
420 &nbsp;&nbsp;Upload: <input type="text" name="max_up_limit" id="max_up_limit" size="5" class=dinput> kB/s
421 </font>
422 </td>
423 </tr>
425 <tr>
426 <td align=left valign=middle bgcolor="#0066CC">
427 <font face=Tahoma style="font-size:8pt;"><b>Bandwidth Limits</b></font>
428 </td>
430 </tr>
431 <tr>
432 <td align=left valign=top bgcolor="#3399FF">
433 <font face=Tahoma style="font-size:8pt;">
434 &nbsp;&nbsp;&nbsp;&nbsp;Download: <input type="text" name="max_line_down_cap" id="max_line_down_cap" size="5" class=dinput> kB/s
435 &nbsp;&nbsp;Upload: <input type="text" name="max_line_up_cap" id="max_line_up_cap" size="5" class=dinput> kB/s
436 </font>
437 </td>
438 </tr>
440 <tr>
441 <td align=left valign=middle bgcolor="#0066CC">
442 <font face=Tahoma style="font-size:8pt;"><b>Connection Limits</b></font>
444 </td>
445 </tr>
446 <tr>
447 <td align=left valign=top bgcolor="#3399FF">
448 <table border=0>
449 <tr><td><font face=Tahoma style="font-size:8pt;">Max Sources Per File:</font></td><td>
450 <input type="text" name="max_file_src" id="max_file_src" size="5" class=dinput value="300"></td></tr>
451 <tr><td><font face=Tahoma style="font-size:8pt;">Max. Connections:</font></td><td>
452 <input type="text" name="max_conn_total" id="max_conn_total" size="5" class=dinput value="499"></td></tr>
453 <tr><td><font face=Tahoma style="font-size:8pt;">Max. new connections / 5secs:</font></td><td>
454 <input type="text" name="max_conn_5sec" id="max_conn_5sec" size="5" class=dinput value="20"></td></tr>
455 </table>
456 </td>
457 </tr>
459 <tr>
460 <td align=left valign=middle bgcolor="#0066CC">
462 <font face=Tahoma style="font-size:8pt;"><b>File Settings</b></font>
463 </td>
464 </tr>
465 <tr>
466 <td align=left valign=top bgcolor="#3399FF">
467 <table border=0>
468 <tr><td><font face=Tahoma style="font-size:8pt;">Try to transfer full chunks to all uploads</font></td><td>
469 <input type="checkbox" name="upload_full_chunks" id="upload_full_chunks"></td></tr>
470 <tr><td><font face=Tahoma style="font-size:8pt;">Try to download first and last chunks first</font></td><td>
471 <input type="checkbox" name="first_last_chunks_prio" id="first_last_chunks_prio"></td></tr>
472 </table>
473 </td>
474 </tr>
476 <tr>
477 <td align=center><br><input type=submit value="Apply"></td>
479 </tr>
481 </table>
482 </form>
484 </body>
485 </html>