Файл: modules/forum/cat.php
Строк: 62
<?php
if(isset($user)) {
$locate = 'in_forum';
if(!isset($_GET['cat_id'])) { go('/forum/'); }
$cat_id = abs(intval($_GET['cat_id']));
if($db->query("SELECT * FROM `forum_c` WHERE `id` = '". $cat_id ."'")->rowCount() == 0) {
$title = $lang->word('forum');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('forum'));
$tpl->div('menu', $lang->word('subforum_not_exists'));
$tpl->div('block', img('forum.png').' <a href="/forum/">'. $lang->word('forum') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
exit;
}
$topicc = $db->query("SELECT * FROM `forum_c` WHERE `id` = '". $cat_id ."'")->fetch();
$title = $topicc['name'] .' | '.$lang->word('forum');
require_once(SYS.'/view/header.php');
$tpl->div('title', $topicc['name'] .' | '.$lang->word('forum'));
$tpl->div('post','Новые: <a href="/forum/new_topics/">'. $lang->word('new_topics').'</a> | '.'<a href="/forum/new_posts/">'. $lang->word('new_messages').'</a> | ' .' <a href="/forum/search">'. $lang->word('search') .'</a>' .(isset($user) ?' | <a href="/forum/add_topic/'. $cat_id .'/">'. $lang->word('create_topic') .'</a><br/>' : NULL));
$topic_r = $db->query("SELECT * FROM `forum_t` WHERE `cat_id` = '". $cat_id ."'")->rowCount();
$pages = new Paginator($topic_r, $ames);
if($topic_r == 0) {
echo $tpl->div('menu', $lang->word('no_topics'));
}
else {
$topic_q = $db->query("SELECT * FROM `forum_t` WHERE `cat_id` = '". $cat_id ."' ORDER BY attach DESC, time_last_post DESC LIMIT $start, $ames");
while($topic = $topic_q->fetch()) {
echo '<div class="menu">';
if ($topic['closed'] == 1 && $topic['attach'] == 1) echo img('pin-closed.png');
else if ($topic['attach'] == 1) echo img('pin.png');
else if ($topic['closed'] == 1) echo img('topic_closed.png');
else echo img('topic.png');
$topic_a = $db->query("SELECT * FROM `forum_pt` WHERE `topic_id` = '". $topic['id']."' ORDER BY time DESC LIMIT 1")->fetch();
echo '<a href="/forum/topic'. $topic['id'] .'/">'. $topic['name'] .'</a> ['. $db->query("SELECT id FROM `forum_pt` WHERE `topic_id` = '". $topic['id'] ."'")->rowCount().']<a href="/forum/topic'. $topic['id'] .'/?page=end"> »</a> '. ($user['level'] >= 5 ? ' <span style="float:right">( <a href="/forum/delete_topic/'.$topic['id'].'/">'.img('delete_11.png').'</a> | <a href="/forum/edit_topic/'.$topic['id'].'/">'.img('edit_11.png').'</a> )' : NULL) .'</span><br/> [<small class="gray">'. tnick($topic_a['user_id']).' / '. rtime($topic_a['time']).'</small>]
</div>';
}
$pages->view('/forum/cat/'. $cat_id .'?');
}
$fid = $db->query("SELECT f_id FROM `forum_c` WHERE `id` = '". $cat_id ."'")->fetchColumn();
$tpl->div('block', img('forum_1.png') . ' <a href="/forum/'. $fid .'/">'. $db->query("SELECT name FROM `forum` WHERE `id` = '". $fid ."'")->fetchColumn().'</a><br/>' .img('forum.png') . ' <a href="/forum/">'. $lang->word('forum') .'</a><br/>' . 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');
}
?>