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

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

only_reg();
$set['title'] = lang('Счетчики');
include_once H . 'sys/inc/thead.php';

err();
aut();


switch ((isset($_GET['count'])) ? htmlspecialchars($_GET['count']) : null) {
    default:
        #Навигация
        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='/user/settings.php'>" . lang('Настройки') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
        echo lang('Счетчики');
        echo "</small></div><br />";

        echo "<a href='?count=style' class='list-group-item-null'><font color='#$user[color_count]'><i class='fa fa-circle fa-fw'></i></font> " . lang('Цвет счетчиков') . "</a>";
        echo "<a href='?count=style_text' class='list-group-item-null'><font color='#$user[color_counts]'><i class='fa fa-circle fa-fw'></i></font> " . lang('Цвет текста') . "</a>";

        break;

    case 'style':
        $style = array(
            'ffebee', 'ffcdd2', 'ef9a9a', 'e57373', 'ef5350', 'f44336',
            'fce4ec', 'f8bbd0', 'f48fb1', 'f06292', 'ec407a', 'e91e63',
            'f3e5f5', 'e1bee7', 'ce93d8', 'ba68c8', 'ab47bc', '9c27b0',
            'ede7f6', 'd1c4e9', 'b39ddb', '9575cd', '7e57c2', '673ab7',
            'e8eaf6', 'c5cae9', '9fa8da', '7986cb', '5c6bc0', '3f51b5',
            'e3f2fd', 'bbdefb', '90caf9', '64b5f6', '42a5f5', '2196f3',
            'e1f5fe', 'b3e5fc', '81d4fa', '4fc3f7', '29b6f6', '03a9f4',
            'e0f7fa', 'b2ebf2', '80deea', '4dd0e1', '26c6da', '00bcd4',
            'e0f2f1', 'b2dfdb', '80cbc4', '4db6ac', '26a69a', '009688',
            'e8f5e9', 'c8e6c9', 'a5d6a7', '81c784', '66bb6a', '4caf50',
            'f1f8e9', 'dcedc8', 'c5e1a5', 'aed581', '9ccc65', '8bc34a',
            'f9fbe7', 'f0f4c3', 'e6ee9c', 'dce775', 'd4e157', 'cddc39',
            'fffde7', 'fff9c4', 'fff59d', 'fff176', 'ffee58', 'ffeb3b',
            'fff8e1', 'ffecb3', 'ffe082', 'ffd54f', 'ffca28', 'ffc107',
            'fff3e0', 'ffe0b2', 'ffcc80', 'ffb74d', 'ffa726', 'ff9800',
            'fbe9e7', 'ffccbc', 'ffab91', 'ff8a65', 'ff7043', 'ff5722',
            'efebe9', 'd7ccc8', 'bcaaa4', 'a1887f', '8d6e63', '795548',
            'fafafa', 'f5f5f5', 'eeeeee', 'e0e0e0', 'bdbdbd', '9e9e9e'
        );
        if (isset($_GET['ok']) && isset($_GET['color']) && $_GET['color'] < 108) {
            $st = intval($_GET['color']);
            $user['color_count'] = $style[$st];
            mysql_query("UPDATE `user` SET `color_count` = '" . $user['color_count'] . "', `panel` = '" . $st . "' WHERE `id` = '$user[id]' LIMIT 1");
            header('Location: ?count=style');
            $_SESSION['message'] = lang('Изменения сохранены');
            exit();
        }

        #Навигация
        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='/user/settings.php'>" . lang('Настройки') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
        echo "<a href='/user/counts.php'>" . lang('Счетчики') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
        echo lang('Выберите цвет');
        echo "</small></div><br />";
        ?>
        <style>
            .ovs{overflow: hidden;}
            .panels {padding: 11px 10px;}
            .panel_u{float:left}
        </style>
        <div class="list-group-item-null" style="padding-bottom:0;">Выберите цвет:</div>
        <div class="ovs list-group-item-null">
            <div class="panel_u" style="width:50%;"><div style="padding-right:5px;">
                    <?php
                    for ($i = 0; $i <= 107; $i++)
                        echo '<div style="-webkit-border-radius: 4px; border-radius: 4px; background-color:#' . $style[$i] . '; margin-bottom: 10px; " class="ovs"><a href="/user/counts.php?count=style&amp;color=' . $i . '&amp;ok" class="arrow_link" style="display:block; text-decoration:none; padding:5px;"><div class="ovs" style="height:19px; ' . ($user['color_count'] == $style[$i] ? 'background: url(/style/icons/img_p.png) center no-repeat;' : null) . ' "></div></a></div>' . ($i == 53 ? '</div></div><div class="panel_u" style="width:50%;"><div style="padding-right:5px;">' : null) . '' . ($i == 107 ? '</div></div>' : null);
                    ?>
                </div>
                <?php
                break;
            case 'style_text':
                $style = array(
                    'ffebee', 'ffcdd2', 'ef9a9a', 'e57373', 'ef5350', 'f44336',
                    'fce4ec', 'f8bbd0', 'f48fb1', 'f06292', 'ec407a', 'e91e63',
                    'f3e5f5', 'e1bee7', 'ce93d8', 'ba68c8', 'ab47bc', '9c27b0',
                    'ede7f6', 'd1c4e9', 'b39ddb', '9575cd', '7e57c2', '673ab7',
                    'e8eaf6', 'c5cae9', '9fa8da', '7986cb', '5c6bc0', '3f51b5',
                    'e3f2fd', 'bbdefb', '90caf9', '64b5f6', '42a5f5', '2196f3',
                    'e1f5fe', 'b3e5fc', '81d4fa', '4fc3f7', '29b6f6', '03a9f4',
                    'e0f7fa', 'b2ebf2', '80deea', '4dd0e1', '26c6da', '00bcd4',
                    'e0f2f1', 'b2dfdb', '80cbc4', '4db6ac', '26a69a', '009688',
                    'e8f5e9', 'c8e6c9', 'a5d6a7', '81c784', '66bb6a', '4caf50',
                    'f1f8e9', 'dcedc8', 'c5e1a5', 'aed581', '9ccc65', '8bc34a',
                    'f9fbe7', 'f0f4c3', 'e6ee9c', 'dce775', 'd4e157', 'cddc39',
                    'fffde7', 'fff9c4', 'fff59d', 'fff176', 'ffee58', 'ffeb3b',
                    'fff8e1', 'ffecb3', 'ffe082', 'ffd54f', 'ffca28', 'ffc107',
                    'fff3e0', 'ffe0b2', 'ffcc80', 'ffb74d', 'ffa726', 'ff9800',
                    'fbe9e7', 'ffccbc', 'ffab91', 'ff8a65', 'ff7043', 'ff5722',
                    'efebe9', 'd7ccc8', 'bcaaa4', 'a1887f', '8d6e63', '795548',
                    'fafafa', 'f5f5f5', 'eeeeee', 'e0e0e0', 'bdbdbd', '9e9e9e'
                );
                if (isset($_GET['ok']) && isset($_GET['color']) && $_GET['color'] < 108) {
                    $st = intval($_GET['color']);
                    $user['color_counts'] = $style[$st];
                    mysql_query("UPDATE `user` SET `color_counts` = '" . $user['color_counts'] . "', `panel` = '" . $st . "' WHERE `id` = '$user[id]' LIMIT 1");
                    header('Location: ?count=style_text');
                    $_SESSION['message'] = lang('Изменения сохранены');
                    exit();
                }

                #Навигация
                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='/user/settings.php'>" . lang('Настройки') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
                echo "<a href='/user/counts.php'>" . lang('Счетчики') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
                echo lang('Выберите цвет');
                echo "</small></div><br />";
                ?>
                <style>
                    .ovs{overflow: hidden;}
                    .panels {padding: 11px 10px;}
                    .panel_u{float:left}
                </style>
                <div class="list-group-item-null" style="padding-bottom:0;">Выберите цвет:</div>
                <div class="ovs list-group-item-null">
                    <div class="panel_u" style="width:50%;"><div style="padding-right:5px;">
                            <?php
                            for ($i = 0; $i <= 107; $i++)
                                echo '<div style="-webkit-border-radius: 4px; border-radius: 4px; background-color:#' . $style[$i] . '; margin-bottom: 10px; " class="ovs"><a href="/user/counts.php?count=style_text&amp;color=' . $i . '&amp;ok" class="arrow_link" style="display:block; text-decoration:none; padding:5px;"><div class="ovs" style="height:19px; ' . ($user['color_counts'] == $style[$i] ? 'background: url(/style/icons/img_p.png) center no-repeat;' : null) . ' "></div></a></div>' . ($i == 53 ? '</div></div><div class="panel_u" style="width:50%;"><div style="padding-right:5px;">' : null) . '' . ($i == 107 ? '</div></div>' : null);
                            ?>
                        </div>
                        <?php
                        break;
                }

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