Файл: CMS/core/modules/news.inc.php
Строк: 171
<?php
if (!defined('CMS')) { die('Access Denied!'); }
# Вывод последних новостей сайта
$show_news = '';
$news_type = 'link';
if (!empty($_GET['news'])) {
if (!empty($_SESSION['journal'])) unset($_SESSION['journal']);
}
if ($config['last_news'] > 0) {
$news_name = num2name($config['last_news'],array('Новости','Новости','Новость'), false);
if (!empty($_GET['journal']) || !empty($_SESSION['journal'])) {
$_SESSION['journal'] = 1;
$news = $db->selectPage($all_news, "SELECT * FROM ?_journal_posts ORDER BY `journal_id` DESC LIMIT 0, ?d", $config['last_news']);
$show_news .= ' <a href="' . gen_uri('index', '', 'news=1') . '">' . $news_name . '</a> | ';
$show_news .= '<b>Журнал</b>';
$news_type = 'all';
if (!empty($news) && $all_news > 0) {
foreach($news as $data) {
$nid = num($data['journal_id']);
$show_news .= '<br />';
if (!empty($_COOKIE['hidenews'])) {
$show_news .= icon('list.png');
$show_news .= '<a href="/journal/' . gen_uri('post', $nid, RND) . '">' . $data['journal_title'] . '</a> ';
$show_news .= '(' . $data['journal_comments'] . ') ';
$show_news .= '<a href="/news/' . gen_uri('hide', '', RND) . '">' . icon('down.png') . '</a>';
}
else {
$show_news .= icon('list.png');
$show_news .= '<a href="/journal/' . gen_uri('post', $nid, RND) . '">' . $data['journal_title'] . '</a> ';
$show_news .= '<a href="/news/' . gen_uri('hide') . '">' . icon('up.png') . '</a><br />';
$show_news .= bb_code($data['journal_text']) . '<br />';
$show_news .= '<a href="/journal/' . gen_uri('post', $nid, '#comments') . '">Комментарии</a> (' . num($data['journal_comments']) . ') ';
$show_news .= '<a href="/journal/' . gen_uri('post', $nid, '#comments') . '">»</a>';
}
}
}
else $show_news = 'Журнал еще пуст!';
$show_news .= '<br />';
}
else {
$news = $db->selectPage($all_news, "SELECT * FROM ?_news ORDER BY `news_id` DESC LIMIT 0, ?d", $config['last_news']);
$show_news .= ' <b>' . $news_name . '</b> / ';
$show_news .= '<a href="' . gen_uri('index', '', 'journal=1') . '">Журнал</a>';
$news_type = 'all';
if (!empty($news) && $all_news > 0) {
foreach($news as $data) {
$nid = num($data['news_id']);
$show_news .= '<br />';
if (!empty($_COOKIE['hidenews'])) {
$show_news .= icon('list.png');
$show_news .= '<a href="/news/' . gen_uri('news', $nid) . '">' . $data['news_title'] . '</a> (' . $data['news_comments'] . ') ';
$show_news .= '<a href="/news/' . gen_uri('hide') . '">' . icon('down.png') . '</a>';
}
else {
$show_news .= icon('list.png');
$show_news .= '<a href="/news/' . gen_uri('news', $nid) . '">' . $data['news_title'] . '</a> ';
$show_news .= '<a href="/news/' . gen_uri('hide') . '">' . icon('up.png') . '</a><br />';
$show_news .= bb_code($data['news_text']) . '<br />';
$show_news .= '<a href="/news/' . gen_uri('news', $nid, '#comments') . '">Комментарии</a> (' . num($data['news_comments']) . ') ';
$show_news .= '<a href="/news/' . gen_uri('end', $nid) . '">»</a>';
}
}
}
else $show_news = 'Новостей еще нет!';
$show_news .= '<br />';
}
}
else {
$all_news = (int) $db->selectCell("SELECT COUNT(*) FROM ?_news");
$show_news .= $arr . ' <a href="/news/' . gen_uri('index') . '">Новости</a> (' . $all_news . ')<br />';
}
?>