Файл: modules/news/index.php
Строк: 61
<?php
if(isset($user)) {
$locate = 'in_news';
$title = $lang->word('news');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('news'));
$news_n = $db->query("SELECT * FROM `news`")->rowCount();
$pages = new Paginator($news_n, $ames);
if($news_n == 0)
{
$tpl->div('menu', $lang->word('no_news'));
}
else {
$news_q = $db->query("SELECT * FROM `news` ORDER by time DESC LIMIT $start, $ames");
while($news = $news_q->fetch()) {
$tpl->div('menu', img('news.png') .'<a href="/news/article/'. $news['id'] .'/">'. $news['name'] .'</a> '.($user['level'] >= 6 ? '<span style="float:right">( <a href="/news/del_news/?news_id='. $news['id'] .'">'. img('delete_11.png') .'</a> | <a href="/news/edit_news/?news_id='. $news['id'] .'">'. img('edit_11.png') .'</a> )</span>' : NULL) .'');
}
$pages->view('/news/?');
}
$add_news = ''.(isset($user) && $user['level'] >= '6' ? img('edit.png') .'<a href="/news/add_news/">'. $lang->word('add_news') .'</a><br/>' : NULL).'';
$tpl->div('block', $add_news . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
} else {
$title = 'Новости';
require_once(SYS.'/view/header.php');
$tpl->div('title', 'Новости');
$tpl->div('menu', '<center>Новости доступны только зарегистрированным пользователям!</center>');
$tpl->div('block',HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
}
?>