49require_once(
"libs/composer/vendor/autoload.php");
52if (!isset(
$GLOBALS[
'ilGlobalStartTime']) || !
$GLOBALS[
'ilGlobalStartTime']) {
53 $GLOBALS[
'ilGlobalStartTime'] = microtime();
93 foreach ($var as $k => $v) {
101 array(
"\x00",
"\n",
"\r",
"\\",
"'",
'"',
"\x1a"),
114 require_once
"include/inc.ilias_version.php";
116 self::initGlobal(
"ilBench",
"ilBenchmark",
"./Services/Utilities/classes/class.ilBenchmark.php");
127 require_once(
"include/inc.xml5compliance.php");
130 require_once(
"include/inc.xsl5compliance.php");
146 if (!defined(
'ILIAS_DATA_DIR')) {
147 define(
"ILIAS_DATA_DIR",
$ilIliasIniFile->readVariable(
"clients",
"datadir"));
149 if (!defined(
'ILIAS_WEB_DIR')) {
150 define(
"ILIAS_WEB_DIR",
$ilIliasIniFile->readVariable(
"clients",
"path"));
152 if (!defined(
"ILIAS_ABSOLUTE_PATH")) {
153 define(
"ILIAS_ABSOLUTE_PATH",
$ilIliasIniFile->readVariable(
'server',
'absolute_path'));
158 define(
"ILIAS_LOG_FILE",
$ilIliasIniFile->readVariable(
"log",
"file"));
159 if (!defined(
"ILIAS_LOG_ENABLED")) {
160 define(
"ILIAS_LOG_ENABLED",
$ilIliasIniFile->readVariable(
"log",
"enabled"));
162 define(
"ILIAS_LOG_LEVEL",
$ilIliasIniFile->readVariable(
"log",
"level"));
165 define(
"PATH_TO_CONVERT",
$ilIliasIniFile->readVariable(
"tools",
"convert"));
166 define(
"PATH_TO_FFMPEG",
$ilIliasIniFile->readVariable(
"tools",
"ffmpeg"));
168 define(
"PATH_TO_MKISOFS",
$ilIliasIniFile->readVariable(
"tools",
"mkisofs"));
169 define(
"PATH_TO_UNZIP",
$ilIliasIniFile->readVariable(
"tools",
"unzip"));
170 define(
"PATH_TO_GHOSTSCRIPT",
$ilIliasIniFile->readVariable(
"tools",
"ghostscript"));
171 define(
"PATH_TO_JAVA",
$ilIliasIniFile->readVariable(
"tools",
"java"));
172 define(
"URL_TO_LATEX",
$ilIliasIniFile->readVariable(
"tools",
"latex"));
174 define(
"PATH_TO_LESSC",
$ilIliasIniFile->readVariable(
"tools",
"lessc"));
175 define(
"PATH_TO_PHANTOMJS",
$ilIliasIniFile->readVariable(
"tools",
"phantomjs"));
179 define(
"ERROR_EDITOR_URL",
$ilIliasIniFile->readVariable(
'error',
'editor_url'));
182 if (
$ilIliasIniFile->variableExists(
'error',
'editor_path_translations')) {
184 "ERROR_EDITOR_PATH_TRANSLATIONS",
193 define(
"IL_VIRUS_SCANNER",
"Sophos");
194 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
195 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
199 define(
"IL_VIRUS_SCANNER",
"AntiVir");
200 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
201 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
205 define(
"IL_VIRUS_SCANNER",
"ClamAV");
206 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
207 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
210 define(
"IL_VIRUS_SCANNER",
"icap");
211 define(
"IL_ICAP_HOST",
$ilIliasIniFile->readVariable(
"tools",
"icap_host"));
212 define(
"IL_ICAP_PORT",
$ilIliasIniFile->readVariable(
"tools",
"icap_port"));
213 define(
"IL_ICAP_AV_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"icap_service_name"));
214 define(
"IL_ICAP_CLIENT",
$ilIliasIniFile->readVariable(
"tools",
"icap_client_path"));
218 define(
"IL_VIRUS_SCANNER",
"None");
219 define(
"IL_VIRUS_CLEAN_COMMAND",
'');
224 define(
"IL_TIMEZONE", $tz);
243 public static function bootstrapFilesystems(): void
247 $DIC[
'filesystem.security.sanitizing.filename'] =
function (
Container $c) {
249 $c->fileServiceSettings()
253 $DIC[
'filesystem.factory'] =
function (
$c) {
254 return new \ILIAS\Filesystem\Provider\DelegatingFilesystemFactory(
$c[
'filesystem.security.sanitizing.filename']);
257 $DIC[
'filesystem.web'] =
function (
$c) {
263 $delegatingFactory =
$c[
'filesystem.factory'];
264 $webConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
ILIAS_WEB_DIR .
'/' .
CLIENT_ID);
265 return $delegatingFactory->getLocal($webConfiguration);
268 $DIC[
'filesystem.storage'] =
function (
$c) {
274 $delegatingFactory =
$c[
'filesystem.factory'];
275 $storageConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(
ILIAS_DATA_DIR .
'/' .
CLIENT_ID);
276 return $delegatingFactory->getLocal($storageConfiguration);
279 $DIC[
'filesystem.temp'] =
function (
$c) {
285 $delegatingFactory =
$c[
'filesystem.factory'];
286 $tempConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(
ILIAS_DATA_DIR .
'/' .
CLIENT_ID .
'/temp');
287 return $delegatingFactory->getLocal($tempConfiguration);
290 $DIC[
'filesystem.customizing'] =
function (
$c) {
296 $delegatingFactory =
$c[
'filesystem.factory'];
297 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'Customizing');
298 return $delegatingFactory->getLocal($customizingConfiguration);
301 $DIC[
'filesystem.libs'] =
function (
$c) {
307 $delegatingFactory =
$c[
'filesystem.factory'];
308 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'libs');
309 return $delegatingFactory->getLocal($customizingConfiguration,
true);
312 $DIC[
'filesystem.node_modules'] =
function (
$c) {
318 $delegatingFactory =
$c[
'filesystem.factory'];
319 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'node_modules');
320 return $delegatingFactory->getLocal($customizingConfiguration,
true);
323 $DIC[
'filesystem'] =
function (
$c) {
324 return new \ILIAS\Filesystem\FilesystemsImpl(
325 $c[
'filesystem.storage'],
326 $c[
'filesystem.web'],
327 $c[
'filesystem.temp'],
328 $c[
'filesystem.customizing'],
329 $c[
'filesystem.libs'],
330 $c[
'filesystem.node_modules']
343 $dic[
'upload.processor-manager'] =
function (
$c) {
348 $fileUploadImpl = new \ILIAS\FileUpload\FileUploadImpl(
349 $c[
'upload.processor-manager'],
353 if ((defined(
'IL_VIRUS_SCANNER') && IL_VIRUS_SCANNER !=
"None") || (defined(
'IL_SCANNER_TYPE') && IL_SCANNER_TYPE ==
"1")) {
358 $fileUploadImpl->register(
360 $c->fileServiceSettings(),
361 $c->language()->txt(
"msg_info_blacklisted")
366 $c->language()->txt(
"upload_svg_rejection_message"),
367 $c->language()->txt(
"upload_svg_rejection_message_script"),
368 $c->language()->txt(
"upload_svg_rejection_message_base64"),
369 $c->language()->txt(
"upload_svg_rejection_message_elements")
372 return $fileUploadImpl;
383 if (
$DIC[
'https']->isDetected()) {
384 $protocol =
'https://';
386 $protocol =
'http://';
390 $rq_uri = strip_tags(
$_SERVER[
'REQUEST_URI']);
394 if (is_int($pos = strpos($rq_uri,
"?"))) {
395 $rq_uri = substr($rq_uri, 0, $pos);
398 if (!defined(
'ILIAS_MODULE')) {
399 $path = pathinfo($rq_uri);
400 if (isset(
$path[
'extension']) &&
$path[
'extension'] !==
'') {
401 $uri = dirname($rq_uri);
407 $path = dirname($rq_uri);
412 $dirs = explode(
'/', $module);
414 foreach ($dirs as $dir) {
415 $uri = dirname($uri);
422 $ilias_http_path = preg_replace(
'/(http|https)(:\/\/)(.*?\/.*?\.php).*/',
'$1$2$3', $ilias_http_path);
424 $f = new \ILIAS\Data\Factory();
427 $base_URI = $uri->getBaseURI();
429 return define(
'ILIAS_HTTP_PATH', $base_URI);
438 if (defined(
'CLIENT_ID')) {
442 $df = new \ILIAS\Data\Factory();
445 if (!
$DIC->isDependencyAvailable(
'iliasIni')) {
446 self::abortAndDie(
'Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.');
450 $default_client_id =
$DIC->iliasIni()->readVariable(
'clients',
'default');
452 if (
$DIC->http()->wrapper()->query()->has(
'client_id')) {
453 $client_id_from_get =
$DIC->http()->wrapper()->query()->retrieve(
455 self::getClientIdTransformation()
458 if (
$DIC->http()->wrapper()->cookie()->has(
'ilClientId')) {
459 $client_id_from_cookie =
$DIC->http()->wrapper()->cookie()->retrieve(
461 self::getClientIdTransformation()
466 $client_id_to_use =
'';
467 if (isset($client_id_from_get) && $client_id_from_get !==
'') {
468 $client_id_to_use = $client_id_from_get;
471 if ($client_id_to_use ===
'' && isset($client_id_from_cookie)) {
472 $client_id_to_use = $client_id_from_cookie;
475 $client_id_to_use = $client_id_to_use ?: $default_client_id;
477 define(
'CLIENT_ID', $df->clientId($client_id_to_use)->toString());
493 public function transform($from):
string
495 if (!is_string($from)) {
496 throw new InvalidArgumentException(__METHOD__ .
" the argument is not a string.");
498 return strip_tags($from);
506 return $result->
then(
function ($value):
Result {
508 return new Ok($this->transform($value));
509 }
catch (Exception $exception) {
510 return new Error($exception);
518 public function __invoke($from):
string
520 return $this->transform($from);
540 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
545 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
548 $ini_file =
"/client.ini.php";
549 if (defined(
'CLIENT_WEB_DIR')) {
556 $ilClientIniFile =
new ilIniFile($ini_file);
557 $ilClientIniFile->read();
560 if ($ilClientIniFile->ERROR !=
"") {
563 $mess = array(
"en" =>
"Client does not exist.",
564 "de" =>
"Mandant ist ungültig."
566 self::redirect(
"index.php?client_id=" . $default_client,
'', $mess);
568 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile initializing client ini file abborted with: " . $ilClientIniFile->ERROR);
574 define(
"DEBUG", (
int) $ilClientIniFile->readVariable(
"system",
"DEBUG"));
575 define(
"DEVMODE", (
int) $ilClientIniFile->readVariable(
"system",
"DEVMODE"));
576 define(
"SHOWNOTICES", (
int) $ilClientIniFile->readVariable(
"system",
"SHOWNOTICES"));
577 if (!defined(
"ROOT_FOLDER_ID")) {
578 define(
"ROOT_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROOT_FOLDER_ID'));
580 if (!defined(
"SYSTEM_FOLDER_ID")) {
581 define(
"SYSTEM_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'SYSTEM_FOLDER_ID'));
583 if (!defined(
"ROLE_FOLDER_ID")) {
584 define(
"ROLE_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROLE_FOLDER_ID'));
586 define(
"MAIL_SETTINGS_ID", (
int) $ilClientIniFile->readVariable(
'system',
'MAIL_SETTINGS_ID'));
587 $error_handler = $ilClientIniFile->readVariable(
'system',
'ERROR_HANDLER');
588 define(
"ERROR_HANDLER", $error_handler ?:
"PRETTY_PAGE");
592 define(
"OH_REF_ID", (
int) $ilClientIniFile->readVariable(
"system",
"OH_REF_ID"));
598 if (!defined(
"CLIENT_DATA_DIR")) {
601 if (!defined(
"CLIENT_WEB_DIR")) {
604 define(
"CLIENT_NAME", $ilClientIniFile->readVariable(
'client',
'name'));
606 $db_type = $ilClientIniFile->readVariable(
"db",
"type");
607 if ($db_type ===
"") {
610 define(
"IL_DB_TYPE", $db_type);
614 $ilGlobalCacheSettings->readFromIniFile($ilClientIniFile);
623 global $ilClientIniFile;
625 if (!$ilClientIniFile->readVariable(
"client",
"access")) {
627 "en" =>
"The server is not available due to maintenance." .
628 " We apologise for any inconvenience.",
629 "de" =>
"Der Server ist aufgrund von Wartungsarbeiten aktuell nicht verfügbar." .
630 " Wir bitten um Verständnis. Versuchen Sie es später noch einmal."
632 $mess_id =
"init_error_maintenance";
650 $ilDB->initFromIniFile();
663 if (!$db_session_handler->setSaveHandler()) {
670 if (function_exists(
"session_status") && session_status() == PHP_SESSION_ACTIVE) {
671 session_regenerate_id();
683 } elseif (isset(
$GLOBALS[
'COOKIE_PATH'])) {
701 define(
'IL_COOKIE_HTTPONLY',
true);
702 define(
'IL_COOKIE_EXPIRE', 0);
703 define(
'IL_COOKIE_DOMAIN',
'');
704 if (!defined(
'IL_COOKIE_PATH')) {
712 if (defined(
'CLIENT_ID') &&
713 !defined(
'IL_PHPUNIT_TEST') &&
726 if (!defined(
'IL_COOKIE_SECURE')) {
730 $cookie_secure = !
$ilSetting->get(
'https',
'0') &&
$DIC[
'https']->isDetected();
731 define(
'IL_COOKIE_SECURE', $cookie_secure);
733 $cookie_parameters = [
734 'lifetime' => IL_COOKIE_EXPIRE,
736 'domain' => IL_COOKIE_DOMAIN,
737 'secure' => IL_COOKIE_SECURE,
738 'httponly' => IL_COOKIE_HTTPONLY,
743 (!isset(session_get_cookie_params()[
'samesite']) || strtolower(session_get_cookie_params()[
'samesite']) !==
'strict')
745 $cookie_parameters[
'samesite'] =
'Lax';
748 session_set_cookie_params($cookie_parameters);
755 return new \ilMailMimeTransportFactory(
$c->settings(),
$c->event());
758 return new \ilMailMimeSenderFactory(
$c->settings());
771 $c->logger()->cron(),
772 $c[
'component.repository'],
773 $c[
'component.factory']
779 $c[
'cron.repository'],
782 $c->logger()->cron(),
793 $c[
"object.customicons.factory"] =
function (
$c) {
795 $c->filesystem()->web(),
804 $c[
"user.avatar.factory"] =
function (
$c) {
805 return new \ilUserAvatarFactory(
$c);
811 $c[
'tos.criteria.type.factory'] =
function (
815 $c->rbac()->review(),
816 $c[
'ilObjDataCache'],
823 $persistence->setDatabaseAdapter(
$c->database());
826 $c[
'tos.document.evaluator'],
827 $c[
'tos.criteria.type.factory'],
835 $c[
'tos.criteria.type.factory'],
855 $c[
'acc.criteria.type.factory'],
877 "Services/Administration/classes/class.ilSetting.php"
886 define(
"ANONYMOUS_USER_ID", (
int)
$ilSetting->get(
"anonymous_user_id"));
887 define(
"ANONYMOUS_ROLE_ID", (
int)
$ilSetting->get(
"anonymous_role_id"));
888 define(
"SYSTEM_USER_ID", (
int)
$ilSetting->get(
"system_user_id"));
889 define(
"SYSTEM_ROLE_ID", (
int)
$ilSetting->get(
"system_role_id"));
890 define(
"USER_FOLDER_ID", 7);
893 define(
"RECOVERY_FOLDER_ID", (
int)
$ilSetting->get(
"recovery_folder_id"));
896 define(
"IL_INST_ID",
$ilSetting->get(
"inst_id",
'0'));
899 define(
"SUFFIX_REPL_DEFAULT",
"php,php3,php4,inc,lang,phtml,htaccess");
900 define(
"SUFFIX_REPL_ADDITIONAL",
$ilSetting->get(
"suffix_repl_additional",
""));
913 $component_factory =
$DIC[
"component.factory"];
919 "./Services/Style/System/classes/class.ilStyleDefinition.php"
923 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as $ui_plugin) {
924 $gui_class = $ui_plugin->getUIClassInstance();
925 $gui_class->modifyGUI(
"Services/Init",
"init_style", array(
"styleDefinition" =>
$DIC->systemStyle()));
936 static $context_init;
938 $uid =
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
940 $DIC->user()->setId($uid);
941 $DIC->user()->read();
942 if (!isset($context_init)) {
943 if (
$DIC->user()->isAnonymous()) {
944 $DIC->globalScreen()->tool()->context()->claim()->external();
946 $DIC->globalScreen()->tool()->context()->claim()->internal();
948 $context_init =
true;
968 if (trim(
$ilSetting->get(
"locale",
'')) !=
"") {
969 $larr = explode(
",", trim(
$ilSetting->get(
"locale")));
972 foreach ($larr as $l) {
973 if (trim($l) !=
"") {
977 if (count($ls) > 0) {
978 setlocale(LC_ALL, $ls);
981 setlocale(LC_NUMERIC,
"C");
997 $session_destroyed =
false;
998 if (
$DIC[
'ilAuthSession']->isExpired()) {
999 $session_destroyed =
true;
1002 if (!
$DIC[
'ilAuthSession']->isAuthenticated()) {
1003 $session_destroyed =
true;
1007 if ($session_destroyed) {
1014 if (
$DIC->http()->wrapper()->query()->has(
'target')) {
1015 $target =
$DIC->http()->wrapper()->query()->retrieve(
1017 $DIC->refinery()->kindlyTo()->string()
1022 if (strlen($target)) {
1024 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
1025 if ($current_script ==
"goto.php") {
1034 "ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=&ref_id=" . (defined(
1047 $session_expired =
false;
1050 if (
$DIC[
'ilAuthSession']->isExpired()) {
1052 $session_expired =
true;
1054 if (!
$DIC[
'ilAuthSession']->isAuthenticated()) {
1058 $target =
$DIC->http()->wrapper()->query()->has(
'target')
1059 ?
$DIC->http()->wrapper()->query()->retrieve(
1061 $DIC->refinery()->kindlyTo()->string()
1065 if (strlen($target)) {
1066 $target =
"target=" . $target .
"&";
1071 $DIC->refinery()->byTrying([
1072 $DIC->refinery()->kindlyTo()->string(),
1073 $DIC->refinery()->always(
'')
1076 $script =
"login.php?" . $target .
"client_id=" .
$client_id;
1077 $script .= $session_expired ?
"&session_expired=1" :
"";
1081 "init_error_authentication_fail",
1083 "en" =>
"Authentication failed.",
1084 "de" =>
"Authentifizierung fehlgeschlagen."
1092 protected static function initLanguage(
bool $a_use_user_language =
true): void
1101 if ($a_use_user_language) {
1102 if (
$DIC->offsetExists(
'lng')) {
1103 $DIC->offsetUnset(
'lng');
1109 if (is_object($rbacsystem) &&
$DIC->offsetExists(
'tree')) {
1110 $rbacsystem->initMemberView();
1122 './Services/AccessControl/classes/class.ilRbacReview.php',
1132 './Services/AccessControl/classes/class.ilRbacAdmin.php',
1139 './Services/AccessControl/classes/class.ilAccess.php',
1162 ?
string $a_source_file =
null,
1163 ?
bool $destroy_existing =
false
1167 if ($destroy_existing) {
1171 if (isset(
$DIC[$a_name])) {
1172 unset(
$DIC[$a_name]);
1176 $GLOBALS[$a_name] = is_object($a_class) ? $a_class :
new $a_class();
1186 $GLOBALS[
'ilLog']->write(
"Fatal Error: ilInitialisation - " . $a_message);
1197 if ((defined(SHOWNOTICES) && SHOWNOTICES) || version_compare(PHP_VERSION,
'8.0',
'>=')) {
1198 error_reporting(-1);
1202 protected static bool $already_initialized =
false;
1206 self::$already_initialized =
false;
1213 self::initSession();
1217 self::resumeUserSession();
1227 if (self::$already_initialized) {
1232 $GLOBALS[
"DIC"][
"ilLoggerFactory"] =
function (
$c) {
1236 self::$already_initialized =
true;
1239 self::initHTTPServices(
$GLOBALS[
"DIC"]);
1242 self::initFileUploadService(
$GLOBALS[
"DIC"]);
1243 self::initSession();
1249 self::resumeUserSession();
1254 self::includePhp5Compliance();
1257 self::initLanguage(
true);
1258 $GLOBALS[
'DIC'][
'tree']->initLangCode();
1260 self::initInjector(
$GLOBALS[
'DIC']);
1261 self::initBackgroundTasks(
$GLOBALS[
'DIC']);
1262 self::initKioskMode(
$GLOBALS[
'DIC']);
1272 self::replaceSuperGlobals(
$GLOBALS[
'DIC']);
1280 if (isset(
$GLOBALS[
'DIC'][
'ilAuthSession'])) {
1281 unset(
$GLOBALS[
'DIC'][
'ilAuthSession']);
1286 $c[
'ilLoggerFactory']->getLogger(
'auth')
1288 $auth_session->init();
1289 return $auth_session;
1299 error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
1312 self::handleErrorReporting();
1317 self::requireCommonIncludes();
1325 "./Services/Init/classes/class.ilErrorHandling.php"
1334 self::removeUnsafeCharacters();
1336 self::initIliasIniFile();
1338 define(
'IL_INITIAL_WD', getcwd());
1341 self::initGlobal(
"ilias",
"ILIAS",
"./Services/Init/classes/class.ilias.php");
1351 self::setCookieConstants();
1353 self::determineClient();
1355 self::bootstrapFilesystems();
1357 self::initResourceStorage();
1359 self::initClientIniFile();
1366 self::handleDevMode();
1369 self::handleMaintenanceMode();
1371 self::initDatabase();
1373 self::initComponentService(
$DIC);
1376 self::initLanguage(
false);
1382 "ilAppEventHandler",
1383 "ilAppEventHandler",
1384 "./Services/EventHandling/classes/class.ilAppEventHandler.php"
1396 "./Services/Component/classes/class.ilPluginAdmin.php"
1399 self::initGlobal(
"https",
"ilHTTPS",
"./Services/Http/classes/class.ilHTTPS.php");
1400 self::initSettings();
1401 self::setSessionHandler();
1405 self::initCustomObjectIcons(
$GLOBALS[
'DIC']);
1406 self::initTermsOfService(
$GLOBALS[
'DIC']);
1407 self::initAccessibilityControlConcept(
$GLOBALS[
'DIC']);
1414 $https->enableSecureCookies();
1415 $https->checkProtocolAndRedirectIfNeeded();
1422 "ilObjectDataCache",
1423 "./Services/Object/classes/class.ilObjectDataCache.php"
1428 "ilObjectDefinition",
1429 "./Services/Object/classes/class.ilObjectDefinition.php"
1434 self::initGlobal(
"tree", $tree);
1437 self::setSessionCookieParams();
1438 self::setClientIdCookie();
1440 self::initRefinery(
$DIC);
1445 self::initGlobalScreen(
$DIC);
1459 "./Services/User/classes/class.ilObjUser.php",
1464 self::initAccessHandling();
1479 !
$DIC[
'ilAuthSession']->isAuthenticated() or
1480 $DIC[
'ilAuthSession']->isExpired()
1482 if (
$GLOBALS[
'DIC'][
'ilAuthSession']->isExpired()) {
1486 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
1487 if (self::blockedAuthentication($current_script)) {
1493 self::handleAuthenticationFail();
1498 self::initUserAccount();
1504 protected static function handleAuthenticationSuccess(): void
1527 throw new Exception(
"Authentication failed.");
1530 if ((
$DIC->http()->request()->getQueryParams()[
'cmdMode'] ?? 0) ===
'asynch') {
1531 $DIC->language()->loadLanguageModule(
'init');
1532 $DIC->http()->saveResponse(
1533 $DIC->http()->response()
1535 ->withBody(Streams::ofString(
$DIC->language()->txt(
'init_error_authentication_fail')))
1537 $DIC->http()->sendResponse();
1538 $DIC->http()->close();
1541 $DIC[
'ilAuthSession']->isExpired() &&
1550 self::goToPublicSection();
1571 $c[
'global_screen'] =
function () use (
$c) {
1578 $c->globalScreen()->tool()->context()->stack()->clear();
1579 $c->globalScreen()->tool()->context()->claim()->main();
1590 $component_repository =
$c[
"component.repository"];
1591 $component_factory =
$c[
"component.factory"];
1592 foreach ($component_repository->getPlugins() as $pl) {
1593 if (!$pl->isActive()) {
1596 $plugin = $component_factory->getPlugin($pl->getId());
1597 $c[
'ui.renderer'] =
$plugin->exchangeUIRendererAfterInitialization(
$c);
1599 foreach (
$c->keys() as
$key) {
1600 if (strpos(
$key,
"ui.factory") === 0) {
1613 $dataFactory = new \ILIAS\Data\Factory();
1616 return new \ILIAS\Refinery\Factory($dataFactory, $language);
1628 $replace_super_globals = (
1629 !$client_ini->variableExists(
'server',
'prevent_super_global_replacement') ||
1630 !(bool) $client_ini->readVariable(
'server',
'prevent_super_global_replacement')
1633 if ($replace_super_globals) {
1634 $throwOnValueAssignment = defined(
'DEVMODE') && DEVMODE;
1662 self::initUIFramework(
$GLOBALS[
"DIC"]);
1664 self::initGlobal(
"tpl",
$tpl);
1667 $dispatcher = new \ILIAS\Init\StartupSequence\StartUpSequenceDispatcher(
$DIC);
1668 $dispatcher->dispatch();
1672 "ilNavigationHistory",
1673 "ilNavigationHistory",
1674 "Services/Navigation/classes/class.ilNavigationHistory.php"
1680 "Services/Help/classes/class.ilHelpGUI.php"
1686 "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php"
1692 "./Services/Locator/classes/class.ilLocatorGUI.php"
1698 "./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php"
1713 if (isset(
$_GET[
'offset']) &&
$_GET[
'offset'] !=
"") {
1717 self::initGlobal(
"lti",
"ilLTIViewGUI",
"./Services/LTI/classes/class.ilLTIViewGUI.php");
1719 self::initKioskMode(
$GLOBALS[
"DIC"]);
1725 $cmd = $_POST[
'cmd'] ?? (
$_GET[
'cmd'] ??
'');
1727 if (is_array($cmd)) {
1728 $cmd_keys = array_keys($cmd);
1729 $cmd = array_shift($cmd_keys) ??
'';
1767 $a_current_script ==
"register.php" ||
1768 $a_current_script ==
"pwassist.php" ||
1769 $a_current_script ==
"confirmReg.php" ||
1770 $a_current_script ==
"il_securimage_play.php" ||
1771 $a_current_script ==
"il_securimage_show.php" ||
1772 $a_current_script ==
'login.php'
1778 $requestBaseClass = strtolower((
string) (
$_GET[
'baseClass'] ??
''));
1779 if ($requestBaseClass == strtolower(ilStartUpGUI::class)) {
1780 $requestCmdClass = strtolower((
string) (
$_GET[
'cmdClass'] ??
''));
1782 $requestCmdClass == strtolower(ilAccountRegistrationGUI::class) ||
1783 $requestCmdClass == strtolower(ilPasswordAssistanceGUI::class)
1788 $cmd = self::getCurrentCmd();
1790 $cmd ==
"showTermsOfService" ||
1791 $cmd ==
'showAccountMigration' || $cmd ==
'migrateAccount' ||
1792 $cmd ==
'processCode' || $cmd ==
'showLoginPage' || $cmd ==
'showLogout' ||
1793 $cmd ==
'doStandardAuthentication' || $cmd ==
'doCasAuthentication'
1801 if (
$DIC->http()->wrapper()->query()->has(
'target')) {
1803 $target =
$_GET[
'target'];
1808 ($a_current_script ==
"goto.php" && $target ==
"impr_0") ||
1809 $requestBaseClass == strtolower(ilImprintGUI::class)
1816 (strtolower($requestCmdClass ??
"") === strtolower(ilAccessibilityControlConceptGUI::class))
1822 if ($a_current_script ==
'goto.php' && in_array($target, array(
1838 protected static function translateMessage(
string $a_message_id, array $a_message_static =
null): string
1847 } elseif (isset($_REQUEST[
"lang"])) {
1848 $lang = (string) $_REQUEST[
"lang"];
1851 } elseif ($ilClientIniFile) {
1852 $lang = $ilClientIniFile->readVariable(
"language",
"default");
1859 if (
$ilDB && $a_message_id) {
1864 $lng->loadLanguageModule(
"init");
1866 } elseif (is_array($a_message_static)) {
1867 if (!isset($a_message_static[
$lang])) {
1880 string $a_message_id =
'',
1881 array $a_message_static =
null
1884 if (defined(
"ILIAS_HTTP_PATH") &&
1885 !stristr($a_target, ILIAS_HTTP_PATH)) {
1886 $a_target = ILIAS_HTTP_PATH .
"/" . $a_target;
1889 foreach ([
'ext_uid',
'soap_pw'] as
$param) {
1890 if (
false === strpos(
1903 $message = self::translateMessage($a_message_id, $a_message_static);
1907 $link = self::translateMessage(
1908 "init_error_redirect_click",
1909 array(
"en" =>
'Please click to continue.',
1910 "de" =>
'Bitte klicken um fortzufahren.'
1914 '<br /><a href="' . $a_target .
'">' . $link .
'</a>';
1921 $mess = self::translateMessage(
1922 "init_error_redirect_info",
1923 array(
"en" =>
'Redirect not supported by context.',
1924 "de" =>
'Weiterleitungen werden durch Kontext nicht unterstützt.'
1927 ' (' . $a_target .
')';
1931 self::abortAndDie($mess);
1941 self::goToPublicSection();
1947 $DIC->http()->wrapper()->query()->has(
'target')
1949 $target =
$DIC->http()->wrapper()->query()->retrieve(
1951 $DIC->refinery()->kindlyTo()->string()
1957 if ($target ===
'') {
1959 $DIC->ctrl()->redirectToURL(ilUserUtil::getStartingPointAsUrl());
1962 $DIC->ctrl()->redirectToURL(
"goto.php?target=" . $target);
1970 $n_of_tasks =
$ilIliasIniFile->readVariable(
"background_tasks",
"number_of_concurrent_tasks");
1971 $sync =
$ilIliasIniFile->readVariable(
"background_tasks",
"concurrency");
1973 $n_of_tasks = $n_of_tasks ?: 5;
1974 $sync = $sync ?:
'sync';
1976 $c[
"bt.task_factory"] =
function (
$c) {
1977 return new \ILIAS\BackgroundTasks\Implementation\Tasks\BasicTaskFactory(
$c[
"di.injector"]);
1980 $c[
"bt.persistence"] =
function (
$c) {
1981 return \ILIAS\BackgroundTasks\Implementation\Persistence\BasicPersistence::instance(
$c->database());
1984 $c[
"bt.injector"] =
function (
$c) {
1988 $c[
"bt.task_manager"] =
function (
$c) use ($sync) {
1989 if ($sync ==
'sync') {
1990 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager(
$c[
"bt.persistence"]);
1991 } elseif ($sync ==
'async') {
1992 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\AsyncTaskManager(
$c[
"bt.persistence"]);
1994 throw new ilException(
"The supported Background Task Managers are sync and async. $sync given.");
2001 $c[
"di.dependency_map"] =
function (
$c) {
2002 return new \ILIAS\BackgroundTasks\Dependencies\DependencyMap\BaseDependencyMap();
2005 $c[
"di.injector"] =
function (
$c) {
2006 return new \ILIAS\BackgroundTasks\Dependencies\Injector(
$c,
$c[
"di.dependency_map"]);
2012 $c[
"service.kiosk_mode"] =
function (
$c) {
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
const PEAR_ERROR_CALLBACK
static orderBy($orderBy, string $orderDirection='ASC')
Customizing of pimple-DIC for ILIAS.
A result encapsulates a value or an error and simplifies the handling of those.
A result encapsulates a value or an error and simplifies the handling of those.
Class FilenameSanitizerPreProcessor.
Class InsecureFilenameSanitizerPreProcessor.
Class PreProcessorManagerImpl.
Class SVGBlacklistPreProcessor.
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
Class WhiteAndBlacklistedFileNamePolicy.
Class DBRepositoryPreloader.
Class ResourceDBRepository.
Class RevisionDBRepository.
Interface StakeholderDBRepository.
Class FileSystemStorageHandler.
Class StorageHandlerFactory.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class InitCtrlService wraps the initialization of ilCtrl.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Responsible for loading the Resource Storage into the dependency injection container of ILIAS.
Responsible for loading the UI Framework into the dependency injection container of ILIAS.
static setErrorHandling($mode=null, $options=null)
Sets how errors generated by this object should be handled.
if(!isset($GLOBALS['ilGlobalStartTime'])||! $GLOBALS['ilGlobalStartTime']) global $DIC
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CONTEXT_HTTP
HTTP Auth used for WebDAV and CalDAV If a special handling for WebDAV or CalDAV is required overwrite...
static getInstance(\ilLogger $logger)
Get instance.
static isAuthenticationForced()
Check if authentication is should be forced.
static handleForcedAuthentication()
static modifyHttpPath(string $httpPath)
static supportsRedirects()
Are redirects supported?
static hasUser()
Based on user authentication?
static supportsPersistentSessions()
Check if context supports persistent session handling.
static getType()
Get context type.
static hasHTML()
Has HTML output.
static usesHTTP()
Uses HTTP aka browser.
const CONTEXT_LTI_PROVIDER
static initClient()
Init client.
static getCountryCodes()
Get country codes (DIN EN 3166-1)
static getWrapper(string $a_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilFileServicesFilenameSanitizer.
Class ilFileServicesPolicy.
static removeTrailingPathSeparators(string $path)
Class ilGSProviderFactory.
Class ilGlobalCacheSettings.
static setup(ilGlobalCacheSettings $ilGlobalCacheSettings)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Initialisation Utility Class perform basic setup: init database handler, load configuration fil...
static setClientIdCookie()
static initDatabase()
initialise database object $ilDB
static initHTTPServices(\ILIAS\DI\Container $container)
static goToLogin()
go to login
static initILIAS()
ilias initialisation
static initLocale()
Init Locale.
static removeUnsafeCharacters()
Remove unsafe characters from GET.
static buildHTTPPath()
builds http path
static requireCommonIncludes()
get common include code files
static initClientIniFile()
This method provides a global instance of class ilIniFile for the client.ini.php file in variable $il...
static initSession()
Init auth session.
static initClient()
Init client-based objects (level 1)
static initCore()
Init core objects (level 0)
static recursivelyRemoveUnsafeCharacters($var)
static initUIFramework(\ILIAS\DI\Container $c)
init the ILIAS UI framework.
static includePhp5Compliance()
This is a hack for authentication.
static handleErrorReporting()
Set error reporting level.
static initFileUploadService(\ILIAS\DI\Container $dic)
Initializes the file upload service.
static initComponentService(\ILIAS\DI\Container $container)
static redirect(string $a_target, string $a_message_id='', array $a_message_static=null)
Redirects to target url if context supports it.
static determineClient()
This method determines the current client and sets the constant CLIENT_ID.
static initHTML()
init HTML output (level 3)
static initLog()
Init log instance.
static initAvatar(\ILIAS\DI\Container $c)
static goToPublicSection()
go to public section
static resumeUserSession()
Resume an existing user session.
static setSessionHandler()
set session handler to db Used in Soap/CAS
static handleDevMode()
Prepare developer tools.
static setCookieConstants()
static initUser()
Init user / authentification (level 2)
static initKioskMode(\ILIAS\DI\Container $c)
static initGlobal(string $a_name, $a_class, ?string $a_source_file=null, ?bool $destroy_existing=false)
static handleAuthenticationFail()
static initBackgroundTasks(\ILIAS\DI\Container $c)
static initInjector(\ILIAS\DI\Container $c)
static setSessionCookieParams()
set session cookie params
static initResourceStorage()
static abortAndDie(string $a_message)
static blockedAuthentication(string $a_current_script)
Block authentication based on current request.
static initSettings()
initialise $ilSettings object and define constants Used in Soap
static initGlobalScreen(\ILIAS\DI\Container $c)
static initMail(\ILIAS\DI\Container $c)
static redirectToStartingPage(string $target='')
static initTermsOfService(\ILIAS\DI\Container $c)
static initRefinery(\ILIAS\DI\Container $container)
static initAccessibilityControlConcept(\ILIAS\DI\Container $c)
static getClientIdTransformation()
Refinery is not initialized early enough to provide a transformation to be used with the \ILIAS\HTTP ...
static handleMaintenanceMode()
handle maintenance mode
static initAccessHandling()
$ilAccess and $rbac... initialisation
static initUserAccount()
Init user with current account id.
static initCustomObjectIcons(\ILIAS\DI\Container $c)
static initCron(\ILIAS\DI\Container $c)
static initIliasIniFile()
This method provides a global instance of class ilIniFile for the ilias.ini.php file in variable $ilI...
static initStyle()
provide $styleDefinition object
static translateMessage(string $a_message_id, array $a_message_static=null)
Translate message if possible.
Central entry point for users of the service.
static getFallbackInstance()
Builds a global default language instance.
static getGlobalInstance()
Builds the global language object.
static getRootLogger()
The unique root logger has a fixed error level.
static getLogger(string $a_component_id)
Get component logger.
Class ilMailTemplateRepository.
Class ilObjTermsOfService.
static _isAnonymous(int $usr_id)
static updateAccess(ilObjUser $user)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Database Session Handling.
static _exists(string $a_session_id)
Check whether session exists.
const SESSION_CLOSE_LOGIN
static setClosingContext(int $a_context)
set closing context (for statistics)
static _destroy($a_session_id, ?int $a_closing_context=null, $a_expired_at=null)
Destroy session.
const SESSION_CLOSE_PUBLIC
static set(string $a_var, $a_val)
Set a value.
const SESSION_CLOSE_EXPIRE
Class ilTermsOfServiceCriterionTypeFactory.
Class ilTermsOfServiceDataGatewayFactory.
Class ilTermsOfServiceHelper.
Interface ilTermsOfServiceLogicalAndDocumentCriteriaEvaluation.
Interface ilTermsOfServiceSequentialDocumentEvaluation.
static initDefaultTimeZone(ilIniFile $ini)
Initialize default timezone from system settings.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
static redirect(string $a_script)
static setCookie(string $a_cookie_name, string $a_cookie_value='', bool $a_also_set_super_global=true, bool $a_set_cookie_invalid=false)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ILIAS_VERSION_NUMERIC
A result encapsulates a value or an error and simplifies the handling of those.
then(callable $f)
Get a new result from the callable or do nothing if this is an error.
Interface FilesystemFactory.
Interface ilTermsOfServiceCriterionTypeFactoryInterface.
Interface ilTermsOfServiceDocumentEvaluation.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
static http()
Fetches the global http state from ILIAS.
applyTo(Result $result)
@inheritDoc
__invoke($from)
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.