<?php
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->GetHeader();
echo '<div class="container-fluid page_header"><div class="container"><div class="row"><div class="col-xs-12 col-sm-8 col-md-9 col-lg-9"><h1>Главная обменника </h1><ol class="breadcrumb" xmlns:v="http://'.homeurl.'/#"><li typeof="v:Breadcrumb"><a href="/" rel="v:url" property="v:title">'.homeurl.'</a></li><li class="active" typeof="v:Breadcrumb"><span property="v:title">Загруз-центр</span></li></ol></div></div></div></div>';
echo'<div class="container page_body"><div class="row"><div class="col-xs-12 page_content col-lg-9"><div class="navbar page_content_navbar collapse hidden-lg"><div class="container-fluid"><div class="navbar-collapse"></div></div></div><div class="text_box hidden-lg pr_block_small hidden"></div><div class="container-fluid cols_table">';

$newkom = DB::$dbs->querySingle("SELECT count(id) FROM `down_komm` WHERE `time` > ?", [time()-86400]);
echo'<div class="catSides"><a href="/"><i class="md-format-list-bulleted"></i> Главная </a> - Загруз-центр</div>';

$date = time() - 3600 * 72;
$newfiles = DB::$dbs->querySingle("SELECT COUNT(id) FROM `downs` WHERE `time` > ? AND `mod` = ?", [$date,0]);
echo'<ul class="nav nav-pills nav-stacked"><li><a href="newkomm.html"><i class="md-question-answer"></i> Новые комментарии '.$nkom = ($newkom > 0 ? '('.$newkom.'</b>)':NULL).'</a></ul>';
echo'<ul class="nav nav-pills nav-stacked"><li><a href="search.html"><i class="md-search"></i> Поиск скриптов </a></ul>';
echo'<ul class="nav nav-pills nav-stacked"><li><a href="newfiles.html"><i class="md-refresh"></i> Свежие загрузки ('.$newfiles.')</a></ul>';
echo'<div class="catSides"><i class="md-format-list-bulleted"></i> Список категорий</div>';
if (DB::$dbs->querySingle("SELECT count(id) FROM `down_r`")== 0){
echo '<div class="error">Категорий нет</div>';
} else {
$query = DB::$dbs -> query("SELECT * FROM `down_r` ORDER BY `id` ASC");
while ($row = $query -> fetch()) {
echo '<ul class="nav nav-pills nav-stacked"><li><a href="show_dir.html?id='.$row['id'].'"> <i class="md-folder"></i>  '.$row['name'].'  ('.DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `downs` WHERE `rid`= ? AND `mod` = ?", [$row['id'],0]).')</a></ul><div class="row text_box">'.$row['opis'].'</div>';}
}

///Подключаем меню
$title->GetMenu();


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