37 require_once(
"libs/composer/vendor/autoload.php");
41 $GLOBALS[
'ilGlobalStartTime'] = microtime();
70 $_GET = self::recursivelyRemoveUnsafeCharacters(
$_GET);
81 foreach ($var as $k => $v) {
82 $k = self::recursivelyRemoveUnsafeCharacters($k);
83 $mod[$k] = self::recursivelyRemoveUnsafeCharacters($v);
89 array(
"\x00",
"\n",
"\r",
"\\",
"'",
'"',
"\x1a"),
102 require_once
"include/inc.ilias_version.php";
104 self::initGlobal(
"ilBench",
"ilBenchmark",
"./Services/Utilities/classes/class.ilBenchmark.php");
115 require_once(
"include/inc.xml5compliance.php");
118 require_once(
"include/inc.xsl5compliance.php");
134 if (!defined(
'ILIAS_DATA_DIR')) {
135 define(
"ILIAS_DATA_DIR",
$ilIliasIniFile->readVariable(
"clients",
"datadir"));
137 if (!defined(
'ILIAS_WEB_DIR')) {
138 define(
"ILIAS_WEB_DIR",
$ilIliasIniFile->readVariable(
"clients",
"path"));
140 if (!defined(
"ILIAS_ABSOLUTE_PATH")) {
141 define(
"ILIAS_ABSOLUTE_PATH",
$ilIliasIniFile->readVariable(
'server',
'absolute_path'));
146 define(
"ILIAS_LOG_FILE",
$ilIliasIniFile->readVariable(
"log",
"file"));
147 if (!defined(
"ILIAS_LOG_ENABLED")) {
148 define(
"ILIAS_LOG_ENABLED",
$ilIliasIniFile->readVariable(
"log",
"enabled"));
150 define(
"ILIAS_LOG_LEVEL",
$ilIliasIniFile->readVariable(
"log",
"level"));
153 define(
"PATH_TO_CONVERT",
$ilIliasIniFile->readVariable(
"tools",
"convert"));
154 define(
"PATH_TO_FFMPEG",
$ilIliasIniFile->readVariable(
"tools",
"ffmpeg"));
156 define(
"PATH_TO_MKISOFS",
$ilIliasIniFile->readVariable(
"tools",
"mkisofs"));
157 define(
"PATH_TO_UNZIP",
$ilIliasIniFile->readVariable(
"tools",
"unzip"));
158 define(
"PATH_TO_GHOSTSCRIPT",
$ilIliasIniFile->readVariable(
"tools",
"ghostscript"));
159 define(
"PATH_TO_JAVA",
$ilIliasIniFile->readVariable(
"tools",
"java"));
160 define(
"URL_TO_LATEX",
$ilIliasIniFile->readVariable(
"tools",
"latex"));
162 define(
"PATH_TO_SCSS",
$ilIliasIniFile->readVariable(
"tools",
"scss"));
163 define(
"PATH_TO_PHANTOMJS",
$ilIliasIniFile->readVariable(
"tools",
"phantomjs"));
167 define(
"ERROR_EDITOR_URL",
$ilIliasIniFile->readVariable(
'error',
'editor_url'));
170 if (
$ilIliasIniFile->variableExists(
'error',
'editor_path_translations')) {
172 "ERROR_EDITOR_PATH_TRANSLATIONS",
181 define(
"IL_VIRUS_SCANNER",
"Sophos");
182 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
183 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
187 define(
"IL_VIRUS_SCANNER",
"AntiVir");
188 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
189 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
193 define(
"IL_VIRUS_SCANNER",
"ClamAV");
194 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
195 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
198 define(
"IL_VIRUS_SCANNER",
"icap");
199 define(
"IL_ICAP_HOST",
$ilIliasIniFile->readVariable(
"tools",
"icap_host"));
200 define(
"IL_ICAP_PORT",
$ilIliasIniFile->readVariable(
"tools",
"icap_port"));
201 define(
"IL_ICAP_AV_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"icap_service_name"));
202 define(
"IL_ICAP_CLIENT",
$ilIliasIniFile->readVariable(
"tools",
"icap_client_path"));
206 define(
"IL_VIRUS_SCANNER",
"None");
207 define(
"IL_VIRUS_CLEAN_COMMAND",
'');
212 define(
"IL_TIMEZONE", $tz);
231 public static function bootstrapFilesystems():
void 235 $DIC[
'filesystem.security.sanitizing.filename'] =
function (
Container $c) {
237 $c->fileServiceSettings()
241 $DIC[
'filesystem.factory'] =
function (
$c) {
242 return new \ILIAS\Filesystem\Provider\DelegatingFilesystemFactory(
$c[
'filesystem.security.sanitizing.filename']);
245 $DIC[
'filesystem.web'] =
function (
$c) {
251 $delegatingFactory =
$c[
'filesystem.factory'];
252 $webConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
ILIAS_WEB_DIR .
'/' .
CLIENT_ID);
253 return $delegatingFactory->getLocal($webConfiguration);
256 $DIC[
'filesystem.storage'] =
function (
$c) {
262 $delegatingFactory =
$c[
'filesystem.factory'];
263 $storageConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(
ILIAS_DATA_DIR .
'/' .
CLIENT_ID);
264 return $delegatingFactory->getLocal($storageConfiguration);
267 $DIC[
'filesystem.temp'] =
function (
$c) {
273 $delegatingFactory =
$c[
'filesystem.factory'];
274 $tempConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(
ILIAS_DATA_DIR .
'/' .
CLIENT_ID .
'/temp');
275 return $delegatingFactory->getLocal($tempConfiguration);
278 $DIC[
'filesystem.customizing'] =
function (
$c) {
284 $delegatingFactory =
$c[
'filesystem.factory'];
285 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'Customizing');
286 return $delegatingFactory->getLocal($customizingConfiguration);
289 $DIC[
'filesystem.libs'] =
function (
$c) {
295 $delegatingFactory =
$c[
'filesystem.factory'];
296 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'libs');
297 return $delegatingFactory->getLocal($customizingConfiguration,
true);
300 $DIC[
'filesystem.node_modules'] =
function (
$c) {
306 $delegatingFactory =
$c[
'filesystem.factory'];
307 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'node_modules');
308 return $delegatingFactory->getLocal($customizingConfiguration,
true);
311 $DIC[
'filesystem'] =
function (
$c) {
312 return new \ILIAS\Filesystem\FilesystemsImpl(
313 $c[
'filesystem.storage'],
314 $c[
'filesystem.web'],
315 $c[
'filesystem.temp'],
316 $c[
'filesystem.customizing'],
317 $c[
'filesystem.libs'],
318 $c[
'filesystem.node_modules']
331 $dic[
'upload.processor-manager'] =
function (
$c) {
336 $fileUploadImpl = new \ILIAS\FileUpload\FileUploadImpl(
337 $c[
'upload.processor-manager'],
341 if ((defined(
'IL_VIRUS_SCANNER') && IL_VIRUS_SCANNER !=
"None") || (defined(
'IL_SCANNER_TYPE') && IL_SCANNER_TYPE ==
"1")) {
346 $fileUploadImpl->register(
348 $c->fileServiceSettings(),
349 $c->language()->txt(
"msg_info_blacklisted")
354 $c->language()->txt(
"upload_svg_rejection_message"),
355 $c->language()->txt(
"upload_svg_rejection_message_script"),
356 $c->language()->txt(
"upload_svg_rejection_message_base64"),
357 $c->language()->txt(
"upload_svg_rejection_message_elements")
360 return $fileUploadImpl;
366 $dic[
'upload_policy_repository'] =
static function (
$dic) {
372 $dic->rbac()->review(),
374 $dic[
'upload_policy_repository']->getAll(),
386 if ($DIC[
'https']->isDetected()) {
387 $protocol =
'https://';
389 $protocol =
'http://';
393 $rq_uri = strip_tags(
$_SERVER[
'REQUEST_URI']);
397 if (is_int($pos = strpos($rq_uri,
"?"))) {
398 $rq_uri = substr($rq_uri, 0, $pos);
401 if (!defined(
'ILIAS_MODULE')) {
402 $path = pathinfo($rq_uri);
403 if (isset(
$path[
'extension']) &&
$path[
'extension'] !==
'') {
404 $uri = dirname($rq_uri);
410 $path = dirname($rq_uri);
415 $dirs = explode(
'/', $module);
417 foreach ($dirs as $dir) {
418 $uri = dirname($uri);
425 $ilias_http_path = preg_replace(
'/(http|https)(:\/\/)(.*?\/.*?\.php).*/',
'$1$2$3', $ilias_http_path);
426 $ilias_http_path = preg_replace(
'/goto.php\/$/',
'', $ilias_http_path);
427 $ilias_http_path = preg_replace(
'/goto.php$/',
'', $ilias_http_path);
428 $ilias_http_path = preg_replace(
'/go\/.*$/',
'', $ilias_http_path);
430 $f = new \ILIAS\Data\Factory();
433 $base_URI = $uri->getBaseURI();
435 return define(
'ILIAS_HTTP_PATH', $base_URI);
444 if (defined(
'CLIENT_ID')) {
448 $df = new \ILIAS\Data\Factory();
451 if (!$DIC->isDependencyAvailable(
'iliasIni')) {
452 self::abortAndDie(
'Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.');
455 $in_unit_tests = defined(
'IL_PHPUNIT_TEST');
457 $can_set_cookie = !$in_unit_tests && $context_supports_persitent_session;
458 $has_request_client_id = $DIC->http()->wrapper()->query()->has(
'client_id');
459 $has_cookie_client_id = $DIC->http()->cookieJar()->has(
'ilClientId');
462 $default_client_id = $DIC->iliasIni()->readVariable(
'clients',
'default');
464 if ($DIC->http()->wrapper()->query()->has(
'client_id')) {
465 $client_id_from_get = $DIC->http()->wrapper()->query()->retrieve(
467 self::getClientIdTransformation()
470 if ($DIC->http()->wrapper()->cookie()->has(
'ilClientId')) {
471 $client_id_from_cookie = $DIC->http()->wrapper()->cookie()->retrieve(
473 self::getClientIdTransformation()
478 $client_id_to_use =
'';
479 if (isset($client_id_from_get) && $client_id_from_get !==
'') {
480 $client_id_to_use = $client_id_from_get;
483 if (isset($client_id_from_get) && strlen($client_id_from_get) > 0) {
485 $client_id_to_use =
$_GET[
'client_id'] = $df->clientId($client_id_from_get)->toString();
486 if ($can_set_cookie) {
490 $client_id_to_use = $default_client_id;
491 if (!isset(
$_COOKIE[
'ilClientId'])) {
496 $client_id_to_use = $client_id_to_use ?: $default_client_id;
498 define(
'CLIENT_ID', $df->clientId($client_id_to_use)->toString());
514 public function transform($from):
string 516 if (!is_string($from)) {
519 return strip_tags($from);
527 return $result->
then(
function ($value):
Result {
529 return new Ok($this->transform($value));
531 return new Error($exception);
539 public function __invoke($from):
string 541 return $this->transform($from);
561 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
566 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
569 $ini_file =
"/client.ini.php";
570 if (defined(
'CLIENT_WEB_DIR')) {
577 $ilClientIniFile =
new ilIniFile($ini_file);
578 $ilClientIniFile->read();
581 if ($ilClientIniFile->ERROR !=
"") {
582 $default_client = $ilIliasIniFile->readVariable(
"clients",
"default");
584 $mess = array(
"en" =>
"Client does not exist.",
585 "de" =>
"Mandant ist ungültig." 587 self::redirect(
"index.php?client_id=" . $default_client,
'', $mess);
589 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile initializing client ini file abborted with: " . $ilClientIniFile->ERROR);
593 self::initGlobal(
"ilClientIniFile", $ilClientIniFile);
595 define(
"DEVMODE", (
int) $ilClientIniFile->readVariable(
"system",
"DEVMODE"));
596 define(
"SHOWNOTICES", (
int) $ilClientIniFile->readVariable(
"system",
"SHOWNOTICES"));
597 if (!defined(
"ROOT_FOLDER_ID")) {
598 define(
"ROOT_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROOT_FOLDER_ID'));
600 if (!defined(
"SYSTEM_FOLDER_ID")) {
601 define(
"SYSTEM_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'SYSTEM_FOLDER_ID'));
603 if (!defined(
"ROLE_FOLDER_ID")) {
604 define(
"ROLE_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROLE_FOLDER_ID'));
606 define(
"MAIL_SETTINGS_ID", (
int) $ilClientIniFile->readVariable(
'system',
'MAIL_SETTINGS_ID'));
607 $error_handler = $ilClientIniFile->readVariable(
'system',
'ERROR_HANDLER');
608 define(
"ERROR_HANDLER", $error_handler ?:
"PRETTY_PAGE");
612 define(
"OH_REF_ID", (
int) $ilClientIniFile->readVariable(
"system",
"OH_REF_ID"));
618 if (!defined(
"CLIENT_DATA_DIR")) {
621 if (!defined(
"CLIENT_WEB_DIR")) {
624 define(
"CLIENT_NAME", $ilClientIniFile->readVariable(
'client',
'name'));
626 $db_type = $ilClientIniFile->readVariable(
"db",
"type");
627 if ($db_type ===
"") {
630 define(
"IL_DB_TYPE", $db_type);
639 global $ilClientIniFile;
641 if (!$ilClientIniFile->readVariable(
"client",
"access")) {
643 "en" =>
"The server is not available due to maintenance." .
644 " We apologise for any inconvenience.",
645 "de" =>
"Der Server ist aufgrund von Wartungsarbeiten aktuell nicht verfügbar." .
646 " Wir bitten um Verständnis. Versuchen Sie es später noch einmal." 648 $mess_id =
"init_error_maintenance";
651 self::redirect(
"./maintenance.html", $mess_id, $mess);
653 $mess = self::translateMessage($mess_id, $mess);
654 self::abortAndDie($mess);
666 $ilDB->initFromIniFile();
669 self::initGlobal(
"ilDB",
$ilDB);
679 $DIC[
'global_cache'] = new \ILIAS\Cache\Services(
680 $legacy_settings->getConfig()
691 if (!$db_session_handler->setSaveHandler()) {
692 self::abortAndDie(
"Cannot start session handling.");
698 if (function_exists(
"session_status") && session_status() == PHP_SESSION_ACTIVE) {
699 session_regenerate_id();
711 } elseif (isset(
$GLOBALS[
'COOKIE_PATH'])) {
729 define(
'IL_COOKIE_HTTPONLY',
true);
730 define(
'IL_COOKIE_EXPIRE', 0);
731 define(
'IL_COOKIE_DOMAIN',
'');
732 if (!defined(
'IL_COOKIE_PATH')) {
740 if (defined(
'CLIENT_ID') &&
741 !defined(
'IL_PHPUNIT_TEST') &&
754 if (!defined(
'IL_COOKIE_SECURE')) {
758 $cookie_secure = !$ilSetting->get(
'https',
'0') && $DIC[
'https']->isDetected();
759 define(
'IL_COOKIE_SECURE', $cookie_secure);
761 $cookie_parameters = [
762 'lifetime' => IL_COOKIE_EXPIRE,
764 'domain' => IL_COOKIE_DOMAIN,
765 'secure' => IL_COOKIE_SECURE,
766 'httponly' => IL_COOKIE_HTTPONLY,
771 (!isset(session_get_cookie_params()[
'samesite']) || strtolower(session_get_cookie_params()[
'samesite']) !==
'strict')
773 $cookie_parameters[
'samesite'] =
'Lax';
776 session_set_cookie_params($cookie_parameters);
786 $c->logger()->cron(),
787 $c[
'component.repository'],
788 $c[
'component.factory']
794 $c[
'cron.repository'],
797 $c->logger()->cron(),
798 (new \ILIAS\Data\Factory())->clock()
808 $c[
"object.customicons.factory"] =
function (
$c) {
810 $c->filesystem()->web(),
819 $c[
"user.avatar.factory"] =
function (
$c) {
820 return new \ilUserAvatarFactory($c);
838 $c[
'acc.criteria.type.factory'],
860 "Services/Administration/classes/class.ilSetting.php" 864 if (!$ilSetting->get(
"setup_ok")) {
865 self::abortAndDie(
"Setup is not completed. Please run setup routine again.");
869 define(
"ANONYMOUS_USER_ID", (
int) $ilSetting->get(
"anonymous_user_id"));
870 define(
"ANONYMOUS_ROLE_ID", (
int) $ilSetting->get(
"anonymous_role_id"));
871 define(
"SYSTEM_USER_ID", (
int) $ilSetting->get(
"system_user_id"));
872 define(
"SYSTEM_ROLE_ID", (
int) $ilSetting->get(
"system_role_id"));
873 define(
"USER_FOLDER_ID", 7);
876 define(
"RECOVERY_FOLDER_ID", (
int) $ilSetting->get(
"recovery_folder_id"));
879 define(
"IL_INST_ID", $ilSetting->get(
"inst_id",
'0'));
882 define(
"SUFFIX_REPL_DEFAULT",
"php,php3,php4,inc,lang,phtml,htaccess");
883 define(
"SUFFIX_REPL_ADDITIONAL", $ilSetting->get(
"suffix_repl_additional",
""));
886 self::buildHTTPPath();
896 $component_factory = $DIC[
"component.factory"];
902 "./Services/Style/System/classes/class.ilStyleDefinition.php" 906 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as $ui_plugin) {
907 $gui_class = $ui_plugin->getUIClassInstance();
908 $gui_class->modifyGUI(
"Services/Init",
"init_style", array(
"styleDefinition" => $DIC->systemStyle()));
919 static $context_init;
921 $uid =
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
923 $DIC->user()->setId($uid);
924 $DIC->user()->read();
925 if (!isset($context_init)) {
926 if ($DIC->user()->isAnonymous()) {
927 $DIC->globalScreen()->tool()->context()->claim()->external();
929 $DIC->globalScreen()->tool()->context()->claim()->internal();
931 $context_init =
true;
940 self::abortAndDie(
"Init user account failed");
951 if ($ilSetting->get(
"locale") && trim($ilSetting->get(
"locale")) !==
"") {
952 $larr = explode(
",", trim($ilSetting->get(
"locale")));
955 foreach ($larr as $l) {
956 if (trim($l) !=
"") {
960 if (count($ls) > 0) {
961 setlocale(LC_ALL, $ls);
964 setlocale(LC_NUMERIC,
"C");
977 self::abortAndDie(
"Public Section enabled, but no Anonymous user found.");
980 $session_destroyed =
false;
981 if ($DIC[
'ilAuthSession']->isExpired()) {
982 $session_destroyed =
true;
985 if (!$DIC[
'ilAuthSession']->isAuthenticated()) {
986 $session_destroyed =
true;
990 if ($session_destroyed) {
994 self::initUserAccount();
997 if ($DIC->http()->wrapper()->query()->has(
'target')) {
998 $target = $DIC->http()->wrapper()->query()->retrieve(
1000 $DIC->refinery()->kindlyTo()->string()
1005 if (strlen($target)) {
1007 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
1008 if ($current_script ==
"goto.php") {
1012 self::redirect(
"goto.php?target=" . $target);
1017 "ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=&ref_id=" . (defined(
1030 $session_expired =
false;
1033 if ($DIC[
'ilAuthSession']->isExpired()) {
1035 $session_expired =
true;
1037 if (!$DIC[
'ilAuthSession']->isAuthenticated()) {
1041 $target = $DIC->http()->wrapper()->query()->has(
'target')
1042 ? $DIC->http()->wrapper()->query()->retrieve(
1044 $DIC->refinery()->kindlyTo()->string()
1048 if (strlen($target)) {
1049 $target =
"target=" . $target .
"&";
1052 $client_id = $DIC->http()->wrapper()->cookie()->retrieve(
1054 $DIC->refinery()->byTrying([
1055 $DIC->refinery()->kindlyTo()->string(),
1056 $DIC->refinery()->always(
'')
1059 $script =
"login.php?" . $target .
"client_id=" .
$client_id;
1060 $script .= $session_expired ?
"&session_expired=1" :
"";
1064 "init_error_authentication_fail",
1066 "en" =>
"Authentication failed.",
1067 "de" =>
"Authentifizierung fehlgeschlagen." 1075 protected static function initLanguage(
bool $a_use_user_language =
true):
void 1084 if ($a_use_user_language) {
1085 if ($DIC->offsetExists(
'lng')) {
1086 $DIC->offsetUnset(
'lng');
1090 unset($DIC[
'refinery']);
1091 self::initRefinery($DIC);
1095 if (is_object($rbacsystem) && $DIC->offsetExists(
'tree')) {
1096 $rbacsystem->initMemberView();
1108 './Services/AccessControl/classes/class.ilRbacReview.php',
1113 self::initGlobal(
'rbacsystem', $rbacsystem, null,
true);
1118 './Services/AccessControl/classes/class.ilRbacAdmin.php',
1125 './Services/AccessControl/classes/class.ilAccess.php',
1137 self::initGlobal(
"ilLog",
$log);
1139 self::initGlobal(
"log",
$log);
1148 ?
string $a_source_file = null,
1149 ?
bool $destroy_existing =
false 1153 if ($destroy_existing) {
1157 if (isset($DIC[$a_name])) {
1158 unset($DIC[$a_name]);
1162 $GLOBALS[$a_name] = is_object($a_class) ? $a_class :
new $a_class();
1164 $DIC[$a_name] =
static function (
Container $c) use ($a_name) {
1172 $GLOBALS[
'ilLog']->write(
"Fatal Error: ilInitialisation - " . $a_message);
1183 error_reporting(-1);
1190 self::$already_initialized =
false;
1197 self::initSession();
1201 self::resumeUserSession();
1211 if (self::$already_initialized) {
1216 $GLOBALS[
"DIC"][
"ilLoggerFactory"] =
function (
$c) {
1220 self::$already_initialized =
true;
1223 self::initHTTPServices(
$GLOBALS[
"DIC"]);
1225 self::initFileUploadService(
$GLOBALS[
"DIC"]);
1228 self::initSession();
1234 self::resumeUserSession();
1239 self::includePhp5Compliance();
1242 self::initLanguage(
true);
1243 $GLOBALS[
'DIC'][
'tree']->initLangCode();
1245 self::initInjector(
$GLOBALS[
'DIC']);
1246 self::initBackgroundTasks(
$GLOBALS[
'DIC']);
1247 self::initKioskMode(
$GLOBALS[
'DIC']);
1257 self::replaceSuperGlobals(
$GLOBALS[
'DIC']);
1265 if (isset(
$GLOBALS[
'DIC'][
'ilAuthSession'])) {
1266 unset(
$GLOBALS[
'DIC'][
'ilAuthSession']);
1271 $c[
'ilLoggerFactory']->getLogger(
'auth')
1273 $auth_session->init();
1274 return $auth_session;
1284 error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
1297 self::handleErrorReporting();
1302 self::requireCommonIncludes();
1310 "./Services/Init/classes/class.ilErrorHandling.php" 1313 self::removeUnsafeCharacters();
1315 self::initIliasIniFile();
1317 define(
'IL_INITIAL_WD', getcwd());
1320 self::initGlobal(
"ilias",
"ILIAS",
"./Services/Init/classes/class.ilias.php");
1328 global $https, $ilias,
$DIC;
1330 self::setCookieConstants();
1332 self::determineClient();
1334 self::bootstrapFilesystems();
1336 self::initResourceStorage();
1338 self::initClientIniFile();
1345 self::handleDevMode();
1348 self::handleMaintenanceMode();
1350 self::initDatabase();
1352 self::initGlobalCache();
1354 self::initComponentService($DIC);
1357 self::initLanguage(
false);
1363 "ilAppEventHandler",
1364 "ilAppEventHandler",
1365 "./Services/EventHandling/classes/class.ilAppEventHandler.php" 1373 if (!isset($DIC[
"ilPluginAdmin"]) || !$DIC[
"ilPluginAdmin"] instanceof
ilPluginAdmin) {
1376 new ilPluginAdmin($DIC[
"component.repository"]),
1377 "./Services/Component/classes/class.ilPluginAdmin.php" 1380 self::initGlobal(
"https",
"ilHTTPS",
"./Services/Http/classes/class.ilHTTPS.php");
1381 self::initSettings();
1382 self::setSessionHandler();
1385 self::initCustomObjectIcons(
$GLOBALS[
'DIC']);
1386 self::initLegalDocuments(
$GLOBALS[
'DIC']);
1387 self::initAccessibilityControlConcept(
$GLOBALS[
'DIC']);
1394 $https->enableSecureCookies();
1395 $https->checkProtocolAndRedirectIfNeeded();
1402 "ilObjectDataCache",
1403 "./Services/Object/classes/class.ilObjectDataCache.php" 1408 "ilObjectDefinition",
1409 "./Services/Object/classes/class.ilObjectDefinition.php" 1414 self::initGlobal(
"tree", $tree);
1417 self::setSessionCookieParams();
1418 self::setClientIdCookie();
1420 self::initRefinery($DIC);
1425 self::initGlobalScreen($DIC);
1433 global $ilias, $ilUser;
1439 "./Services/User/classes/class.ilObjUser.php",
1442 $ilias->account = $ilUser;
1444 self::initAccessHandling();
1459 !$DIC[
'ilAuthSession']->isAuthenticated() or
1460 $DIC[
'ilAuthSession']->isExpired()
1462 if (
$GLOBALS[
'DIC'][
'ilAuthSession']->isExpired()) {
1466 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
1467 if (self::blockedAuthentication($current_script)) {
1473 self::handleAuthenticationFail();
1478 self::initUserAccount();
1484 protected static function handleAuthenticationSuccess():
void 1507 throw new Exception(
"Authentication failed.");
1510 if (($DIC->http()->request()->getQueryParams()[
'cmdMode'] ?? 0) ===
'asynch') {
1511 $DIC->language()->loadLanguageModule(
'init');
1512 $DIC->http()->saveResponse(
1513 $DIC->http()->response()
1515 ->withBody(Streams::ofString($DIC->language()->txt(
'init_error_authentication_fail')))
1517 $DIC->http()->sendResponse();
1518 $DIC->http()->close();
1521 $DIC[
'ilAuthSession']->isExpired() &&
1531 self::goToPublicSection();
1544 $init_http->init($container);
1554 $c[
'global_screen'] =
function () use ($c) {
1561 $c->globalScreen()->tool()->context()->stack()->clear();
1562 $c->globalScreen()->tool()->context()->claim()->main();
1573 $component_repository = $c[
"component.repository"];
1574 $component_factory = $c[
"component.factory"];
1575 foreach ($component_repository->getPlugins() as $pl) {
1576 if (!$pl->isActive()) {
1579 $plugin = $component_factory->getPlugin($pl->getId());
1580 $c[
'ui.renderer'] =
$plugin->exchangeUIRendererAfterInitialization($c);
1582 foreach ($c->keys() as
$key) {
1583 if (strpos(
$key,
"ui.factory") === 0) {
1595 $container[
'refinery'] =
function (
$container) {
1596 $dataFactory = new \ILIAS\Data\Factory();
1597 $language = $container[
'lng'];
1599 return new \ILIAS\Refinery\Factory($dataFactory, $language);
1613 $client_ini = $container[
'ilClientIniFile'];
1615 $replace_super_globals = (
1616 !$client_ini->variableExists(
'server',
'prevent_super_global_replacement') ||
1617 !(bool) $client_ini->readVariable(
'server',
'prevent_super_global_replacement')
1620 if ($replace_super_globals) {
1621 $throwOnValueAssignment = defined(
'DEVMODE') && DEVMODE;
1633 $init->init($container);
1641 global $ilUser,
$DIC;
1648 self::initUploadPolicies($DIC);
1651 self::initUIFramework(
$GLOBALS[
"DIC"]);
1653 self::initGlobal(
"tpl", $tpl);
1656 $dispatcher = new \ILIAS\Init\StartupSequence\StartUpSequenceDispatcher($DIC);
1657 $dispatcher->dispatch();
1661 "ilNavigationHistory",
1662 "ilNavigationHistory",
1663 "Services/Navigation/classes/class.ilNavigationHistory.php" 1669 "Services/Help/classes/class.ilHelpGUI.php" 1681 "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php" 1687 "./Services/Locator/classes/class.ilLocatorGUI.php" 1693 "./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php" 1699 $_GET[
'limit'] = (
int) $ilUser->getPref(
'hits_per_page');
1709 if (isset(
$_GET[
'offset']) &&
$_GET[
'offset'] !=
"") {
1713 self::initGlobal(
"lti",
"ilLTIViewGUI",
"./Services/LTI/classes/class.ilLTIViewGUI.php");
1715 self::initKioskMode(
$GLOBALS[
"DIC"]);
1751 $a_current_script ==
"register.php" ||
1752 $a_current_script ==
"pwassist.php" ||
1753 $a_current_script ==
"confirmReg.php" ||
1754 $a_current_script ==
"il_securimage_play.php" ||
1755 $a_current_script ==
"il_securimage_show.php" ||
1756 $a_current_script ==
'login.php' 1763 $requestBaseClass = strtolower((
string) (
$_GET[
'baseClass'] ??
''));
1764 if ($requestBaseClass == strtolower(ilStartUpGUI::class)) {
1765 $requestCmdClass = strtolower((
string) (
$_GET[
'cmdClass'] ??
''));
1767 $requestCmdClass == strtolower(ilAccountRegistrationGUI::class) ||
1768 $requestCmdClass == strtolower(ilPasswordAssistanceGUI::class)
1773 $cmd = $DIC->ctrl()->getCmd();
1775 if (in_array($cmd, [
1776 'showLegalDocuments',
1777 'showAccountMigration',
1782 'doStandardAuthentication',
1783 'doCasAuthentication',
1791 if ($DIC->http()->wrapper()->query()->has(
'target')) {
1793 $target =
$_GET[
'target'];
1798 ($a_current_script ==
"goto.php" && $target ==
"impr_0") ||
1799 $requestBaseClass == strtolower(ilImprintGUI::class)
1807 (strtolower($requestCmdClass ??
"") === strtolower(ilAccessibilityControlConceptGUI::class))
1813 if ($a_current_script ==
'goto.php' && in_array($target, array(
1824 $current_ref_id = $DIC->http()->wrapper()->query()->has(
'ref_id')
1825 ? $DIC->http()->wrapper()->query()->retrieve(
'ref_id', $DIC->refinery()->kindlyTo()->int())
1828 if (null !== $current_ref_id
1829 && $DIC->user()->getId() === 0
1830 && $DIC->access()->checkAccessOfUser(
1847 protected static function translateMessage(
string $a_message_id, array $a_message_static = null): string
1855 $lang = $ilUser->getLanguage();
1856 } elseif (isset($_REQUEST[
"lang"])) {
1857 $lang = (string) $_REQUEST[
"lang"];
1858 } elseif ($ilSetting) {
1859 $lang = $ilSetting->get(
"language",
'');
1860 } elseif ($ilClientIniFile) {
1861 $lang = $ilClientIniFile->readVariable(
"language",
"default");
1864 $lang = $lng->getLangKey();
1868 if ($ilDB && $a_message_id) {
1873 $lng->loadLanguageModule(
"init");
1874 $message = $lng->txt($a_message_id);
1875 } elseif (is_array($a_message_static)) {
1876 if (!isset($a_message_static[
$lang])) {
1889 string $a_message_id =
'',
1890 array $a_message_static = null
1893 if (defined(
"ILIAS_HTTP_PATH") &&
1894 !stristr($a_target, ILIAS_HTTP_PATH)) {
1895 $a_target = ILIAS_HTTP_PATH .
"/" . $a_target;
1898 foreach ([
'ext_uid',
'soap_pw'] as
$param) {
1899 if (
false === strpos(
1902 ) && isset(
$GLOBALS[
'DIC']->
http()->request()->getQueryParams()[$param])) {
1904 $GLOBALS[
'DIC']->
http()->request()->getQueryParams()[$param]
1912 $message = self::translateMessage($a_message_id, $a_message_static);
1916 $link = self::translateMessage(
1917 "init_error_redirect_click",
1918 array(
"en" =>
'Please click to continue.',
1919 "de" =>
'Bitte klicken um fortzufahren.' 1923 '<br /><a href="' . $a_target .
'">' . $link .
'</a>';
1930 $mess = self::translateMessage(
1931 "init_error_redirect_info",
1932 array(
"en" =>
'Redirect not supported by context.',
1933 "de" =>
'Weiterleitungen werden durch Kontext nicht unterstützt.' 1936 ' (' . $a_target .
')';
1940 self::abortAndDie($mess);
1950 self::goToPublicSection();
1956 $DIC->http()->wrapper()->query()->has(
'target')
1958 $target = $DIC->http()->wrapper()->query()->retrieve(
1960 $DIC->refinery()->kindlyTo()->string()
1966 if ($target ===
'') {
1968 $DIC->ctrl()->redirectToURL(ilUserUtil::getStartingPointAsUrl());
1971 $DIC->ctrl()->redirectToURL(
"goto.php?target=" . $target);
1979 $n_of_tasks = $ilIliasIniFile->readVariable(
"background_tasks",
"number_of_concurrent_tasks");
1980 $sync = $ilIliasIniFile->readVariable(
"background_tasks",
"concurrency");
1982 $n_of_tasks = $n_of_tasks ?: 5;
1983 $sync = $sync ?:
'sync';
1985 $c[
"bt.task_factory"] =
function (
$c) {
1986 return new \ILIAS\BackgroundTasks\Implementation\Tasks\BasicTaskFactory($c[
"di.injector"]);
1989 $c[
"bt.persistence"] =
function (
$c) {
1990 return \ILIAS\BackgroundTasks\Implementation\Persistence\BasicPersistence::instance($c->database());
1993 $c[
"bt.injector"] =
function (
$c) {
1994 return new \ILIAS\BackgroundTasks\Dependencies\Injector($c,
new BaseDependencyMap());
1997 $c[
"bt.task_manager"] =
function (
$c) use ($sync) {
1998 if ($sync ==
'sync') {
1999 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager($c[
"bt.persistence"]);
2000 } elseif ($sync ==
'async') {
2001 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\AsyncTaskManager($c[
"bt.persistence"]);
2003 throw new ilException(
"The supported Background Task Managers are sync and async. $sync given.");
2010 $c[
"di.dependency_map"] =
function (
$c) {
2011 return new \ILIAS\BackgroundTasks\Dependencies\DependencyMap\BaseDependencyMap();
2014 $c[
"di.injector"] =
function (
$c) {
2015 return new \ILIAS\BackgroundTasks\Dependencies\Injector($c, $c[
"di.dependency_map"]);
2021 $c[
"service.kiosk_mode"] =
function (
$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)
Class ilGSProviderFactory.
static handleMaintenanceMode()
handle maintenance mode
static hasUser()
Based on user authentication?
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
const 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 initRefinery(\ILIAS\DI\Container $container)
static getLogger(string $a_component_id)
Get component logger.
const ILIAS_VERSION_NUMERIC
Class InsecureFilenameSanitizerPreProcessor.
static includePhp5Compliance()
This is a hack for authentication.
This describes a facility that the UI framework can use to retrieve some help text.
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)
Check whether session exists.
Class ChatMainBarProvider .
static initKioskMode(\ILIAS\DI\Container $c)
Class SVGBlacklistPreProcessor.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
Database Session Handling.
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...
A result encapsulates a value or an error and simplifies the handling of those.
const SESSION_CLOSE_LOGIN
static determineClient()
This method determines the current client and sets the constant CLIENT_ID.
static redirect(string $a_target, string $a_message_id='', array $a_message_static=null)
Redirects to target url if context supports it.
static init(Container $c)
static isAuthenticationForced()
Check if authentication is should be forced.
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 modifyHttpPath(string $httpPath)
static resumeUserSession()
Resume an existing user session.
static setCookieConstants()
static setSessionHandler()
set session handler to db Used in Soap/CAS
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.
static removeTrailingPathSeparators(string $path)
static initBackgroundTasks(\ILIAS\DI\Container $c)
static initAccessHandling()
$ilAccess and $rbac...
Responsible for loading the UI Framework into the dependency injection container of ILIAS...
static getWrapper(string $a_type)
const SESSION_CLOSE_EXPIRE
static initLegalDocuments(Container $c)
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 initILIAS()
ilias initialisation
static handleForcedAuthentication()
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 initUIFramework(\ILIAS\DI\Container $c)
init the ILIAS UI framework.
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 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.
if(!isset($GLOBALS['ilGlobalStartTime'])||! $GLOBALS['ilGlobalStartTime']) global $DIC
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)
const SESSION_CLOSE_PUBLIC
static _destroy($a_session_id, ?int $a_closing_context=null, $a_expired_at=null)
Destroy session.
static initUploadPolicies(\ILIAS\DI\Container $dic)
Class FilenameSanitizerPreProcessor.
static removeUnsafeCharacters()
Remove unsafe characters from GET.
static initCore()
Init core objects (level 0)
static setSessionCookieParams()
set session cookie params
static translateMessage(string $a_message_id, array $a_message_static=null)
Translate message if possible.
static supportsPersistentSessions()
Check if context supports persistent session handling.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static redirectToStartingPage(string $target='')
Central entry point for users of the service.
static setClosingContext(int $a_context)
set closing context (for statistics)
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 getInstance(\ilLogger $logger)
Get instance.
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 set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initUser()
Init user / authentification (level 2)
static buildHTTPPath()
builds http path
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.