<?php

/* DCMS Special
 * Дата последнего редактирования 25.09.2016
 * Модифицировал densnet
 */

foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) {
    require_once "../../sys/inc/$inc.php";
}

$post = mysql_fetch_assoc(mysql_query("SELECT * FROM `mini_chat` WHERE `id` = '" . intval($_GET['post']) . "' limit 1"));
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
$page = intval($_GET['page']);

if (!$post) {
    header("Location: index.php");
    exit;
}

if (isset($_GET['act']) && $_GET['act'] == 'layp') {
    $set['title'] = 'Просмотр поста :: Cписок оставивших ляпы'; // заголовок страницы

    require_once H . 'sys/inc/thead.php';

    aut();

    #Навигация
    echo "<div class='list-group-item-null list-group-item-grey'><small>";
    echo "<a href='/' class='hint--right' data-hint='" . lang('На главную') . "'><i class='fa fa-home fa-lg'></i></a> <i class='fa fa-angle-right fa-fw'></i> ";
    echo "<a href='/modules/mini_chat/'>" . lang('Мини чат') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
    echo lang('Список ляпов');
    echo "</small></div><br />";

    echo "<div class='list-group-item-null list-group-item-grey'>";
    echo user($ank['id']) . "  ";
    echo "<small style='color: grey;'>" . date::times($post['time']) . "</small><br />";

    echo toOutput($post['msg']);
    echo "</div>";

    echo "<div class='list-group-item-null'>";
    echo lang('Cписок действий') . ':';
    echo "</div>";

    $l = mysql_query("SELECT * FROM `mini_chat_layp` WHERE `id_post` = '$post[id]'");

    while ($layp = mysql_fetch_assoc($l)) {
        $ank = get_user($layp['id_user']);

        echo "<div class='list-group-item-null'>";

        echo "<b><font color='#4C6B8F'>$ank[nick]</font></b>";

        if ($layp['dir'] == 'tomate') {
            $msg = ", кинул" . ($ank['sex'] == 0 ? "а" : "") . " [red][b]Помидор[/b][/red]";
        } elseif ($layp['dir'] == 'kraski') {
            $msg = ", заляпал" . ($ank['sex'] == 0 ? "а" : "") . " [red][b]Краской[/b][/red]";
        } elseif ($layp['dir'] == 'puli') {
            $msg = ", пальнул" . ($ank['sex'] == 0 ? "а" : "") . " [blue][b]Из Нагана[/b][/blue]";
        } elseif ($layp['dir'] == 'pchel') {
            $msg = ", посадил" . ($ank['sex'] == 0 ? "а" : "") . " [green][b]Пчелку[/b][/green]";
        } elseif ($layp['dir'] == 'scelet') {
            $msg = ", оставил" . ($ank['sex'] == 0 ? "а" : "") . " [blue][b]Скелет[/b][/blue]";
        } elseif ($layp['dir'] == 'dino') {
            $msg = ", оставил" . ($ank['sex'] == 0 ? "а" : "") . " [green][b]След ДИНОЗАВРА[/b][/green]";
        } elseif ($layp['dir'] == 'kiss') {
            $msg = ", оставил" . ($ank['sex'] == 0 ? "а" : "") . " [red][b]Поцелуйчик[/b][/red]";
        } elseif ($layp['dir'] == 'serdce') {
            $msg = ", оставил" . ($ank['sex'] == 0 ? "а" : "") . " [red][b]Сердечко[/b][/red]";
        }

        echo toOutput($msg);

        echo " <small style='color: grey;'>" . date::timek($layp['time']) . "</small>";

        echo "</div>";
        echo "<div class='hr'></div>";
    }
}

require_once H . 'sys/inc/tfoot.php';
