Просмотр файла modules/chat/room.php

Размер файла: 2.19Kb
  1. <?php
  2. /**********************************
  3. * @package: PerfCMS *
  4. * @year: 2012 *
  5. * @author: Artas *
  6. * @link: http://perfcms.pp.ua *
  7. **********************************/
  8. $locate = 'in_chat';
  9. if(!isset($user)) { go('/'); exit;}
  10. $room_id = abs(intval($_GET['room_id']));
  11. $title = $lang->word('chat');
  12. require_once(SYS.'/view/header.php');
  13. $tpl->div('title', $lang->word('chat'));
  14. $tpl->div('menu', NAV .' <a href="/chat/room/'. $room_id .'/">'. $lang->word('refresh') .'</a><br/>
  15. '. NAV .' <a href="/chat/room/'. $room_id .'/add/">'. $lang->word('add_post') .'</a>');
  16.  
  17. $room_n = $db->query("SELECT * FROM `chat_p` WHERE `room_id` = '". $room_id ."'")->rowCount();
  18. $pages = new Paginator($room_n, $ames);
  19. if($room_n == 0)
  20. {
  21. $tpl->div('menu', $lang->word('no_posts'));
  22. }
  23. else {
  24. $room_q = $db->query("SELECT * FROM `chat_p` WHERE `room_id` = '". $room_id ."' ORDER BY time DESC LIMIT $start, $ames");
  25. while($room = $room_q->fetch()) {
  26. $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>');
  27. }
  28. $pages->view('/chat/room/'. $room_id .'/?');
  29. }
  30. if($settings['fast_mess'] == 'yes') {
  31. $tpl->div('post', '<form action="/chat/room/'. $room_id .'/add/" method="post">
  32. <textarea name="message" rows="5" cols="25">'.(isset($_GET['reply_to']) ? '[b]'.tnick($_GET['reply_to']).'[/b], ' : NULL).'</textarea>
  33. <br/>
  34. <input type="submit" name="send" value="'. $lang->word('send') .'" /><br/>
  35. </form>');
  36. }
  37. $clear_room = ''.(isset($user) && $user['level'] >= '6' ? NAV .'<a href="/chat/clear_room/?room_id='. $room_id .'">'. $lang->word('clear') .'</a><br/>' : NULL).'';
  38. $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>');
  39. require_once(SYS.'/view/footer.php');
  40. ?>