PageRenderTime 67ms CodeModel.GetById 38ms RepoModel.GetById 1ms app.codeStats 0ms

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