// XHR - writes a message to chatroom // child = room id // $_GET['m'] = message if (!$this->child || !is_numeric($this->child) || empty($_GET['m'])) { die('hey'); } $cr = ChatRoom::get($this->child); if ($cr->locked_by) { die('hey3'); } $m = new ChatMessage(); $m->room = $this->child; $m->from = $session->id; $m->msg = $_GET['m']; $m->microtime = microtime(true); $m->store(); $page->setMimeType('text/plain'); echo 'OK'; break; case 'show': // child = room id $cr = ChatRoom::get($this->child); echo '<h2>Chat in ' . $cr->name . '</h2>'; if ($cr->locked_by) { echo 'The chatroom is locked!'; return; } $div_name = 'chatroom_txt'; $form_id = 'chatfrm'; ChatRoomUpdater::init($this->child, $div_name, $form_id); $css = 'width:500px;' . 'height:300px;' . 'background-color:#eee;' . 'overflow:auto;';