41if (!isset(
$GLOBALS[
'ilGlobalStartTime']) || !
$GLOBALS[
'ilGlobalStartTime']) {
42 $GLOBALS[
'ilGlobalStartTime'] = microtime();
76 foreach ($var as $k => $v) {
84 array(
"\x00",
"\n",
"\r",
"\\",
"'",
'"',
"\x1a"),
97 require_once(__DIR__ .
"/../../../../ilias_version.php");
98 self::initGlobal(
"ilBench",
"ilBenchmark",
"./components/ILIAS/Utilities/classes/class.ilBenchmark.php");
115 if (!defined(
'ILIAS_DATA_DIR')) {
116 define(
"ILIAS_DATA_DIR",
$ilIliasIniFile->readVariable(
"clients",
"datadir"));
119 if (!defined(
'ILIAS_WEB_DIR')) {
121 $from_ilias_ini = str_replace(
'public/',
'', $from_ilias_ini);
122 define(
"ILIAS_WEB_DIR", $from_ilias_ini);
124 if (!defined(
"ILIAS_ABSOLUTE_PATH")) {
125 define(
"ILIAS_ABSOLUTE_PATH",
$ilIliasIniFile->readVariable(
'server',
'absolute_path'));
130 define(
"ILIAS_LOG_FILE",
$ilIliasIniFile->readVariable(
"log",
"file"));
131 if (!defined(
"ILIAS_LOG_ENABLED")) {
132 define(
"ILIAS_LOG_ENABLED",
$ilIliasIniFile->readVariable(
"log",
"enabled"));
134 define(
"ILIAS_LOG_LEVEL",
$ilIliasIniFile->readVariable(
"log",
"level"));
137 define(
"PATH_TO_CONVERT",
$ilIliasIniFile->readVariable(
"tools",
"convert"));
138 define(
"PATH_TO_FFMPEG",
$ilIliasIniFile->readVariable(
"tools",
"ffmpeg"));
140 define(
"PATH_TO_MKISOFS",
$ilIliasIniFile->readVariable(
"tools",
"mkisofs"));
141 define(
"PATH_TO_UNZIP",
$ilIliasIniFile->readVariable(
"tools",
"unzip"));
142 define(
"PATH_TO_GHOSTSCRIPT",
$ilIliasIniFile->readVariable(
"tools",
"ghostscript"));
143 define(
"PATH_TO_JAVA",
$ilIliasIniFile->readVariable(
"tools",
"java"));
145 define(
"PATH_TO_SCSS",
$ilIliasIniFile->readVariable(
"tools",
"scss"));
149 define(
"ERROR_EDITOR_URL",
$ilIliasIniFile->readVariable(
'error',
'editor_url'));
152 if (
$ilIliasIniFile->variableExists(
'error',
'editor_path_translations')) {
154 "ERROR_EDITOR_PATH_TRANSLATIONS",
163 define(
"IL_VIRUS_SCANNER",
"Sophos");
164 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
165 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
169 define(
"IL_VIRUS_SCANNER",
"AntiVir");
170 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
171 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
175 define(
"IL_VIRUS_SCANNER",
"ClamAV");
176 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
177 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
180 define(
"IL_VIRUS_SCANNER",
"icap");
181 define(
"IL_ICAP_HOST",
$ilIliasIniFile->readVariable(
"tools",
"icap_host"));
182 define(
"IL_ICAP_PORT",
$ilIliasIniFile->readVariable(
"tools",
"icap_port"));
183 define(
"IL_ICAP_AV_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"icap_service_name"));
184 define(
"IL_ICAP_CLIENT",
$ilIliasIniFile->readVariable(
"tools",
"icap_client_path"));
188 define(
"IL_VIRUS_SCANNER",
"None");
189 define(
"IL_VIRUS_CLEAN_COMMAND",
'');
194 define(
"IL_TIMEZONE", $tz);
213 public static function bootstrapFilesystems(): void
217 $DIC[
'filesystem.security.sanitizing.filename'] =
function (
Container $c) {
219 $c->fileServiceSettings()
223 $DIC[
'filesystem.factory'] =
function (
$c) {
224 return new \ILIAS\Filesystem\Provider\DelegatingFilesystemFactory(
$c[
'filesystem.security.sanitizing.filename']);
227 $DIC[
'filesystem.web'] =
function (
$c) {
233 $delegatingFactory =
$c[
'filesystem.factory'];
234 $webConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/public/' .
ILIAS_WEB_DIR .
'/' .
CLIENT_ID);
235 return $delegatingFactory->getLocal($webConfiguration);
238 $DIC[
'filesystem.storage'] =
function (
$c) {
244 $delegatingFactory =
$c[
'filesystem.factory'];
245 $storageConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(
ILIAS_DATA_DIR .
'/' .
CLIENT_ID);
246 return $delegatingFactory->getLocal($storageConfiguration);
249 $DIC[
'filesystem.temp'] =
function (
$c) {
255 $delegatingFactory =
$c[
'filesystem.factory'];
256 $tempConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(
ILIAS_DATA_DIR .
'/' .
CLIENT_ID .
'/temp');
257 return $delegatingFactory->getLocal($tempConfiguration);
260 $DIC[
'filesystem.customizing'] =
function (
$c) {
266 $delegatingFactory =
$c[
'filesystem.factory'];
267 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/public/' .
'Customizing');
268 return $delegatingFactory->getLocal($customizingConfiguration);
271 $DIC[
'filesystem.libs'] =
function (
$c) {
277 $delegatingFactory =
$c[
'filesystem.factory'];
278 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'vendor');
279 return $delegatingFactory->getLocal($customizingConfiguration,
true);
282 $DIC[
'filesystem.node_modules'] =
function (
$c) {
288 $delegatingFactory =
$c[
'filesystem.factory'];
289 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'node_modules');
290 return $delegatingFactory->getLocal($customizingConfiguration,
true);
293 $DIC[
'filesystem'] =
function (
$c) {
294 return new \ILIAS\Filesystem\FilesystemsImpl(
295 $c[
'filesystem.storage'],
296 $c[
'filesystem.web'],
297 $c[
'filesystem.temp'],
298 $c[
'filesystem.customizing'],
299 $c[
'filesystem.libs'],
300 $c[
'filesystem.node_modules']
313 $dic[
'upload.processor-manager'] =
function (
$c) {
318 $fileUploadImpl = new \ILIAS\FileUpload\FileUploadImpl(
319 $c[
'upload.processor-manager'],
323 if ((defined(
'IL_VIRUS_SCANNER') && IL_VIRUS_SCANNER !=
"None") || (defined(
'IL_SCANNER_TYPE') && IL_SCANNER_TYPE ==
"1")) {
328 $fileUploadImpl->register(
330 $c->fileServiceSettings(),
331 $c->language()->txt(
"msg_info_blacklisted")
336 $c->language()->txt(
"upload_svg_rejection_message"),
337 $c->language()->txt(
"upload_svg_rejection_message_script"),
338 $c->language()->txt(
"upload_svg_rejection_message_base64"),
339 $c->language()->txt(
"upload_svg_rejection_message_foreign_object"),
340 $c->language()->txt(
"upload_svg_rejection_message_elements")
343 return $fileUploadImpl;
349 $dic[
'upload_policy_repository'] =
static function (
$dic) {
355 $dic->rbac()->review(),
357 $dic[
'upload_policy_repository']->getAll(),
372 $DIC[
'ilIliasIniFile'],
374 ))->build()->getBaseURI()
384 if (defined(
'CLIENT_ID')) {
388 $df =
$DIC[\ILIAS\Data\Factory::class];
391 if (!
$DIC->isDependencyAvailable(
'iliasIni')) {
392 self::abortAndDie(
'Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.');
395 $in_unit_tests = defined(
'IL_PHPUNIT_TEST');
397 $can_set_cookie = !$in_unit_tests && $context_supports_persitent_session;
398 $has_request_client_id =
$DIC->http()->wrapper()->query()->has(
'client_id');
399 $has_cookie_client_id =
$DIC->http()->cookieJar()->has(
'ilClientId');
402 $default_client_id =
$DIC->iliasIni()->readVariable(
'clients',
'default');
404 if (
$DIC->http()->wrapper()->query()->has(
'client_id')) {
405 $client_id_from_get =
$DIC->http()->wrapper()->query()->retrieve(
407 self::getClientIdTransformation()
410 if (
$DIC->http()->wrapper()->cookie()->has(
'ilClientId')) {
411 $client_id_from_cookie =
$DIC->http()->wrapper()->cookie()->retrieve(
413 self::getClientIdTransformation()
418 $client_id_to_use =
'';
419 if (isset($client_id_from_get) && $client_id_from_get !==
'') {
420 $client_id_to_use = $client_id_from_get;
423 if (isset($client_id_from_get) && strlen($client_id_from_get) > 0) {
425 $client_id_to_use =
$_GET[
'client_id'] = $df->clientId($client_id_from_get)->toString();
426 if ($can_set_cookie) {
430 $client_id_to_use = $default_client_id;
431 if (!isset(
$_COOKIE[
'ilClientId'])) {
436 $client_id_to_use = $client_id_to_use ?: $default_client_id;
438 define(
'CLIENT_ID', $df->clientId($client_id_to_use)->toString());
456 if (!is_string($from)) {
457 throw new InvalidArgumentException(__METHOD__ .
" the argument is not a string.");
459 return strip_tags($from);
467 return $result->
then(
function ($value):
Result {
470 }
catch (Exception $exception) {
471 return new Error($exception);
479 public function __invoke($from):
string
501 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
506 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
509 $ini_file =
"/client.ini.php";
510 if (defined(
'CLIENT_WEB_DIR')) {
516 $ilClientIniFile =
new ilIniFile($ini_file);
517 $ilClientIniFile->read();
520 if ($ilClientIniFile->ERROR !=
"") {
523 $mess = array(
"en" =>
"Client does not exist.",
524 "de" =>
"Mandant ist ungültig."
526 self::redirect(
"index.php?client_id=" . $default_client,
'', $mess);
528 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile initializing client ini file abborted with: " . $ilClientIniFile->ERROR);
534 define(
"DEVMODE", (
int) $ilClientIniFile->readVariable(
"system",
"DEVMODE"));
535 define(
"SHOWNOTICES", (
int) $ilClientIniFile->readVariable(
"system",
"SHOWNOTICES"));
536 if (!defined(
"ROOT_FOLDER_ID")) {
537 define(
"ROOT_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROOT_FOLDER_ID'));
539 if (!defined(
"SYSTEM_FOLDER_ID")) {
540 define(
"SYSTEM_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'SYSTEM_FOLDER_ID'));
542 if (!defined(
"ROLE_FOLDER_ID")) {
543 define(
"ROLE_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROLE_FOLDER_ID'));
545 define(
"MAIL_SETTINGS_ID", (
int) $ilClientIniFile->readVariable(
'system',
'MAIL_SETTINGS_ID'));
546 $error_handler = $ilClientIniFile->readVariable(
'system',
'ERROR_HANDLER');
547 define(
"ERROR_HANDLER", $error_handler ?:
"PRETTY_PAGE");
551 define(
"OH_REF_ID", (
int) $ilClientIniFile->readVariable(
"system",
"OH_REF_ID"));
557 if (!defined(
"CLIENT_DATA_DIR")) {
560 if (!defined(
"CLIENT_WEB_DIR")) {
563 define(
"CLIENT_NAME", $ilClientIniFile->readVariable(
'client',
'name'));
565 $db_type = $ilClientIniFile->readVariable(
"db",
"type");
566 if ($db_type ===
"") {
569 define(
"IL_DB_TYPE", $db_type);
578 global $ilClientIniFile;
580 if (!$ilClientIniFile->readVariable(
"client",
"access")) {
582 "en" =>
"The server is not available due to maintenance." .
583 " We apologise for any inconvenience.",
584 "de" =>
"Der Server ist aufgrund von Wartungsarbeiten aktuell nicht verfügbar." .
585 " Wir bitten um Verständnis. Versuchen Sie es später noch einmal."
587 $mess_id =
"init_error_maintenance";
605 $ilDB->initFromIniFile();
618 $DIC[
'global_cache'] = new \ILIAS\Cache\Services(
619 $legacy_settings->getConfig()
630 if (!$db_session_handler->setSaveHandler()) {
637 if (function_exists(
"session_status") && session_status() == PHP_SESSION_ACTIVE) {
638 session_regenerate_id();
650 } elseif (isset(
$GLOBALS[
'COOKIE_PATH'])) {
668 define(
'IL_COOKIE_HTTPONLY',
true);
669 define(
'IL_COOKIE_EXPIRE', 0);
670 define(
'IL_COOKIE_DOMAIN',
'');
671 if (!defined(
'IL_COOKIE_PATH')) {
679 if (defined(
'CLIENT_ID') &&
680 !defined(
'IL_PHPUNIT_TEST') &&
693 if (!defined(
'IL_COOKIE_SECURE')) {
697 $cookie_secure = !
$ilSetting->get(
'https',
'0') &&
$DIC[
'https']->isDetected();
698 define(
'IL_COOKIE_SECURE', $cookie_secure);
700 $cookie_parameters = [
701 'lifetime' => IL_COOKIE_EXPIRE,
703 'domain' => IL_COOKIE_DOMAIN,
704 'secure' => IL_COOKIE_SECURE,
705 'httponly' => IL_COOKIE_HTTPONLY,
710 (!isset(session_get_cookie_params()[
'samesite']) || strtolower(session_get_cookie_params()[
'samesite']) !==
'strict')
712 $cookie_parameters[
'samesite'] =
'Lax';
715 session_set_cookie_params($cookie_parameters);
725 $c->logger()->cron(),
726 $c[
'component.repository'],
727 $c[
'component.factory']
733 $c[
'cron.repository'],
736 $c->logger()->cron(),
747 $c[
"object.customicons.factory"] =
function (
$c) {
748 return new CustomIconFactory(
749 $c->filesystem()->web(),
758 $c[
"user.avatar.factory"] =
function (
$c) {
759 return new \ilUserAvatarFactory(
$c);
782 $c[
'acc.criteria.type.factory'],
804 "components/ILIAS/Administration/classes/class.ilSetting.php"
813 define(
"ANONYMOUS_USER_ID", (
int)
$ilSetting->get(
"anonymous_user_id"));
814 define(
"ANONYMOUS_ROLE_ID", (
int)
$ilSetting->get(
"anonymous_role_id"));
815 define(
"SYSTEM_USER_ID", (
int)
$ilSetting->get(
"system_user_id"));
816 define(
"SYSTEM_ROLE_ID", (
int)
$ilSetting->get(
"system_role_id"));
817 define(
"USER_FOLDER_ID", 7);
820 define(
"RECOVERY_FOLDER_ID", (
int)
$ilSetting->get(
"recovery_folder_id"));
823 define(
"IL_INST_ID",
$ilSetting->get(
"inst_id",
'0'));
826 define(
"SUFFIX_REPL_DEFAULT",
"php,php3,php4,inc,lang,phtml,htaccess");
827 define(
"SUFFIX_REPL_ADDITIONAL",
$ilSetting->get(
"suffix_repl_additional",
""));
840 $component_factory =
$DIC[
"component.factory"];
846 "./components/ILIAS/Style/System/classes/class.ilStyleDefinition.php"
850 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as $ui_plugin) {
851 $gui_class = $ui_plugin->getUIClassInstance();
852 $gui_class->modifyGUI(
"components/ILIAS/Init",
"init_style", array(
"styleDefinition" =>
$DIC->systemStyle()));
863 static $context_init;
865 $uid =
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
867 $DIC->user()->setId($uid);
868 $DIC->user()->read();
869 if (!isset($context_init)) {
870 if (
$DIC->user()->isAnonymous()) {
871 $DIC->globalScreen()->tool()->context()->claim()->external();
873 $DIC->globalScreen()->tool()->context()->claim()->internal();
875 $context_init =
true;
896 $larr = explode(
",", trim(
$ilSetting->get(
"locale")));
899 foreach ($larr as $l) {
900 if (trim($l) !=
"") {
904 if (count($ls) > 0) {
905 setlocale(LC_ALL, $ls);
908 setlocale(LC_NUMERIC,
"C");
924 $session_destroyed =
false;
925 if (
$DIC[
'ilAuthSession']->isExpired()) {
926 $session_destroyed =
true;
929 if (!
$DIC[
'ilAuthSession']->isAuthenticated()) {
930 $session_destroyed =
true;
934 if ($session_destroyed) {
941 if (
$DIC->http()->wrapper()->query()->has(
'target')) {
942 $target =
$DIC->http()->wrapper()->query()->retrieve(
944 $DIC->refinery()->kindlyTo()->string()
949 if (strlen($target)) {
951 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
952 if ($current_script ==
"goto.php") {
961 "ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=&ref_id=" . (defined(
974 $session_expired =
false;
977 if (
$DIC[
'ilAuthSession']->isExpired()) {
979 $session_expired =
true;
981 if (!
$DIC[
'ilAuthSession']->isAuthenticated()) {
985 $target =
$DIC->http()->wrapper()->query()->has(
'target')
986 ?
$DIC->http()->wrapper()->query()->retrieve(
988 $DIC->refinery()->kindlyTo()->string()
992 if (strlen($target)) {
993 $target =
"target=" . $target .
"&";
998 $DIC->refinery()->byTrying([
999 $DIC->refinery()->kindlyTo()->string(),
1000 $DIC->refinery()->always(
'')
1004 $script =
"login.php?" . $target .
"client_id=" .
$client_id;
1005 $script .= $session_expired ?
"&session_expired=1" :
"";
1009 "init_error_authentication_fail",
1011 "en" =>
"Authentication failed.",
1012 "de" =>
"Authentifizierung fehlgeschlagen."
1020 public static function initLanguage(
bool $a_use_user_language =
true): void
1029 if ($a_use_user_language) {
1030 if (
$DIC->offsetExists(
'lng')) {
1031 $DIC->offsetUnset(
'lng');
1037 if (is_object($rbacsystem) &&
$DIC->offsetExists(
'tree')) {
1038 $rbacsystem->initMemberView();
1050 "./components/ILIAS/AccessControl/classes/class.ilRbacReview.php",
1060 "./components/ILIAS/AccessControl/classes/class.ilRbacAdmin.php",
1067 "./components/ILIAS/AccessControl/classes/class.ilAccess.php",
1090 ?
string $a_source_file =
null,
1091 ?
bool $destroy_existing =
false
1095 if ($destroy_existing) {
1099 if (isset(
$DIC[$a_name])) {
1100 unset(
$DIC[$a_name]);
1104 $GLOBALS[$a_name] = is_object($a_class) ? $a_class :
new $a_class();
1114 $GLOBALS[
'ilLog']->write(
"Fatal Error: ilInitialisation - " . $a_message);
1125 error_reporting(-1);
1128 protected static bool $already_initialized =
false;
1132 self::$already_initialized =
false;
1139 self::initSession();
1143 self::resumeUserSession();
1153 if (self::$already_initialized) {
1157 $GLOBALS[
"DIC"][
"ilLoggerFactory"] =
function (
$c) {
1161 self::$already_initialized =
true;
1164 self::initHTTPServices(
$GLOBALS[
"DIC"]);
1166 self::initFileUploadService(
$GLOBALS[
"DIC"]);
1169 self::initSession();
1175 self::resumeUserSession();
1180 self::initLanguage(
true);
1181 $GLOBALS[
'DIC'][
'tree']->initLangCode();
1183 self::initInjector(
$GLOBALS[
'DIC']);
1184 self::initBackgroundTasks(
$GLOBALS[
'DIC']);
1185 self::initKioskMode(
$GLOBALS[
'DIC']);
1195 self::replaceSuperGlobals(
$GLOBALS[
'DIC']);
1203 if (isset(
$GLOBALS[
'DIC'][
'ilAuthSession'])) {
1204 unset(
$GLOBALS[
'DIC'][
'ilAuthSession']);
1209 $c[
'ilLoggerFactory']->getLogger(
'auth')
1211 $auth_session->init();
1212 return $auth_session;
1222 error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
1235 self::handleErrorReporting();
1237 self::requireCommonIncludes();
1244 "./components/ILIAS/Init/classes/class.ilErrorHandling.php"
1247 self::removeUnsafeCharacters();
1249 self::initIliasIniFile();
1251 define(
'IL_INITIAL_WD', getcwd());
1254 self::initGlobal(
"ilias",
"ILIAS",
"./components/ILIAS/Init/classes/class.ilias.php");
1262 global $https, $ilias,
$DIC;
1264 self::setCookieConstants();
1266 self::determineClient();
1268 self::bootstrapFilesystems();
1270 self::initResourceStorage();
1272 self::initClientIniFile();
1279 self::handleDevMode();
1282 self::handleMaintenanceMode();
1284 self::initDatabase();
1286 self::initGlobalCache();
1288 self::initComponentService(
$DIC);
1291 self::initLanguage(
false);
1297 "ilAppEventHandler",
1298 "ilAppEventHandler",
1299 "./components/ILIAS/EventHandling/classes/class.ilAppEventHandler.php"
1311 "./components/ILIAS/Component/classes/class.ilPluginAdmin.php"
1314 self::initGlobal(
"https",
"ilHTTPS",
"./components/ILIAS/Http/classes/class.ilHTTPS.php");
1315 self::initSettings();
1316 self::setSessionHandler();
1319 self::initCustomObjectIcons(
$GLOBALS[
'DIC']);
1320 self::initLegalDocuments(
$GLOBALS[
'DIC']);
1322 self::initAccessibilityControlConcept(
$GLOBALS[
'DIC']);
1323 self::initLearningObjectMetadata(
$GLOBALS[
'DIC']);
1330 $https->enableSecureCookies();
1331 $https->checkProtocolAndRedirectIfNeeded();
1338 "ilObjectDataCache",
1339 "./components/ILIAS/Object/classes/class.ilObjectDataCache.php"
1344 "ilObjectDefinition",
1345 "./components/ILIAS/Object/classes/class.ilObjectDefinition.php"
1350 self::initGlobal(
"tree", $tree);
1353 self::setSessionCookieParams();
1354 self::setClientIdCookie();
1359 self::initGlobalScreen(
$DIC);
1367 global $ilias, $ilUser;
1373 "./components/ILIAS/User/classes/class.ilObjUser.php",
1379 new UserPublicInterface($ilUser),
1384 $ilias->account = $ilUser;
1386 self::initAccessHandling();
1401 !
$DIC[
'ilAuthSession']->isAuthenticated() ||
1402 $DIC[
'ilAuthSession']->isExpired()
1404 if (
$GLOBALS[
'DIC'][
'ilAuthSession']->isExpired()) {
1409 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
1410 if (self::blockedAuthentication($current_script)) {
1416 self::handleAuthenticationFail();
1421 self::initUserAccount();
1427 protected static function handleAuthenticationSuccess(): void
1450 throw new Exception(
"Authentication failed.");
1453 if ((
$DIC->http()->request()->getQueryParams()[
'cmdMode'] ?? 0) ===
'asynch') {
1454 $DIC->language()->loadLanguageModule(
'init');
1455 $DIC->http()->saveResponse(
1456 $DIC->http()->response()
1458 ->withBody(Streams::ofString(
$DIC->language()->txt(
'init_error_authentication_fail')))
1460 $DIC->http()->sendResponse();
1461 $DIC->http()->close();
1464 $DIC[
'ilAuthSession']->isExpired() &&
1474 self::goToPublicSection();
1497 $c[
'global_screen'] =
function () use (
$c) {
1504 $c->globalScreen()->tool()->context()->stack()->clear();
1505 $c->globalScreen()->tool()->context()->claim()->main();
1514 $component_repository =
$c[
"component.repository"];
1515 $component_factory =
$c[
"component.factory"];
1516 foreach ($component_repository->getPlugins() as $pl) {
1517 if (!$pl->isActive()) {
1520 $plugin = $component_factory->getPlugin($pl->getId());
1521 $closure =
$plugin->exchangeUIRendererAfterInitialization(
$c);
1522 $c->offsetUnset(
'ui.renderer');
1523 $c[
'ui.renderer'] = $closure;
1525 foreach (
$c->keys() as $key) {
1526 if (strpos($key,
"ui.factory") === 0) {
1527 $c[$key] =
$plugin->exchangeUIFactoryAfterInitialization($key,
$c);
1541 $replace_super_globals = (
1542 !$client_ini->variableExists(
'server',
'prevent_super_global_replacement') ||
1543 !(bool) $client_ini->readVariable(
'server',
'prevent_super_global_replacement')
1546 if ($replace_super_globals) {
1547 $throwOnValueAssignment = defined(
'DEVMODE') && DEVMODE;
1567 global $ilUser,
$DIC;
1574 self::initUploadPolicies(
$DIC);
1577 self::applyPluginManipulationsToUiFramework(
$GLOBALS[
"DIC"]);
1579 self::initGlobal(
"tpl", $tpl);
1582 $dispatcher = new \ILIAS\Init\StartupSequence\StartUpSequenceDispatcher(
$DIC);
1583 $dispatcher->dispatch();
1587 "ilNavigationHistory",
1588 "ilNavigationHistory",
1589 "components/ILIAS/Navigation/classes/class.ilNavigationHistory.php"
1595 "components/ILIAS/Help/classes/class.ilHelpGUI.php"
1607 "./components/ILIAS/UIComponent/Toolbar/classes/class.ilToolbarGUI.php"
1613 "./components/ILIAS/Locator/classes/class.ilLocatorGUI.php"
1619 "./components/ILIAS/UIComponent/Tabs/classes/class.ilTabsGUI.php"
1630 if (isset(
$_GET[
'offset']) &&
$_GET[
'offset'] !=
"") {
1634 self::initGlobal(
"lti",
"ilLTIViewGUI",
"./components/ILIAS/LTIProvider/classes/class.ilLTIViewGUI.php");
1636 self::initKioskMode(
$GLOBALS[
"DIC"]);
1672 $a_current_script ==
"register.php" ||
1673 $a_current_script ==
"pwassist.php" ||
1674 $a_current_script ==
"confirmReg.php" ||
1675 $a_current_script ==
"il_securimage_play.php" ||
1676 $a_current_script ==
"il_securimage_show.php" ||
1677 $a_current_script ==
'login.php'
1684 $requestBaseClass = strtolower((
string) (
$_GET[
'baseClass'] ??
''));
1685 if ($requestBaseClass == strtolower(ilStartUpGUI::class)) {
1686 $requestCmdClass = strtolower((
string) (
$_GET[
'cmdClass'] ??
''));
1688 $requestCmdClass == strtolower(ilAccountRegistrationGUI::class) ||
1689 $requestCmdClass == strtolower(ilPasswordAssistanceGUI::class)
1694 $cmd =
$DIC->ctrl()->getCmd();
1696 if (in_array($cmd, [
1697 'showLegalDocuments',
1698 'showAccountMigration',
1703 'doStandardAuthentication',
1704 'doCasAuthentication',
1712 if (
$DIC->http()->wrapper()->query()->has(
'target')) {
1714 $target =
$_GET[
'target'];
1719 ($a_current_script ==
"goto.php" && $target ==
"impr_0") ||
1720 $requestBaseClass == strtolower(ilImprintGUI::class)
1728 (strtolower($requestCmdClass ??
"") === strtolower(ilAccessibilityControlConceptGUI::class))
1734 if ($a_current_script ==
'goto.php' && in_array($target, array(
1745 $current_ref_id =
$DIC->http()->wrapper()->query()->has(
'ref_id')
1746 ?
$DIC->http()->wrapper()->query()->retrieve(
'ref_id',
$DIC->refinery()->kindlyTo()->int())
1749 if (
null !== $current_ref_id
1750 &&
$DIC->user()->getId() === 0
1751 &&
$DIC->access()->checkAccessOfUser(
1768 protected static function translateMessage(
string $a_message_id, ?array $a_message_static =
null): string
1776 $lang = $ilUser->getLanguage();
1777 } elseif (isset($_REQUEST[
"lang"])) {
1778 $lang = (string) $_REQUEST[
"lang"];
1781 } elseif ($ilClientIniFile) {
1782 $lang = $ilClientIniFile->readVariable(
"language",
"default");
1785 $lang =
$lng->getLangKey();
1789 if (
$ilDB && $a_message_id) {
1794 $lng->loadLanguageModule(
"init");
1795 $message =
$lng->txt($a_message_id);
1796 } elseif (is_array($a_message_static)) {
1797 if (!isset($a_message_static[$lang])) {
1800 $message = $a_message_static[$lang];
1810 string $a_message_id =
'',
1811 ?array $a_message_static =
null
1814 if (defined(
"ILIAS_HTTP_PATH") &&
1815 !stristr($a_target, ILIAS_HTTP_PATH)) {
1816 $a_target = ILIAS_HTTP_PATH .
"/" . $a_target;
1819 foreach ([
'ext_uid',
'soap_pw'] as
$param) {
1820 if (
false === strpos(
1833 $message = self::translateMessage($a_message_id, $a_message_static);
1837 $link = self::translateMessage(
1838 "init_error_redirect_click",
1839 array(
"en" =>
'Please click to continue.',
1840 "de" =>
'Bitte klicken um fortzufahren.'
1844 '<br /><a href="' . $a_target .
'">' . $link .
'</a>';
1851 $mess = self::translateMessage(
1852 "init_error_redirect_info",
1853 array(
"en" =>
'Redirect not supported by context.',
1854 "de" =>
'Weiterleitungen werden durch Kontext nicht unterstützt.'
1857 ' (' . $a_target .
')';
1861 self::abortAndDie($mess);
1871 self::goToPublicSection();
1877 $DIC->http()->wrapper()->query()->has(
'target')
1879 $target =
$DIC->http()->wrapper()->query()->retrieve(
1881 $DIC->refinery()->kindlyTo()->string()
1887 if ($target ===
'') {
1892 $DIC->ctrl()->redirectToURL(
"goto.php?target=" . $target);
1900 $n_of_tasks =
$ilIliasIniFile->readVariable(
"background_tasks",
"number_of_concurrent_tasks");
1901 $sync =
$ilIliasIniFile->readVariable(
"background_tasks",
"concurrency");
1903 $n_of_tasks = $n_of_tasks ?: 5;
1904 $sync = $sync ?:
'sync';
1906 $c[
"bt.task_factory"] =
function (
$c) {
1907 return new \ILIAS\BackgroundTasks\Implementation\Tasks\BasicTaskFactory(
$c[
"di.injector"]);
1910 $c[
"bt.persistence"] =
function (
$c) {
1911 return \ILIAS\BackgroundTasks\Implementation\Persistence\BasicPersistence::instance(
$c->database());
1914 $c[
"bt.injector"] =
function (
$c) {
1918 $c[
"bt.task_manager"] =
function (
$c) use ($sync) {
1919 if ($sync ==
'sync') {
1920 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager(
$c[
"bt.persistence"]);
1921 } elseif ($sync ==
'async') {
1922 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\AsyncTaskManager(
$c[
"bt.persistence"]);
1924 throw new ilException(
"The supported Background Task Managers are sync and async. $sync given.");
1931 $c[
"di.dependency_map"] =
function (
$c) {
1932 return new \ILIAS\BackgroundTasks\Dependencies\DependencyMap\BaseDependencyMap();
1935 $c[
"di.injector"] =
function (
$c) {
1936 return new \ILIAS\BackgroundTasks\Dependencies\Injector(
$c,
$c[
"di.dependency_map"]);
1942 $c[
"service.kiosk_mode"] =
function (
$c) {
1954 $c[
'learning_object_metadata'] =
function (
$c) {
1955 return new \ILIAS\MetaData\Services\Services(
$c);
static orderBy(string $orderBy, string $orderDirection='ASC')
Customizing of pimple-DIC for ILIAS.
A result encapsulates a value or an error and simplifies the handling of those.
Class FilenameSanitizerPreProcessor.
Class InsecureFilenameSanitizerPreProcessor.
Class PreProcessorManagerImpl.
Class SVGBlacklistPreProcessor.
Stream factory which enables the user to create streams without the knowledge of the concrete class.
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
static init(Container $c)
This HelpTextRetriever simply echo the purpose and the topics for debugging and development purpose.
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.
Responsible for loading the HTTP Service into the dependency injection container of ILIAS.
Responsible for loading the Resource Storage into the dependency injection container of ILIAS.
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 int CONTEXT_HTTP
HTTP Auth used for WebDAV and CalDAV If a special handling for WebDAV or CalDAV is required overwrite...
static getInstance(ilLogger $logger)
static isAuthenticationForced()
static handleForcedAuthentication()
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 getWrapper(string $a_type)
Base class for ILIAS Exception handling.
Class ilFileServicesFilenameSanitizer.
Class ilFileServicesPolicy.
This describes a facility that the UI framework can use to retrieve some help text.
INIFile Parser Early access in init proceess! Avoid further dependencies like logging or other servic...
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 initMail(Container $c)
static removeUnsafeCharacters()
Remove unsafe characters from GET.
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 translateMessage(string $a_message_id, ?array $a_message_static=null)
Translate message if possible.
static applyPluginManipulationsToUiFramework(\ILIAS\DI\Container $c)
static handleErrorReporting()
Set error reporting level.
static initFileUploadService(\ILIAS\DI\Container $dic)
Initializes the file upload service.
static initLegalDocuments(Container $c)
static initComponentService(\ILIAS\DI\Container $container)
static initLearningObjectMetadata(\ILIAS\DI\Container $c)
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
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 redirectToStartingPage(string $target='')
static initUploadPolicies(\ILIAS\DI\Container $dic)
static initAccessibilityControlConcept(\ILIAS\DI\Container $c)
static redirect(string $a_target, string $a_message_id='', ?array $a_message_static=null)
Redirects to target url if context supports it.
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
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.
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...
static _exists(string $a_session_id)
const int SESSION_CLOSE_LOGIN
const int SESSION_CLOSE_PUBLIC
static setClosingContext(int $a_context)
set closing context (for statistics)
const int SESSION_CLOSE_EXPIRE
static _destroy($a_session_id, ?int $a_closing_context=null, $a_expired_at=null)
Destroy session.
static initDefaultTimeZone(ilIniFile $ini)
Initialize default timezone from system settings.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static getStartingPointAsUrl()
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)
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.
static http()
Fetches the global http state from ILIAS.
applyTo(Result $result)
@inheritDoc
__invoke($from)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))