Файл: CMS/adm/index.php
Строк: 192
<?php
define('CMS',TRUE);
define('ROOT','../');
require('../core/inc.php');
define('EMPTY_ADS',TRUE); // Отключили рекламу в админке
define('IS_ADMINKA',TRUE); // Отключили запись онлайн в админке
if (!$is_logged) {
redirect('/?' . RND);
}
if (!empty($config['admin_auth'])) {
$cur_date = date('d');
if (!empty($_POST['pswd']) && $_POST['pswd'] == $config['admin_auth']) {
$_SESSION[SP]['admin'][$cur_date] = md5($config['admin_auth']);
}
else if (empty($_SESSION[SP]['admin'][$cur_date]) || md5($config['admin_auth']) <> $_SESSION[SP]['admin'][$cur_date]) {
show_header('');
$form = new cmsForm();
$form->addCode(blink('Внимание!') . ' Доступ только по паролю<br />');
$form->addText('Ваш пароль:','pswd');
echo $form->Submit('ОК');
show_footer();
exit();
}
}
if (is_admin()) {
$id = !empty($_GET['id']) ? (int) $_GET['id'] : 0;
$mod = !empty($_GET['m']) ? (string) $_GET['m'] : '';
$page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$onpage = 10;
switch($mod):
case 'ban': case 'ban_user': case 'edit_ban': case 'ban_history':
include(ENGINE.'/admin/ban.php');
break;
case 'blog': case 'blogs': case 'blog_edit_cat': case 'blog_del_cat': case 'blog_edit': case 'blog_move': case 'moders':
include(ENGINE.'/admin/blog.php');
break;
case 'board': case 'boards': case 'board_edit_cat': case 'board_del_cat': case 'board_edit': case 'board_move': case 'board_moders':
include(ENGINE.'/admin/board.php');
break;
case 'chat': case 'reply_chat': case 'quote_chat': case 'clear_chat':
include(ENGINE.'/admin/chat.php');
break;
case 'journal': case 'journals': case 'journal_edit_cat': case 'journal_del_cat': case 'journal_edit': case 'journal_move': case 'moders_journal':
include(ENGINE.'/admin/journal.php');
break;
case 'load': case 'cats': case 'downs': case 'del_cats':
case 'new_file': case 'edit_file': case 'del_file': case 'del_files': case 'move_files':
include(ENGINE.'/admin/loads.php');
break;
case 'down_upload':
include(ENGINE.'/admin/down_upload.php');
break;
case 'forum': case 'edit_forum': case 'del_forum': case 'forums':
case 'edit_topic': case 'move_topic': case 'act_topic': case 'topic': case 'edit_post':
include(ENGINE.'/admin/forum.php');
break;
case 'present': case 'add_present': case 'edit_present':
include(ENGINE.'/admin/present.php');
break;
case 'news': case 'add_news': case 'edit_news':
include(ENGINE.'/admin/news.php');
break;
case 'guest': case 'reply_guest': case 'edit_guest': case 'clear_guest':
include(ENGINE.'/admin/guest.php');
break;
case 'gallery': case 'edit_photos':
include(ENGINE.'/admin/gallery.php');
break;
case 'users': case 'users_edit': case 'users_del':
include(ENGINE.'/admin/users.php');
break;
case 'votes': case 'new_votes': case 'edit_votes': case 'history_votes':
include(ENGINE.'/admin/votes.php');
break;
case 'soo': case 'soo_list': case 'soo_edit': case 'soo_del':
include(ENGINE.'/admin/soo.php');
break;
default:
if ( @file_exists( ENGINE . '/admin/' . $mod . '.php' )) {
include( ENGINE . '/admin/' . $mod . '.php' );
}
else {
if (is_admin(array(101))) {
if (!empty($_GET['clear_cache'])) {
deldir( ENGINE . '/cache' );
$inSes->addMessage('Кеш успешно очишен!', 'ok');
redirect('?' . RND);
}
}
//$stat = get_vars('stats_admin', 900);
//if (!$stat || !is_array($stat)) {
$days = (SITE_TIME-86400 * 3);
$stat = array();
$stat = $db->selectRow("SELECT COUNT(1) AS `chat`,
(SELECT COUNT(1) FROM ?_ads) AS `ads`,
(SELECT COUNT(1) FROM ?_users WHERE `users_level` >= 101 AND `users_level` <= 105) AS `admins`,
(SELECT COUNT(1) FROM ?_anecdots) AS `anek`,
(SELECT COUNT(1) FROM ?_comments) AS `comm`,
(SELECT COUNT(1) FROM ?_comm_comm) AS `soo`,
(SELECT COUNT(1) FROM ?_users WHERE `users_ban` = 1 AND `users_timeban` > ?) AS `ban`,
(SELECT COUNT(1) FROM ?_blog_posts) AS `all_blog`,
(SELECT COUNT(1) FROM ?_blog_posts WHERE `blog_time` > ?) AS `new_blog`,
(SELECT COUNT(1) FROM ?_board_posts) AS `all_board`,
(SELECT COUNT(1) FROM ?_board_posts WHERE `board_time` > ?) AS `new_board`,
(SELECT SUM(`forums_topics`) FROM ?_forums) AS `topics`,
(SELECT SUM(`forums_posts`) FROM ?_forums) AS `posts`,
(SELECT COUNT(1) FROM ?_journal_posts) AS `all_journal`,
(SELECT COUNT(1) FROM ?_journal_posts WHERE `journal_time` > ?) AS `new_journal`,
(SELECT COUNT(1) FROM ?_users_photos) AS `gall`,
(SELECT COUNT(1) FROM ?_guest) AS `guest`,
(SELECT SUM(`cats_count`) FROM ?_downs_category WHERE `cats_upload` = 1) AS `all_loads`,
(SELECT COUNT(1) FROM ?_downs WHERE `downs_time` > ? AND `downs_cats_id` != '0') AS `new_loads`,
(SELECT COUNT(1) FROM ?_news) AS `news`,
(SELECT COUNT(1) FROM ?_present_files) AS `pres`,
(SELECT COUNT(1) FROM ?_users WHERE `users_confirmreg` > 0) AS `reglist`,
(SELECT COUNT(1) FROM ?_users) AS `all_users`,
(SELECT COUNT(*) FROM ?_users WHERE `users_joined` > UNIX_TIMESTAMP(CURDATE())) AS `new_users`,
(SELECT COUNT(1) FROM ?_vote) AS `vote`
FROM ?_chat;", SITE_TIME, $days, $days, $days, (SITE_TIME-86400 * 5));
$stat = array_map('intval', $stat);
$stat['blog'] = !empty($stat['new_blog']) ? num($stat['all_blog']) . '/+' . num($stat['new_blog']) : num($stat['all_blog']);
$stat['board'] = !empty($stat['new_board']) ? num($stat['all_board']) . '/+' . num($stat['new_board']) : num($stat['all_board']);
$stat['forum'] = num($stat['topics']) . '/' . num($stat['posts']);
$stat['journal'] = !empty($stat['new_journal']) ? num($stat['all_journal']) . '/+' . num($stat['new_journal']) : num($stat['all_journal']);
$stat['loads'] = !empty($stat['new_loads']) ? num($stat['all_loads']) . '/+' . num($stat['new_loads']) : num($stat['all_loads']);
$stat['users'] = !empty($stat['new_users']) ? num($stat['all_users']) . '/+' . num($stat['new_users']) : num($stat['all_users']);
//set_vars('stats_admin', $stat);
//}
show_header('Панель управления');
?>
<div class="b">
<b>Модератор</b><br />
- <a href="?m=chat">Админ-чат</a> (<?=$stat['chat']?>)<br />
- <a href="?m=guest">Управление гостевой</a> (<?=$stat['guest']?>)<br />
- <a href="?m=gallery">Управление галереей</a> (<?=$stat['gall']?>)<br />
- <a href="?m=forum">Управление форумом</a> (<?=$stat['forum']?>)<br />
- <a href="?m=blog">Управление блогами</a> (<?=$stat['blog']?>)<br />
- <a href="?m=board">Управление объявлениями</a> (<?=$stat['board']?>)<br />
<? if (is_admin(array(101, 102, 103))) { ?>
</div><div class="b">
<b>Старший модер</b><br />
- <a href="?m=ban">Список забаненых</a> (<?=$stat['ban']?>)<br />
- <a href="?m=adminlist">Список старших</a> (<?=$stat['admins']?>)<br />
- <a href="?m=reglist">Список ожидающих</a> (<?=$stat['reglist']?>)<br />
- <a href="?m=comments">Управление ком-ми</a> (<?=$stat['comm']?>)<br />
<? } ?>
<? if (is_admin(array(101, 102))) { ?>
</div><div class="b">
<b>Администратор</b><br />
- <a href="?m=news">Управление новостями</a> (<?=$stat['news']?>)<br />
- <a href="?m=journal">Управление журналом</a> (<?=$stat['journal']?>)<br />
- <a href="?m=anek">Управление анекдотами</a> (<?=$stat['anek']?>)<br />
- <a href="?m=users">Управление юзерами</a> (<?=$stat['users']?>)<br />
- <a href="?m=phpinfo">PHP-информация</a> (<?=phpversion()?>)<br />
- <a href="?m=jobs">Управление заданиями</a><br />
- <a href="?m=load">Управление загрузками</a> (<?=$stat['loads']?>)<br />
- <a href="?m=present">Управление подарками</a> (<?=$stat['pres']?>)<br />
- <a href="?m=votes">Управление голосованием</a> (<?=$stat['vote']?>)<br />
- <a href="?m=soo">Управление сообществами</a> (<?=$stat['soo']?>)<br />
- <a href="?m=status">Управление статусами</a><br />
- <a href="?m=mat">Управление матом</a><br />
<? } ?>
<? if (is_admin(array(101))) { ?>
</div><div class="b">
<b>Суперадмин</b><br />
- <a href="?m=ads">Реклама</a> (<?=$stat['ads']?>)<br />
- <a href="?clear_cache=1">Очистка кэша</a><br />
- <a href="?m=set">Настройки сайта</a><br />
- <a href="?m=static">Статические страницы</a><br />
<? if ($log == $config['nickname']) { ?>
- <a href="?m=backup">Архивация и восстановление</a><br />
<? } ?>
<? } ?>
</div>
<?php
$row = $db->selectRow("SELECT `users_level` FROM ?_users WHERE `users_login` = ? LIMIT 1;", $config['nickname']);
if (!empty($row)) {
if ($row['users_level'] <> 101) {
?>
<div class="message_warning"><b><span style="color:#ff0000">Внимание!!! Cуперадминистратор не имеет достаточных прав!</span></b><br />
Профилю назначен уровень доступа <b><?=$row['users_level']?> - <?=user_status($row['users_level'])?></b></div>
<?php
}
}
else {
?>
<div class="message_warning"><b><span style="color:#ff0000">Внимание!!! Отсутствует профиль суперадмина</span></b><br />
Профиль администратора <b><?=$config['nickname']?></b> не задействован на сайте</div>
<?php
}
if ( @file_exists($_SERVER['DOCUMENT_ROOT'] . '/install.php') && !empty($config['nickname'])) {
?>
<div class="message_warning"><b><span style="color:#ff0000">Внимание!!! Необходимо удалить файл install.php</span></b><br />
Наличие этого файла может нарушить безопасность сайта. Удалите его прямо сейчас!</div>
<?php
}
}
break;
endswitch;
show_footer();
}
else {
redirect('/?' . RND);
}
?>