Файл: DARK WARS/dark_war/taverna/index.php
Строк: 89
<?php
include_once '../start.php';
$doc = new document();
$doc->title('Таверна');
if (isset($_POST['save'])) {
$msg = my_esc(trim($_POST['msg']));
if (!$msg) {
$doc->err('Пустое сообщение');
} else {
mysql_query("INSERT INTO `dark_war_taverna` (`id_player`, `msg`, `time`) values('{$player->id}', '$msg', '".TIME."')");
$doc->msg('Сообщение отправлено');
$_POST['msg'] = FALSE;
$_GET['msg'] = FALSE;
$_GET['smile'] = FALSE;
}
}
if (isset($_POST['smilelist'])) {
$doc->assign('post', $dispatch);
$doc->display('view_two_table.tpl');
$dispatch= array();
$dispatch[] = array ('one' => '<a href="./index.php?smile=:-O&msg='.$_POST['msg'].'"><img src='smile/angel.gif'></a>', 'two' => '<a href="./index.php?smile=*BYE*&msg='.$_POST['msg'].'"><img src='smile/bye.gif'></a>');
$dispatch[] = array ('one' => '<a href="./index.php?smile=:-D&msg='.$_POST['msg'].'"><img src='smile/biggrin.gif'></a>', 'two' => '<a href="./index.php?smile=8-)&msg='.$_POST['msg'].'"><img src='smile/cool.gif'></a>');
$dispatch[] = array ('one' => '<a href="./index.php?smile=*CRAZY*&msg='.$_POST['msg'].'"><img src='smile/crazy.gif'></a>', 'two' => '<a href="./index.php?smile=*FUCK*&msg='.$_POST['msg'].'"><img src='smile/fuck.gif'></a>');
$dispatch[] = array ('one' => '<a href="./index.php?smile=XD&msg='.$_POST['msg'] .'"><img src='smile/lol.gif'></a>', 'two' => '<a href="./index.php?smile=o_0&msg='.$_POST['msg'] .'"><img src='smile/shok.gif'></a>');
$dispatch[] = array ('one' => '<a href="./index.php?smile=*SPAM*&msg='.$_POST['msg'] .'"><img src='smile/spam_light.gif'></a>', 'two' => '<a href="./index.php?smile=*alcoholic*&msg='.$_POST['msg'] .'"><img src='smile/alcoholic.gif'></a>');
$dispatch[] = array ('one' => '<a href="./index.php?smile=*mail*&msg='.$_POST['msg'] .'"><img src='smile/mail.gif'></a>', 'two' => '<a href="./index.php?smile=*witch*&msg='.$_POST['msg'] .'"><img src='smile/girl_witch.gif'></a>');
$dispatch[] = array ('one' => '<a href="./index.php?smile=*nose*&msg='.$_POST['msg'] .'"><img src='smile/to_pick_ones_nose.gif'></a>', 'two' => '<a href="./index.php?smile=*wacko*&msg='.$_POST['msg'] .'"><img src='smile/wacko.gif'></a>');
$dispatch[] = array ('one' => '<a href="./index.php?smile=*hang*&msg='.$_POST['msg'] .'"><img src='smile/hang.gif'></a>', 'two' => '<a href="./index.php?smile=*hunter*&msg='.$_POST['msg'] .'"><img src='smile/hunter.gif'></a>');
$dispatch[] = array ('one' => '<a href="./index.php?smile=*sarcastic*&msg='.$_POST['msg'] .'"><img src='smile/sarcastic.gif'></a>');
$doc->assign('post', $dispatch);
$doc->display('view_two_table.tpl');
}
$doc->assign('method', 'post');
$doc->assign('action', null);
$dispatch= array();
if($_GET['smile'] == null)
$dispatch[] = array('type' => 'textarea', 'value' => $_POST['msg'], 'name' => 'msg', 'title' => 'Сообщение', 'br' => 1);
else
$dispatch[] = array('type' => 'textarea', 'value' => $_GET['msg'] . $_GET['smile'], 'name' => 'msg', 'title' => 'Сообщение', 'br' => 1);
$dispatch[] = array('type' => 'submit', 'name' => 'save', 'value' => 'Отправить', 'br' => 0);
$dispatch[] = array('type' => 'submit', 'name' => 'update', 'value' => 'Обновить', 'br' => 0);
$dispatch[] = array('type' => 'submit', 'name' => 'smilelist', '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_taverna`"), 0);
$pages->this_page(); // получаем текущую страницу
$dispatch = array();
$q=mysql_query("SELECT * FROM `dark_war_taverna` ORDER BY id DESC LIMIT {$pages->my_start()}, {$pages->items_per_page}");
$trans = array(":-O" => "<img src='smile/angel.gif'>",
":-D" => "<img src='smile/biggrin.gif'>",
"*BYE*" => "<img src='smile/bye.gif'>",
"8-)" => "<img src='smile/cool.gif'>",
"*CRAZY*" => "<img src='smile/crazy.gif'>",
"*FUCK*" => "<img src='smile/fuck.gif'>",
"XD" => "<img src='smile/lol.gif'>",
"o_0" => "<img src='smile/shok.gif'>",
"*SPAM*" => "<img src='smile/spam_light.gif'>",
"*alcoholic*" => "<img src='smile/alcoholic.gif'>",
"*mail*" => "<img src='smile/mail.gif'>",
"*witch*" => "<img src='smile/girl_witch.gif'>",
"*nose*" => "<img src='smile/to_pick_ones_nose.gif'>",
"*wacko*" => "<img src='smile/wacko.gif'>",
"*hang*" => "<img src='smile/hang.gif'>",
"*hunter*" => "<img src='smile/hunter.gif'>",
"*sarcastic*" => "<img src='smile/sarcastic.gif'>");
while ($post = mysql_fetch_array($q)) {
$action = array();
$ank = new player($post['id_player']);
$list = $ank->name." " . date('H:i:s', $post['time']);
$link = "/dark_war/profil.php?id=" . $ank->id . "";
$descrip = text::opis($post['msg']);
$descrip = strtr($descrip, $trans);
$action[] = array('link' => 'reply.php?id='.$post['id'].'', 'name' => 'Ответ');
if ($player->admin) {
$action[] = array('link' => "delete_msg.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("?"); // вывод страниц
if ($player->admin > 2) {
$doc->act("clear.php", "Очистить");
}
?>