
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">

        <link rel="shortcut icon" href="/style/icons/special.png" />

        <title><?= $set['title'] ?></title>

        <link rel="stylesheet" href="/style/touch/font-awesome.css">
        <link rel="stylesheet" href="/style/touch/style.css"> 
        <link rel="stylesheet" href="/style/touch/bootstrap.css">  
        <link rel="stylesheet" href="/style/touch/hint.css">

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha384-THPy051/pYDQGanwU6poAc/hOdQxjnOEXzbT+OuUAFqNqFjL+4IGLBgCJC3ZOShY" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js" integrity="sha384-Plbmg8JY28KFelvJVai01l8WyZzrYWG825m+cZ0eDDS1f7d/js6ikvy1+X+guPIB" crossorigin="anonymous"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.4/js/bootstrap.min.js" integrity="sha384-VjEeINv9OSwtWFLAtmc4JCtEJXXBub00gtSnszmspDLCtC0I4z4nqz7rEFbIZLLU" crossorigin="anonymous"></script>
        <script src="/modules/public/js/public.js"></script>    
        <script src="/style/touch/js/pushy.js"></script>

    </head> 

    <body> 
        <style>
            .horiz-menu__link:hover{
                background: #<?= $user['colorbp'] ?> !important;
            }
            span.badge {
                margin: 2px 0 2px 2px;
                zoom: 1;
                padding: 4px 6px;
                vertical-align: top;
                color: #<?php
                if (isset($user)) {
                    echo $user['color_counts'];
                } else {
                    echo '5b6e85';
                }
                ?>;
                background: #<?php
                if (isset($user)) {
                    echo $user['color_count'];
                } else {
                    echo 'd1d9e0';
                }
                ?>;
                font-weight: 700;
                -webkit-font-smoothing: antialiased;
                -moz-osx-font-smoothing: grayscale;
                font-size: 11px;
                line-height: 17px;
                height: 16px;
                border-radius: 2px;
                -o-transition: background-color 200ms linear, color 200ms linear;
                transition: background-color 200ms linear, color 200ms linear;
                float: right;
            }
            .count {
                margin: 2px 0 2px 2px;
                zoom: 1;
                padding: 4px 6px;
                vertical-align: top;
                color: #<?php
                if (isset($user)) {
                    echo $user['color_counts'];
                } else {
                    echo '5b6e85';
                }
                ?>;
                background: #<?php
                if (isset($user)) {
                    echo $user['color_count'];
                } else {
                    echo 'd1d9e0';
                }
                ?>;
                font-weight: 700;
                -webkit-font-smoothing: antialiased;
                -moz-osx-font-smoothing: grayscale;
                font-size: 11px;
                line-height: 17px;
                height: 16px;
                border-radius: 2px;
                -o-transition: background-color 200ms linear, color 200ms linear;
                transition: background-color 200ms linear, color 200ms linear;
                float: right;
            }
        </style>
        <div class="body">
            <?php
            if (isset($user)) {
                echo "<div class='header' style='background-image: linear-gradient(to bottom, #$user[colorfp] 0%,#$user[colorbs] 100%);'></div>";
            } else {
                echo "<div class='header' style='background-image: linear-gradient(to bottom, #282b36 0%, #282b36 100%);'></div>";
            }
            ?>

            <div class="content">
                <div class="size">
                    <div class="cont_left pushy-left">
                        <a href="/" class="logo"></a>
                        <?php if (isset($user)) { ?>

                            <a href="/info.php" class="list-group-item-null">
                                <?php avatar($user['id'], 40, 40); ?>
                                <span class="nick"><b><?php echo $user['nick']; ?></b></span>

                                <div class="clear"></div>
                            </a>

                            <?php
                            #уведомления о сообщениях
                            $mail = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_kont` = '$user[id]' AND `read` = '0' AND `deleted` != '$user[id]' AND `deleted` != '-1' AND `flaggedTo` = 'inbox'"), 0);
                            $jn = mysql_result(mysql_query("SELECT COUNT(*) FROM `notification` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
                            $jne = mysql_result(mysql_query("SELECT COUNT(*) FROM `events` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
                            $jnf = mysql_result(mysql_query("SELECT COUNT(*) FROM `f_journal` WHERE `id_user` = '$user[id]' AND `read` = '0'"), 0);
                            $guest = mysql_result(mysql_query("SELECT COUNT(*) FROM `myguests` WHERE `id_ank` = '$user[id]' AND `time` > '" . (time() - 86400) . "'", $db), 0);

                            $not = $jn + $jne + $jnf;
                            $friends = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends_new` WHERE `to` = '$user[id]'"), 0);

                            echo "<a href='/user/anketa/?name=$user[nick]' class='list-group-item-null list-group-item-grey'><i class='fa fa-user fa-fw'></i> " . lang('Анкета') . "</a>";

                            echo "<a href='/user/bookmark/?id=$user[id]' class='list-group-item-null list-group-item-grey'><i class='fa fa-bookmark fa-fw'></i> " . lang('Закладки') . "</a>";
                            echo "<a href='/modules/foto/$user[id]/' class='list-group-item-null list-group-item-grey'><i class='fa fa-photo fa-fw'></i> " . lang('Фотографии') . "</a>";
                            if (isset($user) && $user['id'] == $user['id']) {
                                echo "<a href='/modules/foto/ocenky.php?id=$user[id]' class='list-group-item-null list-group-item-grey'><i class='fa fa-html5 fa-fw'></i> " . lang('Оценки к фото') . "</a>\n";
                            }
                            echo "<a href='/modules/gifts/index.php?id=$user[id]' class='list-group-item-null list-group-item-grey'><i class='fa fa-gift fa-fw'></i> " . lang('Подарки') . "</a>";
                            echo "<a href='/modules/diary/user.php?id=$user[id]' class='list-group-item-null list-group-item-grey'><i class='fa fa-book fa-fw'></i> " . lang('Блоги') . "</a>";
                            echo "<a href='/user/files.php?id=$user[id]' class='list-group-item-null list-group-item-grey'><i class='fa fa-file fa-fw'></i> " . lang('Файлы') . "</a>";
                            echo "<a href='/user/friends/?id=$user[id]' class='list-group-item-null list-group-item-grey'><i class='fa fa-users fa-fw'></i> " . lang('Друзья') . " " . (($friends > 0) ? "<span class='count'>$friends</span>" : "") . "</a>";

                            if (isset($user) && $user['id'] == $user['id']) {
                                echo "<a href='/user/guests.php' class='list-group-item-null list-group-item-grey'><i class='fa fa-eye fa-fw'></i> " . lang('Гости') . " " . (($guest > 0) ? "<span class='count'>$guest</span>" : "") . "</a>";
                                echo "<a href='/user/mail/' class='list-group-item-null list-group-item-grey'><i class='fa fa-envelope fa-fw'></i> " . lang('Сообщения') . " " . (($mail > 0) ? "<span class='count'>$mail</span>" : "") . "</a>";
                                echo "<a href='/user/blacklist/' class='list-group-item-null list-group-item-grey'><i class='fa fa-ban fa-fw'></i> " . lang('Черный список') . "</a>";
                                echo "<a href='/user/notification/' class='list-group-item-null list-group-item-grey'><i class='fa fa-bell fa-fw'></i> " . lang('Уведомления') . " " . (($not > 0) ? "<span class='count'>$not</span>" : "") . "</a>";
                            }
                            echo "<a href='/user/referals/?id=$user[id]' class='list-group-item-null list-group-item-grey'><i class='fa fa-map-marker fa-fw'></i> " . lang('Рефералы') . "</a>";
                            echo "<a class='list-group-item-null list-group-item-grey' href='/user/history_login.php?id=$user[id]'><i class='fa fa-i-cursor fa-fw'></i> " . lang('История логинов') . "</a>";


                            if (access('adm_panel_show')) {
                                ?>
                                <div class="hr"></div>
                                <a href="/panel/" class="list-group-item-null list-group-item-grey"><i class="fa fa-cogs fa-fw"></i> Панель управления</a>
                                <?php
                            }
                            ?>


                            <div class="hr"></div>

                            <a href="/user/settings.php" class="list-group-item-null list-group-item-grey"><i class="fa fa-sliders fa-fw"></i> Настройки</a>
                            <a href="/exit.php" class="list-group-item-null list-group-item-grey"><i class="fa fa-sign-out fa-fw"></i> Выход</a>

                            <?php
                        } else {
                            ?>
                            <a href="/aut.php" class="list-group-item-null list-group-item-grey"><i class="fa fa-sign-in fa-fw"></i> Вход</b></a> 
                            <a href="/reg.php" class="list-group-item-null list-group-item-grey"><i class="fa fa-key fa-fw"></i> Регистрация</b></a>
                            <?php
                        }
                        ?>
                    </div>
                    <div class="site-overlay"></div>
                    <div class="site-overlay2"></div>
                    <div class="cont_center">
                        <div class="menu-btn" style="overflow: hidden;">
                            <?php
                            if (isset($user)) {
                                avatar($user['id'], 30, 30, 0, null);
                            } else {
                                echo "<i class='fa fa-sign-in' style='color: #fff;overflow: hidden;'></i>";
                            }
                            ?>
                        </div>
                        <div class="menu-btn_2" style="overflow: hidden;">
                            <?php
                            #Меняем иконки для гостя
                            if (isset($user)) {
                                echo '<i class="fa fa-sliders" style="color: #fff;"></i>';
                            } else {
                                echo "<i class='fa fa-search' style='color: #fff;'></i>";
                            }
                            ?>
                        </div>
                        <div class="title">
                            <?php
                            #Цвет текста заголовка
                            if (isset($user)) {
                                echo "<font color='#$user[colorbp]'>$set[title]</font>";
                            } else {
                                echo "<font color='#fff'>$set[title]</font>";
                            }
                            ?>
                        </div>
                        <?php
                        #Предупреждение об ограничение сайта гостем
                        if (isset($user)) {
                            echo "";
                        } else {
                            echo "<div class='list-group-item-null list-group-item-warning'>Доступ ограничен - <a href='/aut.php'>авторизуйтесь</a></div>";
                        }
                        ?>

                        <div class="cont">
                            <header>
                                <?php
                                #Выводим сообщение, уведомление
                                if (isset($_SESSION['message']{0})) {
                                    echo "<div class='bg-success-msg'>" . toOutput($_SESSION['message']) . "</div>";
                                    unset($_SESSION['message']);
                                }
                                if (isset($_SESSION['err']{0})) {
                                    echo "<div class='bg-danger'>" . toOutput($_SESSION['err']) . "</div>";
                                    unset($_SESSION['err']);
                                }
                                ?>
                            </header>

                            <?php
                            if (isset($user)) {
                                #Верхняя панель для авторизованных
                                include_once H . 'style/touch/aut.php';
                            }



                                