38 if($use_cache && self::$connection_status !== null)
40 return self::$connection_status;
43 require_once
'Modules/Chatroom/classes/class.ilChatroomAdmin.php';
44 $connector =
new self(ilChatroomAdmin::getDefaultConfiguration()->getServerSettings());
45 self::$connection_status = (bool)$connector->isServerAlive();
47 return self::$connection_status;
56 $this->
settings->getURL(
'Heartbeat'),
67 $responseObject = json_decode($response);
69 return $responseObject->status == 200;
82 $this->
settings->getURL(
'Connect', $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))
112 $ctx = array_merge_recursive($ctx, $stream_context_params);
115 set_error_handler(
function ($severity, $message,
$file, $line)
117 throw new ErrorException($message, $severity, $severity,
$file, $line);
123 restore_error_handler();
128 restore_error_handler();
144 $this->
settings->getURL(
'CreatePrivateRoom', $scope) .
'/' . $subScope .
'/' . $user .
'/' . rawurlencode(
$title)
157 $this->
settings->getURL(
'DeletePrivateRoom', $scope) .
'/' . $subScope .
'/' . $user
182 $this->
settings->getURL(
'EnterPrivateRoom', $scope) .
'/' . $subScope .
'/' . $user
195 $this->
settings->getURL(
'ClearMessages', $scope) .
'/' . $subScope .
'/' . $user
220 $this->
settings->getURL(
'LeavePrivateRoom', $scope) .
'/' . $subScope .
'/' . $user
232 return $this->
kick($scope, $subScope, $user);
243 public function kick($scope, $subScope, $user)
246 $this->
settings->getURL(
'Kick', $scope) .
'/' . $subScope .
'/' . $user
256 public function sendBan($scope, $subScope, $user)
259 $this->
settings->getURL(
'Ban', $scope) .
'/' . $subScope .
'/' . $user
285 return @json_decode($response);
312 $this->
settings->getURL(
'InvitePrivateRoom', $scope) .
'/' . $subScope .
'/' . $user .
'/' . $invited_id
325 $roomId .=
'-' . $pRoomId;
337 $query = http_build_query(
array(
'message' => $message));
339 $this->
settings->getURL(
'UserConfigChange', null) .
'?' .
$query);
sendLeavePrivateRoom($scope, $subScope, $user)
sendDeletePrivateRoom($scope, $subScope, $user)
__construct(ilChatroomServerSettings $settings)
Constructor Sets $this->settings using given $settings.
post($scope, $query)
Returns post URL Creates post URL using given $scope and $query and returns it.
sendClearMessages($scope, $subScope, $user)
enterPrivateRoom($scope, $subScope, $user)
sendMessage($scope, $message, $options=array())
Returns if given message is sucessfully sent.
sendBan($scope, $subScope, $user)
kick($scope, $subScope, $user)
Returns kick URL Creates kick URL using given $scope and $query and returns it.
if(!is_array($argv)) $options
sendEnterPrivateRoom($scope, $subScope, $user)
connect($scope, $userId)
Returns connect URL Creates connect URL using given $scope and $userId and returns it...
static checkServerConnection($use_cache=true)
Class ilChatroomServerConnector.
file_get_contents($url, array $stream_context_params=null)
sendKick($scope, $subScope, $user)
Create styles array
The data for the language used.
static $connection_status
Class ilChatroomServerSettings.
createUniqueScopeId($roomId, $pRoomId=null)
leavePrivateRoom($scope, $subScope, $user)
sendInviteToPrivateRoom($scope, $subScope, $user, $invited_id)
sendCreatePrivateRoom($scope, $subScope, $user, $title)
static getLogger($a_component_id)
Get component logger.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
getSettings()
Returns $this->settings.
sendUserConfigChange($message)