<?php
#Виджет сообщений из чата

$k_post = $db->super_query("SELECT COUNT(id) as count FROM mini_chat");
$k_post = $k_post['count'];
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$limit = $user['set_chat_str'];
$q = $db->query("SELECT * FROM `mini_chat` ORDER BY id DESC LIMIT $limit");

echo "<div class='list-group-item-null'>\n";
if ($db->num_rows($q) != 0) {

    while ($post = $db->get_row($q)) {
        if ($post['id_user'] == 0) {
            $ank['id'] = 0;
            $ank['pol'] = 'guest';
            $ank['level'] = 0;
        } else {
            $ank = get_user($post['id_user']);
        }

        echo "<a href='/id$ank[id]'><b><font color='#4C6B8F'>$ank[nick]</font></b></a> ";
        echo '<small style="color: grey;">' . date::times($post['time']) . '</small><br />';

        echo toOutput(utf8_substr($post['msg'], 200)) . "\n";
        echo "<hr>";
    }
} else {
    echo "<small style='color: grey;'>" . lang('Начните беседу') . "...</small>";
}
?>
<form method='post' action='/modules/mini_chat/?<?= $passgen ?>'>
    <div class="input-group">
        <input type="text" class="form-control" name='msgs' placeholder="Введите сообщение...">
        <span class="input-group-btn">
            <button class="btn btn-secondary">Отправить</button>
        </span>
    </div>
</form>
</div>
























