Файл: DARK WARS/dark_war/clans/board/topic.php
Строк: 75
<?php
include_once '../../start.php';
$doc = new document();
$doc->title('Таверна');
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
$doc->err('Ошибка, не выбран элемент');
exit();
}
$id = (int)$_GET['id'];
if (!isset($_GET['id_clan']) || !is_numeric($_GET['id_clan'])) {
$doc->err('Ошибка, не выбран клан');
exit();
}
$id_clan = (int)$_GET['id_clan'];
$q = mysql_query("SELECT * FROM `dark_war_clan_board` WHERE id='$id' LIMIT 1");
if (!mysql_num_rows($q)) {
$doc->err('Запрос к не существующему элементу');
exit();
}
$admin = mysql_fetch_assoc(mysql_query("SELECT * FROM `dark_war_clans_us` WHERE id_player='{$player->id}' AND `id_clan` = '$id_clan' LIMIT 1"));
if (isset($_POST['msg'])) {
$msg = my_esc(trim($_POST['msg']));
if (!$msg) {
$doc->err('Постое сообщение');
} else {
mysql_query("INSERT INTO `dark_war_clan_topic` (`id_player`, `id_clan`, `id_board`, `msg`, `time`)
values('{$player->id}', '$id_clan', '$id', '$msg', '11111')");
$doc->msg('Сообщение отправлено');
}
}
if ($ar['set_access_board'] == 0 || $admin['admin'] > 0 || $player->admin > 0) {
$doc->assign('method', 'post');
$doc->assign('action', null);
$dispatch = array();
$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');
}
$pages = new pages;
$pages->posts = mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_clan_topic` WHERE `id_clan` = '$id_clan' AND `id_board` = '$id'"), 0);
$pages->this_page();
$dispatch = array();
$q=mysql_query("SELECT * FROM `dark_war_clan_topic` WHERE `id_clan` = '$id_clan' AND `id_board` = '$id' ORDER BY id DESC 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::lead_text($post['msg']);
$action[] = array('link' => 'reply.php?id='.$post['id'].'&id_clan='.$id_clan.'', 'name' => 'Ответ');
if ($admin['admin'] > 0 || $player->admin > 1) {
$action[] = array('link' => "delete_msg.php?id=$post[id]&id_clan=$id_clan".(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&id_clan=$id_clan&"); // вывод страниц
if ($admin['admin'] > 1 || $player->admin > 0) {
$doc->act("/dark_war/clans/board/delete_board.php?id=$id&id_clan=$id_clan", 'Удалмть обсуждение');
}
$doc->ret("/dark_war/clans/board?id=$id_clan", 'В обсуждения');
?>