Файл: page/forum/index.php
Строк: 56
<?php
$title = 'Форум';
require_once($_SERVER["DOCUMENT_ROOT"]."/inc/head.php");
if (isset($active) && $sys['modules']['forum'] == 1) {
if ($count_forum > 0) {
echo '<div class="title">Последние темы ('.$count_forum.')</div>';
$type = 3;
/* ТОП */
$data = $connect->prepare("select * from `topic` where `top` > :time order by `top` desc");
$data->bindValue(':time', time(), PDO::PARAM_INT);
$data->execute();
$sql = $data->fetchAll();
foreach ($sql as $row) {
// количество комментариев
$count_comm = Comments::CountMess($row['id'], $type);
echo '<div class="forlink"><a href="/forum/topic/'.$row['id'].'" class="links"><img src="/img/pt.png" alt="pt">'.$row['name'].'<div class="chi">'.$count_comm.'</div></a></div>';
}
/* Последние темы */
$page = new Pagination($count_forum, 5);
$data = $connect->prepare("select * from `topic` where `top` < :time order by `up` desc limit :start, 5");
$data->bindValue(':time', time(), PDO::PARAM_INT);
$data->bindValue(':start', $page->start, PDO::PARAM_INT);
$data->execute();
$sql = $data->fetchAll();
foreach ($sql as $row) {
// количество комментариев
$count_comm = Comments::CountMess($row['id'], $type);
echo '<div class="forlink"><a href="/forum/topic/'.$row['id'].'" class="links">'.($row['status'] == 1 ? '<img src="/img/post.png" alt="post">' : '<img src="/img/locked.png" alt="locked">') . $row['name'].'<div class="chi">'.$count_comm.'</div></a></div>';
}
$page->navigation();
}
echo '<div class="title">Разделы ('.$count_forum_kat.')</div>
<div class="menu">
<div class="butt2">
<a href="/forum/add">Новая тема</a>
<a href="/forum/my">Мои темы ('.$user_forum.')</a>
<a href="/forum/search">Поиск</a>
</div>
</div>';
$stmt_count = $connect->prepare("select count(*) from `topic` where `kat` = ?");
if ($count_forum_kat == 0) {
echo '<div class="menu">Разделов нет!</div>';
} else {
$sql = $connect->query("select * from `kat` where `type` = '2' order by `id` asc")->fetchAll();
foreach ($sql as $row) {
$stmt_count->execute(array($row['id']));
$count = $stmt_count->fetchColumn();
echo '<div class="forlink"><a href="/forum/category/'.$row['id'].'" class="links"><img src="/img/top.png" alt="kat">'.$row['name'].'<div class="chi">'.$count.'</div></a></div>';
}
}
} else {
header('Location: /');
}
require($_SERVER["DOCUMENT_ROOT"]."/inc/foot.php");
?>