Файл: index.php
Строк: 108
<?php
define('GCMS',true);
#####Связь с движком######
require_once ('system/power.php');
#####Личное меню######
require_once ('styles/'.STYLE.'/hi.php');
#####Модули######
if($aut)$msg.='<div class="spisok">'.$diz -> img('styles.png').' <a href="help/pravila.php">Правила обменника</a></div>';
#############Новости#############
$maxid = $db -> dbcount('MAX(`id`)','news');
$all = $db -> query("SELECT * FROM `news` WHERE `id` = '".$maxid."' LIMIT 1");
$assoc = $all -> fetch_assoc();
if ($assoc > 0){
$text = $func -> tags($func -> smiles($assoc['new']));
$user = $assoc['user'];
if(mb_strlen($text)>80){$up='<a href="news/new'.$assoc['id'].'">[Читать далее]</a>';}
$user = $assoc['user'];
$msg .= '<div class="spisok">'.$diz -> img('news.png').'<a href="/news/"> Новости</a> ('.$func -> vremja($assoc['time']).')
</div>'.mb_substr($text,0,80).''.$up.'</br><b>Добавил: </b>'. $func -> user($user).'';
if ($assoc['onf']==1){
$pob = $db -> dbcount('COUNT(*)','forum_posts','`tema` = '.$assoc['temaonf'].'');
if ($pob==0)$pob=NULL;
else $pob=''.$pob;
$msg .= '</br><a href="./forum/tema'.$assoc['temaonf'].'">Обсудить на форуме</a> ('.$pob.')';
}elseif($assoc['onf']==2){
$pob = $db -> dbcount('COUNT(*)','comes','`where`="news" and `idwh` = '.$assoc['id'].'');
$msg .= '</br><a href="news/com'.$assoc['id'].'">Комментарии</a> ('.$pob.')';
}
}
//////////////////////////////////////////////////
if($aut==true){
$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'].'');
$msg .= '<div class="levo">'.$diz -> img('load/new.gif').' <a href="new.php">Новые файлы</a> (<span style="color:red">'.$p.'</span>)</br>
'.$diz -> img('load/edit.gif').' <a href="upload.php">Загрузить файл</a></br>
'.$diz -> img('load/my_load.png').' <a href="./my_load.php?id='.$ya['id'].'">Мои файлы</a> ('.$my.')</br>
'.$diz -> img('load/poisk.png').' <a href="./poisk.php">Поиск файлов</a></div>';}
if ($id) {$count = $db -> dbcount('COUNT(`id`)','load_files','`cat`='.$id.'');}else{
///====================
$count = $db -> dbcount('COUNT(`id`)','load_cat');}
$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;
////==================
$sqli = $db -> query("SELECT `id` FROM `load_cat` WHERE `id` = '".$id."' LIMIT 1");
if ($id!="" and $sqli -> num_rows == 0){$msg .='Папка не существует!';}else{
if ($id=='0' or $id=="") {
$sql2 = $db -> query("SELECT * from `load_cat` ORDER BY `sid` ASC LIMIT ".$start.",".$num);
if($count>0){
$i=1;
while ($row2 = $sql2 -> fetch_assoc()) {
$fz = $db -> dbcount('COUNT(*)','load_files','`cat` = '.$row2['id'].'');
$fzn = $db -> dbcount('COUNT(*)','load_files','`cat` = '.$row2['id'].' and `dateupload` > '.(time()-86400).'');
if ($fzn==0)$fzn=NULL;
else $fzn='+ '.$fzn;
$sz = $db -> dbcount('SUM(`size`)','load_files','`cat`='.$row2['id'].'');
if($ya['level']>=4){$adm='[<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>';}
$msg .='<div class="post">'.$diz -> img('load/'.$row2['icon'].'').' <a href="index.php?id='.$row2['id'].'">'.htmlspecialchars(str_replace('*', '', $row2['name'])).'</a> ('.$fz.'<span style="color:red">'.$fzn.'</span>)
'.$func->size($sz).' '.$adm.'</div>';
}
}else{$msg .='<div class="spisok">Папки пока не созданы</div>';}}
if ($id) {
$sql = $db -> query("SELECT * from `load_files` where `cat`='$id' ORDER BY `dateupload` DESC LIMIT ".$start.",".$num);
$count2 = $db -> dbcount('COUNT(`id`)','load_files',"`cat`='$id'");
if($count2>0){
while ($row = $sql -> fetch_assoc()) {
$ext = strtolower(pathinfo($row['infolder'], PATHINFO_EXTENSION));
$filename = pathinfo($row['infolder'], PATHINFO_BASENAME);
if ($ext == 'gif' || $ext == 'jpeg' || $ext == 'jpg' || $ext == 'png') {
$type=''.$diz -> img('load/img.gif').'';
}
else if ($ext == 'mp3' || $ext == 'wav') {
$type=''.$diz -> img('load/mp3.gif').'';
}
else if ($ext == 'jar') {
$type=''.$diz -> img('load/jar.png').'';
}
else if ($ext == 'txt') {
$type=''.$diz -> img('load/byb.gif').'';
}
else if ($ext == '3gp' || $ext == 'avi' || $ext == 'mp4' || $ext == 'flv') {
$type=''.$diz -> img('load/video.gif').'';
}
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.gif').'';
}
$msg .= '<div class="spisok">'.$type.' <a href="./view/'.$row['id'].'/">'.htmlspecialchars($row['name']).'</a> ('.$func -> size(filesize($row['infolder'])).')<br/> </table></div>';
}
}else{$msg .='Файлов в данной папке пока нет!';}
}
if ($id) {$act = 'index.php?id='.$id.'';
}else{$act = 'index.php?';}
if($aut==true){
$msg .= $func -> pagenav($act,$page,$total);}
unset($sql);
}
$u = $db -> query("SELECT * from `load_cat` where `id`='$id'")-> fetch_assoc();
if($id!='0'){$msg .= '<div class="levo">'.$diz -> img('back.png').' <a href="./?id='.$u['ifcat'].'">Назад</a></div>';}
if ($id=='0' or $id=="") {
if($ya['level']>=4){$msg .= '<div class="tochechki">'.$diz -> img('r.png').' <a href="func.php?mode=new&id='.$id.'">Создать папку</a></div>';}
}
$guest = $db -> dbcount('COUNT(*)','guest');
$res2 = $db -> query("SELECT * FROM `guest`");
while($agu = $res2 -> fetch_assoc()){
if (strftime("%d.%m.%Y",$agu['time']) == date("d.m.Y"))
$cgu++;
}
if($cgu>0){
$cg= '+'.$cgu.'';}
$msg .='<div class="spisok">'.$diz -> img('guest.png').' <a href="guest/">Гостевая книга</a> ('.$guest.'<span style="color:red">'.$cg.'</span>)</div>';
#####Статистика######
require_once ('styles/'.STYLE.'/foot.php');
#####Копирайт#######
require_once ('system/kopy.php');
#####Баннеры#######
$rekl3 = $db -> query("SELECT `url`,`title`,`img` FROM `reklama` WHERE `poz`='0' and `type`='ban' and `time` > '".time()."'");
if ($rekl3 -> num_rows > 0) {
while ($rek3 = $rekl3 -> fetch_assoc()) {
$msg .= '<a href="http://'.$rek3['url'].'"><img src="http://'.$rek3['img'].'" alt="'.$rek3['title'].'" /></a> ';
}
}
####ноги сайта
$diz -> out($msg);
?>