Файл: load/index.php
Строк: 111
<?
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
$diz -> head('Файловый архив');
$diz -> title('Файловый архив');
$dir = $db -> query("SELECT * from `load_cat` where `id`='".$id."'")-> fetch_assoc();
//////меню для авторизированых
if($aut){
$p = $db -> dbcount('COUNT(*)','files','`what`="load" and `time` > '.(time()-86400).'');
if ($p==0)$p=0;
else $p=$p;
echo '<div class="but_razdel">';
echo '<a href="new.php" class="button_razdel">Новое <span class="count">'.$p.'</span></a>';
$my = $db -> dbcount('COUNT(*)','files','`user` = '.$ya['id'].' and `what`="load"');
echo '<a href="my_load.php?id='.$ya['id'].'" class="button_razdel">Моё <span class="count">'.$my.'</span></a>';
echo '<a href="poisk.php" class="button_razdel">Поиск</a>';
if ($id != 0 and $id !="" and $ya['level']>=$dir['lvl']) {
echo '<a href="upload.php?id='.$id.'" class="button_razdel">Загрузить</a>';
}
echo '</div>';
}
////////////
$r = $db -> query("SELECT * from `load_cat` where `ifcat`='".$id."'");
$cocat = $db -> dbcount('COUNT(*)','load_cat',"`ifcat`='".$id."'");
if($id!=0){
$tree = array();
$dirid = $id;
while ($dirid != '0' && $dirid != "") {
$req_down = $db -> query("SELECT * FROM `load_cat` WHERE `id` = '".$dirid."' LIMIT 1")-> fetch_assoc();
$tree[] = '<a href="?id='.$dirid.'">' . $req_down['name']. '</a>';
$dirid = $req_down['ifcat'];
}
krsort($tree);
$cdir = array_pop($tree);
echo '<div class="fon"><a href="?">Корневая</a> / ';
foreach ($tree as $value) {
echo $value . ' / ';
}
echo '<b>'.$dir['name'].'</b></div>';
}
$count = $db -> dbcount('COUNT(*)','files',"`what`='load' and `where`='".$id."'");
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
$sql2 = $db -> query("SELECT * from `load_cat` where `ifcat`='".$id."' ORDER BY `sid` ASC");
if($cocat>0){
while ($row2 = $sql2 -> fetch_assoc()) {
////Счётчик файлов
$chet_count = $db -> dbcount('COUNT(*)','files','`what`="load" and `infolder` LIKE "%'.$row2['ifcat'].'/'.$row2['id'].'%"');
////Счётчик новых файлов
$chet_count2 = $db -> dbcount('COUNT(*)','files','`what`="load" and `infolder` LIKE "%'.$row2['ifcat'].'/'.$row2['id'].'%" and `time` > '.(time()-86400).'');
if($chet_count2>0)$chet_count2='<font class="chet">+'.$chet_count2.'</font>'; else $chet_count2=null;
/////////////////
$fz = $db -> dbcount('COUNT(*)','files','`what`="load" and `where` = '.$row2['id'].'');
$rpath=null;
if($ya['level']>=4)$rpath='[<a href="">Редактировать</a> | <a href="">Удалить</a>]<br/>
<small>'.$row2['info'].'</small>';
echo '<a href="?id='.$row2['id'].'" class="mail">
<table width=100%><tr valign="top"><td width=2%>'.$diz -> img('load.png').'</td>
<td>'.$row2['name'].' <span class="count">'.$chet_count.''.$chet_count2.'</span>';
if(mb_strlen($row2['info'])>2)echo '<br/><small>'.$row2['info'].'</small>';
echo '</td></tr></table></a>';
if($ya['level']>=4){
echo '<div class="zap">
<a class="zap_b" href="func.php?mode=redraz&id='.$row2['id'].'">Редактировать</a>';
echo'<a class="zap_b" href="func.php?mode=delr&id='.$row2['id'].'">Удалить</span></a>';
echo'</div>';
}
}
}else if($count==0 and $cocat==0)echo'<div class="fon">Категории не созданы</div>';
if ($id) {
$sql = $db -> query("SELECT `url`,`id`,`name` from `files` where `what`='load' and `where`='".$id."' ORDER BY `time` DESC LIMIT ".$start.",".$num);
if($count>0){
while ($row = $sql -> fetch_assoc()) {
$ext = strtolower(pathinfo(ROOT.'downloads/load/'.$row['url'], PATHINFO_EXTENSION));
if ($ext == 'gif' || $ext == 'jpeg' || $ext == 'jpg' || $ext == 'png') {
$type=$diz -> img('load/img.png');
}
else if ($ext == 'mp3' || $ext == 'wav') {
$type=$diz -> img('load/mp3.png');
}
else if ($ext == 'jar') {
$type=$diz -> img('load/jar.png');
}
else if ($ext == 'txt') {
$type=$diz -> img('load/byb.png');
}
else if ($ext == '3gp' || $ext == 'avi' || $ext == 'mp4' || $ext == 'flv') {
$type=$diz -> img('load/video.png');
}
else if ($ext == 'rar' || $ext == 'zip') {
$type=$diz -> img('load/rar.png');
}
else {
$type=$diz -> img('load/other.png');
}
echo '<div class="menu"><a href="file'.$row['id'].'" class="menutuch">
<table width=100%><tr valign="top"><td width=2%>'.$type.'</td>
<td>'.$row['name'].' <span class="count"/>'.$func -> size(filesize(ROOT.'downloads/load/'.$row['url'])).'</span></td></tr></table></a></div>';
}
}else{
if($count==0 and $cocat>0)echo'<div class="fon">Файлов пока нет.</div>';}
}
$act = '?id='.$id.'';
echo $func -> pagenav($act,$page,$total);
if($ya['level']>=4){echo '<div class="levo"><a href="func.php?mode=new&id='.$id.'" class="levo_tuch">'.$diz -> img('load/upload.png').' Создать папку</a></div>';}
echo '<div class="levo"><a href="/index.php" class="levo_tuch"> '.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
?>