<?
require_once('classes/body.class.php');
require_once('classes/db.class.php');
require_once('classes/system.class.php');
$title= new Body;
$title->SetTitle(homeurl.' - Сообщество мастеров!');
$title->SetDescription(homeurl.' | Форум Wap мастеров, программистов, дизайнеров, кодеров и администраторов');
$title->SetKeywords('CMS, системы управления, '.homeurl.', модули, wap, wap cms, вап движок, мобильный двиг, cms для сайта, релизы dcms, шаблоны CMS');

///Подключаем шапку
$title->GetHeader();
$AlexCount = DB :: $dbs -> queryFetch ("SELECT * FROM `counts` WHERE `id` = '1' LIMIT 1");


echo'<div class="container page_body"><div class="row"><div class="col-xs-12 page_content col-lg-9"><div class="container-fluid cols_table">';

$news = DB :: $dbs -> queryFetch ("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 1");
echo '<div class="catSides"><i class="md-apps"></i> <a href="/news">Новости ресурса</a> - '. text ($news['name']).'</div>';
$sql = DB::$dbs->query("SELECT * FROM news ORDER BY time DESC LIMIT 1");
while($a = $sql->fetch()) {
echo '<div class="row text_box">'.text($a['txt']).'<br><a href="/news/comm.html?id='.$a['id'].'"><i class="md-comment"></i> Комментарии ('.$AlexCount['news_comm'].')</a></div>';
}
if ($b['level'] != 0) {
echo'<div class="row text_box"><a href="/panel/fort.html"><i class="md-comment"></i> Админ форум (' .$AlexCount['adm_topic']. ' <b style="COLOR:green"> +' .$AlexCount['adm_topic_new']. '</b>/' .$AlexCount['adm_mess']. ' <b style="COLOR:red"> +' .$AlexCount['adm_mess_new']. '</b>)</a></div>';
}
$it = DB :: $dbs -> queryFetch ("SELECT * FROM `gazeta_article` ORDER BY `id` DESC LIMIT 1");
$sql = DB::$dbs->query("SELECT * FROM gazeta_article ORDER BY time DESC LIMIT 1");
while($a = $sql->fetch()) {
echo '<div class="row text_box"><a href="/allnews/news.html?id='.$a['id'].'"><i class="md-dashboard"></i> '.$a['name'].' </a></div>';
}
echo'<div class="catSides"><a href="/forum"><i class="md-forum"></i> Форум - Общение / Помощь</a> <small> ( ' .$AlexCount['forum_topic']. ' <b style="COLOR:green"> +' .$AlexCount['forum_topic_new']. '</b> / ' .$AlexCount['forum_mess'].' <b style="COLOR:red">+' .$AlexCount['forum_mess_new']. ' </b>) </small></div>';


