<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<script language="JavaScript">
function check() {
if (document.search.word.value == "") {
alert('<?php echo $LNG[11]?>');
return false;
};
};
function rowover(aaa) {
var cc;
if(aaa){
cc="row2"
}
else
{
cc="row1"
}
return cc;
}
</script>
<?php
require_once("./config.php");
require_once("./conect_db.php");
require_once("./function.php");
// Init values
$PHP_SELF = $_SERVER[PHP_SELF];
$lng = $_REQUEST[lng];
$word = $_REQUEST[word];
$offset = intval($_REQUEST[of]);
if (empty($offset)) $offset = 0;
$typs= $_REQUEST[typs];
$showfile=intval( $_REQUEST[showfile]);
$golemt=$_REQUEST[gts];
$golemv=$_REQUEST[gv];
$golemp=$_REQUEST[gp];
$word=decodtrance_uri($word);
//echo 'show='.$showfile.'typs='.$typs;
//echo $typs;
if (!empty($lng) && file_exists("./lang/lng_$lng.php") ) {
require_once("./lang/lng_$lng.php");
}
else {
$lng = $DEFAULT_LNG;
require_once("./lang/lng_$lng.php");
};
?>
<title><?php echo $LNG[0] ?></title>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link rel="stylesheet" href="./skin/<? echo $skin; ?>/fs.css" type="text/css">
<script language="JavaScript">
var isIE = document.all?true:false;
var isNS = document.layers?true:false;
function check() {
if (document.search.word.value == "") {
alert('<?php echo $LNG[11]?>');
return false;
};
};
function checkgts() {
if (document.search.gts.value == "") {
alert('<?php echo $LNG[11]?>');
return false;
};
};
function onlyDigits(e,decReq) {
var key = (isIE) ? window.event.keyCode : e.which;
var obj = (isIE) ? event.srcElement : e.target;
var isNum = (key > 47 && key < 58) ? true:false;
var dotOK = (key==46 && decReq=='decOK' && (obj.value.indexOf(".")<0 || obj.value.length==0)) ? true:false;
window.event.keyCode = (!isNum && !dotOK && isIE) ? 0:key;
e.which = (!isNum && !dotOK && isNS) ? 0:key;
return (isNum || dotOK);
}
function startpos(typss,showfilee,sortt,tss,gts,gv,gp) {
var indd=0,fi=0,s=0,t=0,gg=0,ggg=0;
//alert('<?php echo $typs ?>');
//alert(gts);
//alert(showfilee);
document.search.gts.value=gts;
//alert(gp);
if ( gv == "nula"){ gg= 0 ; }
if ( gv == "kb"){ gg= 1 ; }
if ( gv == "mb"){ gg= 2 ; }
document.search.gv.selectedIndex=gg;
if ( gp == "nula"){ ggg= 0 ; }
if ( gp == "hi"){ ggg= 1 ; }
if ( gp == "lo"){ ggg= 2 ; }
document.search.gp.selectedIndex=ggg;
if ( typss == "all"){ indd= 0 ; }
if ( typss == "sound"){ indd= 1 ; }
if ( typss == "movie"){ indd= 2 ; }
if ( typss == "subtit"){ indd= 3 ; }
if ( typss == "image"){ indd= 4 ; }
if ( typss == "cd"){ indd= 5 ; }
if ( typss == "compressed"){ indd= 6 ; }
if ( typss == "doc"){ indd= 7 ; }
//document.search.word..value="sssssss";
document.search.typefile.selectedIndex = indd ;
if ( showfilee == '<?php echo $rezpp[0] ?>' ){ fi= 0 ; }
if ( showfilee == '<?php echo $rezpp[1] ?>'){ fi= 1 ; }
if ( showfilee == '<?php echo $rezpp[2] ?>'){ fi= 2 ; }
if ( showfilee == '<?php echo $rezpp[3] ?>'){ fi= 3 ; }
document.search.sshowfile.selectedIndex = fi ;
if ( sortt == "n"){ s= 0 ; }
if ( sortt == "g"){ s= 1 ; }
if ( sortt == "d"){ s= 2 ; }
if ( sortt == "s"){ s= 3 ; }
document.search.sorted.selectedIndex = s;
if ( tss == "n"){ t= 0 ; }
if ( tss == "v"){ t= 1 ; }
document.search.tip.selectedIndex = t;
//document.write('as');
//alert('<?php echo $LNG[11]?>');
//return false;
//<?php echo 'document.search.typefile.options[document.search.typefile.selectedIndex].value' ?>
return true;
};
function onsub() {
var indd,fi;
/* <?php $typs= $_POST['typefile']; ?>;
<?php $showfile= $_POST['$showfile']; ?>;
if ( '<?php echo $typs ?>' == "all"){ indd= 0 ; }
if ( '<?php echo $typs ?>' == "sound"){ indd= 1 ; }
if ( '<?php echo $typs ?>' == "movie"){ indd= 2 ; }
if ( '<?php echo $typs ?>' == "subtit"){ indd= 3 ; }
if ( '<?php echo $typs ?>' == "image"){ indd= 4 ; }
document.search.typefile.selectedIndex = indd ;
if ( '<?php echo $showfile ?>' == "20"){ fi= 0 ; }
if ( '<?php echo $showfile ?>' == "40"){ fi= 1 ; }
if ( '<?php echo $showfile ?>' == "60"){ fi= 2 ; }
document.search.sshowfile.selectedIndex = fi ;
*/
return true;
//document.search.typefile.options[document.search.typefile.selectedIndex].value
};
</script>
<body>
<form name="search" method="post" action="<?php echo $PHP_SELF?>" OnSubmit=" return check() ">
<? require_once("./skin/$skin/index.php"); ?>
<?php
$starttime = microtime();
// MAIN PROGRAM
//if (empty($typs)) {$typs= $_POST['typefile']; }
$tty=$typs;
//if (empty($showfile)) {$showfile= $_POST['sshowfile']; }
//$NUM_SHOW_FILES =20;//$showfile;
$typs= $_REQUEST[typs];
if ($typs=='') {$typs= $_POST['typefile']; if ($typs==''){ $typs='all';} }
$showfile=intval( $_REQUEST[showfile]);
if ($showfile==0) {$showfile= intval($_POST['sshowfile']); if (empty($showfile)) {$showfile=$rezpp[0];}}
$sor=$_REQUEST[sor];
if ($sor=='') {$sor= $_POST['sorted']; if ($sor==''){ $sor='n';} }
$ts=$_REQUEST[ts];
if ($ts=='') {$ts= $_POST['tip']; if ($ts==''){ $ts='v';} }
$golemt=$_REQUEST[gts];
if ($golemt=='') {$golemt= $_POST['gts']; }
$golemv=$_REQUEST[gv];
if ($golemv=='') {$golemv= $_POST['gv']; }
$golemp=$_REQUEST[gp];
if ($golemp=='') {$golemp= $_POST['gp']; }
//$golemt= $_POST['gts'];
echo ' <script language="JavaScript"> startpos("'.$typs.'" , "'.$showfile.'","'.$sor.'","'.$ts.'","'.$golemt.'","'.$golemv.'","'.$golemp.'"); </script>';
//echo 'sorr='.$sor.' ts='.$ts;
//echo 'show='.$showfile.'typs='.$typs;
//echo "gt=".$golemt." gv=".$golemv." gp=".$golemp;
$NUM_SHOW_FILES = $showfile;
$orgWord = $word;
$word = checkWords($word); // Check for corect input
if (!empty($IgnoredWord)) {
$IgnoredWord = implode("', '", $IgnoredWord);
$IgnoredWord = str_replace("\%", "%", $IgnoredWord );
$IgnoredWord = str_replace("\_", "_", $IgnoredWord );
};
if (!empty($word)) {
//tabel
echo $tablesize;
//tabel finished
// Return finded directory
$allDirs = searchDir($word);
$resDir = searchDir($word, "$offset");
// Return finded files
$allFiles = searchFile($word,$typs,$sor,$ts,$golemt,$golemv,$golemp);
$resFile = searchFile($word, $typs,$sor ,$ts,$golemt,$golemv,$golemp,"$offset");
$numOfDirs = mysql_num_rows($allDirs);
$numOfFiles = mysql_num_rows($allFiles);
// Show number of finden DIRECTORY, FILES and IGNORED WORDS
echo "<div align=center><span class=f12>$LNG[4] - <b>$numOfFiles</b> $LNG[30]".(strlen($IgnoredWord) > 0 ? ", $LNG[5] <b>'$IgnoredWord'</b>" : "")."</span></div><br>";
// Show files
$Folder = '<font size="-2"><img src="'.$icon_path.'dir.png" width="15" height="16" border="0"> DIR</font>';
$FTP = '<font size="-2">FTP</font>';
if ($numOfFiles > 0) {
$aaa=true;
while (list($nameFile, $fileSize,$fileExt, $nameDir, $predira, $prefilea, $filetime) = mysql_fetch_array($resFile)) {
$pathtype= '<img src="'.$icon_path.$fileExt.'.png" width="15" height="15" border="0">';
$TnameFile=translate_uri($nameFile);
$TnameDir=translate_uri($nameDir);
//$predira=translate_uri($predira);
//$prefilea=translate_uri($prefilea);
if($aaa){
$color="row1";
$aaa=false;
}else{
$color="row2";
$aaa=true;
}
$days = ( strtotime(date("Y-m-d")) - strtotime($filetime) ) / (60 * 60 * 24);
if ($days <= $novi_failove){
$is_new = '<img alt="'."$age_r day$s".' old" height="14" width="28" src="'.$icon_path.'/new.png" />';
} else {$is_new=''; }
if ($predira==$pat[0][2]){$server=$pat[0][3];}
elseif ($predira==$pat[1][2]){$server=$pat[1][3];}
elseif ($predira==$pat[2][2]){$server=$pat[2][3];}
elseif ($predira==$pat[3][2]){$server=$pat[3][3];}
elseif ($predira==$pat[4][2]){$server=$pat[4][3];}
else {$server=$prefilea;}
if(ereg("(.+)\.".$type,$nameFile)){ //REDSPACE
printf('<tr class="%s" onMouseOver=(this.className="rowover") onMouseOut="this.className=rowover(%s);">',$color,$aaa);
printf('<td class="result-dir" align="center">');
printf('<a href="%s%s/" target=_blank>%s</a>',$prefilea,$TnameDir,$Folder);
if ($MODftp=='yes'){
printf('/<a href="%s%s/%s" target=_blank>%s</a></td>',$server,$nameDir,$TnameFile,$FTP);}
printf('<td class="result-type" align="center">');
printf('<a href="%s/" target=_blank class="server">%s</a></td>',$prefilea,$predira);
printf('<td class="result-type" align="center">');
printf('<a href="%s%s/%s" target=_blank>%s</a></td>',$prefilea,$nameDir,$TnameFile,$pathtype);
printf('<td class="result-file" align="left">');
printf('<a href="%s%s/%s">%s </a>%s</td>',$prefilea,$nameDir,$TnameFile,((strlen($nameFile)>$strlen)?substr($nameFile,0,$substr)." ...": $nameFile), $is_new);
printf('<td class="result-data" align="center">');
printf($filetime);
printf('<td class="result-size" align="right">');
printf(size($fileSize));
printf('</td></tr>');
}//REDSPACE
}
printf('</tr><table>');
}
else echo "<li class=f12>$LNG[8]";
echo "</il>";
}
else if (!empty($IgnoredWord)) {
echo "<span class=f12><b>$LNG[9]</b></span>";
};
// Show next dirs and files
//if ($numOfFiles < $numOfDirs) $numOfFiles = $numOfDirs;
if ($numOfFiles > $NUM_SHOW_FILES) {
echo '<br><table class="width" height="18" border=0 cellspacing=0 cellpadding=0 align=center>';
echo '<tr class="page-text">';
echo '<td align=left>';
echo "<strong>$LNG[31] </strong>";
$pages_total = (int) ($numOfFiles / $showfile) + 1;
$pages_last = (int) ($pages_total-1)*$showfile." ";
if ($pages_total>=0){
$pages_displ = 25-$const;}
elseif ($pages_total>=99){
$pages_displ = 17-$const;}
elseif ($pages_total>=999){
$pages_displ = 13-$const;}
$submit_link = "";
$LorgWord= translate_uri($orgWord);
if ($page > $pages_displ/2+1) echo '<A HREF="' . $submit_link . "$PHP_SELF?word=$LorgWord&of=0&lng=$lng&typs=$typs&showfile=$showfile&sor=$sor&ts=$ts>s=$golemt&gv=$golemv&gp=$golemp&page=" . (1) . '"> « първа</A>'; else echo " ";
if ($page > 1) echo '<A HREF="' . $submit_link . "$PHP_SELF?word=$LorgWord&of=$end_of&lng=$lng&typs=$typs&showfile=$showfile&sor=$sor&ts=$ts>s=$golemt&gv=$golemv&gp=$golemp&page=" . ($page - 1) . '"> ‹ </A>'; else echo " ";
if (($page < (int) ($pages_displ / 2) + 1) || ($pages_total <= $pages_displ))
$start_page = 1;
elseif ($page > (int) ($pages_total - ($pages_displ / 2)))
$start_page = $pages_total - $pages_displ + 1;
else
$start_page = $page - (int) ($pages_displ / 2);
for ($i = 0, $page_i = $start_page;
($i < $pages_displ) && ($i < $pages_total);
$i++, $page_i++
) {
if ($page_i == $page) echo "<FONT class=result><B> $page_i </B></FONT>";
else
echo "<A HREF=$PHP_SELF?word=$LorgWord&of=".($page_i * $showfile - $showfile)."&page=$page_i&lng=$lng&typs=$typs&showfile=$showfile&sor=$sor&ts=$ts>s=$golemt&gv=$golemv&gp=$golemp> " . $page_i . " </A>";
}
if ($page < $pages_total) echo '<A HREF="' . $submit_link . "$PHP_SELF?word=$LorgWord&of=$end_of&lng=$lng&typs=$typs&showfile=$showfile&sor=$sor&ts=$ts>s=$golemt&gv=$golemv&gp=$golemp&page=" . ($page + 1) . '"> › </A>';
if ($pages_total > 26)
{
if ($page < $pages_total-$pages_displ/2) echo '<A HREF="' . $submit_link . "$PHP_SELF?word=$LorgWord&of=$pages_last&lng=$lng&typs=$typs&showfile=$showfile&sor=$sor&ts=$ts>s=$golemt&gv=$golemv&gp=$golemp&page=" . ($pages_total) . '"> последна »</A>'; else echo " ";
}
$pages = $numOfFiles /$showfile;
echo '<td class="down-right" align="right"><strong>'.$LNG[32], $pages_total.'</strong> ';
echo '</td>';
echo '</td>';
echo '</tr>';
};
$time = round ($starttime - $endtime,3);
//printf("%01.3f",$time)
if ($numOfFiles > 0) echo "</table><br><p align=center>".$LNG[12]."<strong> ".$time." </strong>".$LNG[13]."</p>";
$edttime = microtime();
?>
</table>
</form>
</body>
</html>