View file social/sys/inc/news_main.php

File size: 913B
<?
$q = mysql_query("SELECT * FROM `news` WHERE `main_time` > '".time()."' ORDER BY `id` DESC LIMIT 1");

if (mysql_num_rows($q) == 1 && !$set['web'] && $user['news_read'] == 0)
{
	$news = mysql_fetch_assoc($q);
	echo '<div class="panel-title">';
	echo ' <a href="/news/news.php?id=' . $news['id'] . '">' . text($news['title']) . '</a><span class="pull-right"> ' . vremja($news['time']) . '</span>';
	echo '</div>';

	echo '<div class="panel-news">';
	echo output_text($news['msg']) . '<br />';
	
	if ($news['link']!=NULL)
	echo '<a href="' .htmlentities($news['link'], ENT_QUOTES, 'UTF-8').'">Подробности</a><br />';

	echo '<span class="badge pull-right"> ' . mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `id_news` = '$news[id]'"),0) . ' </span>';
	
	if (isset($user))
	echo '<a href="?news_read"> Скрыть Новость</a><br>';
	echo '</div>';
}
?>