<?php

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

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

$doc->Title('Иконки');

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

aut();
err();
only_reg();
?>
<style>
    .adv_user_link{
        float:left;
        border:1px solid #ccc;
        -webkit-border-radius:4px;
        border-radius:4px;
        padding:10px !important;
        text-decoration:none;
        margin-right:5px;
        background:#f7fafa;
        background:-webkit-gradient(linear,left top,left bottom,from(#f7fafa),to(#edeef0));
    }
    .oh{
        overflow:hidden;
    }
</style>
<?php

#Навигация
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='/?umenu'>" . lang('Кабинет') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='/modules/shop/'>" . lang('Магазин') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo lang('Иконки');
echo "</small></div><br />";

if (!isset($_GET['get'])) {
    echo "<div class='list-group-item-null'>";
    echo "<ul class='nav nav-pills'>";
    echo "<li class='nav-item'><a class='nav-link active'>" . lang('Купить') . "</a></li>";
    echo "<li class='nav-item'><a class='nav-link' href='?get=my_icons'>" . lang('Мои иконки') . "</a></li>";
    echo "</ul>";
    echo "</div>";

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

    $x = 0;
    while ($x++ < 125) {
        echo '<a href="pay.php?id=' . $x . '"><span class="icon_s"><img src="png/' . $x . '.png" class="adv_user_link wa mt_m"></span></a>';
    }

    echo '</div>';
    echo '</div>';
} else {
    echo "<div class='list-group-item-null'>";
    echo "<ul class='nav nav-pills'>";
    echo "<li class='nav-item'><a class='nav-link' href='?'>" . lang('Купить') . "</a></li>";
    echo "<li class='nav-item'><a class='nav-link active'>" . lang('Мои иконки') . "</a></li>";
    echo "</ul>";
    echo "</div>";

    $icon = mysql_fetch_assoc(mysql_query("SELECT * FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'  LIMIT 1"));

    if (empty($icon)) {
        $doc->NoResult();
    } else {
        echo "<div class='list-group-item-null'>";

        echo "<span style='float: right;' id='hides'><a href='?get=my_icons&amp;delete' class='hint--left' data-hint='" . lang('Удалить иконку') . "'><i class='fa fa-trash-o fa-fw'></i></a></span>";
        echo lang('Иконка') . ': <img src="png/' . $icon['id_icon'] . '.png" /><br />';

        if ($icon['time'] > $time) {
            echo lang('Осталось') . ': ' . date::time($icon['time']) . '';
        } else {
            echo lang('Осталось') . ': <i>' . lang('срок истек') . '</i>';
        }

        if (isset($_GET['delete'])) {
            mysql_query("DELETE FROM `user_icon` WHERE `id_user` = '" . $user['id'] . "'");
            header('Location: index.php?get=my_icons' . SID);
            $_SESSION['message'] = lang('Иконка успешно удалена');
        }
        echo '</div>';
        echo "<div class='hr'></div>";
    }
}

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