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	<?php
109		if ($_SESSION["guest_login"] != 0) {
110				echo 'alert("You logged in as guest - commands are disabled");';
111				echo "return;";
112		}
113	?>
114	var frm=document.forms.mainform
115	frm.command.value=command
116	frm.submit()
117}
118
119</script>
120<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');">
121<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
122  <tr valign="top">
123    <td width="143" height="64"><img src="images/logo.png" width="143" height="64"></td>
124    <td width="100%" height="64" align="right" background="images/fond_haut.png"> <table border="0" cellspacing="0" cellpadding="0">
125        <tr>
126          <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>
127          <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>
128          <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>
129          <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>
130          <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>
131          <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>
132          <td><img src="images/col.png"></td>
133          <td width="10"></td>
134          <td width="190" align="right" class="texteinv"><a href="login.php">exit</a><br>
135            <a href="amuleweb-main-log.php">log &bull;</a> <a href="amuleweb-main-prefs.php">configuration</a></td>
136          <td width="10"></td>
137        </tr>
138      </table></td>
139  </tr>
140  <tr align="center" valign="top">
141    <td colspan="2">
142        <table width="100%" border="0" cellspacing="0" cellpadding="0">
143          <caption>
144        SEARCH
145        </caption>
146          <tr>
147            <td width="24"><img src="images/tab_top_left.png" width="24" height="24"></td>
148            <td background="images/tab_top.png">&nbsp;</td>
149            <td width="24"><img src="images/tab_top_right.png" width="24" height="24"></td>
150          </tr>
151          <tr>
152            <td width="24" background="images/tab_left.png">&nbsp;</td>
153
154      <td bgcolor="#FFFFFF"><form name="mainform" action="amuleweb-main-search.php" method="post">
155              <table width="100%" border="0" align="center" cellpadding="4" cellspacing="0">
156                <tr align="center">
157                  <td align="center">
158<input type="hidden" name="command" value="">
159                    <input name="searchval" type="text" id="searchval4" size="60">
160                    <input name="Search" type="submit" id="Search4" value="Search" onClick="javascript:formCommandSubmit('search');"></td>
161                  <td align="right">Availability :</td>
162                  <td align="left">
163                    <input name="avail" type="text" id="avail13" size="6"></td>
164                  <td align="left">Min Size : </td>
165                  <td align="left">
166<input name="minsize" type="text" id="minsize2" size="5">
167                    <select name="minsizeu" id="select8">
168                      <option>Byte</option>
169                      <option>KByte</option>
170                      <option selected>MByte</option>
171                      <option>GByte</option>
172                    </select></td>
173                </tr>
174                <tr>
175                  <td align="center"><a href="amuleweb-main-search.php?search_sort=<?php echo($HTTP_GET_VARS["sort"]);?>">Click here to update the search results</a> </td>
176                  <td align="right">Search type :</td>
177                  <td>
178                    <select name="searchtype" id="select">
179                      <option selected>Local</option>
180                      <option>Global</option>
181                      <option>Kad</option>
182                    </select></td>
183                  <td>Max Size : </td>
184                  <td>
185<input name="maxsize" type="text" id="maxsize4" size="5">
186                    <select name="maxsizeu" id="select10">
187                      <option>Byte</option>
188                      <option>KByte</option>
189                      <option selected>MByte</option>
190                      <option>GByte</option>
191                    </select></td>
192                </tr>
193              </table>
194              <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
195                  <th>&nbsp;</th>
196                  <th><a href="amuleweb-main-search.php?sort=name">File Name</a></th>
197                  <th><a href="amuleweb-main-search.php?sort=size">Size</a></th>
198                  <th><a href="amuleweb-main-search.php?sort=sources">Sources</a></th>
199    </tr><tr><td colspan="9" height="1" bgcolor="#000000"></td></tr>
200    <?php
201		function CastToXBytes($size)
202		{
203			if ( $size < 1024 ) {
204				$result = $size . " b";
205			} elseif ( $size < 1048576 ) {
206				$result = ($size / 1024.0) . "kb";
207			} elseif ( $size < 1073741824 ) {
208				$result = ($size / 1048576.0) . "mb";
209			} else {
210				$result = ($size / 1073741824.0) . "gb";
211			}
212			return $result;
213		}
214
215		//
216		// declare it here, before any function reffered it in "global"
217		//
218		$sort_order;$sort_reverse;
219
220		function my_cmp($a, $b)
221		{
222			global $sort_order, $sort_reverse;
223
224			switch ( $sort_order) {
225				case "size": $result = $a->size > $b->size; break;
226				case "name": $result = $a->name > $b->name; break;
227				case "sources": $result = $a->sources > $b->sources; break;
228			}
229
230			if ( $sort_reverse ) {
231				$result = !$result;
232			}
233
234			return $result;
235		}
236
237		function str2mult($str)
238		{
239			$result = 1;
240			switch($str) {
241				case "Byte":	$result = 1; break;
242				case "KByte":	$result = 1024; break;
243				case "MByte":	$result = 1012*1024; break;
244				case "GByte":	$result = 1012*1024*1024; break;
245			}
246			return $result;
247		}
248
249		function cat2idx($cat)
250		{
251                	$cats = amule_get_categories();
252                	$result = 0;
253                	foreach($cats as $i => $c) {
254                		if ( $cat == $c) $result = $i;
255                	}
256            		return $result;
257		}
258
259		if ($_SESSION["guest_login"] == 0) {
260			if ( $HTTP_GET_VARS["command"] == "search") {
261				$search_type = -1;
262				switch($HTTP_GET_VARS["searchtype"]) {
263					case "Local": $search_type = 0; break;
264					case "Global": $search_type = 1; break;
265					case "Kad": $search_type = 2; break;
266				}
267				$min_size = $HTTP_GET_VARS["minsize"] == "" ? 0 : $HTTP_GET_VARS["minsize"];
268				$max_size = $HTTP_GET_VARS["maxsize"] == "" ? 0 : $HTTP_GET_VARS["maxsize"];
269
270				$min_size *= str2mult($HTTP_GET_VARS["minsizeu"]);
271				$max_size *= str2mult($HTTP_GET_VARS["maxsizeu"]);
272
273				amule_do_search_start_cmd($HTTP_GET_VARS["searchval"],
274					//$HTTP_GET_VARS["ext"], $HTTP_GET_VARS["filetype"],
275					"", "",
276					$search_type, $HTTP_GET_VARS["avail"], $min_size, $max_size);
277			} elseif ( $HTTP_GET_VARS["command"] == "download") {
278				foreach ( $HTTP_GET_VARS as $name => $val) {
279					// this is file checkboxes
280					if ( (strlen($name) == 32) and ($val == "on") ) {
281						$cat = $HTTP_GET_VARS["targetcat"];
282						$cat_idx = cat2idx($cat);
283						amule_do_search_download_cmd($name, $cat_idx);
284					}
285				}
286			} else {
287			}
288		}
289		$search = amule_load_vars("searchresult");
290
291		$sort_order = $HTTP_GET_VARS["sort"];
292
293		if ( $sort_order == "" ) {
294			$sort_order = $_SESSION["search_sort"];
295		} else {
296			if ( $_SESSION["search_sort_reverse"] == "" ) {
297				$_SESSION["search_sort_reverse"] = 0;
298			} else {
299				$_SESSION["search_sort_reverse"] = !$_SESSION["search_sort_reverse"];
300			}
301		}
302
303		$sort_reverse = $_SESSION["search_sort_reverse"];
304		if ( $sort_order != "" ) {
305			$_SESSION["search_sort"] = $sort_order;
306			usort(&$search, "my_cmp");
307		}
308
309		foreach ($search as $file) {
310			print "<tr>";
311
312			echo "<td class='texte'>", '<input type="checkbox" name="', $file->hash, '" >', "</td>";
313
314			echo "<td class='texte'>", $file->short_name, "</td>";
315
316			echo "<td class='texte' align='center'>", CastToXBytes($file->size), "</td>";
317
318			echo "<td class='texte' align='center'>", $file->sources, "</td>";
319
320			print "</tr></tr><tr><td colspan='9' height='1' bgcolor='#c0c0c0'></td></tr>";
321		}
322
323	  ?>
324    <tr align="right">
325      <td colspan="4" scope="col">
326        <input name="Download" type="submit" id="Download6" value="Download" onClick="javascript:formCommandSubmit('download');" >
327        <select name="targetcat" id="select32">
328          <?php
329                	$cats = amule_get_categories();
330                	foreach($cats as $c) {
331                		echo "<option>", $c, "</option>";
332                	}
333                ?>
334        </select></td>
335  </table>
336</form></td>
337            <td width="24" background="images/tab_right.png">&nbsp;</td>
338          </tr>
339          <tr>
340            <td width="24"><img src="images/tab_bottom_left.png" width="24" height="24"></td>
341            <td background="images/tab_bottom.png">&nbsp;</td>
342            <td width="24"><img src="images/tab_bottom_right.png" width="24" height="24"></td>
343          </tr>
344        </table></td>
345  </tr>
346  <tr valign="bottom">
347    <td height="25" colspan="2"> <table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
348        <tr align="center" valign="middle">
349          <td width="50%"> <iframe name="stats" src="footer.php" height="35" width="100%" scrolling="no" frameborder="0">edklink</iframe>
350          </td>
351          <td width="50%"> <iframe name="stats" src="stats.php" height="35" width="100%" scrolling="no" frameborder="0">connection</iframe>
352          </td>
353        </tr>
354      </table></td>
355  </tr>
356</table>
357</body>
358</html>
359