39 $GLOBALS[
'ilGlobalStartTime'] = microtime();
68 $_GET = self::recursivelyRemoveUnsafeCharacters(
$_GET);
79 foreach ($var as $k => $v) {
80 $k = self::recursivelyRemoveUnsafeCharacters($k);
81 $mod[$k] = self::recursivelyRemoveUnsafeCharacters($v);
87 array(
"\x00",
"\n",
"\r",
"\\",
"'",
'"',
"\x1a"),
100 require_once(__DIR__ .
"/../../../../ilias_version.php");
101 self::initGlobal(
"ilBench",
"ilBenchmark",
"./components/ILIAS/Utilities/classes/class.ilBenchmark.php");
118 if (!defined(
'ILIAS_DATA_DIR')) {
119 define(
"ILIAS_DATA_DIR",
$ilIliasIniFile->readVariable(
"clients",
"datadir"));
122 if (!defined(
'ILIAS_WEB_DIR')) {
124 $from_ilias_ini = str_replace(
'public/',
'', $from_ilias_ini);
125 define(
"ILIAS_WEB_DIR", $from_ilias_ini);
127 if (!defined(
"ILIAS_ABSOLUTE_PATH")) {
128 define(
"ILIAS_ABSOLUTE_PATH",
$ilIliasIniFile->readVariable(
'server',
'absolute_path'));
133 define(
"ILIAS_LOG_FILE",
$ilIliasIniFile->readVariable(
"log",
"file"));
134 if (!defined(
"ILIAS_LOG_ENABLED")) {
135 define(
"ILIAS_LOG_ENABLED",
$ilIliasIniFile->readVariable(
"log",
"enabled"));
137 define(
"ILIAS_LOG_LEVEL",
$ilIliasIniFile->readVariable(
"log",
"level"));
140 define(
"PATH_TO_CONVERT",
$ilIliasIniFile->readVariable(
"tools",
"convert"));
141 define(
"PATH_TO_FFMPEG",
$ilIliasIniFile->readVariable(
"tools",
"ffmpeg"));
143 define(
"PATH_TO_MKISOFS",
$ilIliasIniFile->readVariable(
"tools",
"mkisofs"));
144 define(
"PATH_TO_UNZIP",
$ilIliasIniFile->readVariable(
"tools",
"unzip"));
145 define(
"PATH_TO_GHOSTSCRIPT",
$ilIliasIniFile->readVariable(
"tools",
"ghostscript"));
146 define(
"PATH_TO_JAVA",
$ilIliasIniFile->readVariable(
"tools",
"java"));
147 define(
"URL_TO_LATEX",
$ilIliasIniFile->readVariable(
"tools",
"latex"));
149 define(
"PATH_TO_SCSS",
$ilIliasIniFile->readVariable(
"tools",
"scss"));
150 define(
"PATH_TO_PHANTOMJS",
$ilIliasIniFile->readVariable(
"tools",
"phantomjs"));
154 define(
"ERROR_EDITOR_URL",
$ilIliasIniFile->readVariable(
'error',
'editor_url'));
157 if (
$ilIliasIniFile->variableExists(
'error',
'editor_path_translations')) {
159 "ERROR_EDITOR_PATH_TRANSLATIONS",
168 define(
"IL_VIRUS_SCANNER",
"Sophos");
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",
"AntiVir");
175 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
176 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
180 define(
"IL_VIRUS_SCANNER",
"ClamAV");
181 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
182 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
185 define(
"IL_VIRUS_SCANNER",
"icap");
186 define(
"IL_ICAP_HOST",
$ilIliasIniFile->readVariable(
"tools",
"icap_host"));
187 define(
"IL_ICAP_PORT",
$ilIliasIniFile->readVariable(
"tools",
"icap_port"));
188 define(
"IL_ICAP_AV_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"icap_service_name"));
189 define(
"IL_ICAP_CLIENT",
$ilIliasIniFile->readVariable(
"tools",
"icap_client_path"));
193 define(
"IL_VIRUS_SCANNER",
"None");
194 define(
"IL_VIRUS_CLEAN_COMMAND",
'');
199 define(
"IL_TIMEZONE", $tz);
218 public static function bootstrapFilesystems():
void 222 $DIC[
'filesystem.security.sanitizing.filename'] =
function (
Container $c) {
224 $c->fileServiceSettings()
228 $DIC[
'filesystem.factory'] =
function (
$c) {
229 return new \ILIAS\Filesystem\Provider\DelegatingFilesystemFactory(
$c[
'filesystem.security.sanitizing.filename']);
232 $DIC[
'filesystem.web'] =
function (
$c) {
238 $delegatingFactory =
$c[
'filesystem.factory'];
239 $webConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/public/' .
ILIAS_WEB_DIR .
'/' .
CLIENT_ID);
240 return $delegatingFactory->getLocal($webConfiguration);
243 $DIC[
'filesystem.storage'] =
function (
$c) {
249 $delegatingFactory =
$c[
'filesystem.factory'];
250 $storageConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(
ILIAS_DATA_DIR .
'/' .
CLIENT_ID);
251 return $delegatingFactory->getLocal($storageConfiguration);
254 $DIC[
'filesystem.temp'] =
function (
$c) {
260 $delegatingFactory =
$c[
'filesystem.factory'];
261 $tempConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(
ILIAS_DATA_DIR .
'/' .
CLIENT_ID .
'/temp');
262 return $delegatingFactory->getLocal($tempConfiguration);
265 $DIC[
'filesystem.customizing'] =
function (
$c) {
271 $delegatingFactory =
$c[
'filesystem.factory'];
272 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/public/' .
'Customizing');
273 return $delegatingFactory->getLocal($customizingConfiguration);
276 $DIC[
'filesystem.libs'] =
function (
$c) {
282 $delegatingFactory =
$c[
'filesystem.factory'];
283 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'vendor');
284 return $delegatingFactory->getLocal($customizingConfiguration,
true);
287 $DIC[
'filesystem.node_modules'] =
function (
$c) {
293 $delegatingFactory =
$c[
'filesystem.factory'];
294 $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH .
'/' .
'node_modules');
295 return $delegatingFactory->getLocal($customizingConfiguration,
true);
298 $DIC[
'filesystem'] =
function (
$c) {
299 return new \ILIAS\Filesystem\FilesystemsImpl(
300 $c[
'filesystem.storage'],
301 $c[
'filesystem.web'],
302 $c[
'filesystem.temp'],
303 $c[
'filesystem.customizing'],
304 $c[
'filesystem.libs'],
305 $c[
'filesystem.node_modules']
318 $dic[
'upload.processor-manager'] =
function (
$c) {
323 $fileUploadImpl = new \ILIAS\FileUpload\FileUploadImpl(
324 $c[
'upload.processor-manager'],
328 if ((defined(
'IL_VIRUS_SCANNER') && IL_VIRUS_SCANNER !=
"None") || (defined(
'IL_SCANNER_TYPE') && IL_SCANNER_TYPE ==
"1")) {
333 $fileUploadImpl->register(
335 $c->fileServiceSettings(),
336 $c->language()->txt(
"msg_info_blacklisted")
341 $c->language()->txt(
"upload_svg_rejection_message"),
342 $c->language()->txt(
"upload_svg_rejection_message_script"),
343 $c->language()->txt(
"upload_svg_rejection_message_base64"),
344 $c->language()->txt(
"upload_svg_rejection_message_elements")
347 return $fileUploadImpl;
353 $dic[
'upload_policy_repository'] =
static function (
$dic) {
359 $dic->rbac()->review(),
361 $dic[
'upload_policy_repository']->getAll(),
372 (
new \
ILIAS\
Init\Environment\HttpPathBuilder(
376 $DIC[
'ilIliasIniFile'],
378 ))->build()->getBaseURI()
388 if (defined(
'CLIENT_ID')) {
392 $df = new \ILIAS\Data\Factory();
395 if (!$DIC->isDependencyAvailable(
'iliasIni')) {
396 self::abortAndDie(
'Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.');
399 $in_unit_tests = defined(
'IL_PHPUNIT_TEST');
401 $can_set_cookie = !$in_unit_tests && $context_supports_persitent_session;
402 $has_request_client_id = $DIC->http()->wrapper()->query()->has(
'client_id');
403 $has_cookie_client_id = $DIC->http()->cookieJar()->has(
'ilClientId');
406 $default_client_id = $DIC->iliasIni()->readVariable(
'clients',
'default');
408 if ($DIC->http()->wrapper()->query()->has(
'client_id')) {
409 $client_id_from_get = $DIC->http()->wrapper()->query()->retrieve(
411 self::getClientIdTransformation()
414 if ($DIC->http()->wrapper()->cookie()->has(
'ilClientId')) {
415 $client_id_from_cookie = $DIC->http()->wrapper()->cookie()->retrieve(
417 self::getClientIdTransformation()
422 $client_id_to_use =
'';
423 if (isset($client_id_from_get) && $client_id_from_get !==
'') {
424 $client_id_to_use = $client_id_from_get;
427 if (isset($client_id_from_get) && strlen($client_id_from_get) > 0) {
429 $client_id_to_use =
$_GET[
'client_id'] = $df->clientId($client_id_from_get)->toString();
430 if ($can_set_cookie) {
434 $client_id_to_use = $default_client_id;
435 if (!isset(
$_COOKIE[
'ilClientId'])) {
440 $client_id_to_use = $client_id_to_use ?: $default_client_id;
442 define(
'CLIENT_ID', $df->clientId($client_id_to_use)->toString());
460 if (!is_string($from)) {
463 return strip_tags($from);
471 return $result->
then(
function ($value):
Result {
475 return new Error($exception);
483 public function __invoke($from):
string 505 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
510 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
513 $ini_file =
"/client.ini.php";
514 if (defined(
'CLIENT_WEB_DIR')) {
520 $ilClientIniFile =
new ilIniFile($ini_file);
521 $ilClientIniFile->read();
524 if ($ilClientIniFile->ERROR !=
"") {
525 $default_client = $ilIliasIniFile->readVariable(
"clients",
"default");
527 $mess = array(
"en" =>
"Client does not exist.",
528 "de" =>
"Mandant ist ungültig." 530 self::redirect(
"index.php?client_id=" . $default_client,
'', $mess);
532 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile initializing client ini file abborted with: " . $ilClientIniFile->ERROR);
536 self::initGlobal(
"ilClientIniFile", $ilClientIniFile);
538 define(
"DEVMODE", (
int) $ilClientIniFile->readVariable(
"system",
"DEVMODE"));
539 define(
"SHOWNOTICES", (
int) $ilClientIniFile->readVariable(
"system",
"SHOWNOTICES"));
540 if (!defined(
"ROOT_FOLDER_ID")) {
541 define(
"ROOT_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROOT_FOLDER_ID'));
543 if (!defined(
"SYSTEM_FOLDER_ID")) {
544 define(
"SYSTEM_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'SYSTEM_FOLDER_ID'));
546 if (!defined(
"ROLE_FOLDER_ID")) {
547 define(
"ROLE_FOLDER_ID", (
int) $ilClientIniFile->readVariable(
'system',
'ROLE_FOLDER_ID'));
549 define(
"MAIL_SETTINGS_ID", (
int) $ilClientIniFile->readVariable(
'system',
'MAIL_SETTINGS_ID'));
550 $error_handler = $ilClientIniFile->readVariable(
'system',
'ERROR_HANDLER');
551 define(
"ERROR_HANDLER", $error_handler ?:
"PRETTY_PAGE");
555 define(
"OH_REF_ID", (
int) $ilClientIniFile->readVariable(
"system",
"OH_REF_ID"));
561 if (!defined(
"CLIENT_DATA_DIR")) {
564 if (!defined(
"CLIENT_WEB_DIR")) {
567 define(
"CLIENT_NAME", $ilClientIniFile->readVariable(
'client',
'name'));
569 $db_type = $ilClientIniFile->readVariable(
"db",
"type");
570 if ($db_type ===
"") {
573 define(
"IL_DB_TYPE", $db_type);
582 global $ilClientIniFile;
584 if (!$ilClientIniFile->readVariable(
"client",
"access")) {
586 "en" =>
"The server is not available due to maintenance." .
587 " We apologise for any inconvenience.",
588 "de" =>
"Der Server ist aufgrund von Wartungsarbeiten aktuell nicht verfügbar." .
589 " Wir bitten um Verständnis. Versuchen Sie es später noch einmal." 591 $mess_id =
"init_error_maintenance";
594 self::redirect(
"./maintenance.html", $mess_id, $mess);
596 $mess = self::translateMessage($mess_id, $mess);
597 self::abortAndDie($mess);
609 $ilDB->initFromIniFile();
612 self::initGlobal(
"ilDB",
$ilDB);
622 $DIC[
'global_cache'] = new \ILIAS\Cache\Services(
623 $legacy_settings->getConfig()
634 if (!$db_session_handler->setSaveHandler()) {
635 self::abortAndDie(
"Cannot start session handling.");
641 if (function_exists(
"session_status") && session_status() == PHP_SESSION_ACTIVE) {
642 session_regenerate_id();
654 } elseif (isset(
$GLOBALS[
'COOKIE_PATH'])) {
672 define(
'IL_COOKIE_HTTPONLY',
true);
673 define(
'IL_COOKIE_EXPIRE', 0);
674 define(
'IL_COOKIE_DOMAIN',
'');
675 if (!defined(
'IL_COOKIE_PATH')) {
683 if (defined(
'CLIENT_ID') &&
684 !defined(
'IL_PHPUNIT_TEST') &&
697 if (!defined(
'IL_COOKIE_SECURE')) {
701 $cookie_secure = !$ilSetting->get(
'https',
'0') && $DIC[
'https']->isDetected();
702 define(
'IL_COOKIE_SECURE', $cookie_secure);
704 $cookie_parameters = [
705 'lifetime' => IL_COOKIE_EXPIRE,
707 'domain' => IL_COOKIE_DOMAIN,
708 'secure' => IL_COOKIE_SECURE,
709 'httponly' => IL_COOKIE_HTTPONLY,
714 (!isset(session_get_cookie_params()[
'samesite']) || strtolower(session_get_cookie_params()[
'samesite']) !==
'strict')
716 $cookie_parameters[
'samesite'] =
'Lax';
719 session_set_cookie_params($cookie_parameters);
729 $c->logger()->cron(),
730 $c[
'component.repository'],
731 $c[
'component.factory']
737 $c[
'cron.repository'],
740 $c->logger()->cron(),
741 (new \ILIAS\Data\Factory())->clock()
751 $c[
"object.customicons.factory"] =
function (
$c) {
753 $c->filesystem()->web(),
762 $c[
"user.avatar.factory"] =
function (
$c) {
763 return new \ilUserAvatarFactory($c);
781 $c[
'acc.criteria.type.factory'],
803 "components/ILIAS/Administration/classes/class.ilSetting.php" 807 if (!$ilSetting->get(
"setup_ok")) {
808 self::abortAndDie(
"Setup is not completed. Please run setup routine again.");
812 define(
"ANONYMOUS_USER_ID", (
int) $ilSetting->get(
"anonymous_user_id"));
813 define(
"ANONYMOUS_ROLE_ID", (
int) $ilSetting->get(
"anonymous_role_id"));
814 define(
"SYSTEM_USER_ID", (
int) $ilSetting->get(
"system_user_id"));
815 define(
"SYSTEM_ROLE_ID", (
int) $ilSetting->get(
"system_role_id"));
816 define(
"USER_FOLDER_ID", 7);
819 define(
"RECOVERY_FOLDER_ID", (
int) $ilSetting->get(
"recovery_folder_id"));
822 define(
"IL_INST_ID", $ilSetting->get(
"inst_id",
'0'));
825 define(
"SUFFIX_REPL_DEFAULT",
"php,php3,php4,inc,lang,phtml,htaccess");
826 define(
"SUFFIX_REPL_ADDITIONAL", $ilSetting->get(
"suffix_repl_additional",
""));
829 self::buildHTTPPath();
839 $component_factory = $DIC[
"component.factory"];
845 "./components/ILIAS/Style/System/classes/class.ilStyleDefinition.php" 849 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as $ui_plugin) {
850 $gui_class = $ui_plugin->getUIClassInstance();
851 $gui_class->modifyGUI(
"components/ILIAS/Init",
"init_style", array(
"styleDefinition" => $DIC->systemStyle()));
862 static $context_init;
864 $uid =
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
866 $DIC->user()->setId($uid);
867 $DIC->user()->read();
868 if (!isset($context_init)) {
869 if ($DIC->user()->isAnonymous()) {
870 $DIC->globalScreen()->tool()->context()->claim()->external();
872 $DIC->globalScreen()->tool()->context()->claim()->internal();
874 $context_init =
true;
883 self::abortAndDie(
"Init user account failed");
894 if ($ilSetting->get(
"locale") && trim($ilSetting->get(
"locale")) !==
"") {
895 $larr = explode(
",", trim($ilSetting->get(
"locale")));
898 foreach ($larr as $l) {
899 if (trim($l) !=
"") {
903 if (count($ls) > 0) {
904 setlocale(LC_ALL, $ls);
907 setlocale(LC_NUMERIC,
"C");
920 self::abortAndDie(
"Public Section enabled, but no Anonymous user found.");
923 $session_destroyed =
false;
924 if ($DIC[
'ilAuthSession']->isExpired()) {
925 $session_destroyed =
true;
928 if (!$DIC[
'ilAuthSession']->isAuthenticated()) {
929 $session_destroyed =
true;
933 if ($session_destroyed) {
937 self::initUserAccount();
940 if ($DIC->http()->wrapper()->query()->has(
'target')) {
941 $target = $DIC->http()->wrapper()->query()->retrieve(
943 $DIC->refinery()->kindlyTo()->string()
948 if (strlen($target)) {
950 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
951 if ($current_script ==
"goto.php") {
955 self::redirect(
"goto.php?target=" . $target);
960 "ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=&ref_id=" . (defined(
973 $session_expired =
false;
976 if ($DIC[
'ilAuthSession']->isExpired()) {
978 $session_expired =
true;
980 if (!$DIC[
'ilAuthSession']->isAuthenticated()) {
984 $target = $DIC->http()->wrapper()->query()->has(
'target')
985 ? $DIC->http()->wrapper()->query()->retrieve(
987 $DIC->refinery()->kindlyTo()->string()
991 if (strlen($target)) {
992 $target =
"target=" . $target .
"&";
995 $client_id = $DIC->http()->wrapper()->cookie()->retrieve(
997 $DIC->refinery()->byTrying([
998 $DIC->refinery()->kindlyTo()->string(),
999 $DIC->refinery()->always(
'')
1003 $script =
"login.php?" . $target .
"client_id=" .
$client_id;
1004 $script .= $session_expired ?
"&session_expired=1" :
"";
1008 "init_error_authentication_fail",
1010 "en" =>
"Authentication failed.",
1011 "de" =>
"Authentifizierung fehlgeschlagen." 1019 protected static function initLanguage(
bool $a_use_user_language =
true):
void 1028 if ($a_use_user_language) {
1029 if ($DIC->offsetExists(
'lng')) {
1030 $DIC->offsetUnset(
'lng');
1034 unset($DIC[
'refinery']);
1035 self::initRefinery($DIC);
1039 if (is_object($rbacsystem) && $DIC->offsetExists(
'tree')) {
1040 $rbacsystem->initMemberView();
1052 "./components/ILIAS/AccessControl/classes/class.ilRbacReview.php",
1057 self::initGlobal(
'rbacsystem', $rbacsystem, null,
true);
1062 "./components/ILIAS/AccessControl/classes/class.ilRbacAdmin.php",
1069 "./components/ILIAS/AccessControl/classes/class.ilAccess.php",
1081 self::initGlobal(
"ilLog",
$log);
1083 self::initGlobal(
"log",
$log);
1092 ?
string $a_source_file = null,
1093 ?
bool $destroy_existing =
false 1097 if ($destroy_existing) {
1101 if (isset($DIC[$a_name])) {
1102 unset($DIC[$a_name]);
1106 $GLOBALS[$a_name] = is_object($a_class) ? $a_class :
new $a_class();
1108 $DIC[$a_name] =
static function (
Container $c) use ($a_name) {
1116 $GLOBALS[
'ilLog']->write(
"Fatal Error: ilInitialisation - " . $a_message);
1127 error_reporting(-1);
1134 self::$already_initialized =
false;
1141 self::initSession();
1145 self::resumeUserSession();
1155 if (self::$already_initialized) {
1160 $GLOBALS[
"DIC"][
"ilLoggerFactory"] =
function (
$c) {
1164 self::$already_initialized =
true;
1167 self::initHTTPServices(
$GLOBALS[
"DIC"]);
1169 self::initFileUploadService(
$GLOBALS[
"DIC"]);
1172 self::initSession();
1178 self::resumeUserSession();
1183 self::initLanguage(
true);
1184 $GLOBALS[
'DIC'][
'tree']->initLangCode();
1186 self::initInjector(
$GLOBALS[
'DIC']);
1187 self::initBackgroundTasks(
$GLOBALS[
'DIC']);
1188 self::initKioskMode(
$GLOBALS[
'DIC']);
1198 self::replaceSuperGlobals(
$GLOBALS[
'DIC']);
1206 if (isset(
$GLOBALS[
'DIC'][
'ilAuthSession'])) {
1207 unset(
$GLOBALS[
'DIC'][
'ilAuthSession']);
1212 $c[
'ilLoggerFactory']->getLogger(
'auth')
1214 $auth_session->init();
1215 return $auth_session;
1225 error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
1238 self::handleErrorReporting();
1242 self::requireCommonIncludes();
1249 "./components/ILIAS/Init/classes/class.ilErrorHandling.php" 1252 self::removeUnsafeCharacters();
1254 self::initIliasIniFile();
1256 define(
'IL_INITIAL_WD', getcwd());
1259 self::initGlobal(
"ilias",
"ILIAS",
"./components/ILIAS/Init/classes/class.ilias.php");
1267 global $https, $ilias,
$DIC;
1269 self::setCookieConstants();
1271 self::determineClient();
1273 self::bootstrapFilesystems();
1275 self::initResourceStorage();
1277 self::initClientIniFile();
1284 self::handleDevMode();
1287 self::handleMaintenanceMode();
1289 self::initDatabase();
1291 self::initGlobalCache();
1293 self::initComponentService($DIC);
1296 self::initLanguage(
false);
1302 "ilAppEventHandler",
1303 "ilAppEventHandler",
1304 "./components/ILIAS/EventHandling/classes/class.ilAppEventHandler.php" 1312 if (!isset($DIC[
"ilPluginAdmin"]) || !$DIC[
"ilPluginAdmin"] instanceof
ilPluginAdmin) {
1315 new ilPluginAdmin($DIC[
"component.repository"]),
1316 "./components/ILIAS/Component/classes/class.ilPluginAdmin.php" 1319 self::initGlobal(
"https",
"ilHTTPS",
"./components/ILIAS/Http/classes/class.ilHTTPS.php");
1320 self::initSettings();
1321 self::setSessionHandler();
1324 self::initCustomObjectIcons(
$GLOBALS[
'DIC']);
1325 self::initLegalDocuments(
$GLOBALS[
'DIC']);
1326 self::initAccessibilityControlConcept(
$GLOBALS[
'DIC']);
1327 self::initLearningObjectMetadata(
$GLOBALS[
'DIC']);
1334 $https->enableSecureCookies();
1335 $https->checkProtocolAndRedirectIfNeeded();
1342 "ilObjectDataCache",
1343 "./components/ILIAS/Object/classes/class.ilObjectDataCache.php" 1348 "ilObjectDefinition",
1349 "./components/ILIAS/Object/classes/class.ilObjectDefinition.php" 1354 self::initGlobal(
"tree", $tree);
1357 self::setSessionCookieParams();
1358 self::setClientIdCookie();
1360 self::initRefinery($DIC);
1365 self::initGlobalScreen($DIC);
1373 global $ilias, $ilUser;
1379 "./components/ILIAS/User/classes/class.ilObjUser.php",
1382 $ilias->account = $ilUser;
1384 self::initAccessHandling();
1399 !$DIC[
'ilAuthSession']->isAuthenticated() ||
1400 $DIC[
'ilAuthSession']->isExpired()
1402 if (
$GLOBALS[
'DIC'][
'ilAuthSession']->isExpired()) {
1407 $current_script = substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"), 1);
1408 if (self::blockedAuthentication($current_script)) {
1414 self::handleAuthenticationFail();
1419 self::initUserAccount();
1425 protected static function handleAuthenticationSuccess():
void 1448 throw new Exception(
"Authentication failed.");
1451 if (($DIC->http()->request()->getQueryParams()[
'cmdMode'] ?? 0) ===
'asynch') {
1452 $DIC->language()->loadLanguageModule(
'init');
1453 $DIC->http()->saveResponse(
1454 $DIC->http()->response()
1456 ->withBody(Streams::ofString($DIC->language()->txt(
'init_error_authentication_fail')))
1458 $DIC->http()->sendResponse();
1459 $DIC->http()->close();
1462 $DIC[
'ilAuthSession']->isExpired() &&
1472 self::goToPublicSection();
1485 $init_http->init($container);
1495 $c[
'global_screen'] =
function () use ($c) {
1502 $c->globalScreen()->tool()->context()->stack()->clear();
1503 $c->globalScreen()->tool()->context()->claim()->main();
1514 $component_repository = $c[
"component.repository"];
1515 $component_factory = $c[
"component.factory"];
1516 foreach ($component_repository->getPlugins() as $pl) {
1517 if (!$pl->isActive()) {
1520 $plugin = $component_factory->getPlugin($pl->getId());
1521 $c[
'ui.renderer'] =
$plugin->exchangeUIRendererAfterInitialization($c);
1523 foreach ($c->keys() as $key) {
1524 if (strpos($key,
"ui.factory") === 0) {
1525 $c[$key] =
$plugin->exchangeUIFactoryAfterInitialization($key, $c);
1536 $container[
'refinery'] =
function (
$container) {
1537 $dataFactory = new \ILIAS\Data\Factory();
1538 $language = $container[
'lng'];
1540 return new \ILIAS\Refinery\Factory($dataFactory, $language);
1554 $client_ini = $container[
'ilClientIniFile'];
1556 $replace_super_globals = (
1557 !$client_ini->variableExists(
'server',
'prevent_super_global_replacement') ||
1558 !(bool) $client_ini->readVariable(
'server',
'prevent_super_global_replacement')
1561 if ($replace_super_globals) {
1562 $throwOnValueAssignment = defined(
'DEVMODE') && DEVMODE;
1574 $init->init($container);
1582 global $ilUser,
$DIC;
1589 self::initUploadPolicies($DIC);
1592 self::initUIFramework(
$GLOBALS[
"DIC"]);
1594 self::initGlobal(
"tpl", $tpl);
1597 $dispatcher = new \ILIAS\Init\StartupSequence\StartUpSequenceDispatcher($DIC);
1598 $dispatcher->dispatch();
1602 "ilNavigationHistory",
1603 "ilNavigationHistory",
1604 "components/ILIAS/Navigation/classes/class.ilNavigationHistory.php" 1610 "components/ILIAS/Help/classes/class.ilHelpGUI.php" 1622 "./components/ILIAS/UIComponent/Toolbar/classes/class.ilToolbarGUI.php" 1628 "./components/ILIAS/Locator/classes/class.ilLocatorGUI.php" 1634 "./components/ILIAS/UIComponent/Tabs/classes/class.ilTabsGUI.php" 1645 if (isset(
$_GET[
'offset']) &&
$_GET[
'offset'] !=
"") {
1649 self::initGlobal(
"lti",
"ilLTIViewGUI",
"./components/ILIAS/LTIProvider/classes/class.ilLTIViewGUI.php");
1651 self::initKioskMode(
$GLOBALS[
"DIC"]);
1687 $a_current_script ==
"register.php" ||
1688 $a_current_script ==
"pwassist.php" ||
1689 $a_current_script ==
"confirmReg.php" ||
1690 $a_current_script ==
"il_securimage_play.php" ||
1691 $a_current_script ==
"il_securimage_show.php" ||
1692 $a_current_script ==
'login.php' 1699 $requestBaseClass = strtolower((
string) (
$_GET[
'baseClass'] ??
''));
1700 if ($requestBaseClass == strtolower(ilStartUpGUI::class)) {
1701 $requestCmdClass = strtolower((
string) (
$_GET[
'cmdClass'] ??
''));
1703 $requestCmdClass == strtolower(ilAccountRegistrationGUI::class) ||
1704 $requestCmdClass == strtolower(ilPasswordAssistanceGUI::class)
1709 $cmd = $DIC->ctrl()->getCmd();
1711 if (in_array($cmd, [
1712 'showLegalDocuments',
1713 'showAccountMigration',
1718 'doStandardAuthentication',
1719 'doCasAuthentication',
1727 if ($DIC->http()->wrapper()->query()->has(
'target')) {
1729 $target =
$_GET[
'target'];
1734 ($a_current_script ==
"goto.php" && $target ==
"impr_0") ||
1735 $requestBaseClass == strtolower(ilImprintGUI::class)
1743 (strtolower($requestCmdClass ??
"") === strtolower(ilAccessibilityControlConceptGUI::class))
1749 if ($a_current_script ==
'goto.php' && in_array($target, array(
1760 $current_ref_id = $DIC->http()->wrapper()->query()->has(
'ref_id')
1761 ? $DIC->http()->wrapper()->query()->retrieve(
'ref_id', $DIC->refinery()->kindlyTo()->int())
1764 if (null !== $current_ref_id
1765 && $DIC->user()->getId() === 0
1766 && $DIC->access()->checkAccessOfUser(
1783 protected static function translateMessage(
string $a_message_id, array $a_message_static = null): string
1791 $lang = $ilUser->getLanguage();
1792 } elseif (isset($_REQUEST[
"lang"])) {
1793 $lang = (string) $_REQUEST[
"lang"];
1794 } elseif ($ilSetting) {
1795 $lang = $ilSetting->get(
"language",
'');
1796 } elseif ($ilClientIniFile) {
1797 $lang = $ilClientIniFile->readVariable(
"language",
"default");
1800 $lang = $lng->getLangKey();
1804 if ($ilDB && $a_message_id) {
1809 $lng->loadLanguageModule(
"init");
1810 $message = $lng->txt($a_message_id);
1811 } elseif (is_array($a_message_static)) {
1812 if (!isset($a_message_static[$lang])) {
1815 $message = $a_message_static[$lang];
1825 string $a_message_id =
'',
1826 array $a_message_static = null
1829 if (defined(
"ILIAS_HTTP_PATH") &&
1830 !stristr($a_target, ILIAS_HTTP_PATH)) {
1831 $a_target = ILIAS_HTTP_PATH .
"/" . $a_target;
1834 foreach ([
'ext_uid',
'soap_pw'] as
$param) {
1835 if (
false === strpos(
1838 ) && isset(
$GLOBALS[
'DIC']->
http()->request()->getQueryParams()[$param])) {
1840 $GLOBALS[
'DIC']->
http()->request()->getQueryParams()[$param]
1848 $message = self::translateMessage($a_message_id, $a_message_static);
1852 $link = self::translateMessage(
1853 "init_error_redirect_click",
1854 array(
"en" =>
'Please click to continue.',
1855 "de" =>
'Bitte klicken um fortzufahren.' 1859 '<br /><a href="' . $a_target .
'">' . $link .
'</a>';
1866 $mess = self::translateMessage(
1867 "init_error_redirect_info",
1868 array(
"en" =>
'Redirect not supported by context.',
1869 "de" =>
'Weiterleitungen werden durch Kontext nicht unterstützt.' 1872 ' (' . $a_target .
')';
1876 self::abortAndDie($mess);
1886 self::goToPublicSection();
1892 $DIC->http()->wrapper()->query()->has(
'target')
1894 $target = $DIC->http()->wrapper()->query()->retrieve(
1896 $DIC->refinery()->kindlyTo()->string()
1902 if ($target ===
'') {
1904 $DIC->ctrl()->redirectToURL(ilUserUtil::getStartingPointAsUrl());
1907 $DIC->ctrl()->redirectToURL(
"goto.php?target=" . $target);
1915 $n_of_tasks = $ilIliasIniFile->readVariable(
"background_tasks",
"number_of_concurrent_tasks");
1916 $sync = $ilIliasIniFile->readVariable(
"background_tasks",
"concurrency");
1918 $n_of_tasks = $n_of_tasks ?: 5;
1919 $sync = $sync ?:
'sync';
1921 $c[
"bt.task_factory"] =
function (
$c) {
1922 return new \ILIAS\BackgroundTasks\Implementation\Tasks\BasicTaskFactory($c[
"di.injector"]);
1925 $c[
"bt.persistence"] =
function (
$c) {
1926 return \ILIAS\BackgroundTasks\Implementation\Persistence\BasicPersistence::instance($c->database());
1929 $c[
"bt.injector"] =
function (
$c) {
1930 return new \ILIAS\BackgroundTasks\Dependencies\Injector($c,
new BaseDependencyMap());
1933 $c[
"bt.task_manager"] =
function (
$c) use ($sync) {
1934 if ($sync ==
'sync') {
1935 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager($c[
"bt.persistence"]);
1936 } elseif ($sync ==
'async') {
1937 return new \ILIAS\BackgroundTasks\Implementation\TaskManager\AsyncTaskManager($c[
"bt.persistence"]);
1939 throw new ilException(
"The supported Background Task Managers are sync and async. $sync given.");
1946 $c[
"di.dependency_map"] =
function (
$c) {
1947 return new \ILIAS\BackgroundTasks\Dependencies\DependencyMap\BaseDependencyMap();
1950 $c[
"di.injector"] =
function (
$c) {
1951 return new \ILIAS\BackgroundTasks\Dependencies\Injector($c, $c[
"di.dependency_map"]);
1957 $c[
"service.kiosk_mode"] =
function (
$c) {
1969 $c[
'learning_object_metadata'] =
function (
$c) {
1970 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 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.
Class InsecureFilenameSanitizerPreProcessor.
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.
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="")
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...
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 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 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()
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 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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
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.
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 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.