19 declare(strict_types=1);
32 final public const PREFIX =
'/backend';
34 private int $port = self::DEFAULT_PORT;
36 private string $domain = self::DEFAULT_HOST;
50 $query =
'SELECT * FROM chatroom_admconfig';
51 $rset = $DIC->database()->query($query);
52 $row = $DIC->database()->fetchAssoc($rset);
54 $client_settings = json_decode($row[
'client_settings'],
false, 512, JSON_THROW_ON_ERROR);
55 $server_settings = json_decode($row[
'server_settings'],
false, 512, JSON_THROW_ON_ERROR);
57 $settings =
new self();
58 if ($server_settings instanceof
stdClass) {
59 $settings->setPort((
int) ($server_settings->port ?? self::DEFAULT_PORT));
60 $settings->setProtocol((
string) ($server_settings->protocol ?? self::DEFAULT_PROCOTOL));
61 $settings->setDomain((
string) ($server_settings->address ?? self::DEFAULT_HOST));
62 $settings->setClientUrlEnabled((
bool) ($server_settings->client_proxy ??
false));
63 $settings->setIliasUrlEnabled((
bool) ($server_settings->ilias_proxy ??
false));
64 $settings->setClientUrl((
string) ($server_settings->client_url ??
''));
65 $settings->setIliasUrl((
string) ($server_settings->ilias_url ??
''));
66 $settings->setSubDirectory((
string) ($server_settings->sub_directory ??
''));
69 if ($client_settings instanceof stdClass) {
70 $settings->setInstance((
string) ($client_settings->name ??
''));
71 $settings->setAuthKey((
string) ($client_settings->auth->key ??
''));
72 $settings->setAuthSecret((
string) ($client_settings->auth->secret ??
''));
99 if (!str_contains(
$url,
'://')) {
126 if (!str_contains($protocol,
'://')) {
127 $this->protocol = $protocol .
'://';
185 if (!str_contains(
$url,
'://')) {
setSubDirectory(string $subDirectory)
getURL(string $action, $scope=null)
Creates URL by calling $this->getBaseURL and using given $action and $scope and returns it...
setAuthKey(string $authKey)
setIliasUrl(string $iliasUrl)
setClientUrl(string $clientUrl)
setProtocol(string $protocol)
setAuthSecret(string $authSecret)
setClientUrlEnabled(bool $clientUrlEnabled)
setIliasUrlEnabled(bool $iliasUrlEnabled)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setDomain(string $domain)
getBaseURL()
Creates base URL by calling $this->getProtocol(), $this->getDomain() and $this->getPort() and returne...
setInstance(string $instance)