<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
$set['title']='Новости';
include_once '../sys/inc/thead.php';
title();
aut();
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `news2`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `news2` ORDER BY `id` DESC LIMIT $start, $set[p_str]");
echo "<table class='post'>";
if ($k_post==0)echo "<div class='p_m'>Нет новостей.</div>";
while ($post = mysql_fetch_assoc($q))
{
echo "<tr><td class='p_t'>$post[title](".vremja($post['time']).")</td></tr><tr><td class='p_m'>";
echo output_text($post['msg'])."<br>";
if ($post['link']!=NULL)echo "<a href='".htmlentities($post['link'], ENT_QUOTES, 'UTF-8')."'>Подробности</a><br>";
echo "<a href='komm.php?id=$post[id]'>Комментарии</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm2` WHERE `id_news` = '$post[id]'"),0).")<br></td></tr>";
}
echo "</table>";
if (user_access('adm_news'))
echo "&raquo;<a href='/adm_panel/news2.php'>Добавить новость</a><br>";
if ($k_page>1)str('index.php?',$k_page,$page);
include_once '../sys/inc/tfoot.php';
?>
