Файл: DARK WARS/dark_war/news/view.php
Строк: 38
<?php
include_once '../start.php';
$doc = new document();
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
$doc->err('Ошибка, не выбрана новость');
exit();
}
$id = (int)$_GET['id'];
$q = mysql_query("SELECT * FROM `dark_war_news` WHERE `id` = '$id' LIMIT 1");
if (!mysql_num_rows($q)) {
$doc->err('Нет такой новости');
exit();
}
$ar = mysql_fetch_assoc($q);
$doc->title($ar['name']);
$dispatch[] = array ('title' => $ar['name'], 'descrip' => text::opis($ar['description']));
$doc->assign('post', $dispatch);
$doc->display('view_list_plus_img.tpl');
$dispatch = array();
$doc->assign('method', 'post');
$doc->assign('action', "save_kom.php?id=$id");
$dispatch[] = array('type' => 'textarea', 'name' => 'msg', 'title' => 'Комментарий', 'br' => 1);
$dispatch[] = array('type' => 'submit', 'name' => 'save', 'value' => 'Отправить', 'br' => 0);
$doc->assign('dis', $dispatch);
$doc->display('form.tpl');
$dispatch = array();
$pages = new pages;
$pages->posts = mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_news_kom` WHERE `id_news` = '$id'"), 0);
$pages->this_page(); // получаем текущую страницу
$q=mysql_query("SELECT * FROM `dark_war_news_kom` WHERE `id_news` = '$id'
ORDER BY `id` DESC LIMIT {$pages->my_start()}, {$pages->items_per_page}");
while ($post = mysql_fetch_array($q)) {
$ank = new player($post['id_player']);
$list = $ank->name;
$link = "/dark_war/profil.php?id=" . $ank->id . "";
$descrip = text::opis($post['description']);
$dispatch[] = array ('title' => $list, 'link' => $link, 'descrip' => $descrip);
}
if (!$dispatch) {
$dispatch[] = array ('title' => 'Нет комментариев');
}
$doc->assign('post', $dispatch);
$doc->display('view_list_plus_img.tpl');
$pages->listing("?id=$id&"); // вывод страниц
if ($player->admin > 2) {
$doc->act("delete_news.php?id=$id", "Удалить новость");
}
$doc->ret("/dark_war/news/", "Новости");
?>