<?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();
if ($b['level'] == 0) {
header('location:/');
die();
}
$pay = DB::$dbs->querySingle("SELECT COUNT(*) FROM pay WHERE type = ?", [3]);
$out = DB::$dbs->querySingle("SELECT COUNT(*) FROM billing_out WHERE type = ?", [0]);
$count = DB ::$dbs->querySingle("SELECT COUNT(id) FROM billing_rekl WHERE type = ?",[0]);
$bill = $count + $out + $pay;

$garant = DB ::$dbs->querySingle("SELECT COUNT(id) FROM garant WHERE type = ?",[0]);
$reits = DB :: $dbs -> querySingle("SELECT COUNT(id) FROM arbitage WHERE status = ?",[1]);
$jal = DB::$dbs->querySingle("SELECT COUNT(id) FROM `complaint` WHERE `read` = ?", [1]);

echo'<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-camera-alt"></i> Модератор <font color="red"><b>(level >=1)</b></font></div></div></div><div class="tile">';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="rulls.html"> <i class="zmdi zmdi-shuffle"></i>  Правила модераторов </a></ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="fort.html"> <i class="zmdi zmdi-shuffle"></i> Админ форум (' . DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `adm_topic`") . '/' . DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `adm_mess`") . ')</a> </ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="narlist.html"> <i class="zmdi zmdi-shuffle"></i> Список нарушений (' . DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `nar`") . ') </a> </ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="banlist.html"> <i class="zmdi zmdi-shuffle"></i> Бан лист (' . DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `ban`") . ') </a> </ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="searip.html"> <i class="zmdi zmdi-shuffle"></i> Поиск по IP </a> </ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="complaint.html"> <i class="zmdi zmdi-shuffle"></i> Модерация жалоб (' . DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `complaint`") . ''.(!empty($jal) ? '<font color="red">/+'.$jal.'</font>':NULL).') </a> </ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="rating.html"> <i class="zmdi zmdi-shuffle"></i> Модерация рейтинга  ('.$reits.') </a></ul>';
if ($b['level']>2) {
echo '<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-camera-alt"></i> Администратор <font color="red"><b>(level >=2)</b></font></div></div></div>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="tickets.html"> <i class="zmdi zmdi-shuffle"></i> Модерация тикетов ('.DB::$dbs->querySingle("SELECT COUNT(id) FROM support WHERE type = ?", [1]).'/'.DB::$dbs->querySingle("SELECT COUNT(id) FROM support WHERE type = ?", [2]).') </a> </ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="codes.html"> <i class="zmdi zmdi-shuffle"></i> Модерация кодов ('.DB::$dbs -> query('SELECT `id` FROM `codes_code` WHERE `check` = "0"')  -> rowCount().')</a> </ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="rekl.html"> <i class="zmdi zmdi-shuffle"></i> Модерация рекламы ('.$count.')</a></ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="files.html"> <i class="zmdi zmdi-shuffle"></i> Модерация файлов ('.DB::$dbs -> query('SELECT `id` FROM `downs` WHERE `mod` = "1"')  -> rowCount().') </a></ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="otzyvy.html"> <i class="zmdi zmdi-shuffle"></i> Модерация отзывов  ('.DB::$dbs->querySingle("SELECT COUNT(id) FROM otzyvy WHERE activ = ?", [0]).') </a></ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="garant.html"> <i class="zmdi zmdi-shuffle"></i> Модерация гарантов ('.$garant.')</a></ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="moderation.html"> <i class="zmdi zmdi-shuffle"></i> Модерация пользователей ('.DB::$dbs->querySingle("SELECT COUNT(id) FROM blogger WHERE activ = ?", [1]).') </a></ul>';
}

if ($b['level']>3) {
echo '<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-camera-alt"></i> Гл. Администратор <font color="red"><b>(level >=3)</b></font></div></div></div>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="news.html"> <i class="zmdi zmdi-shuffle"></i> Управление новостями</a> </ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="smiles.html"> <i class="zmdi zmdi-shuffle"></i> Управление смайлами</a> </ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="/rules.html"> <i class="zmdi zmdi-shuffle"></i> Управление правилами </a></ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="log_votes.html"> <i class="zmdi zmdi-shuffle"></i> Логи голосовавших (Загруз-центр)</a></ul>';
}

if ($b['level']>4) {
echo '<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-camera-alt"></i> Разработчик <font color="red"><b>(level >=4)</b></font></div></div></div>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="billing.html"><i class="zmdi zmdi-shuffle"></i> Модерация биллинга '.($bill > 0 ? '(<font color="red">'.$bill.'</font>)':NULL).'</a></ul>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="send.html"><i class="zmdi zmdi-shuffle"></i> Просмотр почты (' . DB::$dbs -> querySingle ("SELECT COUNT(*) FROM `letters`") . '/<font color="red">' . DB::$dbs->querySingle ("SELECT COUNT(*) FROM `letters` WHERE `data`> ?", [time()-86400]) . '</font>)</a></ul>';
}
echo '<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-camera-alt"></i> Лишние модули <font color="red"><b>(level >=5)</b></font></div></div></div>';
$us = DB::$dbs->querySingle("SELECT count(id) FROM `blogger` WHERE `last` > ?", [time()-3600]);
$g = DB::$dbs->querySingle("SELECT count(*) FROM `guests` WHERE `date` > ?", [time()-3600]);
$vse = $us + $g;



echo'<div class="tile"><div class="tile-body"><div class="bg-blue count-box"><div class="row">
<a href="online"style="text-decoration:none; color:white;"><div class="col-sm-3 col-xs-6"><div class="cb-item"><h3 style="text-decoration:none; color:white;">'.$vse.'</h3><small>Онлайн</small></div></div></a>
<a href="#"style="text-decoration:none; color:white;"><div class="col-sm-3 col-xs-6"><div class="cb-item"><h3 style="text-decoration:none; color:white;">0</h3><small>Пусто</small></div></div></a>
<a href="admin"style="text-decoration:none; color:white;"><div class="col-sm-3 col-xs-6"><div class="cb-item"><h3 style="text-decoration:none; color:white;">'.DB::$dbs->querySingle("SELECT COUNT(*) FROM blogger WHERE level > ?", [0]).'</h3><small>Состав</small></div></div></a>
<a href="#"style="text-decoration:none; color:white;"><div class="col-sm-3 col-xs-6"><div class="cb-item"><h3 style="text-decoration:none; color:white;">0</h3><small>Пусто</small></div></div></a></div></div>';


$title->GetMenu();
$title->GetFooter();
?>