Esempio n. 1
0
 public static function submitChat($chatText)
 {
     if (!$_SESSION['user']) {
         throw new Exception('You are not logged in');
     }
     if (!$chatText) {
         throw new Exception('You haven\' entered a chat message.');
     }
     $chat = new ChatLine(array('author' => $_SESSION['user']['name'], 'gravatar' => $_SESSION['user']['gravatar'], 'text' => $chatText));
     $insertID = $chat->save()->insert_id;
     return array('status' => 1, 'insertID' => $insertID);
 }
Esempio n. 2
0
 public static function submitChat($chatText)
 {
     if (!$_SESSION['user']) {
         throw new Exception('You are not logged in');
     }
     if (!$chatText) {
         throw new Exception('You haven\' entered a chat message.');
     }
     $chat = new ChatLine(array('author' => Yii::app()->user->name, 'gravatar' => '123', 'text' => $chatText));
     // The save method returns a MySQLi object
     $insertID = $chat->save()->insert_id;
     return array('status' => 1, 'insertID' => $insertID);
 }
Esempio n. 3
0
 public static function submitChat($chatText, $room, $room_od)
 {
     if (!$_SESSION['user']) {
         throw new Exception('Nie jesteś zalogowany');
     }
     if (!$chatText) {
         throw new Exception('You haven\' entered a chat message.');
     }
     $ilejest = DB::query('SELECT COUNT(*) as asd FROM webchat_users WHERE gravatar="' . $room . '"')->fetch_object()->asd;
     if ($ilejest >= 1 or $room == "0") {
         $czyt = 1;
     } else {
         $czyt = 0;
     }
     $chat = new ChatLine(array('author' => $_SESSION['user']['name'], 'gravatar' => "asd", 'text' => $chatText, 'room' => $room, 'room_od' => $room_od, 'czyt' => $czyt));
     // The save method returns a MySQLi object
     $insertID = $chat->save()->insert_id;
     return array('status' => 1, 'insertID' => $insertID);
 }
Esempio n. 4
0
 public static function getChats($chat_id, $role, $timestamp_last_update = null)
 {
     $chatline = new ChatLine(array());
     $options = array('first_id' => $chat_id, 'role' => $role, 'since' => $timestamp_last_update, 'limit_paging' => 20);
     $chats = $chatline->get($options);
     return $chats;
 }