40if (!isset(
$GLOBALS[
'ilGlobalStartTime']) || !
$GLOBALS[
'ilGlobalStartTime']) {
41 $GLOBALS[
'ilGlobalStartTime'] = microtime();
75 foreach ($var as $k => $v) {
83 array(
"\x00",
"\n",
"\r",
"\\",
"'",
'"',
"\x1a"),
96 require_once(__DIR__ .
"/../../../../ilias_version.php");
97 self::initGlobal(
"ilBench",
"ilBenchmark",
"./components/ILIAS/Utilities/classes/class.ilBenchmark.php");
114 if (!defined(
'ILIAS_DATA_DIR')) {
115 define(
"ILIAS_DATA_DIR",
$ilIliasIniFile->readVariable(
"clients",
"datadir"));
118 if (!defined(
'ILIAS_WEB_DIR')) {
120 $from_ilias_ini = str_replace(
'public/',
'', $from_ilias_ini);
121 define(
"ILIAS_WEB_DIR", $from_ilias_ini);
123 if (!defined(
"ILIAS_ABSOLUTE_PATH")) {
124 define(
"ILIAS_ABSOLUTE_PATH",
$ilIliasIniFile->readVariable(
'server',
'absolute_path'));
129 define(
"ILIAS_LOG_FILE",
$ilIliasIniFile->readVariable(
"log",
"file"));
130 if (!defined(
"ILIAS_LOG_ENABLED")) {
131 define(
"ILIAS_LOG_ENABLED",
$ilIliasIniFile->readVariable(
"log",
"enabled"));
133 define(
"ILIAS_LOG_LEVEL",
$ilIliasIniFile->readVariable(
"log",
"level"));
136 define(
"PATH_TO_CONVERT",
$ilIliasIniFile->readVariable(
"tools",
"convert"));
137 define(
"PATH_TO_FFMPEG",
$ilIliasIniFile->readVariable(
"tools",
"ffmpeg"));
139 define(
"PATH_TO_MKISOFS",
$ilIliasIniFile->readVariable(
"tools",
"mkisofs"));
140 define(
"PATH_TO_UNZIP",
$ilIliasIniFile->readVariable(
"tools",
"unzip"));
141 define(
"PATH_TO_GHOSTSCRIPT",
$ilIliasIniFile->readVariable(
"tools",
"ghostscript"));
142 define(
"PATH_TO_JAVA",
$ilIliasIniFile->readVariable(
"tools",
"java"));
144 define(
"PATH_TO_SCSS",
$ilIliasIniFile->readVariable(
"tools",
"scss"));
148 define(
"ERROR_EDITOR_URL",
$ilIliasIniFile->readVariable(
'error',
'editor_url'));
151 if (
$ilIliasIniFile->variableExists(
'error',
'editor_path_translations')) {
153 "ERROR_EDITOR_PATH_TRANSLATIONS",
162 define(
"IL_VIRUS_SCANNER",
"Sophos");
163 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
164 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
168 define(
"IL_VIRUS_SCANNER",
"AntiVir");
169 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
170 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
174 define(
"IL_VIRUS_SCANNER",
"ClamAV");
175 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
176 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
179 define(
"IL_VIRUS_SCANNER",
"icap");
180 define(
"IL_ICAP_HOST",
$ilIliasIniFile->readVariable(
"tools",
"icap_host"));
181 define(
"IL_ICAP_PORT",
$ilIliasIniFile->readVariable(
"tools",
"icap_port"));
182 define(
"IL_ICAP_AV_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"icap_service_name"));
183 define(
"IL_ICAP_CLIENT",
$ilIliasIniFile->readVariable(
"tools",
"icap_client_path"));
187 define(
"IL_VIRUS_SCANNER",
"None");
188 define(
"IL_VIRUS_CLEAN_COMMAND",
'');
193 define(
"IL_TIMEZONE", $tz);
212 public static function bootstrapFilesystems(): void
216 $DIC[
'filesystem.security.sanitizing.filename'] =
function (
Container $c) {
218 $c->fileServiceSettings()
222 $DIC[
'filesystem.factory'] =
function (
$c) {
223 return new \ILIAS\Filesystem\Provider\DelegatingFilesystemFactory(
$c[
'filesystem.security.sanitizing.filename']);
226 $DIC[
'filesystem.web'] =
function (
$c) {
232 $delegatingFactory =
$c[
'filesystem.factory'];
233 $webConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/public/' .
ILIAS_WEB_DIR .
'/' .
CLIENT_ID);
234 return $delegatingFactory->getLocal($webConfiguration);
237 $DIC[
'filesystem.storage'] =
function (
$c) {
243 $delegatingFactory =
$c[
'filesystem.factory'];
244 $storageConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(
ILIAS_DATA_DIR .
'/' .
CLIENT_ID);
245 return $delegatingFactory->getLocal($storageConfiguration);
248 $DIC[
'filesystem.temp'] =
function (
$c) {
254 $delegatingFactory =
$c[
'filesystem.factory'];
255 $tempConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(
ILIAS_DATA_DIR .
'/' .
CLIENT_ID .
'/temp');
256 return $delegatingFactory->getLocal($tempConfiguration);
259 $DIC[
'filesystem.customizing'] =
function (
$c) {
265 $delegatingFactory =
$c[
'filesystem.factory'];
266 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/public/' .
'Customizing');
267 return $delegatingFactory->getLocal($customizingConfiguration);
270 $DIC[
'filesystem.libs'] =
function (
$c) {
276 $delegatingFactory =
$c[
'filesystem.factory'];
277 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'vendor');
278 return $delegatingFactory->getLocal($customizingConfiguration,
true);
281 $DIC[
'filesystem.node_modules'] =
function (
$c) {
287 $delegatingFactory =
$c[
'filesystem.factory'];
288 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'node_modules');
289 return $delegatingFactory->getLocal($customizingConfiguration,
true);
292 $DIC[
'filesystem'] =
function (
$c) {
293 return new \ILIAS\Filesystem\FilesystemsImpl(
294 $c[
'filesystem.storage'],
295 $c[
'filesystem.web'],
296 $c[
'filesystem.temp'],
297 $c[
'filesystem.customizing'],
298 $c[
'filesystem.libs'],
299 $c[
'filesystem.node_modules']
312 $dic[
'upload.processor-manager'] =
function (
$c) {
317 $fileUploadImpl = new \ILIAS\FileUpload\FileUploadImpl(
318 $c[
'upload.processor-manager'],
322 if ((defined(
'IL_VIRUS_SCANNER') && IL_VIRUS_SCANNER !=
"None") || (defined(
'IL_SCANNER_TYPE') && IL_SCANNER_TYPE ==
"1")) {
327 $fileUploadImpl->register(
329 $c->fileServiceSettings(),
330 $c->language()->txt(
"msg_info_blacklisted")
335 $c->language()->txt(
"upload_svg_rejection_message"),
336 $c->language()->txt(
"upload_svg_rejection_message_script"),
337 $c->language()->txt(
"upload_svg_rejection_message_base64"),
338 $c->language()->txt(
"upload_svg_rejection_message_elements")
341 return $fileUploadImpl;
347 $dic[
'upload_policy_repository'] =
static function (
$dic) {
353 $dic->rbac()->review(),
355 $dic[
'upload_policy_repository']->getAll(),
370 $DIC[
'ilIliasIniFile'],
372 ))->build()->getBaseURI()
382 if (defined(
'CLIENT_ID')) {
386 $df =
$DIC[\ILIAS\Data\Factory::class];
389 if (!
$DIC->isDependencyAvailable(
'iliasIni')) {
390 self::abortAndDie(
'Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.');
393 $in_unit_tests = defined(
'IL_PHPUNIT_TEST');
395 $can_set_cookie = !$in_unit_tests && $context_supports_persitent_session;
396 $has_request_client_id =
$DIC->http()->wrapper()->query()->has(
'client_id');
397 $has_cookie_client_id =
$DIC->http()->cookieJar()->has(
'ilClientId');
400 $default_client_id =
$DIC->iliasIni()->readVariable(
'clients',
'default');
402 if (
$DIC->http()->wrapper()->query()->has(
'client_id')) {
403 $client_id_from_get =
$DIC->http()->wrapper()->query()->retrieve(
405 self::getClientIdTransformation()
408 if (
$DIC->http()->wrapper()->cookie()->has(
'ilClientId')) {
409 $client_id_from_cookie =
$DIC->http()->wrapper()->cookie()->retrieve(
411 self::getClientIdTransformation()
416 $client_id_to_use =
'';
417 if (isset($client_id_from_get) && $client_id_from_get !==
'') {
418 $client_id_to_use = $client_id_from_get;
421 if (isset($client_id_from_get) && strlen($client_id_from_get) > 0) {
423 $client_id_to_use =
$_GET[
'client_id'] = $df->clientId($client_id_from_get)->toString();
424 if ($can_set_cookie) {
428 $client_id_to_use = $default_client_id;
429 if (!isset(
$_COOKIE[
'ilClientId'])) {
434 $client_id_to_use = $client_id_to_use ?: $default_client_id;
436 define(
'CLIENT_ID', $df->clientId($client_id_to_use)->toString());
454 if (!is_string($from)) {
455 throw new InvalidArgumentException(__METHOD__ .
" the argument is not a string.");
457 return strip_tags($from);
465 return $result->
then(
function ($value):
Result {
468 }
catch (Exception $exception) {
469 return new Error($exception);
477 public function __invoke($from):
string
499 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
504 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
507 $ini_file =
"/client.ini.php";
508 if (defined(
'CLIENT_WEB_DIR')) {
514 $ilClientIniFile =
new ilIniFile($ini_file);
515 $ilClientIniFile->read();
518 if ($ilClientIniFile->ERROR !=
"") {
521 $mess = array(
"en" =>
"Client does not exist.",
522 "de" =>
"Mandant ist ungültig."
524 self::redirect(
"index.php?client_id=" . $default_client,
'', $mess);
526 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile initializing client ini file abborted with: " . $ilClientIniFile->ERROR);
532 define(
"DEVMODE", (
int) $ilClientIniFile->readVariable(
"system",
"DEVMODE"));
533 define(
"SHOWNOTICES", (
int) $ilClientIniFile->readVariable(
"system",
"SHOWNOTICES"));
534 if (!defined(
"ROOT_FOLDER_ID")) {
535 define(
"ROOT_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROOT_FOLDER_ID'));
537 if (!defined(
"SYSTEM_FOLDER_ID")) {
538 define(
"SYSTEM_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'SYSTEM_FOLDER_ID'));
540 if (!defined(
"ROLE_FOLDER_ID")) {
541 define(
"ROLE_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROLE_FOLDER_ID'));
543 define(
"MAIL_SETTINGS_ID", (
int) $ilClientIniFile->readVariable(
'system',
'MAIL_SETTINGS_ID'));
544 $error_handler = $ilClientIniFile->readVariable(
'system',
'ERROR_HANDLER');
545 define(
"ERROR_HANDLER", $error_handler ?:
"PRETTY_PAGE");
549 define(
"OH_REF_ID", (
int) $ilClientIniFile->readVariable(
"system",
"OH_REF_ID"));
555 if (!defined(
"CLIENT_DATA_DIR")) {
558 if (!defined(
"CLIENT_WEB_DIR")) {
561 define(
"CLIENT_NAME", $ilClientIniFile->readVariable(
'client',
'name'));
563 $db_type = $ilClientIniFile->readVariable(
"db",
"type");
564 if ($db_type ===
"") {
567 define(
"IL_DB_TYPE", $db_type);
576 global $ilClientIniFile;
578 if (!$ilClientIniFile->readVariable(
"client",
"access")) {
580 "en" =>
"The server is not available due to maintenance." .
581 " We apologise for any inconvenience.",
582 "de" =>
"Der Server ist aufgrund von Wartungsarbeiten aktuell nicht verfügbar." .
583 " Wir bitten um Verständnis. Versuchen Sie es später noch einmal."
585 $mess_id =
"init_error_maintenance";
603 $ilDB->initFromIniFile();
616 $DIC[
'global_cache'] = new \ILIAS\Cache\Services(
617 $legacy_settings->getConfig()
628 if (!$db_session_handler->setSaveHandler()) {
635 if (function_exists(
"session_status") && session_status() == PHP_SESSION_ACTIVE) {
636 session_regenerate_id();
648 } elseif (isset(
$GLOBALS[
'COOKIE_PATH'])) {
666 define(
'IL_COOKIE_HTTPONLY',
true);
667 define(
'IL_COOKIE_EXPIRE', 0);
668 define(
'IL_COOKIE_DOMAIN',
'');
669 if (!defined(
'IL_COOKIE_PATH')) {
677 if (defined(
'CLIENT_ID') &&
678 !defined(
'IL_PHPUNIT_TEST') &&
691 if (!defined(
'IL_COOKIE_SECURE')) {
695 $cookie_secure = !
$ilSetting->get(
'https',
'0') &&
$DIC[
'https']->isDetected();
696 define(
'IL_COOKIE_SECURE', $cookie_secure);
698 $cookie_parameters = [
699 'lifetime' => IL_COOKIE_EXPIRE,
701 'domain' => IL_COOKIE_DOMAIN,
702 'secure' => IL_COOKIE_SECURE,
703 'httponly' => IL_COOKIE_HTTPONLY,
708 (!isset(session_get_cookie_params()[
'samesite']) || strtolower(session_get_cookie_params()[
'samesite']) !==
'strict')
710 $cookie_parameters[
'samesite'] =
'Lax';
713 session_set_cookie_params($cookie_parameters);
723 $c->logger()->cron(),
724 $c[
'component.repository'],
725 $c[
'component.factory']
731 $c[
'cron.repository'],
734 $c->logger()->cron(),
745 $c[
"object.customicons.factory"] =
function (
$c) {
746 return new CustomIconFactory(
747 $c->filesystem()->web(),
756 $c[
"user.avatar.factory"] =
function (
$c) {
757 return new \ilUserAvatarFactory(
$c);
775 $c[
'acc.criteria.type.factory'],
797 "components/ILIAS/Administration/classes/class.ilSetting.php"
806 define(
"ANONYMOUS_USER_ID", (
int)
$ilSetting->get(
"anonymous_user_id"));
807 define(
"ANONYMOUS_ROLE_ID", (
int)
$ilSetting->get(
"anonymous_role_id"));
808 define(
"SYSTEM_USER_ID", (
int)
$ilSetting->get(
"system_user_id"));
809 define(
"SYSTEM_ROLE_ID", (
int)
$ilSetting->get(
"system_role_id"));
810 define(
"USER_FOLDER_ID", 7);
813 define(
"RECOVERY_FOLDER_ID", (
int)
$ilSetting->get(
"recovery_folder_id"));
816 define(
"IL_INST_ID",
$ilSetting->get(
"inst_id",
'0'));
819 define(
"SUFFIX_REPL_DEFAULT",
"php,php3,php4,inc,lang,phtml,htaccess");
820 define(
"SUFFIX_REPL_ADDITIONAL",
$ilSetting->get(
"suffix_repl_additional",
""));
833 $component_factory =
$DIC[
"component.factory"];
839 "./components/ILIAS/Style/System/classes/class.ilStyleDefinition.php"
843 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as $ui_plugin) {
844 $gui_class = $ui_plugin->getUIClassInstance();
845 $gui_class->modifyGUI(
"components/ILIAS/Init",
"init_style", array(
"styleDefinition" =>
$DIC->systemStyle()));
856 static $context_init;
858 $uid =
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
860 $DIC->user()->setId($uid);
861 $DIC->user()->read();
862 if (!isset($context_init)) {
863 if (
$DIC->user()->isAnonymous()) {
864 $DIC->globalScreen()->tool()->context()->claim()->external();
866 $DIC->globalScreen()->tool()->context()->claim()->internal();
868 $context_init =
true;
889 $larr = explode(
",", trim(
$ilSetting->get(
"locale")));
892 foreach ($larr as $l) {
893 if (trim($l) !=
"") {
897 if (count($ls) > 0) {
898 setlocale(LC_ALL, $ls);
901 setlocale(LC_NUMERIC,
"C");
917 $session_destroyed =
false;
918 if (
$DIC[
'ilAuthSession']->isExpired()) {
919 $session_destroyed =
true;
922 if (!
$DIC[
'ilAuthSession']->isAuthenticated()) {
923 $session_destroyed =
true;
927 if ($session_destroyed) {
934 if (
$DIC->http()->wrapper()->query()->has(
'target')) {
935 $target =
$DIC->http()->wrapper()->query()->retrieve(
937 $DIC->refinery()->kindlyTo()->string()
942 if (strlen($target)) {
944 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
945 if ($current_script ==
"goto.php") {
954 "ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=&ref_id=" . (defined(
967 $session_expired =
false;
970 if (
$DIC[
'ilAuthSession']->isExpired()) {
972 $session_expired =
true;
974 if (!
$DIC[
'ilAuthSession']->isAuthenticated()) {
978 $target =
$DIC->http()->wrapper()->query()->has(
'target')
979 ?
$DIC->http()->wrapper()->query()->retrieve(
981 $DIC->refinery()->kindlyTo()->string()
985 if (strlen($target)) {
986 $target =
"target=" . $target .
"&";
991 $DIC->refinery()->byTrying([
992 $DIC->refinery()->kindlyTo()->string(),
993 $DIC->refinery()->always(
'')
997 $script =
"login.php?" . $target .
"client_id=" .
$client_id;
998 $script .= $session_expired ?
"&session_expired=1" :
"";
1002 "init_error_authentication_fail",
1004 "en" =>
"Authentication failed.",
1005 "de" =>
"Authentifizierung fehlgeschlagen."
1013 protected static function initLanguage(
bool $a_use_user_language =
true): void
1022 if ($a_use_user_language) {
1023 if (
$DIC->offsetExists(
'lng')) {
1024 $DIC->offsetUnset(
'lng');
1030 if (is_object($rbacsystem) &&
$DIC->offsetExists(
'tree')) {
1031 $rbacsystem->initMemberView();
1043 "./components/ILIAS/AccessControl/classes/class.ilRbacReview.php",
1053 "./components/ILIAS/AccessControl/classes/class.ilRbacAdmin.php",
1060 "./components/ILIAS/AccessControl/classes/class.ilAccess.php",
1083 ?
string $a_source_file =
null,
1084 ?
bool $destroy_existing =
false
1088 if ($destroy_existing) {
1092 if (isset(
$DIC[$a_name])) {
1093 unset(
$DIC[$a_name]);
1097 $GLOBALS[$a_name] = is_object($a_class) ? $a_class :
new $a_class();
1107 $GLOBALS[
'ilLog']->write(
"Fatal Error: ilInitialisation - " . $a_message);
1118 error_reporting(-1);
1121 protected static bool $already_initialized =
false;
1125 self::$already_initialized =
false;
1132 self::initSession();
1136 self::resumeUserSession();
1146 if (self::$already_initialized) {
1150 $GLOBALS[
"DIC"][
"ilLoggerFactory"] =
function (
$c) {
1154 self::$already_initialized =
true;
1157 self::initHTTPServices(
$GLOBALS[
"DIC"]);
1159 self::initFileUploadService(
$GLOBALS[
"DIC"]);
1162 self::initSession();
1168 self::resumeUserSession();
1173 self::initLanguage(
true);
1174 $GLOBALS[
'DIC'][
'tree']->initLangCode();
1176 self::initInjector(
$GLOBALS[
'DIC']);
1177 self::initBackgroundTasks(
$GLOBALS[
'DIC']);
1178 self::initKioskMode(
$GLOBALS[
'DIC']);
1188 self::replaceSuperGlobals(
$GLOBALS[
'DIC']);
1196 if (isset(
$GLOBALS[
'DIC'][
'ilAuthSession'])) {
1197 unset(
$GLOBALS[
'DIC'][
'ilAuthSession']);
1202 $c[
'ilLoggerFactory']->getLogger(
'auth')
1204 $auth_session->init();
1205 return $auth_session;
1215 error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
1228 self::handleErrorReporting();
1230 self::requireCommonIncludes();
1237 "./components/ILIAS/Init/classes/class.ilErrorHandling.php"
1240 self::removeUnsafeCharacters();
1242 self::initIliasIniFile();
1244 define(
'IL_INITIAL_WD', getcwd());
1247 self::initGlobal(
"ilias",
"ILIAS",
"./components/ILIAS/Init/classes/class.ilias.php");
1255 global $https, $ilias,
$DIC;
1257 self::setCookieConstants();
1259 self::determineClient();
1261 self::bootstrapFilesystems();
1263 self::initResourceStorage();
1265 self::initClientIniFile();
1272 self::handleDevMode();
1275 self::handleMaintenanceMode();
1277 self::initDatabase();
1279 self::initGlobalCache();
1281 self::initComponentService(
$DIC);
1284 self::initLanguage(
false);
1290 "ilAppEventHandler",
1291 "ilAppEventHandler",
1292 "./components/ILIAS/EventHandling/classes/class.ilAppEventHandler.php"
1304 "./components/ILIAS/Component/classes/class.ilPluginAdmin.php"
1307 self::initGlobal(
"https",
"ilHTTPS",
"./components/ILIAS/Http/classes/class.ilHTTPS.php");
1308 self::initSettings();
1309 self::setSessionHandler();
1312 self::initCustomObjectIcons(
$GLOBALS[
'DIC']);
1313 self::initLegalDocuments(
$GLOBALS[
'DIC']);
1314 self::initAccessibilityControlConcept(
$GLOBALS[
'DIC']);
1315 self::initLearningObjectMetadata(
$GLOBALS[
'DIC']);
1322 $https->enableSecureCookies();
1323 $https->checkProtocolAndRedirectIfNeeded();
1330 "ilObjectDataCache",
1331 "./components/ILIAS/Object/classes/class.ilObjectDataCache.php"
1336 "ilObjectDefinition",
1337 "./components/ILIAS/Object/classes/class.ilObjectDefinition.php"
1342 self::initGlobal(
"tree", $tree);
1345 self::setSessionCookieParams();
1346 self::setClientIdCookie();
1351 self::initGlobalScreen(
$DIC);
1359 global $ilias, $ilUser;
1365 "./components/ILIAS/User/classes/class.ilObjUser.php",
1371 new UserPublicInterface($ilUser)
1374 $ilias->account = $ilUser;
1376 self::initAccessHandling();
1391 !
$DIC[
'ilAuthSession']->isAuthenticated() ||
1392 $DIC[
'ilAuthSession']->isExpired()
1394 if (
$GLOBALS[
'DIC'][
'ilAuthSession']->isExpired()) {
1399 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
1400 if (self::blockedAuthentication($current_script)) {
1406 self::handleAuthenticationFail();
1411 self::initUserAccount();
1417 protected static function handleAuthenticationSuccess(): void
1440 throw new Exception(
"Authentication failed.");
1443 if ((
$DIC->http()->request()->getQueryParams()[
'cmdMode'] ?? 0) ===
'asynch') {
1444 $DIC->language()->loadLanguageModule(
'init');
1445 $DIC->http()->saveResponse(
1446 $DIC->http()->response()
1448 ->withBody(Streams::ofString(
$DIC->language()->txt(
'init_error_authentication_fail')))
1450 $DIC->http()->sendResponse();
1451 $DIC->http()->close();
1454 $DIC[
'ilAuthSession']->isExpired() &&
1464 self::goToPublicSection();
1487 $c[
'global_screen'] =
function () use (
$c) {
1494 $c->globalScreen()->tool()->context()->stack()->clear();
1495 $c->globalScreen()->tool()->context()->claim()->main();
1504 $component_repository =
$c[
"component.repository"];
1505 $component_factory =
$c[
"component.factory"];
1506 foreach ($component_repository->getPlugins() as $pl) {
1507 if (!$pl->isActive()) {
1510 $plugin = $component_factory->getPlugin($pl->getId());
1511 $c[
'ui.renderer'] =
$plugin->exchangeUIRendererAfterInitialization(
$c);
1513 foreach (
$c->keys() as $key) {
1514 if (strpos($key,
"ui.factory") === 0) {
1515 $c[$key] =
$plugin->exchangeUIFactoryAfterInitialization($key,
$c);
1529 $replace_super_globals = (
1530 !$client_ini->variableExists(
'server',
'prevent_super_global_replacement') ||
1531 !(bool) $client_ini->readVariable(
'server',
'prevent_super_global_replacement')
1534 if ($replace_super_globals) {
1535 $throwOnValueAssignment = defined(
'DEVMODE') && DEVMODE;
1555 global $ilUser,
$DIC;
1562 self::initUploadPolicies(
$DIC);
1565 self::applyPluginManipulationsToUiFramework(
$GLOBALS[
"DIC"]);
1567 self::initGlobal(
"tpl", $tpl);
1570 $dispatcher = new \ILIAS\Init\StartupSequence\StartUpSequenceDispatcher(
$DIC);
1571 $dispatcher->dispatch();
1575 "ilNavigationHistory",
1576 "ilNavigationHistory",
1577 "components/ILIAS/Navigation/classes/class.ilNavigationHistory.php"
1583 "components/ILIAS/Help/classes/class.ilHelpGUI.php"
1595 "./components/ILIAS/UIComponent/Toolbar/classes/class.ilToolbarGUI.php"
1601 "./components/ILIAS/Locator/classes/class.ilLocatorGUI.php"
1607 "./components/ILIAS/UIComponent/Tabs/classes/class.ilTabsGUI.php"
1618 if (isset(
$_GET[
'offset']) &&
$_GET[
'offset'] !=
"") {
1622 self::initGlobal(
"lti",
"ilLTIViewGUI",
"./components/ILIAS/LTIProvider/classes/class.ilLTIViewGUI.php");
1624 self::initKioskMode(
$GLOBALS[
"DIC"]);
1660 $a_current_script ==
"register.php" ||
1661 $a_current_script ==
"pwassist.php" ||
1662 $a_current_script ==
"confirmReg.php" ||
1663 $a_current_script ==
"il_securimage_play.php" ||
1664 $a_current_script ==
"il_securimage_show.php" ||
1665 $a_current_script ==
'login.php'
1672 $requestBaseClass = strtolower((
string) (
$_GET[
'baseClass'] ??
''));
1673 if ($requestBaseClass == strtolower(ilStartUpGUI::class)) {
1674 $requestCmdClass = strtolower((
string) (
$_GET[
'cmdClass'] ??
''));
1676 $requestCmdClass == strtolower(ilAccountRegistrationGUI::class) ||
1677 $requestCmdClass == strtolower(ilPasswordAssistanceGUI::class)
1682 $cmd =
$DIC->ctrl()->getCmd();
1684 if (in_array($cmd, [
1685 'showLegalDocuments',
1686 'showAccountMigration',
1691 'doStandardAuthentication',
1692 'doCasAuthentication',
1700 if (
$DIC->http()->wrapper()->query()->has(
'target')) {
1702 $target =
$_GET[
'target'];
1707 ($a_current_script ==
"goto.php" && $target ==
"impr_0") ||
1708 $requestBaseClass == strtolower(ilImprintGUI::class)
1716 (strtolower($requestCmdClass ??
"") === strtolower(ilAccessibilityControlConceptGUI::class))
1722 if ($a_current_script ==
'goto.php' && in_array($target, array(
1733 $current_ref_id =
$DIC->http()->wrapper()->query()->has(
'ref_id')
1734 ?
$DIC->http()->wrapper()->query()->retrieve(
'ref_id',
$DIC->refinery()->kindlyTo()->int())
1737 if (
null !== $current_ref_id
1738 &&
$DIC->user()->getId() === 0
1739 &&
$DIC->access()->checkAccessOfUser(
1756 protected static function translateMessage(
string $a_message_id, ?array $a_message_static =
null): string
1764 $lang = $ilUser->getLanguage();
1765 } elseif (isset($_REQUEST[
"lang"])) {
1766 $lang = (string) $_REQUEST[
"lang"];
1769 } elseif ($ilClientIniFile) {
1770 $lang = $ilClientIniFile->readVariable(
"language",
"default");
1777 if (
$ilDB && $a_message_id) {
1782 $lng->loadLanguageModule(
"init");
1784 } elseif (is_array($a_message_static)) {
1785 if (!isset($a_message_static[
$lang])) {
1798 string $a_message_id =
'',
1799 ?array $a_message_static =
null
1802 if (defined(
"ILIAS_HTTP_PATH") &&
1803 !stristr($a_target, ILIAS_HTTP_PATH)) {
1804 $a_target = ILIAS_HTTP_PATH .
"/" . $a_target;
1807 foreach ([
'ext_uid',
'soap_pw'] as
$param) {
1808 if (
false === strpos(
1821 $message = self::translateMessage($a_message_id, $a_message_static);
1825 $link = self::translateMessage(
1826 "init_error_redirect_click",
1827 array(
"en" =>
'Please click to continue.',
1828 "de" =>
'Bitte klicken um fortzufahren.'
1832 '<br /><a href="' . $a_target .
'">' . $link .
'</a>';
1839 $mess = self::translateMessage(
1840 "init_error_redirect_info",
1841 array(
"en" =>
'Redirect not supported by context.',
1842 "de" =>
'Weiterleitungen werden durch Kontext nicht unterstützt.'
1845 ' (' . $a_target .
')';
1849 self::abortAndDie($mess);
1859 self::goToPublicSection();
1865 $DIC->http()->wrapper()->query()->has(
'target')
1867 $target =
$DIC->http()->wrapper()->query()->retrieve(
1869 $DIC->refinery()->kindlyTo()->string()
1875 if ($target ===
'') {
1880 $DIC->ctrl()->redirectToURL(
"goto.php?target=" . $target);
1888 $n_of_tasks =
$ilIliasIniFile->readVariable(
"background_tasks",
"number_of_concurrent_tasks");
1889 $sync =
$ilIliasIniFile->readVariable(
"background_tasks",
"concurrency");
1891 $n_of_tasks = $n_of_tasks ?: 5;
1892 $sync = $sync ?:
'sync';
1894 $c[
"bt.task_factory"] =
function (
$c) {
1895 return new \ILIAS\BackgroundTasks\Implementation\Tasks\BasicTaskFactory(
$c[
"di.injector"]);
1898 $c[
"bt.persistence"] =
function (
$c) {
1899 return \ILIAS\BackgroundTasks\Implementation\Persistence\BasicPersistence::instance(
$c->database());
1902 $c[
"bt.injector"] =
function (
$c) {
1906 $c[
"bt.task_manager"] =
function (
$c) use ($sync) {
1907 if ($sync ==
'sync') {
1908 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager(
$c[
"bt.persistence"]);
1909 } elseif ($sync ==
'async') {
1910 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\AsyncTaskManager(
$c[
"bt.persistence"]);
1912 throw new ilException(
"The supported Background Task Managers are sync and async. $sync given.");
1919 $c[
"di.dependency_map"] =
function (
$c) {
1920 return new \ILIAS\BackgroundTasks\Dependencies\DependencyMap\BaseDependencyMap();
1923 $c[
"di.injector"] =
function (
$c) {
1924 return new \ILIAS\BackgroundTasks\Dependencies\Injector(
$c,
$c[
"di.dependency_map"]);
1930 $c[
"service.kiosk_mode"] =
function (
$c) {
1942 $c[
'learning_object_metadata'] =
function (
$c) {
1943 return new \ILIAS\MetaData\Services\Services(
$c);
const IL_COOKIE_PATH(isset($_GET['client_id']))
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 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'))