Файл: ftp/flist.php
Строк: 88
<?php
function flist($res,$dr,$skey) {global $dftp, $shs, $ib;
if (strpos($dr," ")===false) {$al="-al ";} else {$al="";}
$lines=@ftp_rawlist($res,$al.$dr); $fnm=NULL; $dnm=NULL;
include("dechm.php");
for ($i=0;$i<count($lines);$i++) {
$name=@preg_replace("~([^s]*[s]*){8}s{1}(.*)~m","\2",$lines[$i]);
$size=@preg_replace("~([^s]*[s]*){4}s{1}([^s]*)(.*)~m","\2",$lines[$i]);
// if($size==NULL) $size="";
if (($name<>".")&&($name<>"..")) {$rname=$name;
if (strpos($name,".htaccess")!==false) {
$name=str_replace(".htaccess",".|htaccess",$name);
}
$chm=@preg_replace("~([^s]*).*~m","\1",$lines[$i]);
$nchm=dechm($chm);
if ($chm[0]=="-") {
$rf=strtolower(preg_replace("~.*.([^.]*)~m","\1",str_replace('|','',$name)));
if ($rf==NULL) {$rf="?";}
$icn="<img src="/ftp/icons/unkn.png" width="16" height="16" alt="."/>";
$ar1=array("3gp","avi","bmp","doc","exe","gif","htm","html","jpg","jpe","jpeg",
"mdb","mid","midi","mp3","php","png","ppt","psd","rar","rtf","ttf","wav","wml",
"xls","xml","wmv","txt","zip","tar","tgz","tbz","tgz2","tbz2","fla","swf",
"htaccess","css","py","log","ini","jar","jad","sql");
$ar2=array("3gp","avi","bmp","doc","exe","gif","htm","htm","jpg","jpg","jpg",
"mdb","mid","mid","mp3","php","png","ppt","psd","rar","rtf","ttf","wav","wml",
"xls","xml","wmv","txt","zip","rar","rar","rar","rar","rar","fla","swf",
"htaccess","css","py","log","css","jar","jad","sql");
$ct=count($ar1);
for ($j=0;$j<$ct;$j++) {
if ($rf==$ar1[$j]) {
$icn="<img src="/ftp/icons/".$ar2[$j].".png" width="16" height="16" alt="."/>";
break;
}
}
/*
$size="<span class = 'count'>".round($size/1024)." кб.</span>";
if ($size<100) {$size="<span class = 'count'> ".$size."b.</span>";}
if ($size>102402) $size="<span class = 'count'> ".str_replace(".",",",round($size/1024/1024,1))." мб.</span>";
*/
if ($size<100) {$sz="<span class = 'count'>".$size." б.</span>";}
elseif ($size<1024) {$sz="<span class = 'count'>".str_replace(".",",",round($size/1024,1))." кб.</span>";}
elseif ($size<102400) {$sz="<span class = 'count'> ".round($size/1024)." кб.</span>";}
else {$sz="<span class = 'count'>".str_replace(".",",",round($size/1024/1024,1))." мб.</span>";}
if($size==0) $sz=NULL;
$fnm[]="<div class='subhead'>$icn <a href="file.php?k=$skey&d=".rawurlencode($dr)."&n=".rawurlencode($name)."">$rname $sz</a> </div>";
} else {
if($rname== "tmp -> mod-tmp"){$rname='Error dir';}
$icn="<img src="/ftp/icons/cldir.png" width="16" height="16" alt=">"/>";
$dnm[]="<div class='subhead'>$icn <a href="ftp.php?k=$skey&d=".rawurlencode($dr)."&n=".rawurlencode($name)."">$rname </a></div> ";
}
}
}
if ($fnm==NULL) {return $dnm;}
elseif ($dnm==NULL) {return $fnm;}
else {return array_merge($dnm,$fnm);}
}
?>