<?php
@ini_set("max_execution_time", "600");
define('_IN_JOHNCMS', 1);
define('_IN_JOHNADM', 1);
require('../incfiles/core.php');
// Подключаем язык Админ-панели
$lng = array_merge($lng, core::load_lng('admin'));
// Проверяем права доступа
if (core::$user_rights < 1) {
    header('Location: /?err');
    exit;
}
$headmod = 'admin';
$textl = $lng['admin_panel'];
require('../incfiles/head.php');
$array = array(
    'forum',
    'news',
    'ads',
    'counters',
    'ip_whois',
    'languages',
    'settings',
    'sitemap',
    'smileys',
    'access',
    'antispy',
    'httpaf',
    'ipban',
    'antiflood',
    'ban_panel',
    'karma',
    'reg',
    'mail',
    'search_ip',
    'usr',
    'usr_adm',
    'usr_clean',
    'usr_del'
);
if ($act && ($key = array_search($act, $array)) !== false && file_exists('includes/' . $array[$key] . '.php')) {
    require('includes/' . $array[$key] . '.php');
} else {
    $regtotal = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `preg`='0'"), 0);
    $bantotal = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_ban_users` WHERE `ban_time` > '" . time() . "'"), 0);
    echo '<div class="phdr"><b>' . $lng['admin_panel'] . '</b></div>';
    // Блок пользователей
    echo '<div class="user"><p><h3>' . $lng['users'] . '</h3><ul>';
    if ($regtotal && core::$user_rights >= 6) echo '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><span class="red"><b><a href="index.php?act=reg">' . $lng['users_reg'] . '</a>&#160;(' . $regtotal . ')</b></span><br />';
    echo '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=usr">' . $lng['users'] . '</a>&#160;(' . counters::users() . ')<br />' .
        '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=usr_adm">' . $lng['users_administration'] . '</a>&#160;(' . mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `rights` >= '1'"), 0) . ')<br />' .
        ($rights >= 7 ? '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=usr_clean">' . $lng['users_clean'] . '</a><br />' : '') .
        '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=ban_panel">' . $lng['ban_panel'] . '</a>&#160;(' . $bantotal . ')' .
       (core::$user_rights >= 9 ? '&#160;<a href="/users/ban.php"><span class="red">Бан чат</span></a>' : '') .
        (core::$user_rights >= 7 ? '<br /><img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=antiflood">' . $lng['antiflood'] . '</a><br />' : '') .
        (core::$user_rights >= 7 ? '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=karma">' . $lng['karma'] . '</a><br />' : '') .
        '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="../users/search.php">' . $lng['search_nick'] . '</a><br />' .
        '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=search_ip">' . $lng['ip_search'] . '</a><br />' .
        '</ul></p></div>';
    if ($rights >= 7) {
        // Блок модулей
        $spam = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_mail` WHERE `spam`='1';"), 0);
        echo '<div class="list1"><p>';
        echo '<h3>' . $lng['modules'] . '</h3><ul>' .
            '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=forum">' . $lng['forum'] . '</a><br />' .
            '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=news">' . $lng['news'] . '</a><br />' .
            '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=ads">' . $lng['advertisement'] . '</a><br />';
        if (core::$user_rights == 9) {
            echo '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=sitemap">' . $lng['site_map'] . '</a><br />' .
                '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=counters">' . $lng['counters'] . '</a><br />' .
                '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=mail">' . $lng['mail'] . '</a>';
        }
        echo '</ul></p></div>';
        // Блок системных настроек
        echo '<div class="menu"><p>' .
            '<h3>' . $lng['system'] . '</h3>' .
            '<ul>' .
            (core::$user_rights == 9 ? '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=settings"><b>' . $lng['site_settings'] . '</b></a><br />' : '') .
            '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=smileys">' . $lng['refresh_smileys'] . '</a><br />' .
            (core::$user_rights == 9 ? '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=languages">' . $lng['language_settings'] . '</a><br />' : '') .
             (core::$user_rights == 9 ? '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="theme.php">Смена дизайна</a><br />' : '') .
            '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=access">' . $lng['access_rights'] . '</a><br />' .
            '</ul>' .
            '</p></div>';
        // Блок безопасности
        echo '<div class="gmenu"><p>' .
            '<h3>' . $lng['security'] . '</h3>' .
            '<ul>' .
            '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=antispy">' . $lng['antispy'] . '</a><br />' .
            (core::$user_rights == 9 ? '<img src="../theme/' . $set_user['skin'] . '/images/li.png" alt="*"/><a href="index.php?act=ipban">' . $lng['ip_ban'] . '</a>' : '') .
            '</ul>' .
            '</p></div>';
    }
    echo '<div class="phdr" style="font-size: x-small"><b>WMAB.Ru</b></div>';
}
require('../incfiles/end.php');