Файл: masteram_us/down/apanel_index.php
Строк: 224
<?php
list($msec,$sec)=explode(chr(32),microtime());
$HeadTime=$sec+$msec;
require'../shaxty.php'; // waphp.ru - закрытый клуб вап мастеров!
require_once'fun.php';
$align='left';
$title='Архив файлов!';
$head='Архив файлов! Тут найдется все )';
include_once (H.'shaxty/head.php');
check_login();
levels($set['zc_levadm']);
###################ГЛАВНОЕ МЕНЮ####################
$page = intval($_GET['page']);
$start = intval($_GET['start']);
$onpage = check(get2ses('onpage'));
if($onpage < 1)$onpage = 10;
if($page < 1)$page = 1;
//------------------------------------------------------------------------------------------
if(!$id){
$d['path'] = set('path').'/';
}
else{
$d = mysql_fetch_array(mysql_query('SELECT `path` FROM `files` WHERE `id` = '.$id));
}
if(!is_dir ($d['path'])) die('Такой категории не существует!');
//------------------------------------------------------------------------------------------
$all = mysql_fetch_array(mysql_query("SELECT count(*) FROM `files` WHERE `infolder` = '".$d['path']."'"));
$all = $all[0];
$pages = ceil($all/$onpage);
if(!$pages) $pages = 1;
if($page>$pages or $page<=0) $page=1;
if($start>$all or $start<=0) $start = 0;
if($page) $start = ($page - 1) * $onpage; else $start = 0;
//------------------------------------------------------------------------------------------
$query = mysql_query('SELECT `id` FROM `files` WHERE `infolder` = "'.$d['path'].'" ORDER BY `priority` DESC,`timeupload` DESC LIMIT '.$start.', '.$onpage);
while($list_sw = mysql_fetch_array($query)) $array_id[] = $list_sw['id'];
//------------------------------------------------------------------------------------------
$ex=explode('/',$d['path']);
foreach($ex as $k=>$v)
{
if ($v[0]!='.' AND $v AND $v!=set('path'))
{
$s = mysql_fetch_array(mysql_query("SELECT * FROM `files` WHERE `path` LIKE '%".clean($v)."/' AND `size` = 0"));
$s['name'] = str_replace('*','',$s['name']);
if($k >= sizeof($ex)-2) $put .= $s['name'];
else $put .= '<a href="apanel_index.php?id='.$s['id'].'">'.$s['name'].'</a>»';
}
}
echo $div4.'<a href="apanel_index.php">Загрузки</a>»'.$put.'</div>';
//-----------------------------------------------------------------------------------------
echo '<dt></dt><a href="apanel.php?id='.$id.'&action=newdir">Новая папка</a><dt></dt>';
//------------------------------------------------------------------------------------------
if(!$all){
echo '<strong>[Раздел пуст]</strong>';
}
foreach($array_id as $key => $value)
{
if(is_integer($key / 2)) $user = '<div class="mainzag">'; else $user = '<div class="row">';
$file_info = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`path`,`fastabout`,`timeupload`,`infolder`,`size` FROM `files` WHERE `id` = '.$value));
if(is_dir($file_info['path']))
{
echo $user;
$allinfolder = mysql_fetch_array(mysql_query('SELECT count(*) FROM `files` WHERE `infolder` LIKE "'.$file_info['path'].'%" AND `size` > 0'));
$allinfolder = $allinfolder[0];
$file_info['name'] = str_replace('*','',$file_info['name']);
if(!file_exists($file_info['path'].'folder.png'))
{
$ico = '<img src="ext/dir.png" alt="">';
$addico = '[<font color="#761DE2"><a href="apanel.php?action=addico&id='.$file_info['id'].'">Загрузка иконки к папке</a></font>]';
}
else
{
$ico = '<img src="'.$file_info['path'].'folder.png" alt="">';
$addico = '[<font color="#BF00BF"><a href="apanel.php?action=reico&id='.$file_info['id'].'">-I</a></font>]';
}
$updown = '[<font color="#008080"><a href="apanel.php?id='.$file_info['id'].'&action=pos&to=up">Приоритет каталога вверх</a></font>][<font color="#008080"><a href="apanel.php?id='.$file_info['id'].'&action=pos&to=down">Приоритет каталога вниз</a></font>]';
if(set('delete_dir')==1) $dl = '[<font color="#B90000"><a href="apanel.php?action=redir&id='.$file_info['id'].'">Чистка каталога</a></font>]'; else $dl = '';
echo $ico.'<strong><a href="apanel_index.php?id='.$file_info['id'].'">'.$file_info['name'].'</a></strong>('.$allinfolder.')[<font color="#0080FF"><a href="apanel.php?id='.$file_info['id'].'&action=flash">Обновить базу</a></font>][<font color="#008080"><a href="apanel.php?id='.$file_info['id'].'&action=rename">Переименовать раздел</a></font>][<font color="#000080"><a href="apanel.php?id='.$file_info['id'].'&action=fast">Добавить описание</a></font>]'.$dl.$addico.$updown;
if(!empty($file_info['fastabout'])) echo '<br>'.str_replace("", '<br>',$file_info['fastabout']);
echo '</div>';
}
elseif(is_file($file_info['path']))
{
$ex = pathinfo($file_info['path']);
$ext = strtolower($ex['extension']);
$filename = $ex['basename'];
if($file_info['size'] < 1024) $file_info['size'] = '('.$file_info['size'].'b)';
if($file_info['size'] < 1048576 and $file_info['size'] >= 1024) $file_info['size'] = '('.round($file_info['size']/1024, 2).'Kb)';
if($file_info['size'] > 1048576) $file_info['size'] = '('.round($file_info['size']/1024/1024, 2).'Mb)';
if(!file_exists("ext/$ext.png")) $ico = '<img src="ext/stand.png" alt="">'; else $ico = '<img src="ext/'.$ext.'.png" alt="">';
$file_info['timeupload'] = date('d.m.Y (H:i)', $file_info['timeupload']);
if(set('ext')==1) $extension = '('.$ext.')'; else $extension = '';
if(set('delete_file')==1) $dl = '[<font color="#B90000"><a href="apanel.php?action=refile&id='.$file_info['id'].'">Чистка каталога</a></font>]'; else $dl = '';
if($ext=='zip') $unzip = '[<font color="#FFFF00"><a href="apanel.php?id='.$file_info['id'].'&action=unpack">U</a></font>]'; else $unzip = '';
if(!is_file(set('spath').'/'.$filename.'.gif')) $add_screen = '+S'; else $add_screen = '-S';
$screen = '[<font color="#FFFF00"><a href="apanel.php?id='.$file_info['id'].'&action=screen">'.$add_screen.'</a></font>]';
echo $user;
echo $ico.'<strong><a href="apanel_view.php?id='.$file_info['id'].'">'.$file_info['name'].'</a></strong>'.$extension.$file_info['size'].'[<font color="#008080"><a href="apanel.php?id='.$file_info['id'].'&action=rename">Переименовать раздел</a></font>][<font color="#800080"><a href="apanel.php?id='.$file_info['id'].'&action=editabout">O</a></font>][<font color="#000080"><a href="apanel.php?id='.$file_info['id'].'&action=fast">Описание</a></font>]'.$unzip.$dl.$screen;
if(!empty($file_info['fastabout'])) echo '<br>'.str_replace("", '<br>',$file_info['fastabout']);
if ($sort=='data') echo '<br>Добавлен: '.$file_info['timeupload'];
if ($sort=='load') echo '<br>Скачано '.$file_info['loads'].' раз(а)';
if ($sort=='eval' and set('eval_change')==1) echo "<br>Рейтинг(+/-): $file_info[yes]/$file_info[no]<br>";
echo '</div>';
}
}
//------------------------------------------------------------------------------------------
echo '<br/><dl><dt></dt></dl>';
echo '</div><div class="iblock">Страницы: ';
$asd= $page - 2;
$asd2= $page + 3;
if($asd<$all && $asd>0 && $page>3) echo '<a href="apanel_index.php?id='.$id.'&page=1">1</a> ... ';
for($i=$asd; $i<$asd2;$i++)
{
if($i<$all && $i>0)
{
if ($i > $pages ) break;
if ($page==$i) echo '<strong>['.$i.']</strong> ';
else echo '<a href="apanel_index.php?id='.$id.'&page='.$i.'">'.$i.'</a> ';
}
}
if ($i <= $pages)
{
if($asd2<$all) echo ' ... <a href="apanel_index.php?id='.$id.'&page='.$pages.'">'.$pages.'</a>';
}
echo '<br>';
//------------------------------------------------------------------------------------------
if ($pages>set('pagehand'))
{
echo 'Страница '.$page.' из '.$pages.':<br>
<form action="apanel_index.php?id='.$id.'" method="post">
<input class="enter" name="page" type="text" maxlength="4" size="8" value="">
<input class="buttom" type="submit" value="Перейти">
</form>';
}
//------------------------------------------------------------------------------------------
echo 'Файлов на страницу: ';
for($i=10; $i<35; $i=$i+5)
{
if($i==$onpage) echo '<strong>['.$i.']</strong>';
else echo '[<a href="apanel_index.php?onpage='.$i.'&id='.$id.'">'.$i.'</a>]';
}
echo '<br/><dl><dt></dt></dl>';
echo '<br>';
echo '<br>';
echo $div1.'<a href="apanel.php">Админка</a>'.$div9;
echo $div1.'<a href="./">Загрузки</a>'.$div9;;
include_once (H.'shaxty/foot.php');
?>