| @@ 69-73 (lines=5) @@ | ||
| 66 | ||
| 67 |     function deleteMsgAction($messageId) { | |
| 68 | $result = new Server\Result(); | |
| 69 |         if (!\Users\User::$cur->isAdmin()) { | |
| 70 | $result->success = false; | |
| 71 | $result->content = 'Вы не админ'; | |
| 72 | $result->send(); | |
| 73 | } | |
| 74 | $msg = Chats\Chat\Message::get((int) $messageId); | |
| 75 |         if (!$msg) { | |
| 76 | $result->success = false; | |
| @@ 88-92 (lines=5) @@ | ||
| 85 | ||
| 86 |     function banUserAction($messageId) { | |
| 87 | $result = new Server\Result(); | |
| 88 |         if (!\Users\User::$cur->isAdmin()) { | |
| 89 | $result->success = false; | |
| 90 | $result->content = 'Вы не админ'; | |
| 91 | $result->send(); | |
| 92 | } | |
| 93 | $msg = Chats\Chat\Message::get((int) $messageId); | |
| 94 |         if (!$msg) { | |
| 95 | $result->success = false; | |
| @@ 122-126 (lines=5) @@ | ||
| 119 | $result->content = 'Такого чата не существует'; | |
| 120 | $result->send(); | |
| 121 | } | |
| 122 |         if (!Users\User::$cur->id) { | |
| 123 | $result->success = false; | |
| 124 | $result->content = 'Вы не авторизованы'; | |
| 125 | $result->send(); | |
| 126 | } | |
| 127 |         if (empty($_POST['chat-message']) || !trim($_POST['chat-message'])) { | |
| 128 | $result->success = false; | |
| 129 | $result->content = 'Сообщение не может быть пустым'; | |