<?
include_once "../SYSTEM/include/functions.php";
include_once "../SYSTEM/include/mysql.php";
include_once "../SYSTEM/include/param.php";
include_once "../SYSTEM/include/ban.php";
include_once "../SYSTEM/include/sess.php";
include_once "../SYSTEM/include/ban_2.php";
include_once "../SYSTEM/include/theme.php";
$title='Новости';
$mesto='Читает новости';
head();

echo "<div class=\"h\">Новости</div><hr />\n";

if ($mail_in_new>0)echo "<div class=\"privat\"><img src=\"../SYSTEM/themes/$them/img/mail0.gif\" alt=\"\" /> <a href=\"../mail.php?act=in\">Приват</a> [$mail_in_new]</div><hr />\n";

$q = mysql_query("SELECT COUNT(*) FROM `$mysql[pref]news`;");
if (mysql_result($q, 0)>0)
{
$q = mysql_query("SELECT * FROM `$mysql[pref]news` ORDER BY `id` DESC LIMIT 1;");
$news = mysql_fetch_array($q);

mysql_query("UPDATE `$mysql[pref]news` SET `times_read` = '".++$news['times_read']."' WHERE `id` = '$news[id]';");

echo "<div class=\"mess\">\n";
echo "<b>$news[title]</b><br />\n";
echo "<span style=\"color:$color[post_time]\">[".vremja($news['time']+$timesdvig)."]</span><br />";

echo "<span style=\"color:$color[post]\">".smiles($news['text'])."</span>";
echo "</div>\n";

$q = mysql_query("SELECT COUNT(*) FROM `$mysql[pref]news` WHERE `id` = '$news[id]' AND `id_t` <> '0';");
if (mysql_result($q, 0)>0) {
$q = mysql_query("SELECT COUNT(*) FROM `$mysql[pref]forum_p` WHERE `id_f` = '$id_news_forum' AND `id_r` = '$id_news_razd' AND `id_t` = '$news[id_t]';");
echo "<a href=\"".BASEDIR."forum/index.php?id_forum=$id_news_forum&amp;id_razd=$id_news_razd&amp;id_them=$news[id_t]\">Обсудить</a> <a href=\"".BASEDIR."forum/index.php?id_forum=$id_news_forum&amp;id_razd=$id_news_razd&amp;id_them=$news[id_t]&amp;page=end\">[".mysql_result($q, 0)."]</a><br />\n";
} else {
$q = mysql_query("SELECT COUNT(*) FROM `$mysql[pref]news_komm` WHERE `id_n` = '$news[id]';");
echo "<a href=\"komm.php\">Комментарии</a> <a href=\"komm.php?page=end\">[".mysql_result($q, 0)."]</a><br />\n";
}
echo "Прочитано $news[times_read] ".plural_form($news['times_read'], "раз", "раза", "раз").".<br />\n";
}
else
{
echo "Нет новостей<br />\n";
}
echo "<hr />\n";


echo "<a href=\"../index.php\">&lt;&lt; На главную</a>\n";
foot();
?>
