<?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="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> :: Лента новостей</div></div></div>';

if (isset($_GET['del'])) {
if ($b['level'] < 3) {
header('location: ?');
die();
}
DB::$dbs->query("DELETE FROM lenta WHERE id = ?", [abs((int)$_GET['del'])]);
header('location: ?');
die();
}
$look = DB::$dbs->querySingle("SELECT COUNT(id) FROM lenta");
if ($look == 0) {
err('Пусто...');
}
$num = 10;
$k_page = k_page($look, $num);
$page = page($k_page);
$start = $num*$page-$num;
$sql = DB::$dbs->query("SELECT * FROM lenta ORDER BY time DESC LIMIT $start,$num");
while($a = $sql->fetch()) {
$D = ($b['level'] > 4 ? '[<a href="?del='.$a['id'].'">Удл</a>] ':NULL);
echo '<div class="list-group-item media"><i class="zmdi zmdi-shuffle"></i> '.Nick(0).' ('.vr($a['time']).') '.$D.'</br>'.text($a['text']).'</div>';
}
if ($k_page > 1) {
str('?',$k_page,$page);
}
$title->GetMenu();
$title->GetFooter();
?>
