Размер файла: 5.16Kb
<?php
//////////////////////////////////
include('conf.php');
include('func/format.php');
include('func/func.php');
if(!IsSet($f))
{
include('verh.php');
}
//////////////////////////////////
$files_kolvo = $page_kol;
if(!IsSet($srt)) { $sort='name'; } else { if($srt!='name' && $srt!='date') { $srt='name'; } $sort=$srt; }
if(!IsSet($pg) || $pg<1) $pg=1;
$pg=$pg+0;
$page['end'] = $files_kolvo*$pg;
$page['men'] = $files_kolvo-1;
$page['begin'] = $page['end']-$page['men'];
$page['next'] = $pg+1;
$page['back'] = $pg-1;
if(!IsSet($d)) $d=''; else $d=del_slash($d);
$d = str_replace('/home/','',$d);
$d = str_replace('../','',$d);
$d = str_replace('.','',$d);
$d = str_replace('..','',$d);
$i=0;
$i2=0;
if(!IsSet($f))
{
if($ver=='html') print '<div class="header">Downloads</div>';
if($ver=='wml') print 'Downloads<br/>';
print 'Сортировать по ';
if($sort=='name') $sort_url='Имени/<a href="'.$SCRIPT_NAME.'?pg='.$pg.'&srt=date&ver='.$ver.'&d='.$d.'">Дате</a>';
else $sort_url = '<a href="'.$SCRIPT_NAME.'?pg='.$pg.'&srt=name&ver='.$ver.'&d='.$d.'">Имени</a>/Дате';
print $sort_url.'<br/>';
$dir = opendir('./'.$d);
while(($e=readdir($dir))!==false)
{
$rsh = rsh($e);
if($rsh=='php' || $rsh=='name' || $rsh=='dat' || $rsh=='cmt' || $rsh=='info') continue;
if($e=='name.dat' || $e=='.' || $e=='..' || $e=='index.php' || $e=='niz.php' || $e=='verh.php' || $e=='info.php' || $e=='save.gif' || $e=='conf.php' || $e=='.htaccess' || $e=='func') continue;
if(is_dir("./$d/$e"))
{
$kol = Kolvo_Files("./$d/$e");
if(file_exists("./$d/$e/dir.dat")) $kol = PrintKolvo("./$d/$e/dir.dat");
$dir_name = @implode('',file("./$d/$e/name.dat"));
if($dir_name=='') $dir_name = $e;
$ms2[$i] = "» <a href=\"$SCRIPT_NAME?d=$d/$e&ver=$ver\">$dir_name</a> [$kol]<br/>"; $i++;
}
else // if(is_file("./$d/$e"))
{
$file_name = @implode('',file("./$d/$e.name"));
if($file_name=='') { if(rsh($e)!='jad' && rsh($e)!='jar') $file_name=ext_rsh($e); else $file_name=$e; }
$sizefile = ceil(filesize("./$d/$e")/1000);
$infodate = date("YmdHis",filectime("./$d/$e"));
$vrem_1 = "» <a href=\"$SCRIPT_NAME?f=$e&d=$d\">$file_name</a>-<a href=\"info.php?d=$d&f=$e&ver=$ver\">[info]</a> ($sizefile"."kb)<br/>"; $i2++;
if($sort=='date') $ms1[$i2] = '<!--'.$infodate."-->".$vrem_1;
if($sort=='name') $ms1[$i2] = $vrem_1;
}
}
closedir($dir);
$err_not[1] = 0;
$err_not[2] = 0;
$wabxru[1] = 0;
$wabxru[2] = 0;
if(!IsSet($ms1)) { $ms1[0] = '<!--error-->'; $err_not[1]=1; $wabxru[1]=1; }
if(!IsSet($ms2)) { $ms2[0] = '<!--error-->'; $err_not[2]=1; $wabxru[2]=1; }
if(count($ms1) && $err_not[1]==0 && $sort=='name') asort($ms1);
if(count($ms1) && $err_not[1]==0 && $sort=='date') arsort($ms1);
if(count($ms2) && $err_not[2]==0) asort($ms2);
$ms = mas_ms($ms2,$ms1);
$pp=0;
for($p=($page['begin']-1);$p<$page['end'];$p++)
{
if((Count($ms))>$p)
{
$mas[$pp] = $ms[$p];
$pp++;
}
}
if(((count($ms2)-$wabxru[2])>0) && $pg==1)
{
print 'Папки: '.$page['begin'].'..';
if($page['end']<count($ms2)) print $page['end']; else print count($ms2);
print ' из '.count($ms2).'<br/>';
}
if((count($ms1)-$wabxru[1])>0)
{
print 'Файлы: '.$page['begin'].'..';
if($page['end']<count($ms1)) print $page['end']; else print count($ms1);
print ' из '.count($ms1).'<br/>';
}
print '<br/>';
if($err_not[1]==1 && $err_not[2]==1) $mas[0] = 'В этой папке нет файлов.<br/>';
print @implode('',$mas);
if($pg>1) { $niz1 = '<a href="'.$SCRIPT_NAME.'?d='.$d.'&pg='.$page['back'].'&srt='.$sort.'&ver='.$ver.'">Назад</a>'; $nazad=1; } else { $niz1=''; }
if(count($ms)>$page['end']) { $pered = 1; $niz2 = '<a href="'.$SCRIPT_NAME.'?d='.$d.'&pg='.$page['next'].'&srt='.$sort.'&ver='.$ver.'">Далее</a>'; } else {$niz2=''; }
if(IsSet($nazad) && IsSet($pered)) $niz3 = '|'; else $niz3='';
print $niz1.$niz3.$niz2;
print '<br/>--==--';
flush();
$ddd = top_dir($d);
if($ddd!='..' && $ddd!='.') { $dir_name = @implode('',file("./$ddd/name.dat")); if($dir_name=='') {$dir_name=$ddd;} print '<br/><a href="index.php?d='.$ddd.'&ver='.$ver.'&pg='.$pg.'">'.$dir_name.'</a>'; }
if($d!='' && $d!='/') print '<br/><a href="index.php">Загрузки</a><br/>';
if($ver=='wml') print '<br/>wml|<a href="'.$SCRIPT_NAME.'?pg='.$pg."&d=$d&srt='.$sort.'&ver=html".'">html</a><br/>';
if($ver=='html') print '<div class="footers"><a href="'.$SCRIPT_NAME.'?pg='.$pg."&d=$d&srt='.$sort.'&ver=wml".'">wml</a>|html</div>';
if($ver=='wml') print '<a href="http://'.$main.'">'.$main_title.'</a><br/>';
if($ver=='html') { print '<div class="news"><a href="http://'.$main.'">'.$main_title.'</a></div>'; }
include('niz.php');
exit;
}
if(file_exists("./$d/$f") && is_file("./$d/$f"))
{
Header("Location: ./$d/$f");
}
else
{
include('verh.php');
print 'Не найдено';
include('niz.php');
}
include('niz.php');
?>