예제 #1
0
 public function listAction()
 {
     if (Request::isAjax() && Request::isPost()) {
         $user = UsersPDO::get(AuthModel::getUserName());
         $receiverId = $_POST['receiverId'];
         $model = new ChatModel($user['Id']);
         $result = $model->getChat($receiverId);
         $this->renderJSON($result);
     }
 }
예제 #2
0
 public function load()
 {
     parent::load();
     $this->Filter = new FilterWordsModel();
     $m = new ChatModel();
     if ($this->isPost() && isset($_POST['text'])) {
         $text = stripslashes(htmlspecialchars(trim($_POST['text'])));
         if ($text != "") {
             $m->SendToChat($this->data['name'], $this->player->playerId, $text);
         }
     }
     $m->DeleteOldChat();
     $this->chats = $m->GetFromChat();
     $m->dispose();
 }
예제 #3
0
 public static function ActionSaveMessage($chatId)
 {
     ChatModel::saveMessage($chatId, 1, $_POST['message']);
     exit('ok');
     if (UserModel::isUserLoggedIn() and ChatModel::isUserInChat($chatId, UserModel::getUserId())) {
     }
 }
예제 #4
0
 public function load()
 {
     parent::load();
     $this->Filter = new FilterWordsModel();
     $m = new ChatModel();
     $this->chats = $m->GetFromChat();
     $storCtat = array();
     while ($this->chats->next()) {
         $text = $this->Filter->FilterWords($this->chats->row['text']);
         $storCtat[$this->chats->row['ID']] = array(date("g:i A", $this->chats->row['date']), $this->chats->row['username'], $text, $this->chats->row['userid']);
     }
     ksort($storCtat);
     foreach ($storCtat as $ChatLine) {
         echo "<div class=\"msgln\">(" . $ChatLine[0] . ") <b><a href=\"profile.php?uid=" . $ChatLine[3] . "\" target=\"_blank\">" . $ChatLine[1] . "</a></b>: " . $ChatLine[2] . "<br></div>";
     }
     $m->dispose();
 }
예제 #5
0
 function load()
 {
     parent::load();
     $this->Filter = new FilterWordsModel();
     $m = new ChatModel();
     $this->chats = $m->GetFromChat();
     $storCtat = array();
     while ($this->chats->next()) {
         $text = $this->Filter->FilterWords($this->chats->row['text']);
         $storCtat[$this->chats->row['ID']] = array(date('g:i A', $this->chats->row['date']), $this->chats->row['username'], $text, $this->chats->row['userid']);
     }
     ksort($storCtat);
     foreach ($storCtat as $ChatLine) {
         echo '<div class="msgln">(' . $ChatLine[0] . ') <b><a href="profile.php?uid=' . $ChatLine[3] . '" target="_blank">' . $ChatLine[1] . '</a></b>: ' . $ChatLine[2] . '<br></div>';
     }
     $m->dispose();
 }
 public static function ActionCreateChat($userId)
 {
     $chatId = ChatModel::findChatByMembers($userId, UserModel::getUserId());
     if ($chatId) {
         header('Location: /dialog/' . $chatId);
     } else {
         $chatId = ChatModel::createChat($userId, UserModel::getUserId());
         header('Location: /dialog/' . $chatId);
     }
 }
예제 #7
0
 public function updateuseronlineAction()
 {
     $model = new ChatModel();
     $cur_user_id = getSession('user', false);
     $time = time();
     $query .= "UPDATE `users` SET `dateLast` =  '" . time() . "'  WHERE `id` = '" . $cur_user_id . "';";
     $model->multiQuery($query);
     exit;
 }