Файл: CMS/comm/comm_forum_print.php
Строк: 53
<?php
if (!defined('CMS')) { die('Access Denied!'); }
$data = '';
$data = $db->selectRow("SELECT ?_comm_comm.*, ?_comm_category.*
                       FROM ?_comm_comm LEFT JOIN ?_comm_category 
                       ON ?_comm_comm.`comm_cats_id` = ?_comm_category.`cats_id` 
                       WHERE `comm_url` = ? LIMIT 1;", $soo);
if (empty($data) || !is_array($data)) {
    $inSes->addMessage('Ошибка! Сообщество не найдено или ссылка неверна!');
    gen_red('index', '', RND);
}
if (empty($data['comm_forum'])) {
    $inSes->addMessage('Ошибка! Форум не найден или ссылка неверна!');
    gen_red('index', '', RND);
}
$arr_admins = @explode(',', $data['comm_admins']);
$users = array();
if ($is_logged) {
    $users = $db->selectRow("SELECT * FROM ?_comm_users WHERE `cu_comm` = ? AND `cu_user` = ? LIMIT 1;", $data['comm_id'], $log);
    if ($data['comm_user'] == $log) {
        $is_admin_soo = true;
    }
    if (in_array($log, $arr_admins) && $users['cu_admin'] == 1) {
        $is_moder_soo = true;
    }
}
if ($data['comm_status'] == 1 && empty($users)) {
    $inSes->addMessage('Форум только для участников сообщества!');
    gen_red('index', '', RND);
}
$row = $db->selectRow("SELECT `t`.*, `f`.`forums_id`, `f`.`forums_name`
                       FROM ?_comm_topics `t`
                       LEFT JOIN ?_comm_forums `f`
                       ON `t`.`topics_forums_id` = `f`.`forums_id`
                       WHERE `t`.`topics_id` = ? AND `t`.`topics_comm` = ? LIMIT 1;", $id, $data['comm_id']);
if (!empty($row)) {
    $soo_href = gen_uri('index', '', RND);
    $forum_href = gen_uri('forum', '', RND);
    $cat = '<a href="' . gen_uri('forum', $row['forums_id'], RND) . '">' . $row['forums_name'] . '</a>';
    $url = '<a href="' . gen_uri('topic', $row['topics_id'], RND) . '">' . $row['topics_title'] . '</a>';
    $date = get_date($row['topics_last_time'], 'j F Y');
    header('Content-type:text/html; charset=utf-8');
echo <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
body,td { font-family: verdana, arial, sans-serif; color: #666; font-size: 80%; }
h1,h2,h3,h4 { font-family: verdana, arial, sans-serif; color: #666; font-size: 100%; margin: 0px; }
img {border:0}
</style>
<title>Форум {$data['comm_name']}> Версия для печати > {$row['topics_title']}</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<table border="0" width="100%" cellspacing="1" cellpadding="3">
<tr>
<td width="100%">
<a href="{$soo_href}">Сообщество</a> > <a href="{$forum_href}">Форум</a> > {$cat} > {$url}
<hr><h1>{$row['topics_title']}</h1><br /><small>{$date}. Разместил: {$row['topics_author'] }</small></td>
</tr>
<tr>
<td width="100%">
HTML;
    $rows = $db->select("SELECT * FROM ?_comm_posts
                         WHERE `posts_topics_id` = ?
                         ORDER BY `posts_time` ASC;", $id);
    $i = 0;
    foreach($rows as $data) {
        echo ++$i . '. <b>' . nickname($data['posts_user']) . '</b> (' . get_date($data['posts_time'], 'j.m.Y H:i') . ')<br />';
        echo nl2br(bb_code($data['posts_text'])) . '<br /><br />';
    }
echo <<<HTML
<hr>
<a href="javascript:history.go(-1)">Вернуться назад</a>
</td>
</tr>
</table>
</body>
</html>
HTML;
exit;
}
else {
    $inSes->addMessage('Ошибка! Выбранная вами тема не существует, возможно она была удалена!');
    gen_red('forum', '', RND);
}
?>