コード例 #1
0
 public function sendChat()
 {
     $from = $this->data['name'];
     $to = isset($_POST['to']) ? $_POST['to'] : "";
     $message = isset($_POST['message']) ? $_POST['message'] : "";
     $_SESSION['openChatBoxes'][$to] = date("Y-m-d H:i:s", time());
     $messagesan = $this->sanitize($message);
     if (!isset($_SESSION['chatHistory'][$to])) {
         $_SESSION['chatHistory'][$to] = "";
     }
     $_SESSION['chatHistory'][$to] .= "\t\t\t\t\t\t   {\r\n\t\t\t\t\"s\": \"1\",\r\n\t\t\t\t\"f\": \"{$to}\",\r\n\t\t\t\t\"img\": \"{$this->data['avatar']}\",\r\n\t\t\t\t\"id\": \"{$this->player->playerId}\",\r\n\t\t\t\t\"m\": \"{$messagesan}\"\r\n\t\t   },";
     unset($this->tsChatBoxes[$to]);
     $m = new PrivateChatModel();
     $m->SendToChat($from, $this->player->playerId, $this->data['avatar'], $to, $_POST['to_id'], $message);
     $m->dispose();
     echo "1";
     exit(0);
 }
コード例 #2
0
ファイル: privatechat.php プロジェクト: vcelis/tatar-wars
    function sendChat()
    {
        $from = $this->data['name'];
        $to = isset($_POST['to']) ? $_POST['to'] : '';
        $message = isset($_POST['message']) ? $_POST['message'] : '';
        $_SESSION['openChatBoxes'][$to] = date('Y-m-d H:i:s', time());
        $messagesan = $this->sanitize($message);
        if (!isset($_SESSION['chatHistory'][$to])) {
            $_SESSION['chatHistory'][$to] = '';
        }
        $_SESSION['chatHistory']->{$to} .= '' . '						   {
				"s": "1",
				"f": "' . $to . '",
				"img": "' . $this->data['avatar'] . '",
				"id": "' . $this->player->playerId . '",
				"m": "' . $messagesan . '"
		   },';
        unset($_SESSION['tsChatBoxes'][$to]);
        $m = new PrivateChatModel();
        $m->SendToChat($from, $this->player->playerId, $this->data['avatar'], $to, $_POST['to_id'], $message);
        $m->dispose();
        echo '1';
        exit(0);
    }