Файл: CMS/index.php
Строк: 75
<?php
define('CMS',TRUE);
require('core/inc.php');
$id = !empty($_GET['id']) ? num($_GET['id']) : 0;
$mod = !empty($_GET['m']) ? check($_GET['m']) : '';
$page = !empty($_GET['page']) ? num($_GET['page']) : 1;
# Кеширование списка стран
$countries = get_vars('country');
if (!$countries || !is_array($countries)) {
$countries = array();
$rows = $db->select("SELECT `tld`,`name` FROM ?_country ORDER BY `name` ASC;");
foreach($rows as $row) $countries[$row['tld']] = $row['name'];
set_vars('country', $countries);
}
# Кеширование статических страниц
$static_pages = get_vars('static_pages');
if (!$static_pages || !is_array($static_pages)) {
$rows = $db->select( "SELECT `name`,`title` FROM ?_pages WHERE `active` = '1' ORDER BY `views` DESC, `id` DESC;" );
$static_pages = array();
if (!empty($rows)) {
foreach( $rows as $row ) {
$static_pages[$row['name']] = $row['title'];
}
}
set_vars('static_pages', $static_pages);
}
# Проверка пользователей на бан и подтверждение реги
if ($is_logged) {
if (!empty($uset['users_ban'])) {
gen_red('ban', '', RND);
}
if ($config['allow_regkeys'] > 0 && $uset['users_confirmreg'] > 0 && empty($uset['users_ban'])) {
gen_red('key', '', RND);
}
}
$arr = '-';
if (!empty($mod) && file_exists( MODULES_PATH . $mod . '.php' )) {
include( MODULES_PATH . $mod . '.php' );
}
else if (!empty($mod) && array_key_exists($mod, $static_pages)) {
include( MODULES_PATH . 'static.php' );
}
else {
define('IS_INDEX',TRUE);
show_header($config['site_title']);
# Вывод последних новостей сайта
include( MODULES_PATH . 'news.inc.php' );
$db->query("DELETE FROM ?_chat_who WHERE `time` < ?", (SITE_TIME - 120));
$stat = $db->selectRow("SELECT COUNT(1) AS `blog`,
(SELECT COUNT(1) FROM ?_news) AS `news`,
(SELECT COUNT(1) FROM ?_chat_who) AS `chat`,
(SELECT COUNT(1) FROM ?_board_posts) AS `board`,
(SELECT COUNT(1) FROM ?_forums_topics) AS `topics`,
(SELECT COUNT(1) FROM ?_forums_posts) AS `posts`,
(SELECT COUNT(1) FROM ?_users_photos) AS `gallery`,
(SELECT COUNT(1) FROM ?_users_battle) AS `battle`,
(SELECT COUNT(1) FROM ?_downs WHERE `downs_cats_id` != '0' AND `downs_link` != '') AS `downs`,
(SELECT COUNT(1) FROM ?_comm_comm) AS `soo`,
(SELECT COUNT(1) FROM ?_guest) AS `guest`,
(SELECT COUNT(1) FROM ?_users) AS `users`,
(SELECT COUNT(1) FROM ?_vote) AS `votes`
FROM ?_blog_posts WHERE `blog_moders` <> '1'");
if (is_file(THEMES_PATH . $config['themes'] . '/index.tpl')) {
require_once(THEMES_PATH . $config['themes'] . '/index.tpl');
}
else {
?>
<div class="b">
<?=$show_news?><hr />
<?=$arr?> <a href="/chat/<?=gen_uri('index')?>">Чат</a> (<?=num2name($stat['chat'], $config['chat_user_name'])?>)<hr />
<?=$arr?> <a href="/blog/<?=gen_uri('index')?>">Блоги</a> (<?=$stat['blog']?>)<hr />
<?=$arr?> <a href="/forum/<?=gen_uri('index')?>">Форум</a> (<?=$stat['topics']?>/<?=$stat['posts']?>)<hr />
<?=$arr?> <a href="/gallery/<?=gen_uri('index')?>">Галерея</a> (<?=$stat['gallery']?>)<hr />
<?=$arr?> <a href="/guest/<?=gen_uri('index')?>">Гостевая</a> (<?=$stat['guest']?>)<hr />
<?=$arr?> <a href="/load/<?=gen_uri('index')?>">Зона обмена</a> (<?=$stat['downs']?>)<hr />
<?=$arr?> <a href="/gallery/<?=gen_uri('battles')?>">Фото - Битвы</a> (<?=$stat['battle']?>)<hr />
<?=$arr?> <a href="/comm/<?=gen_uri('index')?>">Сообщества</a> (<?=$stat['soo']?>)<hr />
<?=$arr?> <a href="/<?=gen_uri('userlist', '', RND)?>">Обитатели</a> (<?=$stat['users']?>)<hr />
<?=$arr?> <a href="/board/<?=gen_uri('index', '', RND)?>">Обьявления</a> (<?=$stat['board']?>)<hr />
<?=$arr?> <a href="/votes/<?=gen_uri('index', '', RND)?>">Голосования</a> (<?=$stat['votes']?>)<hr />
<?=$arr?> <a href="<?=gen_uri('shop')?>">Магазин сайта</a>
</div>
<?php
}
if ($config['show_themes'] == 1) echo '<div class="b">Диз: ' . ChangeSkin() . '</div>';
}
show_footer();
?>