<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include_once($root . '/core/base.php');
include_once($root . '/core/func.php');
include_once($root . '/core/head.php');
falseauth();
if ($u['id_castle'] < 1) {
header('Location:/castle?');
exit();
}
$set['p_str'] = 15;
$k_post = $base->query("SELECT COUNT(*) FROM `castle_journal` WHERE `id_castle`='" . $u['id_castle'] . "' ")->fetchColumn();
$k_page = $Navigator->k_page($k_post, $set['p_str']);
$page = $Navigator->page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$q = $base->query("SELECT * FROM `castle_journal` WHERE `id_castle`='" . $u['id_castle'] . "' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
if ($k_post == 0)
echo Func::div('error center') . 'Пусто';
echo "<div class='info '>";
$out = DB::getInstance()->query("SELECT * FROM `castle_journal` WHERE `id_castle`='" . $u['id_castle'] . "' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
$i = 0;
foreach ($out as $key => $user_notification) {
$i++;
echo Func::span('quality_5') . ($i + $start) . '. ' . SPAN_CLOSE . $user_notification['text'] . Func::div('center') . Func::span('grey') . tl(time() - $user_notification['time']) . ' назад' . DIV_CLOSE . SPAN_CLOSE;
echo div('razriv1 marg_s_5') . DIV_CLOSE;
}
if ($k_post > 15) {
str('?', $k_page, $page); // Вывод страниц
}
echo DIV_CLOSE;//close div chat
href_link('castle', '/images/icons/back.png', 'Вернуться в замок ');
include_once($root . '/core/foot.php');