<?php
error_reporting(E_ALL & ~E_NOTICE);
Header('Content-type:application/xhtml+xml;charset=UTF-8');
Header('Cache-Control: no-cache, must-revalidate');
@$dir=$_GET['d'];
@$n=$_GET['n'];
$n=intval($n);
@$s=$_GET['s'];
$s=intval($s);
@$ns=$_GET['c'];
$ns=intval($ns);
if($ns<1) $ns=8;
function to_rus($str){
$str=substr($str,1);
$str=strtr($str,array(
'A'=>'А','a'=>'а','B'=>'Б','b'=>'б',
'V'=>'В','v'=>'в','G'=>'Г','g'=>'г',
'D'=>'Д','d'=>'д','E'=>'Е','e'=>'е',
'yo'=>'ё','Yo'=>'Ё','Zh'=>'Ж','zh'=>'ж',
'Z'=>'З','z'=>'з','I'=>'И','i'=>'и',
'J'=>'Й','j'=>'й','K'=>'К','k'=>'к',
'L'=>'Л','l'=>'л','M'=>'М','m'=>'м',
'N'=>'Н','n'=>'н','O'=>'О','o'=>'о',
'P'=>'П','p'=>'п','R'=>'Р','r'=>'р',
'S'=>'С','s'=>'с','T'=>'Т','t'=>'т',
'U'=>'У','u'=>'у','F'=>'Ф','f'=>'ф',
'H'=>'Х','h'=>'х','C'=>'Ц','c'=>'ц',
'Ch'=>'Ч','ch'=>'ч','Sh'=>'Ш','sh'=>'ш',
'Sch'=>'Щ','sch'=>'щ',"''"=>'ъ',"'"=>'ь',
'Y'=>'Ы','y'=>'ы','Ye'=>'Э','ye'=>'э',
'Yu'=>'Ю','yu'=>'ю','Ya'=>'Я','ya'=>'я',
'_'=>' '));
return $str;
}
print '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru"><head>
<link rel="stylesheet" type="text/css" href="_script/style.css" />
<title>';
if(empty($dir)){
$dir='.'; print 'Фaйлы';
}else{
$f=strrpos($dir,'/');
if($f===false) $f=-1;
$str=substr($dir,$f+1);
if($str{0}=='!') $str=to_rus($str); else $str=strtr($str,'_',' ');
print htmlspecialchars($str);
}
print '</title></head><body><div>
';
print '<img src="../images/img/wap-motor.gif" />';
print '<br />';
if(strpos($dir,'..')!==false or strpos($dir,'/.')!==false) die('Дocтуп к тaким пaпкaм зaпpeщён.</div></body></html>');
if($dir!='.'){
print '<img src="_script/up.gif" /> <b><a href="index.php?d=';
$f=strrpos($dir,'/');
if($f!==false) print substr($dir,0,$f);
print '&s='.$s.'&c='.$ns.'">. .</a></b><hr />'; }
$arr=array();
$d=opendir($dir);
while($f=readdir($d)){
if($f!='.' and $f!='..' and $f!='.htaccess' and $f!='_script' and $f!='pfoto.php' and $f!='DimonVideo.ru.txt' and $f!='online.php' and $f!='online.dat' and $f!='index.php'){
if($s=='2') $arr[$f]=filemtime($dir.'/'.$f); else $arr[$f]=filesize($dir.'/'.$f);
}} closedir($d);
if($s!=0) asort($arr); else ksort($arr);
function out($name,$info){
$name=htmlspecialchars($name);
$f=strrpos($name,'.');
if($f){ $ext=substr($name,$f); $str=substr($name,0,$f); }else{ $ext='dir'; $str=$name; }
if($name{0}=='!') $str=to_rus($str); else $str=strtr($str,'_',' ');
if($GLOBALS['dir']!='.') $name=$GLOBALS['dir'].'/'.$name;
$ext2=$ext;
if ($ext2<>'.jpg'); ELSE print '<img src="http://javasoft.h2m.ru/load/'.$name.'" width="100" height="100" /><br />';
if ($ext2<>'.jpeg'); ELSE print '<img src="http://javasoft.h2m.ru/load/'.$name.'" width="100" height="100" /><br />';
if ($ext2<>'.gif'); ELSE print '<img src="http://javasoft.h2m.ru/load/'.$name.'" width="100" height="100" /><br />';
print '<img src="_script/';
switch($ext){
case 'dir': $ico='dir.gif'; break;
case '.jpg': case '.jpeg': $ico='jpg.gif'; break;
case '.gif': $ico='gif.gif'; break;
case '.mid': $ico='mid.gif'; break;
case '.mp3': $ico='mp3.gif'; break;
case '.wav': case '.amr': $ico='wav.gif'; break;
case '.mmf': $ico='mmf.gif'; break;
case '.jad': $ico='jad.gif'; break;
case '.jar': $ico='jar.gif'; break;
case '.zip': $ico='zip.gif'; break;
case '.txt': $ico='txt.gif'; break;
case '.exe': $ico='exe.gif'; break;
case '.htm': $ico='htm.gif'; break;
case '.php': $ico='php.gif'; break;
default: $ico='file.gif'; break; }
print $ico.'" alt="'.$ext.'" /> <a href="';
if($ext=='dir') print './?d='.$name.'&s='.$GLOBALS['s'].'&c='.$GLOBALS['ns']; else print $name;
print '">'.$str.'</a>';
if($ext!='dir' and $GLOBALS['s']!=2) print ' <small>('.round($info/1024,1).'kB)</small>'; elseif($ext!='dir') print ' <small>('.date('d.m.y h:i',$info).')</small>';
print '<br />
'; }
$cnt=count($arr);
$i=0; $c=0;
foreach($arr as $name=>$info){
if($c<$n){ $c++; continue; }
if($i==$ns) break;
out($name,$info);
$i++; $c++; }
if($cnt==0) print 'Здecь пoкa чтo ничeгo нeт';
print '<hr />
';
if($dir!='.') $dir=htmlspecialchars($dir); else $dir='';
if($c<$cnt or $c>$ns) print '<small>';
if($c<$cnt) print '><a href="index.php?d='.$dir.'&n='.$c.'&c='.$ns.'&s='.$s.'">Дaлee</a><br />
';
if($c>$ns){ print '<<<a href="index.php?d='.$dir.'&c='.$ns.'&s='.$s.'">B нaчaлo</a><br />
';
}elseif($c<$cnt) print '>><a href="index.php?d='.$dir.'&n='.($cnt-$ns).'&c='.$ns.'&s='.$s.'">B кoнeц</a><br />
';
if($c<$cnt or $c>$ns) print 'Cтp '.ceil($c/$ns).' из '.ceil($cnt/$ns).'</small><br />
';
print '[<a href="../load.php">Сортировка</a>]';
print '<br />';
print '[<a href="..">На главную</a>]';
print '<br />';
include("online.php");
print '<br />';
print 'Инфо:';
print '<br />';
print '<a href="http://javasoft.h2m.ru">Большие выплаты!</a><br /></div></body></html>';
?>