<?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">';



echo '<div class="catSides"><a href="/"><i class="md-format-list-bulleted"></i> Главная </a> - Список смайлов / <a href="bbcodes">Список BB кодов</a></div>';
if (isset($_GET['del'])) {
if ($b['level'] < 3) {
header('location: /');
}
$arr = DB::$dbs->queryFetch("SELECT * FROM smiles WHERE id = ? LIMIT 1", [abs((int)$_GET['del'])]);
if (!empty($arr['id'])) {
unlink($_SERVER['DOCUMENT_ROOT'].'/assets/smiles/'.$arr['file']);
DB::$dbs->query("DELETE FROM smiles WHERE id = ?", [$arr['id']]);
header('location: ?');
}
}
$look = DB::$dbs->querySingle("SELECT COUNT(id) FROM smiles");
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 smiles ORDER BY id ASC LIMIT $start,$num");
while($a = $sql->fetch()){
echo '<div class="row text_box"> '.($b['level'] > 2 ? '[<a href="?del='.$a['id'].'">Удл</a>]':NULL).' <img src="/assets/smiles/'.$a['file'].'" alt="not found"/> -   '.$a['name'].'</div>';
}
if ($k_page>1) {
str('?', $k_page,$page);
}

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


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