Файл: DARK WARS/dark_war/forum/category.php
Строк: 21
<?php
include_once '../start.php';
$doc = new document();
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
$doc->err('Ошибка, не выбран форум');
exit();
}
$id = (int)$_GET['id'];
$forum = mysql_fetch_assoc(mysql_query("SELECT * FROM `dark_war_forum` WHERE `id` = '$id' LIMIT 1"));
if (!$forum) {
$doc->err('Запрос к несуществующему форуму');
exit();
}
$doc->title('Форум - ' . $forum['name']);
$q=mysql_query("SELECT * FROM `dark_war_forum_topics` WHERE `id_forum` = '$forum[id]'");
while ($post = mysql_fetch_array($q)) {
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_forum_themes` WHERE `id_topic` = '$post[id]'"), 0);
$count2 = mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_forum_messages` WHERE `id_topic` = '$post[id]'"), 0);
$list = $post['name'] . " ($count/$count2)";
$img = '/dark_war/all_img/forum/category.png';
$link = "topic.php?id=" . $post['id'] . "";
$descrip = $post['description'];
$dispatch[] = array ('title' => $list, 'img' => $img, 'link' => $link, 'descrip' => $descrip, 'ico_size' => 32);
}
if (!$dispatch) {
$dispatch[] = array ('title' => 'Нет категорий');
}
$doc->assign('post', $dispatch);
$doc->display('view_list_plus_img.tpl');
if ($player->admin > 1) {
$doc->act("category_new.php?id=$id", 'Создать');
$doc->act("forum_edit.php?id=$id", 'Изменить');
$doc->act("forum_delete.php?id=$id", 'Удалить');
}
$doc->ret("/dark_war/forum/", 'В форум');
?>