39 if (!isset(
$GLOBALS[
'ilGlobalStartTime']) || !
$GLOBALS[
'ilGlobalStartTime']) {
40 $GLOBALS[
'ilGlobalStartTime'] = microtime();
63 $_GET = self::recursivelyRemoveUnsafeCharacters(
$_GET);
74 foreach ($var as $k => $v) {
75 $k = self::recursivelyRemoveUnsafeCharacters($k);
76 $mod[$k] = self::recursivelyRemoveUnsafeCharacters($v);
82 array(
"\x00",
"\n",
"\r",
"\\",
"'",
'"',
"\x1a"),
95 require_once(__DIR__ .
"/../../../../ilias_version.php");
96 self::initGlobal(
"ilBench",
"ilBenchmark",
"./components/ILIAS/Utilities/classes/class.ilBenchmark.php");
113 if (!defined(
'ILIAS_DATA_DIR')) {
114 define(
"ILIAS_DATA_DIR",
$ilIliasIniFile->readVariable(
"clients",
"datadir"));
117 if (!defined(
'ILIAS_WEB_DIR')) {
119 $from_ilias_ini = str_replace(
'public/',
'', $from_ilias_ini);
120 define(
"ILIAS_WEB_DIR", $from_ilias_ini);
122 if (!defined(
"ILIAS_ABSOLUTE_PATH")) {
123 define(
"ILIAS_ABSOLUTE_PATH",
$ilIliasIniFile->readVariable(
'server',
'absolute_path'));
128 define(
"ILIAS_LOG_FILE",
$ilIliasIniFile->readVariable(
"log",
"file"));
129 if (!defined(
"ILIAS_LOG_ENABLED")) {
130 define(
"ILIAS_LOG_ENABLED",
$ilIliasIniFile->readVariable(
"log",
"enabled"));
132 define(
"ILIAS_LOG_LEVEL",
$ilIliasIniFile->readVariable(
"log",
"level"));
135 define(
"PATH_TO_CONVERT",
$ilIliasIniFile->readVariable(
"tools",
"convert"));
136 define(
"PATH_TO_FFMPEG",
$ilIliasIniFile->readVariable(
"tools",
"ffmpeg"));
138 define(
"PATH_TO_MKISOFS",
$ilIliasIniFile->readVariable(
"tools",
"mkisofs"));
139 define(
"PATH_TO_UNZIP",
$ilIliasIniFile->readVariable(
"tools",
"unzip"));
140 define(
"PATH_TO_GHOSTSCRIPT",
$ilIliasIniFile->readVariable(
"tools",
"ghostscript"));
141 define(
"PATH_TO_JAVA",
$ilIliasIniFile->readVariable(
"tools",
"java"));
142 define(
"URL_TO_LATEX",
$ilIliasIniFile->readVariable(
"tools",
"latex"));
144 define(
"PATH_TO_SCSS",
$ilIliasIniFile->readVariable(
"tools",
"scss"));
145 define(
"PATH_TO_PHANTOMJS",
$ilIliasIniFile->readVariable(
"tools",
"phantomjs"));
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_elements")
342 return $fileUploadImpl;
348 $dic[
'upload_policy_repository'] =
static function (
$dic) {
354 $dic->rbac()->review(),
356 $dic[
'upload_policy_repository']->getAll(),
367 (
new \
ILIAS\
Init\Environment\HttpPathBuilder(
371 $DIC[
'ilIliasIniFile'],
373 ))->build()->getBaseURI()
383 if (defined(
'CLIENT_ID')) {
387 $df = $DIC[\ILIAS\Data\Factory::class];
390 if (!$DIC->isDependencyAvailable(
'iliasIni')) {
391 self::abortAndDie(
'Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.');
394 $in_unit_tests = defined(
'IL_PHPUNIT_TEST');
396 $can_set_cookie = !$in_unit_tests && $context_supports_persitent_session;
397 $has_request_client_id = $DIC->http()->wrapper()->query()->has(
'client_id');
398 $has_cookie_client_id = $DIC->http()->cookieJar()->has(
'ilClientId');
401 $default_client_id = $DIC->iliasIni()->readVariable(
'clients',
'default');
403 if ($DIC->http()->wrapper()->query()->has(
'client_id')) {
404 $client_id_from_get = $DIC->http()->wrapper()->query()->retrieve(
406 self::getClientIdTransformation()
409 if ($DIC->http()->wrapper()->cookie()->has(
'ilClientId')) {
410 $client_id_from_cookie = $DIC->http()->wrapper()->cookie()->retrieve(
412 self::getClientIdTransformation()
417 $client_id_to_use =
'';
418 if (isset($client_id_from_get) && $client_id_from_get !==
'') {
419 $client_id_to_use = $client_id_from_get;
422 if (isset($client_id_from_get) && strlen($client_id_from_get) > 0) {
424 $client_id_to_use =
$_GET[
'client_id'] = $df->clientId($client_id_from_get)->toString();
425 if ($can_set_cookie) {
429 $client_id_to_use = $default_client_id;
430 if (!isset(
$_COOKIE[
'ilClientId'])) {
435 $client_id_to_use = $client_id_to_use ?: $default_client_id;
437 define(
'CLIENT_ID', $df->clientId($client_id_to_use)->toString());
455 if (!is_string($from)) {
458 return strip_tags($from);
466 return $result->
then(
function ($value):
Result {
470 return new Error($exception);
478 public function __invoke($from):
string 500 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
505 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
508 $ini_file =
"/client.ini.php";
509 if (defined(
'CLIENT_WEB_DIR')) {
515 $ilClientIniFile =
new ilIniFile($ini_file);
516 $ilClientIniFile->read();
519 if ($ilClientIniFile->ERROR !=
"") {
520 $default_client = $ilIliasIniFile->readVariable(
"clients",
"default");
522 $mess = array(
"en" =>
"Client does not exist.",
523 "de" =>
"Mandant ist ungültig." 525 self::redirect(
"index.php?client_id=" . $default_client,
'', $mess);
527 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile initializing client ini file abborted with: " . $ilClientIniFile->ERROR);
531 self::initGlobal(
"ilClientIniFile", $ilClientIniFile);
533 define(
"DEVMODE", (
int) $ilClientIniFile->readVariable(
"system",
"DEVMODE"));
534 define(
"SHOWNOTICES", (
int) $ilClientIniFile->readVariable(
"system",
"SHOWNOTICES"));
535 if (!defined(
"ROOT_FOLDER_ID")) {
536 define(
"ROOT_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROOT_FOLDER_ID'));
538 if (!defined(
"SYSTEM_FOLDER_ID")) {
539 define(
"SYSTEM_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'SYSTEM_FOLDER_ID'));
541 if (!defined(
"ROLE_FOLDER_ID")) {
542 define(
"ROLE_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROLE_FOLDER_ID'));
544 define(
"MAIL_SETTINGS_ID", (
int) $ilClientIniFile->readVariable(
'system',
'MAIL_SETTINGS_ID'));
545 $error_handler = $ilClientIniFile->readVariable(
'system',
'ERROR_HANDLER');
546 define(
"ERROR_HANDLER", $error_handler ?:
"PRETTY_PAGE");
550 define(
"OH_REF_ID", (
int) $ilClientIniFile->readVariable(
"system",
"OH_REF_ID"));
556 if (!defined(
"CLIENT_DATA_DIR")) {
559 if (!defined(
"CLIENT_WEB_DIR")) {
562 define(
"CLIENT_NAME", $ilClientIniFile->readVariable(
'client',
'name'));
564 $db_type = $ilClientIniFile->readVariable(
"db",
"type");
565 if ($db_type ===
"") {
568 define(
"IL_DB_TYPE", $db_type);
577 global $ilClientIniFile;
579 if (!$ilClientIniFile->readVariable(
"client",
"access")) {
581 "en" =>
"The server is not available due to maintenance." .
582 " We apologise for any inconvenience.",
583 "de" =>
"Der Server ist aufgrund von Wartungsarbeiten aktuell nicht verfügbar." .
584 " Wir bitten um Verständnis. Versuchen Sie es später noch einmal." 586 $mess_id =
"init_error_maintenance";
589 self::redirect(
"./maintenance.html", $mess_id, $mess);
591 $mess = self::translateMessage($mess_id, $mess);
592 self::abortAndDie($mess);
604 $ilDB->initFromIniFile();
607 self::initGlobal(
"ilDB",
$ilDB);
617 $DIC[
'global_cache'] = new \ILIAS\Cache\Services(
618 $legacy_settings->getConfig()
629 if (!$db_session_handler->setSaveHandler()) {
630 self::abortAndDie(
"Cannot start session handling.");
636 if (function_exists(
"session_status") && session_status() == PHP_SESSION_ACTIVE) {
637 session_regenerate_id();
649 } elseif (isset(
$GLOBALS[
'COOKIE_PATH'])) {
667 define(
'IL_COOKIE_HTTPONLY',
true);
668 define(
'IL_COOKIE_EXPIRE', 0);
669 define(
'IL_COOKIE_DOMAIN',
'');
670 if (!defined(
'IL_COOKIE_PATH')) {
678 if (defined(
'CLIENT_ID') &&
679 !defined(
'IL_PHPUNIT_TEST') &&
692 if (!defined(
'IL_COOKIE_SECURE')) {
696 $cookie_secure = !$ilSetting->get(
'https',
'0') && $DIC[
'https']->isDetected();
697 define(
'IL_COOKIE_SECURE', $cookie_secure);
699 $cookie_parameters = [
700 'lifetime' => IL_COOKIE_EXPIRE,
702 'domain' => IL_COOKIE_DOMAIN,
703 'secure' => IL_COOKIE_SECURE,
704 'httponly' => IL_COOKIE_HTTPONLY,
709 (!isset(session_get_cookie_params()[
'samesite']) || strtolower(session_get_cookie_params()[
'samesite']) !==
'strict')
711 $cookie_parameters[
'samesite'] =
'Lax';
714 session_set_cookie_params($cookie_parameters);
724 $c->logger()->cron(),
725 $c[
'component.repository'],
726 $c[
'component.factory']
732 $c[
'cron.repository'],
735 $c->logger()->cron(),
736 $c[\ILIAS\Data\Factory::class]->clock(),
746 $c[
"object.customicons.factory"] =
function (
$c) {
747 return new CustomIconFactory(
748 $c->filesystem()->web(),
757 $c[
"user.avatar.factory"] =
function (
$c) {
758 return new \ilUserAvatarFactory($c);
776 $c[
'acc.criteria.type.factory'],
798 "components/ILIAS/Administration/classes/class.ilSetting.php" 802 if (!$ilSetting->get(
"setup_ok")) {
803 self::abortAndDie(
"Setup is not completed. Please run setup routine again.");
807 define(
"ANONYMOUS_USER_ID", (
int) $ilSetting->get(
"anonymous_user_id"));
808 define(
"ANONYMOUS_ROLE_ID", (
int) $ilSetting->get(
"anonymous_role_id"));
809 define(
"SYSTEM_USER_ID", (
int) $ilSetting->get(
"system_user_id"));
810 define(
"SYSTEM_ROLE_ID", (
int) $ilSetting->get(
"system_role_id"));
811 define(
"USER_FOLDER_ID", 7);
814 define(
"RECOVERY_FOLDER_ID", (
int) $ilSetting->get(
"recovery_folder_id"));
817 define(
"IL_INST_ID", $ilSetting->get(
"inst_id",
'0'));
820 define(
"SUFFIX_REPL_DEFAULT",
"php,php3,php4,inc,lang,phtml,htaccess");
821 define(
"SUFFIX_REPL_ADDITIONAL", $ilSetting->get(
"suffix_repl_additional",
""));
824 self::buildHTTPPath();
834 $component_factory = $DIC[
"component.factory"];
840 "./components/ILIAS/Style/System/classes/class.ilStyleDefinition.php" 844 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as $ui_plugin) {
845 $gui_class = $ui_plugin->getUIClassInstance();
846 $gui_class->modifyGUI(
"components/ILIAS/Init",
"init_style", array(
"styleDefinition" => $DIC->systemStyle()));
857 static $context_init;
859 $uid =
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
861 $DIC->user()->setId($uid);
862 $DIC->user()->read();
863 if (!isset($context_init)) {
864 if ($DIC->user()->isAnonymous()) {
865 $DIC->globalScreen()->tool()->context()->claim()->external();
867 $DIC->globalScreen()->tool()->context()->claim()->internal();
869 $context_init =
true;
878 self::abortAndDie(
"Init user account failed");
889 if ($ilSetting->get(
"locale") && trim($ilSetting->get(
"locale")) !==
"") {
890 $larr = explode(
",", trim($ilSetting->get(
"locale")));
893 foreach ($larr as $l) {
894 if (trim($l) !=
"") {
898 if (count($ls) > 0) {
899 setlocale(LC_ALL, $ls);
902 setlocale(LC_NUMERIC,
"C");
915 self::abortAndDie(
"Public Section enabled, but no Anonymous user found.");
918 $session_destroyed =
false;
919 if ($DIC[
'ilAuthSession']->isExpired()) {
920 $session_destroyed =
true;
923 if (!$DIC[
'ilAuthSession']->isAuthenticated()) {
924 $session_destroyed =
true;
928 if ($session_destroyed) {
932 self::initUserAccount();
935 if ($DIC->http()->wrapper()->query()->has(
'target')) {
936 $target = $DIC->http()->wrapper()->query()->retrieve(
938 $DIC->refinery()->kindlyTo()->string()
943 if (strlen($target)) {
945 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
946 if ($current_script ==
"goto.php") {
950 self::redirect(
"goto.php?target=" . $target);
955 "ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=&ref_id=" . (defined(
968 $session_expired =
false;
971 if ($DIC[
'ilAuthSession']->isExpired()) {
973 $session_expired =
true;
975 if (!$DIC[
'ilAuthSession']->isAuthenticated()) {
979 $target = $DIC->http()->wrapper()->query()->has(
'target')
980 ? $DIC->http()->wrapper()->query()->retrieve(
982 $DIC->refinery()->kindlyTo()->string()
986 if (strlen($target)) {
987 $target =
"target=" . $target .
"&";
990 $client_id = $DIC->http()->wrapper()->cookie()->retrieve(
992 $DIC->refinery()->byTrying([
993 $DIC->refinery()->kindlyTo()->string(),
994 $DIC->refinery()->always(
'')
998 $script =
"login.php?" . $target .
"client_id=" .
$client_id;
999 $script .= $session_expired ?
"&session_expired=1" :
"";
1003 "init_error_authentication_fail",
1005 "en" =>
"Authentication failed.",
1006 "de" =>
"Authentifizierung fehlgeschlagen." 1014 protected static function initLanguage(
bool $a_use_user_language =
true):
void 1023 if ($a_use_user_language) {
1024 if ($DIC->offsetExists(
'lng')) {
1025 $DIC->offsetUnset(
'lng');
1031 if (is_object($rbacsystem) && $DIC->offsetExists(
'tree')) {
1032 $rbacsystem->initMemberView();
1044 "./components/ILIAS/AccessControl/classes/class.ilRbacReview.php",
1049 self::initGlobal(
'rbacsystem', $rbacsystem,
null,
true);
1054 "./components/ILIAS/AccessControl/classes/class.ilRbacAdmin.php",
1061 "./components/ILIAS/AccessControl/classes/class.ilAccess.php",
1073 self::initGlobal(
"ilLog",
$log);
1075 self::initGlobal(
"log",
$log);
1084 ?
string $a_source_file =
null,
1085 ?
bool $destroy_existing =
false 1089 if ($destroy_existing) {
1093 if (isset($DIC[$a_name])) {
1094 unset($DIC[$a_name]);
1098 $GLOBALS[$a_name] = is_object($a_class) ? $a_class :
new $a_class();
1100 $DIC[$a_name] =
static function (
Container $c) use ($a_name) {
1108 $GLOBALS[
'ilLog']->write(
"Fatal Error: ilInitialisation - " . $a_message);
1119 error_reporting(-1);
1126 self::$already_initialized =
false;
1133 self::initSession();
1137 self::resumeUserSession();
1147 if (self::$already_initialized) {
1151 $GLOBALS[
"DIC"][
"ilLoggerFactory"] =
function (
$c) {
1155 self::$already_initialized =
true;
1158 self::initHTTPServices(
$GLOBALS[
"DIC"]);
1160 self::initFileUploadService(
$GLOBALS[
"DIC"]);
1163 self::initSession();
1169 self::resumeUserSession();
1174 self::initLanguage(
true);
1175 $GLOBALS[
'DIC'][
'tree']->initLangCode();
1177 self::initInjector(
$GLOBALS[
'DIC']);
1178 self::initBackgroundTasks(
$GLOBALS[
'DIC']);
1179 self::initKioskMode(
$GLOBALS[
'DIC']);
1189 self::replaceSuperGlobals(
$GLOBALS[
'DIC']);
1197 if (isset(
$GLOBALS[
'DIC'][
'ilAuthSession'])) {
1198 unset(
$GLOBALS[
'DIC'][
'ilAuthSession']);
1203 $c[
'ilLoggerFactory']->getLogger(
'auth')
1205 $auth_session->init();
1206 return $auth_session;
1216 error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
1229 self::handleErrorReporting();
1231 self::requireCommonIncludes();
1238 "./components/ILIAS/Init/classes/class.ilErrorHandling.php" 1241 self::removeUnsafeCharacters();
1243 self::initIliasIniFile();
1245 define(
'IL_INITIAL_WD', getcwd());
1248 self::initGlobal(
"ilias",
"ILIAS",
"./components/ILIAS/Init/classes/class.ilias.php");
1256 global $https, $ilias,
$DIC;
1258 self::setCookieConstants();
1260 self::determineClient();
1262 self::bootstrapFilesystems();
1264 self::initResourceStorage();
1266 self::initClientIniFile();
1273 self::handleDevMode();
1276 self::handleMaintenanceMode();
1278 self::initDatabase();
1280 self::initGlobalCache();
1282 self::initComponentService($DIC);
1285 self::initLanguage(
false);
1291 "ilAppEventHandler",
1292 "ilAppEventHandler",
1293 "./components/ILIAS/EventHandling/classes/class.ilAppEventHandler.php" 1301 if (!isset($DIC[
"ilPluginAdmin"]) || !$DIC[
"ilPluginAdmin"] instanceof
ilPluginAdmin) {
1304 new ilPluginAdmin($DIC[
"component.repository"]),
1305 "./components/ILIAS/Component/classes/class.ilPluginAdmin.php" 1308 self::initGlobal(
"https",
"ilHTTPS",
"./components/ILIAS/Http/classes/class.ilHTTPS.php");
1309 self::initSettings();
1310 self::setSessionHandler();
1313 self::initCustomObjectIcons(
$GLOBALS[
'DIC']);
1314 self::initLegalDocuments(
$GLOBALS[
'DIC']);
1315 self::initAccessibilityControlConcept(
$GLOBALS[
'DIC']);
1316 self::initLearningObjectMetadata(
$GLOBALS[
'DIC']);
1323 $https->enableSecureCookies();
1324 $https->checkProtocolAndRedirectIfNeeded();
1331 "ilObjectDataCache",
1332 "./components/ILIAS/Object/classes/class.ilObjectDataCache.php" 1337 "ilObjectDefinition",
1338 "./components/ILIAS/Object/classes/class.ilObjectDefinition.php" 1343 self::initGlobal(
"tree", $tree);
1346 self::setSessionCookieParams();
1347 self::setClientIdCookie();
1352 self::initGlobalScreen($DIC);
1360 global $ilias, $ilUser;
1366 "./components/ILIAS/User/classes/class.ilObjUser.php",
1369 $ilias->account = $ilUser;
1371 self::initAccessHandling();
1386 !$DIC[
'ilAuthSession']->isAuthenticated() ||
1387 $DIC[
'ilAuthSession']->isExpired()
1389 if (
$GLOBALS[
'DIC'][
'ilAuthSession']->isExpired()) {
1394 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
1395 if (self::blockedAuthentication($current_script)) {
1401 self::handleAuthenticationFail();
1406 self::initUserAccount();
1412 protected static function handleAuthenticationSuccess():
void 1435 throw new Exception(
"Authentication failed.");
1438 if (($DIC->http()->request()->getQueryParams()[
'cmdMode'] ?? 0) ===
'asynch') {
1439 $DIC->language()->loadLanguageModule(
'init');
1440 $DIC->http()->saveResponse(
1441 $DIC->http()->response()
1443 ->withBody(Streams::ofString($DIC->language()->txt(
'init_error_authentication_fail')))
1445 $DIC->http()->sendResponse();
1446 $DIC->http()->close();
1449 $DIC[
'ilAuthSession']->isExpired() &&
1459 self::goToPublicSection();
1472 $init_http->init($container);
1482 $c[
'global_screen'] =
function () use ($c) {
1489 $c->globalScreen()->tool()->context()->stack()->clear();
1490 $c->globalScreen()->tool()->context()->claim()->main();
1499 $component_repository = $c[
"component.repository"];
1500 $component_factory = $c[
"component.factory"];
1501 foreach ($component_repository->getPlugins() as $pl) {
1502 if (!$pl->isActive()) {
1505 $plugin = $component_factory->getPlugin($pl->getId());
1506 $c[
'ui.renderer'] =
$plugin->exchangeUIRendererAfterInitialization($c);
1508 foreach ($c->keys() as $key) {
1509 if (strpos($key,
"ui.factory") === 0) {
1510 $c[$key] =
$plugin->exchangeUIFactoryAfterInitialization($key, $c);
1522 $client_ini = $container[
'ilClientIniFile'];
1524 $replace_super_globals = (
1525 !$client_ini->variableExists(
'server',
'prevent_super_global_replacement') ||
1526 !(bool) $client_ini->readVariable(
'server',
'prevent_super_global_replacement')
1529 if ($replace_super_globals) {
1530 $throwOnValueAssignment = defined(
'DEVMODE') && DEVMODE;
1542 $init->init($container);
1550 global $ilUser,
$DIC;
1557 self::initUploadPolicies($DIC);
1560 self::applyPluginManipulationsToUiFramework(
$GLOBALS[
"DIC"]);
1562 self::initGlobal(
"tpl", $tpl);
1565 $dispatcher = new \ILIAS\Init\StartupSequence\StartUpSequenceDispatcher($DIC);
1566 $dispatcher->dispatch();
1570 "ilNavigationHistory",
1571 "ilNavigationHistory",
1572 "components/ILIAS/Navigation/classes/class.ilNavigationHistory.php" 1578 "components/ILIAS/Help/classes/class.ilHelpGUI.php" 1590 "./components/ILIAS/UIComponent/Toolbar/classes/class.ilToolbarGUI.php" 1596 "./components/ILIAS/Locator/classes/class.ilLocatorGUI.php" 1602 "./components/ILIAS/UIComponent/Tabs/classes/class.ilTabsGUI.php" 1613 if (isset(
$_GET[
'offset']) &&
$_GET[
'offset'] !=
"") {
1617 self::initGlobal(
"lti",
"ilLTIViewGUI",
"./components/ILIAS/LTIProvider/classes/class.ilLTIViewGUI.php");
1619 self::initKioskMode(
$GLOBALS[
"DIC"]);
1655 $a_current_script ==
"register.php" ||
1656 $a_current_script ==
"pwassist.php" ||
1657 $a_current_script ==
"confirmReg.php" ||
1658 $a_current_script ==
"il_securimage_play.php" ||
1659 $a_current_script ==
"il_securimage_show.php" ||
1660 $a_current_script ==
'login.php' 1667 $requestBaseClass = strtolower((
string) (
$_GET[
'baseClass'] ??
''));
1668 if ($requestBaseClass == strtolower(ilStartUpGUI::class)) {
1669 $requestCmdClass = strtolower((
string) (
$_GET[
'cmdClass'] ??
''));
1671 $requestCmdClass == strtolower(ilAccountRegistrationGUI::class) ||
1672 $requestCmdClass == strtolower(ilPasswordAssistanceGUI::class)
1677 $cmd = $DIC->ctrl()->getCmd();
1679 if (in_array($cmd, [
1680 'showLegalDocuments',
1681 'showAccountMigration',
1686 'doStandardAuthentication',
1687 'doCasAuthentication',
1695 if ($DIC->http()->wrapper()->query()->has(
'target')) {
1697 $target =
$_GET[
'target'];
1702 ($a_current_script ==
"goto.php" && $target ==
"impr_0") ||
1703 $requestBaseClass == strtolower(ilImprintGUI::class)
1711 (strtolower($requestCmdClass ??
"") === strtolower(ilAccessibilityControlConceptGUI::class))
1717 if ($a_current_script ==
'goto.php' && in_array($target, array(
1728 $current_ref_id = $DIC->http()->wrapper()->query()->has(
'ref_id')
1729 ? $DIC->http()->wrapper()->query()->retrieve(
'ref_id', $DIC->refinery()->kindlyTo()->int())
1732 if (
null !== $current_ref_id
1733 && $DIC->user()->getId() === 0
1734 && $DIC->access()->checkAccessOfUser(
1759 $lang = $ilUser->getLanguage();
1760 } elseif (isset($_REQUEST[
"lang"])) {
1761 $lang = (string) $_REQUEST[
"lang"];
1762 } elseif ($ilSetting) {
1763 $lang = $ilSetting->get(
"language",
'');
1764 } elseif ($ilClientIniFile) {
1765 $lang = $ilClientIniFile->readVariable(
"language",
"default");
1768 $lang = $lng->getLangKey();
1772 if ($ilDB && $a_message_id) {
1777 $lng->loadLanguageModule(
"init");
1778 $message = $lng->txt($a_message_id);
1779 } elseif (is_array($a_message_static)) {
1780 if (!isset($a_message_static[
$lang])) {
1793 string $a_message_id =
'',
1794 ?array $a_message_static =
null 1797 if (defined(
"ILIAS_HTTP_PATH") &&
1798 !stristr($a_target, ILIAS_HTTP_PATH)) {
1799 $a_target = ILIAS_HTTP_PATH .
"/" . $a_target;
1802 foreach ([
'ext_uid',
'soap_pw'] as
$param) {
1803 if (
false === strpos(
1806 ) && isset(
$GLOBALS[
'DIC']->
http()->request()->getQueryParams()[$param])) {
1808 $GLOBALS[
'DIC']->
http()->request()->getQueryParams()[$param]
1816 $message = self::translateMessage($a_message_id, $a_message_static);
1820 $link = self::translateMessage(
1821 "init_error_redirect_click",
1822 array(
"en" =>
'Please click to continue.',
1823 "de" =>
'Bitte klicken um fortzufahren.' 1827 '<br /><a href="' . $a_target .
'">' . $link .
'</a>';
1834 $mess = self::translateMessage(
1835 "init_error_redirect_info",
1836 array(
"en" =>
'Redirect not supported by context.',
1837 "de" =>
'Weiterleitungen werden durch Kontext nicht unterstützt.' 1840 ' (' . $a_target .
')';
1844 self::abortAndDie($mess);
1854 self::goToPublicSection();
1860 $DIC->http()->wrapper()->query()->has(
'target')
1862 $target = $DIC->http()->wrapper()->query()->retrieve(
1864 $DIC->refinery()->kindlyTo()->string()
1870 if ($target ===
'') {
1872 $DIC->ctrl()->redirectToURL(ilUserUtil::getStartingPointAsUrl());
1875 $DIC->ctrl()->redirectToURL(
"goto.php?target=" . $target);
1883 $n_of_tasks = $ilIliasIniFile->readVariable(
"background_tasks",
"number_of_concurrent_tasks");
1884 $sync = $ilIliasIniFile->readVariable(
"background_tasks",
"concurrency");
1886 $n_of_tasks = $n_of_tasks ?: 5;
1887 $sync = $sync ?:
'sync';
1889 $c[
"bt.task_factory"] =
function (
$c) {
1890 return new \ILIAS\BackgroundTasks\Implementation\Tasks\BasicTaskFactory($c[
"di.injector"]);
1893 $c[
"bt.persistence"] =
function (
$c) {
1894 return \ILIAS\BackgroundTasks\Implementation\Persistence\BasicPersistence::instance($c->database());
1897 $c[
"bt.injector"] =
function (
$c) {
1898 return new \ILIAS\BackgroundTasks\Dependencies\Injector($c,
new BaseDependencyMap());
1901 $c[
"bt.task_manager"] =
function (
$c) use ($sync) {
1902 if ($sync ==
'sync') {
1903 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager($c[
"bt.persistence"]);
1904 } elseif ($sync ==
'async') {
1905 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\AsyncTaskManager($c[
"bt.persistence"]);
1907 throw new ilException(
"The supported Background Task Managers are sync and async. $sync given.");
1914 $c[
"di.dependency_map"] =
function (
$c) {
1915 return new \ILIAS\BackgroundTasks\Dependencies\DependencyMap\BaseDependencyMap();
1918 $c[
"di.injector"] =
function (
$c) {
1919 return new \ILIAS\BackgroundTasks\Dependencies\Injector($c, $c[
"di.dependency_map"]);
1925 $c[
"service.kiosk_mode"] =
function (
$c) {
1937 $c[
'learning_object_metadata'] =
function (
$c) {
1938 return new \ILIAS\MetaData\Services\Services($c);
static initHTTPServices(\ILIAS\DI\Container $container)
then(callable $f)
Get a new result from the callable or do nothing if this is an error.
static initAvatar(\ILIAS\DI\Container $c)
static handleMaintenanceMode()
handle maintenance mode
static hasUser()
Based on user authentication?
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
const int CONTEXT_HTTP
HTTP Auth used for WebDAV and CalDAV If a special handling for WebDAV or CalDAV is required overwrite...
Class InitCtrlService wraps the initialization of ilCtrl.
static getLogger(string $a_component_id)
Get component logger.
Class InsecureFilenameSanitizerPreProcessor.
This describes a facility that the UI framework can use to retrieve some help text.
static applyPluginManipulationsToUiFramework(\ILIAS\DI\Container $c)
const int SESSION_CLOSE_LOGIN
static usesHTTP()
Uses HTTP aka browser.
static initFileUploadService(\ILIAS\DI\Container $dic)
Initializes the file upload service.
static initHTML()
init HTML output (level 3)
static orderBy(string $orderBy, string $orderDirection='ASC')
static _exists(string $a_session_id)
Interface Observer Contains several chained tasks and infos about them.
static initKioskMode(\ILIAS\DI\Container $c)
Class SVGBlacklistPreProcessor.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static abortAndDie(string $a_message)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static updateAccess(ilObjUser $user)
Responsible for loading the Resource Storage into the dependency injection container of ILIAS...
static determineClient()
This method determines the current client and sets the constant CLIENT_ID.
static init(Container $c)
static isAuthenticationForced()
const CONTEXT_LTI_PROVIDER
static initDefaultTimeZone(ilIniFile $ini)
Initialize default timezone from system settings.
static goToPublicSection()
go to public section
static blockedAuthentication(string $a_current_script)
Block authentication based on current request.
static resumeUserSession()
Resume an existing user session.
static setCookieConstants()
static setSessionHandler()
set session handler to db Used in Soap
static initSession()
Init auth session.
Customizing of pimple-DIC for ILIAS.
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
static getGlobalInstance()
Builds the global language object.
const int SESSION_CLOSE_PUBLIC
static initBackgroundTasks(\ILIAS\DI\Container $c)
static initAccessHandling()
$ilAccess and $rbac...
static getWrapper(string $a_type)
static initLegalDocuments(Container $c)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initCron(\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 initILIAS()
ilias initialisation
static handleForcedAuthentication()
const ILIAS_VERSION_NUMERIC
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initDatabase()
initialise database object $ilDB
static initCustomObjectIcons(\ILIAS\DI\Container $c)
static initClientIniFile()
This method provides a global instance of class ilIniFile for the client.ini.php file in variable $il...
static setCookie(string $a_cookie_name, string $a_cookie_value='', bool $a_also_set_super_global=true, bool $a_set_cookie_invalid=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static hasHTML()
Has HTML output.
static bool $already_initialized
A result encapsulates a value or an error and simplifies the handling of those.
static initLearningObjectMetadata(\ILIAS\DI\Container $c)
static initGlobal(string $a_name, $a_class, ?string $a_source_file=null, ?bool $destroy_existing=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initLocale()
Init Locale.
static requireCommonIncludes()
get common include code files
static initLog()
Init log instance.
Class PreProcessorManagerImpl.
static initStyle()
provide $styleDefinition object
static getFallbackInstance()
Builds a global default language instance.
static initClient()
Init client-based objects (level 1)
static initIliasIniFile()
This method provides a global instance of class ilIniFile for the ilias.ini.php file in variable $ilI...
Class ilFileServicesFilenameSanitizer.
static _isAnonymous(int $usr_id)
static redirect(string $a_script)
static _destroy($a_session_id, ?int $a_closing_context=null, $a_expired_at=null)
Destroy session.
const int SESSION_CLOSE_EXPIRE
static initUploadPolicies(\ILIAS\DI\Container $dic)
Class FilenameSanitizerPreProcessor.
static translateMessage(string $a_message_id, ?array $a_message_static=null)
Translate message if possible.
static removeUnsafeCharacters()
Remove unsafe characters from GET.
static initCore()
Init core objects (level 0)
static setSessionCookieParams()
set session cookie params
static supportsPersistentSessions()
Check if context supports persistent session handling.
static redirectToStartingPage(string $target='')
Central entry point for users of the service.
static setClosingContext(int $a_context)
set closing context (for statistics)
static getInstance(ilLogger $logger)
static initClient()
Init client.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initInjector(\ILIAS\DI\Container $c)
static getClientIdTransformation()
Refinery is not initialized early enough to provide a transformation to be used with the implementat...
static initComponentService(\ILIAS\DI\Container $container)
static goToLogin()
go to login
static initAccessibilityControlConcept(\ILIAS\DI\Container $c)
static getType()
Get context type.
static initGlobalScreen(\ILIAS\DI\Container $c)
static initUserAccount()
Init user with current account id.
static recursivelyRemoveUnsafeCharacters($var)
static initResourceStorage()
static handleErrorReporting()
Set error reporting level.
static initSettings()
initialise $ilSettings object and define constants Used in Soap
static handleAuthenticationFail()
static setClientIdCookie()
static initUser()
Init user / authentification (level 2)
const IL_COOKIE_PATH(isset($_GET['client_id']))
Class ilFileServicesPolicy.
Responsible for loading the HTTP Service into the dependency injection container of ILIAS...
static getRootLogger()
The unique root logger has a fixed error level.
static supportsRedirects()
Are redirects supported?
static handleDevMode()
Prepare developer tools.