Файл: load/index.php
Строк: 115
<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
$diz -> head('Файловый архив');
$diz -> title('Файловый архив');
if($aut){
$dir = $db -> query("SELECT * from `load_cat` where `id`='$id'")-> fetch_assoc();
$p = $db -> dbcount('COUNT(*)','load_files','`dateupload` > '.(time()-86400).'');
if ($p==0)$p=0;
else $p=$p;
$my = $db -> dbcount('COUNT(*)','load_files','`user` = '.$ya['id'].'');
echo '<div class="levo"><a href="new.php" class="levo_tuch">'.$diz -> img('load/new.png').' Новые файлы <span class="count"/>'.$p.'</span></a></div>';
echo '<div class="levo"><a href="my_load.php?id='.$ya['id'].'" class="levo_tuch">'.$diz -> img('load/my_load.png').' Мои файлы <span class="count"/>'.$my.'</span></a></div>';
echo '<div class="levo"><a href="poisk.php" class="levo_tuch">'.$diz -> img('search.png').' Поиск файлов</a></div>';
if ($id != 0 and $id !="" and $ya['level']>=$dir['lvl']) {
echo '<div class="levo"><a href="upload.php?id='.$id.'" class="levo_tuch">'.$diz -> img('load/edit.png').' Загрузить файл</a></div>';
echo '<div class="levo"><a href="import.php?id='.$id.'" class="levo_tuch">'.$diz -> img('load/edit.png').' Импорт файла</a></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="index.php?id='.$dirid.'">' . $req_down['name']. '</a>';
$dirid = $req_down['ifcat'];
}
krsort($tree);
$cdir = array_pop($tree);
echo '<div class="fon"><a href="index.php">Корневая</a>/';
foreach ($tree as $value) {
echo $value . '/';
}
echo '<b>'.$dir['name'].'</b></div>';
}
$count = $db -> dbcount('COUNT(*)','load_files',"`cat`='$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(*)','load_files','`infolder` LIKE "%'.$row2['ifcat'].'/'.$row2['id'].'%"');
////Счётчик новых файлов
$chet_count2 = $db -> dbcount('COUNT(*)','load_files','`infolder` LIKE "%'.$row2['ifcat'].'/'.$row2['id'].'%" and `dateupload` > '.(time()-86400).'');
if($chet_count2>0)$chet_count2='<font class="chet">+'.$chet_count2.'</font>'; else $chet_count2=null;
/////////////////
$fz = $db -> dbcount('COUNT(*)','load_files','`cat` = '.$row2['id'].'');
$rpath=null;
if($ya['level']>=4)$rpath='[<a href="func.php?mode=redraz&id='.$row2['id'].'">Ред.</a> | <a href="func.php?mode=delr&id='.$row2['id'].'">Удалить</a>]<br/>
<small>'.$row2['info'].'</small>';
echo '<div class="menu"><a href="?id='.$row2['id'].'" class="menutuch">
<table width=100%><tr valign="top"><td width=2%>'.$diz -> img('load/'.$row2['icon'].'').'</td>
<td>'.$row2['name'].' <span class="count"/>'.$chet_count.''.$chet_count2.'</span><br/>'.$rpath.'</td></tr></table></a></div>';
}
}else if($count==0 and $cocat==0)echo'<div class="fon">Категории не созданы</div>';
if ($id) {
$sql = $db -> query("SELECT `path`,`id`,`name` from `load_files` where `cat`='$id' ORDER BY `dateupload` DESC LIMIT ".$start.",".$num);
if($count>0){
while ($row = $sql -> fetch_assoc()) {
$ext = strtolower(pathinfo($row['path'], PATHINFO_EXTENSION));
$filename = pathinfo($row['path'], PATHINFO_BASENAME);
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') {
$type=''.$diz -> img('load/rar.png').'';
}
else if ($ext == 'zip') {
$type=''.$diz -> img('load/zip.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($row['path'])).'</span></td></tr></table></a></div>';
}
}else{
if($count==0 and $cocat>0)echo'<div class="fon">Файлов пока нет.</div>';}
}
$act = 'index.php?id='.$id.'';
echo $func -> pagenav($act,$page,$total);
unset($sql);
$u = $db -> query("SELECT * from `load_cat` where `id`='$id'")-> fetch_assoc();
if ($id != 0 and $id !="" and $ya['level']>=$dir['lvl']) {
echo '<div class="levo"><a href="upload.php?id='.$id.'" class="levo_tuch">'.$diz -> img('load/edit.png').' Загрузить файл</a></div>';
echo '<div class="levo"><a href="import.php?id='.$id.'" class="levo_tuch">'.$diz -> img('load/edit.png').' Импорт файла</a></div>';
}
if($id!='0'){echo '<div class="levo"><a href="./?id='.$u['ifcat'].'" class="levo_tuch">'.$diz -> img('back.png').' Назад</a></div>';}
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);
}else header('Location: '.ROOT.'aut.php');
?>