Файл: modules/news/article.php
Строк: 62
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$locate = 'in_news';
$news_id = abs(intval($_GET['id']));
# if no article go home
if($db->query("SELECT * FROM `news` WHERE `id` = '". $news_id ."' LIMIT 1")->rowCount() == 0)
{
redirect('/news/');
}
# fetch article
$news = $db->query("SELECT * FROM `news` WHERE `id` = '". $news_id ."' LIMIT 1")->fetch();
# include header
$title = $news['name'] .' | '._t('news');
include_header($title);
$tpl->div('title', $news['name']);
# show article
$tpl->div('post', output($news['text']) .'<br/></div><div class="news">'.nick($news['user_id']) . ' <br/>('.rtime($news['time']).')');
# navigation
$tpl->div('block', NAV .'<a href="/news/comments/'. $news_id .'">'. _t('comments') .'</a> ('. $db->query("SELECT * FROM `news_comms` WHERE `news_id` = '". $news_id ."'")->rowCount() .')<br/>' . NEWS_ICON .' <a href="/news/">'. _t('news') .'</a><br/>' . HICO .' <a href="/">'. _t('home').'</a>');
include_footer();
?>