PageRenderTime 45ms CodeModel.GetById 2ms app.highlight 32ms RepoModel.GetById 1ms app.codeStats 1ms

/src/webserver/default/amuleweb-main-prefs.php

https://bitbucket.org/gzf/umule
PHP | 464 lines | 442 code | 15 blank | 7 comment | 38 complexity | ade491b14d543833c607046e2483fc17 MD5 | raw file
  1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2<html>
  3<head>
  4<title>aMule control panel</title>
  5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6
  7<script language="JavaScript" type="text/JavaScript">
  8<!--
  9function MM_swapImgRestore() { //v3.0
 10  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
 11}
 12
 13function MM_preloadImages() { //v3.0
 14  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
 15    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
 16    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
 17}
 18
 19function MM_findObj(n, d) { //v4.01
 20  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
 21    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
 22  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
 23  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
 24  if(!x && d.getElementById) x=d.getElementById(n); return x;
 25}
 26
 27function MM_swapImage() { //v3.0
 28  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
 29   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
 30}
 31//-->
 32</script>
 33<link href="style.css" rel="stylesheet" type="text/css"><style type="text/css">
 34<!--
 35caption {
 36	font-family: Helvetica;
 37	font-size: 18px;
 38	font-weight: bold;
 39	color: #003161;
 40}
 41th {
 42	font-family: Helvetica;
 43	font-size: 14px;
 44	font-height: 22px;
 45	font-weight: bold;
 46	color: #003161;
 47}
 48a:link {
 49	color: #003161;
 50	text-decoration: none;
 51}
 52a:active {
 53	color: #003161;
 54	text-decoration: none;
 55}
 56a:visited {
 57	color: #003161;
 58	text-decoration: none;
 59}
 60a:hover {
 61	color: #c0c0c0;
 62	text-decoration: underline;
 63}
 64td {
 65	font-family: Helvetica;
 66	font-size: 12px;
 67	font-weight: normal;
 68}
 69label {
 70	font-family: Helvetica;
 71	font-size: 14px;
 72	font-weight: bold;
 73}
 74.texte {
 75	font-family: Helvetica;
 76	font-size: 12px;
 77	font-weight: normal;
 78}
 79label {
 80font-family:"trebuchet ms",sans-serif;
 81font-size: 12px;
 82font-weight:bold
 83}
 84input {
 85border:1px solid #003161;
 86background-color:  white;
 87font-family:"trebuchet ms",sans-serif;
 88font-size: 12px;
 89color: #003161;
 90}
 91select, option {
 92background-color:  white;
 93font-size: 12px;
 94color: #003161;
 95}
 96textarea {
 97border:1px solid #003161;
 98background-color: #90B6DB;
 99font-family:"trebuchet ms",sans-serif;
100font-size: 12px;
101color: white;
102}
103-->
104</style>
105</head><script language="JavaScript" type="text/JavaScript">
106function formCommandSubmit(command)
107{
108	var frm=document.forms.mainform
109	frm.command.value=command
110	frm.submit()
111}
112
113var initvals = new Object;
114
115<?php
116	// apply new options before proceeding
117	//var_dump($HTTP_GET_VARS);
118	if ( ($HTTP_GET_VARS["Submit"] == "Apply") && ($_SESSION["guest_login"] == 0) ) {
119		$file_opts = array("check_free_space", "extract_metadata", 
120			"ich_en","aich_trust", "preview_prio","save_sources", "resume_same_cat",
121			"min_free_space", "new_files_paused", "alloc_full", "alloc_full_chunks",
122			"new_files_auto_dl_prio", "new_files_auto_ul_prio"
123		);
124		$conn_opts = array("max_line_up_cap","max_up_limit",
125			"max_line_down_cap","max_down_limit", "slot_alloc", 
126			"tcp_port","udp_dis","max_file_src","max_conn_total","autoconn_en");
127		$webserver_opts = array("use_gzip", "autorefresh_time");
128		
129		$all_opts;
130		foreach ($conn_opts as $i) {
131			$curr_value = $HTTP_GET_VARS[$i];
132			if ( $curr_value == "on") $curr_value = 1;
133			if ( $curr_value == "") $curr_value = 0;
134			
135			$all_opts["connection"][$i] = $curr_value;
136		}
137		foreach ($file_opts as $i) {
138			$curr_value = $HTTP_GET_VARS[$i];
139			if ( $curr_value == "on") $curr_value = 1;
140			if ( $curr_value == "") $curr_value = 0;
141			
142			$all_opts["files"][$i] = $curr_value;
143		}
144		foreach ($webserver_opts as $i) {
145			$curr_value = $HTTP_GET_VARS[$i];
146			if ( $curr_value == "on") $curr_value = 1;
147			if ( $curr_value == "") $curr_value = 0;
148			
149			$all_opts["webserver"][$i] = $curr_value;
150		}
151		//var_dump($all_opts);
152		amule_set_options($all_opts);
153	}
154	$opts = amule_get_options();
155	//var_dump($opts);
156	$opt_groups = array("connection", "files", "webserver");
157	//var_dump($opt_groups);
158	foreach ($opt_groups as $group) {
159		$curr_opts = $opts[$group];
160		//var_dump($curr_opts);
161		foreach ($curr_opts as $opt_name => $opt_val) {
162			echo 'initvals["', $opt_name, '"] = "', $opt_val, '";';
163		}
164	}
165?>
166
167<!-- Assign php generated data to controls -->
168function init_data()
169{
170	var frm = document.forms.mainform
171
172	var str_param_names = new Array(
173		"max_line_down_cap", "max_line_up_cap",
174		"max_up_limit", "max_down_limit", "max_file_src",
175		"slot_alloc", "max_conn_total",
176		"tcp_port", "udp_port",
177		"min_free_space",
178		"autorefresh_time"
179		)
180	for(i = 0; i < str_param_names.length; i++) {
181		frm[str_param_names[i]].value = initvals[str_param_names[i]];
182	}
183	var check_param_names = new Array(
184		"autoconn_en", "reconn_en", "udp_dis", "new_files_paused",
185		"aich_trust", "alloc_full", "alloc_full_chunks",
186		"check_free_space", "extract_metadata", "ich_en",
187		"new_files_auto_dl_prio", "new_files_auto_ul_prio",
188		"use_gzip"
189		)
190	for(i = 0; i < check_param_names.length; i++) {
191		frm[check_param_names[i]].checked = initvals[check_param_names[i]] == "1" ? true : false;
192	}
193}
194
195</script>
196<body background="images/fond.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/transf_1.png','images/shared_1.png','images/search_1.png','images/edkserv_1.png','images/sheserv_1.png','images/stats_1.png');init_data();">
197<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
198  <tr valign="top"> 
199    <td width="143" height="64"><img src="images/logo.png" width="143" height="64"></td>
200    <td width="100%" height="64" align="right" background="images/fond_haut.png"> <table border="0" cellspacing="0" cellpadding="0">
201        <tr> 
202          <td><a href="amuleweb-main-dload.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('transfert','','images/transf_1.png',1)"><img src="images/transf_0.png" alt="transfert" name="transfert" width="52" height="50" border="0"></a></td>
203          <td><a href="amuleweb-main-shared.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('shared','','images/shared_1.png',1)"><img src="images/shared_0.png" alt="shared" name="shared" width="52" height="50" border="0"></a></td>
204          <td><a href="amuleweb-main-search.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('search','','images/search_1.png',1)"><img src="images/search_0.png" alt="search" name="search" width="52" height="50" border="0"></a></td>
205          <td><a href="amuleweb-main-servers.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('edkserver','','images/edkserv_1.png',1)"><img src="images/edkserv_0.png" alt="edkserver" name="edkserver" width="52" height="50" border="0"></a></td>
206          <td><a href="amuleweb-main-kad.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('sheserv','','images/sheserv_1.png',1)"><img src="images/sheserv_0.png" alt="sheserv" name="sheserv" width="52" height="50" border="0"></a></td>
207          <td><a href="amuleweb-main-stats.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('statistiques','','images/stats_1.png',1)"><img src="images/stats_0.png" alt="statistiques" name="statistiques" width="52" height="50" border="0"></a></td>
208          <td><img src="images/col.png"></td>
209          <td width="10"></td>
210          <td width="190" align="right" class="texteinv"><a href="login.php">exit</a><br> 
211            <a href="amuleweb-main-log.php">log &bull;</a> <a href="amuleweb-main-prefs.php">configuration</a></td>
212          <td width="10"></td>
213        </tr>
214      </table></td>
215  </tr>
216  <tr align="center" valign="top"> 
217    <td colspan="2">
218        <table width="100%" border="0" cellspacing="0" cellpadding="0">
219          <caption>PREFERENCES</caption>
220          <tr> 
221            <td width="24"><img src="images/tab_top_left.png" width="24" height="24"></td>
222            <td background="images/tab_top.png">&nbsp;</td>
223            <td width="24"><img src="images/tab_top_right.png" width="24" height="24"></td>
224          </tr>
225          <tr> 
226            <td width="24" background="images/tab_left.png">&nbsp;</td>
227            
228      <td bgcolor="#FFFFFF"><form name="mainform" action="amuleweb-main-prefs.php" method="post">
229              <table border="0" align="center" cellpadding="0" cellspacing="6">
230               
231    <tr align="center" valign="top"> 
232      <td> 
233        <table width="350" border="0" align="center" cellpadding="0" cellspacing="0" >
234          <tr> 
235            <td width="22">&nbsp;</td>
236            <th>Webserver</th>
237            <td width="63">&nbsp;</td>
238          </tr>
239            <td width="22" height="25">&nbsp;</td>
240            <td height="25">Page refresh interval </td>
241            <td width="63" height="25">
242<input name="autorefresh_time" type="text" id="autorefresh_time7" size="4"></td>
243          </tr>
244          <tr> 
245            <td width="22" height="25">
246<input name="use_gzip" type="checkbox" id="use_gzip5"></td>
247            <td height="25"> Use gzip compression </td>
248            <td width="63" height="25">&nbsp;</td>
249          </tr>
250        </table></td>
251      <td width="50%"> 
252        <table width="350" border="0" align="center" cellpadding="0" cellspacing="0" >
253          <tr> 
254            <td width="22">&nbsp;</td>
255            <th>Line capacity (for statistics only)</th>
256            <td width="63">&nbsp;</td>
257          </tr>
258          <tr> 
259            <td width="22" height="25">&nbsp;</td>
260            <td height="25">Max download rate </td>
261            <td width="63" height="25">
262<input name="max_line_down_cap" type="text" id="max_line_down_cap6" size="4"></td>
263          </tr>
264          <tr> 
265            <td width="22" height="25">&nbsp;</td>
266            <td height="25">Max upload rate </td>
267            <td width="63" height="25">
268<input name="max_line_up_cap" type="text" id="max_line_up_cap7" size="4"></td>
269          </tr>
270        </table></td>
271    </tr>
272    <tr align="center" valign="top"> 
273      <td> 
274        <table width="350" border="0" align="center" cellpadding="0" cellspacing="0" >
275          <tr> 
276            <td width="22" height="19">&nbsp;</td>
277            <th>Bandwidth limits</th>
278            <td width="63">&nbsp;</td>
279          </tr>
280          <tr> 
281            <td width="22" height="25">&nbsp;</td>
282            <td height="25">Max download rate </td>
283            <td width="63" height="25">
284<input name="max_down_limit" type="text" id="max_down_limit6" size="4"></td>
285          </tr>
286          <tr> 
287            <td width="22" height="25">&nbsp;</td>
288            <td height="25">Max upload rate </td>
289            <td width="63" height="25">
290<input name="max_up_limit" type="text" id="max_up_limit6" size="4"></td>
291          </tr>
292          <tr> 
293            <td width="22" height="25">&nbsp;</td>
294            <td height="25">Slot allocation </td>
295            <td width="63" height="25">
296<input name="slot_alloc" type="text" id="slot_alloc6" size="4"></td>
297          </tr>
298        </table></td>
299      <td width="50%" rowspan="3"> 
300        <table width="350" border="0" align="center" cellpadding="0" cellspacing="0" >
301          <tr> 
302            <td width="22">&nbsp;</td>
303            <th> File settings </th>
304            <td width="63">&nbsp;</td>
305          </tr>
306          <tr> 
307            <td width="22" height="25">&nbsp;</td>
308            <td height="25">&nbsp; </td>
309            <td width="63" height="25"></td>
310          </tr>
311          <tr> 
312            <td width="22" height="25"> 
313              <input name="check_free_space" type="checkbox" id="check_free_space5"></td>
314            <td height="25"> Check free space =&gt; Minimum free space (Mb) </td>
315            <td width="63" height="25"> 
316              <input name="min_free_space" type="text" id="min_free_space4" size="4"></td>
317          </tr>
318          <tr> 
319            <td width="22" height="25"> 
320              <input name="new_files_auto_dl_prio" type="checkbox" id="new_files_auto_dl_prio4"></td>
321            <td height="25"> Added download files have auto priority</td>
322            <td width="63" height="25"></td>
323          </tr>
324          <tr> 
325            <td width="22" height="25"> 
326              <input name="new_files_auto_ul_prio" type="checkbox" id="new_files_auto_ul_prio4"></td>
327            <td height="25"> New shared files have auto priority</td>
328            <td width="63" height="25"></td>
329          </tr>
330          <tr> 
331            <td width="22" height="25"> 
332              <input name="ich_en" type="checkbox" id="ich_en5"></td>
333            <td height="25"> I.C.H. active</td>
334            <td width="63" height="25"></td>
335          </tr>
336          <tr> 
337            <td width="22" height="25"> 
338              <input name="aich_trust" type="checkbox" id="aich_trust4"></td>
339            <td height="25"> AICH trusts every hash (not recommended)</td>
340            <td width="63" height="25"></td>
341          </tr>
342          <tr> 
343            <td width="22" height="25"> 
344              <input name="alloc_full_chunks" type="checkbox" id="alloc_full_chunks4"></td>
345            <td height="25"> Alloc full chunks of .part files</td>
346            <td width="63" height="25"></td>
347          </tr>
348          <tr> 
349            <td width="22" height="25"> 
350              <input name="alloc_full" type="checkbox" id="alloc_full4"></td>
351            <td height="25"> Alloc full disk space for .part files</td>
352            <td width="63" height="25"></td>
353          </tr>
354          <tr> 
355            <td width="22" height="25"> 
356              <input name="new_files_paused" type="checkbox" id="new_files_paused4"></td>
357            <td height="25"> Add files to download queue in pause mode</td>
358            <td width="63" height="25"></td>
359          </tr>
360          <tr> 
361            <td width="22" height="25"> 
362              <input name="extract_metadata" type="checkbox" id="extract_metadata4"></td>
363            <td height="25"> Extract metadata tags </td>
364            <td width="63" height="25"></td>
365          </tr>
366        </table></td>
367    </tr>
368    <tr align="center" valign="top"> 
369      <td> 
370        <table width="350" border="0" align="center" cellpadding="0" cellspacing="0" >
371          <tr> 
372            <td width="22">&nbsp;</td>
373            <th>Connection settings</th>
374            <td width="63">&nbsp;</td>
375          </tr>
376          <tr> 
377            <td width="22" height="25">&nbsp;</td>
378            <td height="25">Max total connections (total) </td>
379            <td width="63" height="25">
380<input name="max_conn_total" type="text" id="max_conn_total8" size="4"></td>
381          </tr>
382          <tr> 
383            <td width="22" height="25">&nbsp;</td>
384            <td height="25">Max sources per file </td>
385            <td width="63" height="25">
386<input name="max_file_src" type="text" id="max_file_src7" size="4"></td>
387          </tr>
388          <tr> 
389            <td width="22" height="25">
390<input name="autoconn_en" type="checkbox" id="autoconn_en6"></td>
391            <td height="25"> Autoconnect at startup </td>
392            <td width="63" height="25">&nbsp;</td>
393          </tr>
394          <tr> 
395            <td width="22" height="25">
396<input name="reconn_en" type="checkbox" id="reconn_en6"></td>
397            <td height="25"> Reconnect when connection lost </td>
398            <td width="63" height="25">&nbsp;</td>
399          </tr>
400        </table></td>
401    </tr>
402    <tr align="center" valign="top"> 
403      <td> 
404        <table width="350" border="0" align="center" cellpadding="0" cellspacing="0" >
405          <tr> 
406            <td width="22">&nbsp;</td>
407            <th>Network settings</th>
408            <td width="63">&nbsp;</td>
409          </tr>
410          <tr> 
411            <td width="22" height="25">&nbsp;</td>
412            <td height="25">TCP port </td>
413            <td width="63" height="25">
414<input name="tcp_port" type="text" id="tcp_port6" size="4"></td>
415          </tr>
416          <tr> 
417            <td width="22" height="25">&nbsp;</td>
418            <td height="25">UDP port </td>
419            <td width="63" height="25">
420<input name="udp_port" type="text" id="udp_port6" size="4"></td>
421          </tr>
422          <tr> 
423            <td width="22" height="25">
424<input name="udp_dis" type="checkbox" id="udp_dis5"></td>
425            <td height="25"> Disable UDP connections </td>
426            <td width="63" height="25">&nbsp;</td>
427          </tr>
428        </table></td>
429    </tr>
430    <tr align="center"> 
431      <td colspan="2"> 
432        <?php
433			if ($_SESSION["guest_login"] == 0) {
434				echo '<input type="submit" name="Submit" value="Apply">';
435			} else {
436				echo "<b>&nbsp;You can not change options - logged in as guest</b>";
437			}
438		?>
439        <input name="command" type="hidden" id="command"> </td>
440    </tr>
441  </table>
442  </form></td>
443            <td width="24" background="images/tab_right.png">&nbsp;</td>
444          </tr>
445          <tr> 
446            <td width="24"><img src="images/tab_bottom_left.png" width="24" height="24"></td>
447            <td background="images/tab_bottom.png">&nbsp;</td>
448            <td width="24"><img src="images/tab_bottom_right.png" width="24" height="24"></td>
449          </tr>
450        </table></td>
451  </tr>
452  <tr valign="bottom"> 
453    <td height="25" colspan="2"> <table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
454        <tr align="center" valign="middle"> 
455          <td width="50%"> <iframe name="stats" src="footer.php" height="35" width="100%" scrolling="no" frameborder="0">edklink</iframe> 
456          </td>
457          <td width="50%"> <iframe name="stats" src="stats.php" height="35" width="100%" scrolling="no" frameborder="0">connection</iframe> 
458          </td>
459        </tr>
460      </table></td>
461  </tr>
462</table>
463</body>
464</html>