@@ -25,6 +25,9 @@ discard block |
||
| 25 | 25 | Online::setOnlineStatus($conn->userId); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + /** |
|
| 29 | + * @param ConnectionInterface $conn |
|
| 30 | + */ |
|
| 28 | 31 | public function setID($conn) { |
| 29 | 32 | session_id($conn->WebSocket->request->getCookies()['PHPSESSID']); |
| 30 | 33 | @session_start(); |
@@ -117,11 +120,19 @@ discard block |
||
| 117 | 120 | return $obSidebar->loadSideBar($data); |
| 118 | 121 | } |
| 119 | 122 | |
| 123 | + /** |
|
| 124 | + * @param string $data |
|
| 125 | + * @param boolean $para |
|
| 126 | + */ |
|
| 120 | 127 | public function onConversation($data, $para) { |
| 121 | 128 | $obConversation = new Conversation(); |
| 122 | 129 | return $obConversation->conversationLoad($data, $para); |
| 123 | 130 | } |
| 124 | 131 | |
| 132 | + /** |
|
| 133 | + * @param string $data |
|
| 134 | + * @param boolean $para |
|
| 135 | + */ |
|
| 125 | 136 | public function onReceiver($data, $para) { |
| 126 | 137 | $obReceiver = new Receiver(); |
| 127 | 138 | return $obReceiver->receiverLoad($data, $para); |
@@ -94,6 +94,9 @@ |
||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | |
| 97 | + /** |
|
| 98 | + * @param string $value |
|
| 99 | + */ |
|
| 97 | 100 | public function onError($key, $value) |
| 98 | 101 | { |
| 99 | 102 | $this->flag = 1; |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | $query = "INSERT INTO register VALUES(null, '$email', '$username', '$password')"; |
| 65 | 65 | if (!$this->connect->query($query)) { |
| 66 | 66 | return json_encode( |
| 67 | - [ |
|
| 68 | - "Error" => "You are not registered, ".$this->connect->error |
|
| 69 | - ] |
|
| 67 | + [ |
|
| 68 | + "Error" => "You are not registered, ".$this->connect->error |
|
| 69 | + ] |
|
| 70 | 70 | ); |
| 71 | 71 | } |
| 72 | 72 | $query = "SELECT id FROM register WHERE email = '$email'"; |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | Session::put('start', $userId); |
| 88 | 88 | return json_encode( |
| 89 | - [ |
|
| 89 | + [ |
|
| 90 | 90 | "location" => getenv('APP_URL')."/views/account.php" |
| 91 | - ] |
|
| 91 | + ] |
|
| 92 | 92 | ); |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -75,6 +75,11 @@ |
||
| 75 | 75 | return "Failed"; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | + /** |
|
| 79 | + * @param string $identifier |
|
| 80 | + * @param string $reply |
|
| 81 | + * @param string $time |
|
| 82 | + */ |
|
| 78 | 83 | public function updateMessages($query, $identifier, $reply, $userId, $time) |
| 79 | 84 | { |
| 80 | 85 | if ($result = $this->connect->query($query)) { |
@@ -9,11 +9,11 @@ |
||
| 9 | 9 | |
| 10 | 10 | $server = IoServer::factory( |
| 11 | 11 | new HttpServer( |
| 12 | - new WsServer( |
|
| 13 | - new Chat() |
|
| 14 | - ) |
|
| 15 | - ) |
|
| 16 | - , |
|
| 17 | - 8080 |
|
| 18 | - ); |
|
| 12 | + new WsServer( |
|
| 13 | + new Chat() |
|
| 14 | + ) |
|
| 15 | + ) |
|
| 16 | + , |
|
| 17 | + 8080 |
|
| 18 | + ); |
|
| 19 | 19 | $server->run(); |