Файл: DARK WARS/dark_war/forum/theme.php
Строк: 35
<?php
include_once '../start.php';
$doc = new document();
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
$doc->err('Ошибка, не выбран форум');
exit();
}
$id = (int)$_GET['id'];
$topic = mysql_fetch_assoc(mysql_query("SELECT * FROM `dark_war_forum_themes` WHERE `id` = '$id' LIMIT 1"));
$name = mysql_fetch_assoc(mysql_query("SELECT * FROM `dark_war_forum_topics` WHERE `id` = '$topic[id_topic]' LIMIT 1"));
if (!$topic) {
$doc->err('Запрос к несуществующему форуму');
exit();
}
$doc->title('Форум - ' . $topic['name']);
if ($topic['closed'] == 1) {
$doc->err('Тема закрыта для обсуждения');
}
$pages = new pages;
$pages->posts = mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_forum_messages` WHERE `id_theme` = '$topic[id]'"), 0);
$pages->this_page(); // получаем текущую страницу
$q=mysql_query("SELECT * FROM `dark_war_forum_messages` WHERE `id_theme` = '$topic[id]' ORDER BY `id` ASC LIMIT {$pages->my_start()}, {$pages->items_per_page}");
while ($post = mysql_fetch_array($q)) {
$action = array();
$ank = new player($post['id_player']);
$list = $ank->name;
$link = "/dark_war/profil.php?id=" . $ank->id . "";
$descrip = text::opis($post['msg']);
$action[] = array('link' => "reply.php?id=$post[id]", 'name' => 'Ответить');
if ($player->admin) {
$action[] = array('link' => "message_delete.php?id=$post[id]".(isset($_GET['page'])?'&page='.$_GET['page'].'' : '')."", 'name' => 'Удалить');
}
$dispatch[] = array ('title' => $list, 'link' => $link, 'descrip' => $descrip, 'action' => $action);
}
if (!$dispatch) {
$dispatch[] = array ('title' => 'В теме нет сообщений');
}
$doc->assign('post', $dispatch);
$doc->display('view_list_plus_img.tpl');
$pages->listing("?id=$id&"); // вывод страниц
if (!$topic['closed']) {
$doc->act("message_new.php?id=$id", 'Сообщение');
}
if ($player->admin > 1) {
$doc->act("theme_edit.php?id=$id", 'Действия');
}
$doc->ret("/dark_war/forum/", 'Форум');
$doc->ret("/dark_war/forum/category.php?id=$topic[id_forum]", 'К категориям');
$doc->ret("/dark_war/forum/topic.php?id=$topic[id_topic]", text::length($name['name'], 10));
?>