require_once api_get_path(SYS_CODE_PATH) . 'chat/chat_functions.lib.php'; echo saveMessage($_REQUEST['message'], api_get_user_id(), api_get_course_info(), api_get_session_id(), api_get_group_id(), true); } if (api_get_setting('allow_global_chat') == 'false') { exit; } $to_user_id = isset($_REQUEST['to']) ? $_REQUEST['to'] : null; $message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null; if (!isset($_SESSION['chatHistory'])) { $_SESSION['chatHistory'] = array(); } if (!isset($_SESSION['openChatBoxes'])) { $_SESSION['openChatBoxes'] = array(); } $chat = new Chat(); if (chat::disableChat()) { exit; } if ($chat->is_chat_blocked_by_exercises()) { // Disconnecting the user $chat->setUserStatus(0); exit; } switch ($action) { case 'chatheartbeat': $chat->heartbeat(); break; case 'closechat': $chat->close(); break; case 'sendchat':