<?php
require_once('../classes/body.class.php');
require_once('../classes/db.class.php');
require_once('../classes/system.class.php');
$title= new Body;
$title->SetTitle('Панель управления - Модерация гарантов');
$title->GetHeader();
if ($b['level'] < 4) {
header('location:/');
die();
}
echo '<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-widgets"></i><a href="/"style="text-decoration:none; color:white;"> Главная</a> :: <a href="/administration/"style="text-decoration:none; color:white;"> Дата-центр</a> :: Модерация гарантов</div></div></div>';
if (isset($_GET['da'])) {
$in = DB :: $dbs -> queryFetch("SELECT * FROM garant WHERE id = ? LIMIT 1",[intval($_GET['da'])]);
DB :: $dbs -> query ("UPDATE garant SET type = ? WHERE id = ?",[1,abs(intval($_GET['da']))]);
lenta(Nick($b['id']).' добавил '.Nick($in['user_id']).' в список гарантов.');
header('location: ?');
}
if (isset($_GET['net'])) {
DB :: $dbs -> query ("DELETE FROM garant WHERE id = ?",[abs(intval($_GET['net']))]);
header('location: ?');
}
$look = DB :: $dbs -> querySingle("SELECT COUNT(id) FROM garant WHERE type = ?",[0]);
$num = 10;
$k_page = k_page($look, $num);
$page = page($k_page);
$start = $num*$page-$num;
if ($look == 0) {
err('Нет гарантов на модерации!');
} else {
$query = DB :: $dbs -> query("SELECT * FROM garant WHERE type = ? ORDER BY id DESC LIMIT $start,$num",[0]);
while ($a = $query -> fetch()) {
echo '<div class="list-group-item media"><i class="zmdi zmdi-shuffle"></i> <a href="/garants/view.php?id='.$a['id'].'"> Гарант '.$a['nick'].'</a></br><i class="zmdi zmdi-shuffle"></i> <a href="?da='.$a['id'].'"> [Подтвердить]</a> / <a href="?net='.$a['id'].'">[Отклонить]</a></div>';
}
if ($k_page>1) {
str('?', $k_page,$page);
}
}
$title->GetMenu();
$title->GetFooter();
?>
