Размер файла: 2.19Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.pp.ua *
**********************************/
$locate = 'in_chat';
if(!isset($user)) { go('/'); exit;}
$room_id = abs(intval($_GET['room_id']));
$title = $lang->word('chat');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('chat'));
$tpl->div('menu', NAV .' <a href="/chat/room/'. $room_id .'/">'. $lang->word('refresh') .'</a><br/>
'. NAV .' <a href="/chat/room/'. $room_id .'/add/">'. $lang->word('add_post') .'</a>');
$room_n = $db->query("SELECT * FROM `chat_p` WHERE `room_id` = '". $room_id ."'")->rowCount();
$pages = new Paginator($room_n, $ames);
if($room_n == 0)
{
$tpl->div('menu', $lang->word('no_posts'));
}
else {
$room_q = $db->query("SELECT * FROM `chat_p` WHERE `room_id` = '". $room_id ."' ORDER BY time DESC LIMIT $start, $ames");
while($room = $room_q->fetch()) {
$tpl->div('post', nick($room['user_id']) . ' '.($room['user_id'] != $user['id'] ? '[<a href="/chat/room/'. $room_id .'/'.($settings['fast_mess'] == 'no' ? 'add/' : NULL) .'?reply_to='.$room['user_id'].'">'. $lang->word('reply') .'</a>]':NULL) . ($user['level'] >= 6 || $user['level'] == 2 ? '<a href="/chat/del_post/?post_id='. $room['id'] .'">'. img('delete.png') .'</a>' : NULL) .' <br/>'. output($room['text']) .'<br/><small>('.rtime($room['time']).')</small>');
}
$pages->view('/chat/room/'. $room_id .'/?');
}
if($settings['fast_mess'] == 'yes') {
$tpl->div('post', '<form action="/chat/room/'. $room_id .'/add/" method="post">
<textarea name="message" rows="5" cols="25">'.(isset($_GET['reply_to']) ? '[b]'.tnick($_GET['reply_to']).'[/b], ' : NULL).'</textarea>
<br/>
<input type="submit" name="send" value="'. $lang->word('send') .'" /><br/>
</form>');
}
$clear_room = ''.(isset($user) && $user['level'] >= '6' ? NAV .'<a href="/chat/clear_room/?room_id='. $room_id .'">'. $lang->word('clear') .'</a><br/>' : NULL).'';
$tpl->div('block', ($room_n > 0 ? $clear_room : NULL) . CHAT_ICON .' <a href="/chat/">'. $lang->word('chat') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
?>