$req = DB::$dbs->query("SELECT * FROM forum_topic ORDER BY last DESC LIMIT 5");
if ($req -> rowCount() == 0) {
err('Тем еще нет!');
} else {
while($row = $req->fetch()) {
$last_mess = DB::$dbs->queryFetch("SELECT * FROM forum_mess WHERE tid = ? ORDER BY time DESC LIMIT 1", [$row['id']]);
$mess = DB::$dbs->querySingle("SELECT COUNT(id) FROM forum_mess WHERE tid = ?", [$row['id']]);
if ($mess > 10) {
$pg = ceil($mess / 10);
$st = '?page='.$pg;
} else {
$st = '';
}
echo '<div class="row"><div class="col-xs-3 col-sm-1"><div class="user_brief"><div class="userpic" style="height: 50px;padding: 4px;width: 50px;"><a href="/users/'.$row['user_id'].'"><img class="img-responsive" src="'.(user_inf($row['user_id'], 'ava') != NULL ? user_inf($row['user_id'], 'ava') : '/images/userpic.jpg').'" alt="" ></a></div></div></div><div class="col-xs-9 col-sm-8"><a class="title" href="/forum/thema'.$row['id'].$st.'">  '.$row['name'].' </a><div class="text-muted"><span> '.slv($mess, 'сообщение','сообщения','сообщений').'</span></div></div><div class="col-sm-3 text-muted text-right hidden-xs"><span data-toggle="tooltip" title="Время отправки">('.vr($last_mess['time']).')</span></div></div>';
}
}
echo'<div class="catSides"><a href="/downs"><i class="md-file-download"></i>  Загруз-центр - CMS / Модули</a> <small> (' .$AlexCount['downs']. '/<b style="COLOR:red">' .$AlexCount['downs_new']. '</b>) </small></div>';
$list_file = DB::$dbs->query("SELECT id,name,info,size,time FROM downs WHERE rid != ? ORDER BY id DESC LIMIT 3", [7]);
while($list = $list_file -> fetch()) {
$sqlScreen = DB::$dbs->queryFetch("SELECT * FROM `down_screen` WHERE `fid` = ? ORDER BY `id` DESC LIMIT 1",[$list['id']]);
$mess = DB::$dbs->querySingle("SELECT COUNT(id) FROM down_komm WHERE file = ?", [$list['id']]);
echo '<div class="row"><div class="col-xs-3 col-sm-1"><div class="user_brief"><div class="userpic" style="height: 50px;padding: 4px;width: 50px;"><a href="/'.$sqlScreen['file'].'"><img class="img-responsive" src="/'.$sqlScreen['file'].'" alt="" ></a></div></div></div><div class="col-xs-9 col-sm-8"><a class="title" href="/downs/file.html?id='.$list['id'].'"> '.$list['name'].' ('.get_size($list['size']).')</a><div class="text-muted"><span> '.slv($mess, 'Комментарий','Комментария','Комментариев').' </span></div></div><div class="col-sm-3 text-muted text-right hidden-xs"><span data-toggle="tooltip" title="Время Загрузки">('.vr($list['time']).')</span></div></div>';
}
echo'<div class="catSides"><a href="/codes"><i class="md-crop"></i> Полезные PHP коды</a> <small> (' .$AlexCount['codes_code']. '/<b style="COLOR:red">' .$AlexCount['codes_code_new']. '</b>)</small> </div>';
$list_code = DB::$dbs->query("SELECT * FROM `codes_code` WHERE `check` = ? ORDER BY `time` DESC LIMIT 3", [1]);
while($list = $list_code -> fetch()) {
$mess = DB::$dbs->querySingle("SELECT COUNT(id) FROM codes_comm WHERE cid = ?", [$list['id']]);
echo '<div class="row"><div class="col-xs-3 col-sm-1"><div class="user_brief"><div class="userpic" style="height: 50px;padding: 4px;width: 50px;"><a href="/users/'.$list['user_id'].'"><img class="img-responsive" src="'.(user_inf($list['user_id'], 'ava') != NULL ? user_inf($list['user_id'], 'ava') : '/images/userpic.jpg').'" alt="" ></a></div></div></div><div class="col-xs-9 col-sm-8"><a class="title" href="/codes/code.php?id='.$list['id'].'">  '.$list['name'].' </a><div class="text-muted"><span> '.slv($mess, 'Комментарий','Комментария','Комментариев').'</span></div></div><div class="col-sm-3 text-muted text-right hidden-xs"><span data-toggle="tooltip" title="Время добавления">('.vr($list['time']).')</span></div></div>';
}
echo '<div class="catSides"><a href="/market"><i class="md-shop"></i> Маркет - Скрипты / Дизайны </a> <small> (' .$AlexCount['magazin_file']. '/' .$AlexCount['magazin_file_new']. ')</small> </div>';
$sql = DB :: $dbs -> query ("SELECT * FROM `magazin_file` ORDER BY `time` DESC LIMIT 3");
if ($sql -> rowCount() >0) {
while($a = $sql-> fetch ()) {
$screen = DB::$dbs->queryFetch("SELECT * FROM `magazin_screen` WHERE `file` = ? ORDER BY `id` DESC LIMIT 1",[$a['id']]);
$mess = DB::$dbs->querySingle("SELECT COUNT(id) FROM magazin_komm WHERE file = ?", [$a['id']]);
$path = $_SERVER['DOCUMENT_ROOT'].'/files/mag_file/'.$a['file'];
$ext = strtolower(strrchr($path, '.'));
echo '<div class="row"><div class="col-xs-3 col-sm-1"><div class="user_brief"><div class="userpic" style="height: 50px;padding: 4px;width: 50px;"><a href="/files/mag_screen/'.$screen['screen'].'"><img class="img-responsive" src="/files/mag_screen/'.$screen['screen'].'" alt=""  ></a></div></div></div><div class="col-xs-9 col-sm-8"><a class="title" href="/market/file/'.$a['id'].'"> ' .$a['name'] . ' ('.$ext.' | '.get_size(filesize($path)).')</a><div class="text-muted"><span> '.slv($mess, 'Комментарий','Комментария','Комментариев').' </span></div></div><div class="col-sm-3 text-muted text-right hidden-xs"><span data-toggle="tooltip" title="Время добавления">('.vr($a['time']).')</span></div></div>';
}
}
else {
echo '<div class="error">Товаров пока нет..</div>';
}
echo '<div class="catSides"> <i class="md md-settings-input-antenna"></i> Партнёры сайта - Реклама</div>';
//echo '<ul class="nav nav-pills nav-stacked"><li><a href="/"><i class="md-shuffle"></i>  Партнеров нет!</a></ul>';
//echo '<ul class="nav nav-pills nav-stacked"><li><a href="http://wapcms.ru"><i class="md-shuffle"></i>  Wapcms - Новый проект!</a></ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="http://jacat.ru"><i class="md-shuffle"></i>  JaCat.Ru - Белый каталог!</a></ul>';
//echo '<ul class="nav nav-pills nav-stacked"><li><a href="http://banbase.ru"><i class="md-shuffle"></i>  Banbase.ru - черный список wap!</a></ul>';
///Подключаем меню
$title->GetMenu();

///Подключаем футер
$title->GetFooter();
?>