Upstream tarball 20080304
[amule.git] / src / webserver / default / preferences.php
blob223ffed783739f59e28f2f3d13258875a2db720c
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>aMule CVS - Web Control Panel</title>
8 <style type="text/css">
9 img
11 border : 0px;
13 a, a:active, a:link, a:visited
15 color: white;
17 .down-header, .down-header-left, .down-header-right,
18 .down-line, .down-line-good, .down-line-left, .down-line-good-left,
19 .down-line-right, .down-line-good-right,
20 .up-header, .up-header-left, .up-line, .up-line-left,
21 .server-header, .server-header-left, .server-line, .server-line-left,
22 .shared-header, .shared-header-left, .shared-line, .shared-line-changed,
23 .shared-line-left, .shared-line-left-changed,
24 .header, .smallheader, .commontext,
25 .upqueue-header, .upqueue-line, .upqueue-line-left,
26 .websearch-header, .websearch-line, .addserver-header, .addserver-line
28 font-family : Tahoma;
29 font-size : 8pt;
31 .tabs
33 font-family : Tahoma;
34 font-size : 10pt;
35 background-color : #3399FF;
37 .down-header, .down-line, .down-line-good, .up-header, .up-line,
38 .server-header, .server-line, .shared-header, .shared-line, .shared-line-changed,
39 .upqueue-header, .upqueue-line,
40 .websearch-header, .websearch-line, .addserver-header, .addserver-line
42 text-align : center;
44 .down-header-left, .down-line-left, .down-line-good-left,
45 .server-header-left, .server-line-left, .shared-header-left,
46 .up-header-left, .up-line-left, .shared-line-left, .shared-line-left-changed, .upqueue-line-left
48 text-align : left;
50 .down-line-right, .down-line-good-right, .down-header-right
52 text-align : right;
54 .down-header, .down-header-left, .down-header-right,
55 .up-header, .up-header-left, .server-header, .server-header-left,
56 .shared-header, .shared-header-left, .upqueue-header,
57 .websearch-header, .addserver-header
59 background-color : #0066CC;
61 .header
63 background-color : #0046AC;
65 .smallheader
67 background-color : #003399;
68 color : #FFFFFF;
70 .commontext
72 background-color : #FFFFFF;
73 color : #000000;
75 .down-line, .down-line-good, .down-line-left, .down-line-good-left,
76 .down-line-right, .down-line-good-right,
77 .up-line, .up-line-left, .server-line, .server-line-left,
78 .shared-line, .shared-line-changed, .shared-line-left, .shared-line-left-changed,
79 .upqueue-line, .upqueue-line-left,
80 .websearch-line, .addserver-line
82 background-color : #3399FF;
84 .down-line-good, .down-line-good-left, .down-line-good-right, .shared-line-changed, .shared-line-left-changed
86 color : #F0F000;
88 .percent_table
90 border:0px solid #000000;
91 border-collapse: collapse;
93 .message
95 font-size: 10pt;
96 font-weight: bold;
97 color: #FF0000;
99 .dinput
101 border-width: 1px;
102 border-color: black;
104 </style>
105 </head>
107 <script language="JavaScript" type="text/JavaScript">
109 var initvals = new Object;
111 <?php
112 // apply new options before proceeding
113 //var_dump($HTTP_GET_VARS);
114 if ( ($HTTP_GET_VARS["cmd"] == "apply") && ($_SESSION["guest_login"] == 0) ) {
115 $file_opts = array(
116 "upload_full_chunks", "first_last_chunks_prio"
118 $conn_opts = array("max_line_up_cap","max_up_limit",
119 "max_line_down_cap","max_down_limit",
120 "max_file_src","max_conn_total");
121 $webserver_opts = array("use_gzip", "autorefresh_time");
123 $all_opts;
124 foreach ($conn_opts as $i) {
125 $curr_value = $HTTP_GET_VARS[$i];
126 if ( $curr_value == "on") $curr_value = 1;
127 if ( $curr_value == "") $curr_value = 0;
129 $all_opts["connection"][$i] = $curr_value;
131 foreach ($file_opts as $i) {
132 $curr_value = $HTTP_GET_VARS[$i];
133 if ( $curr_value == "on") $curr_value = 1;
134 if ( $curr_value == "") $curr_value = 0;
136 $all_opts["files"][$i] = $curr_value;
138 foreach ($webserver_opts as $i) {
139 $curr_value = $HTTP_GET_VARS[$i];
140 if ( $curr_value == "on") $curr_value = 1;
141 if ( $curr_value == "") $curr_value = 0;
143 $all_opts["webserver"][$i] = $curr_value;
145 //var_dump($all_opts);
146 amule_set_options($all_opts);
149 $opts = amule_get_options();
150 //var_dump($opts);
151 $opt_groups = array("connection", "files", "webserver", "coretweaks");
152 //var_dump($opt_groups);
153 foreach ($opt_groups as $group) {
154 $curr_opts = $opts[$group];
155 //var_dump($curr_opts);
156 foreach ($curr_opts as $opt_name => $opt_val) {
157 echo 'initvals["', $opt_name, '"] = "', $opt_val, '";', "\n";
162 function init_data()
164 var frm = document.forms.mainform
166 var str_param_names = new Array(
167 "max_line_down_cap", "max_line_up_cap",
168 "max_up_limit", "max_down_limit", "max_file_src",
169 "max_conn_total",
170 "autorefresh_time"
172 for(i = 0; i < str_param_names.length; i++) {
173 frm[str_param_names[i]].value = initvals[str_param_names[i]];
175 var check_param_names = new Array(
176 "use_gzip", "upload_full_chunks", "first_last_chunks_prio"
178 for(i = 0; i < check_param_names.length; i++) {
179 frm[check_param_names[i]].checked = initvals[check_param_names[i]] == "1" ? true : false;
184 </script>
186 <body onload="init_data();" bgcolor="#FBDE9C" text=white link="#3399FF" vlink="#3399FF" alink="#3399FF" marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 style="margin:0px">
187 <table border=0 width="100%" align=center cellpadding=4 cellspacing=0>
188 <tr>
189 <td class="tabs" align="left" colspan="2">
191 <table border="0" cellpadding="4" cellspacing="0">
192 <tr>
193 <td class="tabs" align="center">
194 &nbsp;<a href="http://www.amule.org" target="_blank"><img src="emule.gif"></a>
195 <font face="Tahoma" style="font-size:13pt;" color="#000000">aMule<br>Web Control Panel</font>
196 </td>
197 <td class="tabs" align="center" width="30">&nbsp; </td>
199 <td align="center" class="tabs" width="95">
200 <a href="servers.php">
201 <img src="cp_servers.gif"><br>
202 Server list
203 </a>
204 </td>
205 <td align="center" class="tabs" width="95">
206 <a href="downloads.php">
207 <img src="cp_download.gif"><br>
209 Transfer
210 </a>
211 </td>
212 <td align="center" class="tabs" width="95">
213 <a href="search.php">
214 <img src="cp_search.gif"><br>
215 Search
216 </a>
217 </td>
218 <td align="center" class="tabs" width="95">
220 <a href="shared.php">
221 <img src="cp_shared.gif"><br>
222 Shared Files
223 </a>
224 <td align="center" class="tabs" width="110">
225 <a href="stat_tree.php">
226 <img src="cp_stats.gif"><br>
227 Statistics</a>
228 <font color="#000000">|</font>
230 <a href="stat_graphs.php">Graphs</a>
231 </td>
232 </td>
233 <td align="center" class="tabs" width="95">
234 <a href="preferences.php">
235 <img src="cp_settings.gif"><br>
236 Preferences
237 </a>
238 </td>
240 <td class="tabs" align="center" width="30">&nbsp;</td>
241 <td align="left" class="tabs" width="95">
242 <img src="log.gif"> <a href="index.php?serverinfo=1">Serverinfo</a><br>
243 <img src="log.gif"> <a href="index.php?log=1">Log</a>
244 </td>
245 </tr>
246 </table>
248 </td>
249 </tr>
250 <tr>
251 <td style="background-color: #000000; height: 1px" colspan="2">
252 </td>
253 </tr>
254 <tr>
255 <td class="tabs">
256 &nbsp;&nbsp;<b>Connection:</b>
257 <?php
258 function CastToXBytes($size)
260 if ( $size < 1024 ) {
261 $result = $size . " bytes";
262 } elseif ( $size < 1048576 ) {
263 $result = ($size / 1024.0) . "KB";
264 } elseif ( $size < 1073741824 ) {
265 $result = ($size / 1048576.0) . "MB";
266 } else {
267 $result = ($size / 1073741824.0) . "GB";
269 return $result;
272 $stats = amule_get_stats();
273 if ( $stats["kad_connected"] == 1 ) {
274 echo "Connected";
275 if ( $stats["kad_firewalled"] == 1 ) {
276 echo " to KAD (firewalled), ";
277 } else {
278 echo " to KAD, ";
280 } else {
281 echo "Not connected to KAD, ";
283 if ( $stats["id"] == 0 ) {
284 echo "not connected to ED2K";
285 } elseif ( $stats["id"] == 0xffffffff ) {
286 echo "connecting to ED2k";
287 } else {
288 echo "connected with ", (($stats["id"] < 16777216) ? "low" : "high"), " ID to ",
289 $stats["serv_name"], " ", $stats["serv_addr"];
291 echo '<br>&nbsp;&nbsp;<b>Speed:</b> Up: ', CastToXBytes($stats["speed_up"]), 'ps',
292 ' | Down: ', CastToXBytes($stats["speed_down"]), 'ps',
293 '<small> (Limits: ', CastToXBytes($stats["speed_limit_up"]), 'ps/',
294 CastToXBytes($stats["speed_limit_down"]), 'ps)</small>&nbsp;';
297 <font color=black>
299 <script type="text/javascript" language="javascript">
300 var d = new Date();
301 s = "[ " + d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear() + " " + d.getHours() + ":" + (d.getMinutes() < 10 ? "0" : "") + d.getMinutes() + ":" + (d.getSeconds() < 10 ? "0" : "") + d.getSeconds() + " ]";
302 document.write(s);
303 </script>
304 </font>
305 </td>
306 <td align=right class=tabs>
307 <form>
308 <input type="button" value="ed2k://Download" onClick='self.location.href="index.php?links=1"'>
309 <input type="button" value="Logout" onClick='self.location.href="login.php"'>
310 </form>
311 </td>
312 </tr>
313 </table>
315 &nbsp;
317 <form name="mainform" action="preferences.php" method="post">
319 <input type="hidden" name="cmd" value="apply">
320 <table border=0 align=center cellpadding=4 cellspacing=0 width="90%">
321 <tr><td><font face=Tahoma style="font-size:10pt;" color=black>Web Control Panel</font></td></tr>
322 <tr>
323 <td align=left valign=middle bgcolor="#0066CC">
324 <font face=Tahoma style="font-size:8pt;"><b>Gzip Compression</b></font>
325 <input type="checkbox" name="use_gzip" id="use_gzip">
326 </td>
327 </tr>
328 <tr>
329 <td align=left valign=top bgcolor="#3399FF">
330 <font face=Tahoma style="font-size:8pt;">
331 &nbsp;&nbsp;&nbsp;&nbsp;Save traffic, especially in graphs.
332 </font>
334 <br>
335 </td></tr>
337 <tr>
338 <td align=left valign=middle bgcolor="#0066CC">
339 <font face=Tahoma style="font-size:8pt;"><b>Refresh-Time of Pages</b></font>
340 </td>
341 </tr>
342 <tr>
343 <td align=left valign=top bgcolor="#3399FF">
344 <font face=Tahoma style="font-size:8pt;">
345 &nbsp;&nbsp;&nbsp;&nbsp;Time in seconds (zero=disabled): <input type="text" name="autorefresh_time" id="autorefresh_time" size="5" class=dinput><br>
346 </font>
347 </td>
348 </tr>
351 <tr><td><br><font face=Tahoma style="font-size:10pt;" color=black>aMule</font></td></tr>
352 <tr>
353 <td align=left valign=middle bgcolor="#0066CC">
354 <font face=Tahoma style="font-size:8pt;"><b>Speed Limits</b></font>
355 </td>
356 </tr>
357 <tr>
359 <td align=left valign=top bgcolor="#3399FF">
360 <font face=Tahoma style="font-size:8pt;">
361 &nbsp;&nbsp;&nbsp;&nbsp;Download: <input type="text" name="max_down_limit" id="max_down_limit" size="5" class=dinput> kB/s
362 &nbsp;&nbsp;Upload: <input type="text" name="max_up_limit" id="max_up_limit" size="5" class=dinput> kB/s
363 </font>
364 </td>
365 </tr>
367 <tr>
368 <td align=left valign=middle bgcolor="#0066CC">
369 <font face=Tahoma style="font-size:8pt;"><b>Bandwidth Limits</b></font>
370 </td>
372 </tr>
373 <tr>
374 <td align=left valign=top bgcolor="#3399FF">
375 <font face=Tahoma style="font-size:8pt;">
376 &nbsp;&nbsp;&nbsp;&nbsp;Download: <input type="text" name="max_line_down_cap" id="max_line_down_cap" size="5" class=dinput> kB/s
377 &nbsp;&nbsp;Upload: <input type="text" name="max_line_up_cap" id="max_line_up_cap" size="5" class=dinput> kB/s
378 </font>
379 </td>
380 </tr>
382 <tr>
383 <td align=left valign=middle bgcolor="#0066CC">
384 <font face=Tahoma style="font-size:8pt;"><b>Connection Limits</b></font>
386 </td>
387 </tr>
388 <tr>
389 <td align=left valign=top bgcolor="#3399FF">
390 <table border=0>
391 <tr><td><font face=Tahoma style="font-size:8pt;">Max Sources Per File:</font></td><td>
392 <input type="text" name="max_file_src" id="max_file_src" size="5" class=dinput value="300"></td></tr>
393 <tr><td><font face=Tahoma style="font-size:8pt;">Max. Connections:</font></td><td>
394 <input type="text" name="max_conn_total" id="max_conn_total" size="5" class=dinput value="499"></td></tr>
395 <tr><td><font face=Tahoma style="font-size:8pt;">Max. new connections / 5secs:</font></td><td>
396 <input type="text" name="max_conn_5sec" id="max_conn_5sec" size="5" class=dinput value="20"></td></tr>
397 </table>
398 </td>
399 </tr>
401 <tr>
402 <td align=left valign=middle bgcolor="#0066CC">
404 <font face=Tahoma style="font-size:8pt;"><b>File Settings</b></font>
405 </td>
406 </tr>
407 <tr>
408 <td align=left valign=top bgcolor="#3399FF">
409 <table border=0>
410 <tr><td><font face=Tahoma style="font-size:8pt;">Try to transfer full chunks to all uploads</font></td><td>
411 <input type="checkbox" name="upload_full_chunks" id="upload_full_chunks"></td></tr>
412 <tr><td><font face=Tahoma style="font-size:8pt;">Try to download first and last chunks first</font></td><td>
413 <input type="checkbox" name="first_last_chunks_prio" id="first_last_chunks_prio"></td></tr>
414 </table>
415 </td>
416 </tr>
418 <tr>
419 <td align=center><br><input type=submit value="Apply"></td>
421 </tr>
423 </table>
424 </form>
426 </body>
427 </html>