19 declare(strict_types=1);
40 if ($use_cache && self::$connection_status !== null) {
41 return self::$connection_status;
45 self::$connection_status = $connector->isServerAlive();
47 return self::$connection_status;
53 $this->
settings->getURL(
'Heartbeat'),
68 $responseObject = json_decode(
$response,
false, 512, JSON_THROW_ON_ERROR);
70 return $responseObject instanceof
stdClass && ((
int) $responseObject->status) === 200;
82 $this->
settings->getURL(
'Connect', (
string) $scope) .
'/' . $userId
93 $credentials = $this->
settings->getAuthKey() .
':' . $this->
settings->getAuthSecret();
95 "Connection: close\r\n" .
96 "Content-Type: application/json; charset=utf-8\r\n" .
97 "Authorization: Basic " . base64_encode($credentials);
110 if (is_array($stream_context_params)) {
111 $ctx = array_merge_recursive($ctx, $stream_context_params);
114 set_error_handler(
static function (
int $severity,
string $message,
string $file,
int $line):
void {
115 throw new ErrorException($message, $severity, $severity, $file, $line);
123 restore_error_handler();
139 $this->
settings->getURL(
'CreatePrivateRoom', (
string) $scope) .
140 '/' . $subScope .
'/' . $user .
'/' . rawurlencode($title)
153 $this->
settings->getURL(
'DeletePrivateRoom', (
string) $scope) .
'/' . $subScope .
'/' . $user
178 $this->
settings->getURL(
'EnterPrivateRoom', (
string) $scope) .
'/' . $subScope .
'/' . $user
191 $this->
settings->getURL(
'ClearMessages', (
string) $scope) .
'/' . $subScope .
'/' . $user
215 $this->
settings->getURL(
'LeavePrivateRoom', (
string) $scope) .
'/' . $subScope .
'/' . $user
227 return $this->
kick($scope, $subScope, $user);
241 $this->
settings->getURL(
'Kick', (
string) $scope) .
'/' . $subScope .
'/' . $user
254 $this->
settings->getURL(
'Ban', (
string) $scope) .
'/' . $subScope .
'/' . $user
273 $this->
settings->getURL(
'InvitePrivateRoom', (
string) $scope) .
274 '/' . $subScope .
'/' . $user .
'/' . $invited_id
284 $query = http_build_query([
'message' => $message]);
sendInviteToPrivateRoom(int $scope, int $subScope, int $user, int $invited_id)
kick(int $scope, int $subScope, int $user)
Returns kick URL Creates kick URL using given $scope and $query and returns it.
leavePrivateRoom(int $scope, int $subScope, int $user)
static getLogger(string $a_component_id)
Get component logger.
static getDefaultConfiguration()
Instantiates and returns ilChatroomAdmin object using instance_id and settings from settingsTable...
static bool $connection_status
ilChatroomServerSettings $settings
sendLeavePrivateRoom(int $scope, int $subScope, int $user)
__construct(ilChatroomServerSettings $settings)
sendClearMessages(int $scope, int $subScope, int $user)
connect(int $scope, int $userId)
Creates connect URL using given $scope and $userId and returns it.
sendEnterPrivateRoom(int $scope, int $subScope, int $user)
Class ilChatroomServerConnector.
sendBan(int $scope, int $subScope, int $user)
static checkServerConnection(bool $use_cache=true)
sendUserConfigChange(string $message)
sendKick(int $scope, int $subScope, int $user)
enterPrivateRoom(int $scope, int $subScope, int $user)
Class ilChatroomServerSettings.
sendCreatePrivateRoom(int $scope, int $subScope, int $user, string $title)
file_get_contents(string $url, ?array $stream_context_params=null)
sendDeletePrivateRoom(int $scope, int $subScope, int $user)