Файл: includes/wap/builder/dirmanager.php
Строк: 137
<?php
$buildpath=$wappath."builder/";
$tmp=explode('/',str_replace($userpath,'',realpath($userpath.$currentdir)));
$_dir=$tmp[sizeof($tmp)-1];
if (($query1=='new')||($query1==''))
    {
    $cntsubdir=0;
    $d=dir($userpath.$currentdir);
    while ($entry=$d->read())
        {
        if (($entry=='_BUFER_')||($entry=='_DAT_')||($entry=='.')||($entry=='..')) continue;
        if (filetype($userpath.$currentdir.'/'.$entry)=='dir') $cntsubdir+;
        }
    $d->close();
    }
if ($query1=='up') {$query1='cd'; $query3=$query2; $query2='..';}
if (($query1=='cd')&& is_dir($_new_current_dir=realpath($userpath.$currentdir.'/'.$query2)))
    {
    if ($query3!='') $nocache_=$query3+0;
    $fp = @fopen ($userpath."opeation.cache", "r");$testcache = trim(@fgets($fp, 10));@fclose ($fp);
    if ($nocache_!=$testcache)
        {
        $currentdir=str_replace('.','',str_replace('/.','',str_replace($userpath,'',$_new_current_dir.'/.')));
        $f=@fopen($sitespath.'/'.$user.'/currentdir.dat','w+');
        @fwrite($f,trim($currentdir));
        @fclose($f);
        $f=@fopen($sitespath.'/'.$user.'/currentdir.dat','r+');
        $currentdir=trim(@fread($f,128));
        @fclose($f);
        if (!is_subdir($userpath,$userpath.$currentdir)) $currentdir='.';
        if ($currentdir=='') $currentdir='.';
        $fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache_);fclose ($fp);
        }
    }
if (($query1=='new')&&(sizeof(explode('/',$currentdir))<3)&&($cntsubdir<16)) include($buildpath.'dir_new.php');
if ($query1=='bufer')  include($buildpath.'dir_bufer.php');
if ($query1=='input')  include($buildpath.'dir_bufer2dir.php');
if ($query1=='output') include($buildpath.'dir_files2bufer.php');
if ($query1=='rename') include($buildpath.'dir_rename.php');
if ($query1=='delete') include($buildpath.'dir_delete.php');
if ($query1=='purgebufer') dir_delete($userpath.'_BUFER_/');
print $head.cyr2utf('<card id="main" title="Папки">');
print '<do name="x" type="options" label="xPanel"><go href="http://wap.kmx.ru/?'.$id.'"/></do>';
print cyr2utf('<do name="pm" type="options" label="Страницы"><go href="http://wap.kmx.ru/?'.$id.'/pm"/></do>');
print cyr2utf('<do name="fm" type="options" label="Файлы"><go href="http://wap.kmx.ru/?'.$id.'/fm"/></do>');
if ((sizeof(explode('/',$currentdir))<3)&&($cntsubdir<16)) print cyr2utf('<do name="n" type="options" label="Создать"><go href="http://wap.kmx.ru/?'.$id.'/dm'.$dmpage.$mpage.'/new"/></do>');
print '<p>';
if ($currentdir!='.') print cyr2utf('<b>Папка: /'.$currentdir.'/</b> <br/><small>- - -</small> <br/>');
else print cyr2utf('<b>Папка: /</b> <br/><small>- - -</small> <br/>');
if ($currentdir!='.') print cyr2utf('<a href="#rename">Преименовать</a> <br/>');
if ($currentdir!='.') print cyr2utf('<a href="#delete">Удалить</a> <br/> ');
if (!is_dir($userpath.'_BUFER_')) print cyr2utf('<a href="http://wap.kmx.ru/?'.$id.'/dm'.$dmpage.$mpage.'/output">Файлы в портфель</a> <br/> ');
else print cyr2utf('<a href="/?'.$id.'/dm'.$dmpage.$mpage.'/input">Файлы из портфеля</a> <br/> ');
print '<small>- - -</small> <br/>';
unset($dirs);
$d=dir($userpath.$currentdir);
$found=false;
while ($entry=$d->read())
    {
    if (($entry=='_DAT_')||($entry=='.')||(($entry=='..')&&($currentdir=='.'))) continue;
    if (filetype($userpath.$currentdir.'/'.$entry)=='dir') { $dirs[]=$entry; $found=true; }
    }
$d->close();
@sort($dirs, SORT_STRING);
if (($mpage+0)>1) $tmpage=$mpage+0;
else $tmpage=1;
if ($tmpage<2) $dmpage=$mpage='';
else {$dmpage='-';$mpage=$mpage+0;}
if ($tmpage>1) print cyr2utf('<a href="/?'.$id.'/dm-'.($tmpage-1).'"><<<</a><br/>');
$i=0;
if ($found)
    {
    while ($_dir=@each($dirs))
        {
        if ($i<($tmpage*20)-20) {$i++;continue;}
        $_dir=$_dir[1];
        $found=false;
        if ($_dir=='..')
            {
            print cyr2utf('<b><a href="/?'.$id.'/dm'.$dmpage.$mpage.'/up/'.$nocache.'">вверх</a></b> <br/>');
            }
        elseif ($_dir=='_BUFER_')
            {
            print cyr2utf('<b><a href="/?'.$id.'/dm'.$dmpage.$mpage.'/bufer">-портфель-</a></b> <br/>');
            }
        elseif ($_dir!='_DAT_')
            {
            print '<a href="/?'.$id.'/dm'.$dmpage.$mpage.'/cd/'.$_dir.'/'.$nocache.'">'.$_dir.'</a> <br/>';
            $found=true;
            }
        $i++;
        if ($i>=($tmpage*20)) break;
        }
    }
if (!$found) print cyr2utf('<small>Вложенных папок нет...</small>');
if ($i>=($tmpage*20)) print cyr2utf('<a href="http://wap.kmx.ru/?'.$id.'/dm-'.($tmpage+1).'">>>></a>');
print '</p></card>';
print cyr2utf('<card id="delete" title="Удаление">');
print cyr2utf('<p><b>Вы действительно хотите удалить /'.str_replace($userpath,'',realpath($userpath.$currentdir)).' со всеми вложенными файлами и подпапками без возможности восстановления?</b> <br/>');
print cyr2utf('<a href="/?'.$id.'/dm'.$dmpage.$mpage.'/delete/'.$nocache.'">Удалить</a> <br/>');
print cyr2utf('<a href="#main">Отмена</a>');
print '</p></card>';
for ($i=1;is_dir($userpath.$currentdir.'/../dir'.$i);$i++);
print cyr2utf('<card id="rename" title="Переименовать"><p>');
print cyr2utf('<b>Новое имя папки:</b><br/>');
print cyr2utf('<input name="dir'.$nocache.'" type="text" title="Имя папки" value="dir'.$i.'" maxlength="8"/><br/>');
print cyr2utf('<a href="?'.$id.'/dm'.$dmpage.$mpage.'/rename/$(dir'.$nocache.')/'.$nocache.'">Далее</a> <br/>');
print cyr2utf('<a href="#main">Отмена</a>');
print '</p></card></wml>';
exit;
?>