Guest User

Untitled

a guest
Jun 16th, 2013
50
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2.  
  3. class Controller_Chat extends Controller {
  4.  
  5.     public function action_index()
  6.     {
  7.         if($this->request->is_initial())
  8.             Request::initial()->redirect(URL::site(''));
  9.  
  10.         $content = View::factory('/chat/show')
  11.                     ->bind('chat', $chat);
  12.  
  13.         if($_POST)
  14.         {
  15.             $user = Arr::get($_POST, 'user');
  16.             $chat_msg = Arr::get($_POST, 'chat_msg');
  17.             $date = date("Y-m-d H:i:s");
  18.             Model::factory('Chat')->create_chat_msg($user, $chat_msg);
  19.         }
  20.  
  21.         $chat = Model::factory('Chat')->get_chat();
  22.         $this->response->body($content);
  23.     }
  24.  
  25. } // Comments
RAW Paste Data