Файл: modules/index.php
Строк: 105
<?php
/****
* @package LiveCMS
* @link livecms.org
* @author MyZik
* @version See attached file VERSION.txt
* @license See attached file LICENSE.txt
* @copyright Copyright (C) LiveCMS Development Team
****/
$title = $cms_set['title'];
// Заголовок страницы
$module = 'homepage';
require_once(HOME .'/incfiles/header.php');
// Подключаем шапку
echo error($err);
$icons_dir = '/design/icons/mainmenu/'; // папка и иконками главной страницы
$Read = (isset($user) ? $user['read_news'] = $user['read_news'] : $user['read_news'] = 'no');
// счетчики
$news = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_news`"), 0); // новости
$mini_chat_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `mini_chat` WHERE `time` > '" . (time() - 86400) . "'"), 0); // новые сообщения в мини чате
$mini_chat = mysql_result(mysql_query("SELECT COUNT(*) FROM `mini_chat`"), 0) . ($mini_chat_new == 0 ? '' : ' <span class="red">+' . $mini_chat_new . '</span>'); // мини чат
$forum = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_topics`"), 0) . ' / ' . mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_messages`"), 0); // форум
$days = 2; // число дней
$time = $days * 60 * 60 * 24;
$forum_upd = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_forum_topics` WHERE `time_update` > '" . (time() - $time) . "'"), 0);
$forum_update = ($forum_upd > 0 ? ' / <a href="/forum/update.php"><span class="red">+' . $forum_upd . '</span></a>' : ''); // обновленные темы на форуме
$users_new = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `date_reg` > '" . (time() - 86400) . "'"), 0); // новые пользователи
$users = mysql_result(mysql_query("SELECT COUNT(*) FROM `users`"), 0) . ($users_new == 0 ? '' : ' <span class="red">+' . $users_new . '</span>'); // пользователи
$online_u = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `date_last_entry` > '" . (time() - 600) . "'"), 0); // OnLine пользователи
if (isset($_GET['read']) && isset($user)) {
mysql_query("UPDATE `users` SET `read_news` = 'yes' WHERE `id` = '" . $user['id'] . "'");
}
$q = mysql_query("SELECT * FROM `cms_news` WHERE `days_homepage` > '" . time() . "' ORDER BY `id` DESC LIMIT 1");
if (mysql_num_rows($q) == 1 && $Read == 'no') {
$res = mysql_fetch_assoc($q);
echo '<div class="title" align="right"><img src="' . $icons_dir . 'new_news.png" alt="" /> <b>' . txt($res['name']) . '</b></div>' .
'<div class="list1">' . output(txt(mb_substr($res['text'], 0, 500))) .
'<br /><a href="/news/comments.php?id=' . $res['id'] . '">' . $lang['comments'] . '</a> ' . mysql_result(mysql_query("SELECT COUNT(*) FROM `news_comments` WHERE `news_id` = '" . $res['id'] . "'"), 0) . ' | <a href="/news/">' . $lang['news_archive'] . '</a> ' . $news .
($user['id'] >= 1 ? ' | <img src="' . $icons_dir . 'read.png" alt="" /> <a href="?read">' . $lang['read_news'] . '</a>' : '') .
'</div>';
}
// вывод
echo // новости
'<div class="main"><img src="' . $icons_dir . 'news.png" alt="" /> <a href="/news/">' . $lang['news'] . '</a> [' . $news . ']</div>' .
// мини чат
'<div class="main"><img src="' . $icons_dir . 'mini_chat.png" alt="" /> <a href="/mini_chat/">' . $lang['mini_chat'] . '</a> [' . $mini_chat . ']</div>' .
// форум
'<div class="main"><img src="' . $icons_dir . 'forum.png" alt="" /> <a href="/forum/">' . $lang['forum'] . '</a> [' . $forum . $forum_update . ']</div>' .
// faq
'<div class="main"><img src="' . $icons_dir . 'faq.png" alt="" /> <a href="/pages/faq.php">' . $lang['faq'] . '</a></div>' .
// пользователи
'<div class="main"><img src="' . $icons_dir . 'users.png" alt="" /> <a href="/user/userlist.php">' . $lang['users'] . '</a> [' . $users . '] </div>' .
// счётчик онлайна
'<div class="main"><img src="' . $icons_dir . 'users.png" alt="" /> <a href="/user/online.php">' . $lang['on_u'] . '</a> [' . $online_u . '] </div>';
require_once(HOME .'/incfiles/footer.php');
?>