ILIAS  release_8 Revision v8.23
class.ilInitialisation.php
Go to the documentation of this file.
1 <?php
2 
19 // TODO:
48 
49 require_once("libs/composer/vendor/autoload.php");
50 
51 // needed for slow queries, etc.
52 if (!isset($GLOBALS['ilGlobalStartTime']) || !$GLOBALS['ilGlobalStartTime']) {
53  $GLOBALS['ilGlobalStartTime'] = microtime();
54 }
55 
56 global $DIC;
57 if (null === $DIC) {
58  // Don't remove this, intellisense autocompletion does not work in PhpStorm without a top level assignment
59  $DIC = new Container();
60 }
61 
72 {
76  protected static function removeUnsafeCharacters(): void
77  {
78  // Remove unsafe characters from GET parameters.
79  // We do not need this characters in any case, so it is
80  // feasible to filter them everytime. POST parameters
81  // need attention through ilUtil::stripSlashes() and similar functions)
82  $_GET = self::recursivelyRemoveUnsafeCharacters($_GET);
83  }
84 
89  protected static function recursivelyRemoveUnsafeCharacters($var)
90  {
91  if (is_array($var)) {
92  $mod = [];
93  foreach ($var as $k => $v) {
94  $k = self::recursivelyRemoveUnsafeCharacters($k);
95  $mod[$k] = self::recursivelyRemoveUnsafeCharacters($v);
96  }
97  return $mod;
98  }
99  return strip_tags(
100  str_replace(
101  array("\x00", "\n", "\r", "\\", "'", '"', "\x1a"),
102  "",
103  $var
104  )
105  );
106  }
107 
111  protected static function requireCommonIncludes(): void
112  {
114  require_once "include/inc.ilias_version.php";
115 
116  self::initGlobal("ilBench", "ilBenchmark", "./Services/Utilities/classes/class.ilBenchmark.php");
117  }
118 
123  protected static function includePhp5Compliance(): void
124  {
127  require_once("include/inc.xml5compliance.php");
128  }
130  require_once("include/inc.xsl5compliance.php");
131  }
132 
139  protected static function initIliasIniFile(): void
140  {
141  $ilIliasIniFile = new ilIniFile("./ilias.ini.php");
142  $ilIliasIniFile->read();
143  self::initGlobal('ilIliasIniFile', $ilIliasIniFile);
144 
145  // initialize constants
146  if (!defined('ILIAS_DATA_DIR')) {
147  define("ILIAS_DATA_DIR", $ilIliasIniFile->readVariable("clients", "datadir"));
148  }
149  if (!defined('ILIAS_WEB_DIR')) {
150  define("ILIAS_WEB_DIR", $ilIliasIniFile->readVariable("clients", "path"));
151  }
152  if (!defined("ILIAS_ABSOLUTE_PATH")) {
153  define("ILIAS_ABSOLUTE_PATH", $ilIliasIniFile->readVariable('server', 'absolute_path'));
154  }
155 
156  // logging
157  define("ILIAS_LOG_DIR", $ilIliasIniFile->readVariable("log", "path"));
158  define("ILIAS_LOG_FILE", $ilIliasIniFile->readVariable("log", "file"));
159  if (!defined("ILIAS_LOG_ENABLED")) {
160  define("ILIAS_LOG_ENABLED", $ilIliasIniFile->readVariable("log", "enabled"));
161  }
162  define("ILIAS_LOG_LEVEL", $ilIliasIniFile->readVariable("log", "level"));
163 
164  // read path + command for third party tools from ilias.ini
165  define("PATH_TO_CONVERT", $ilIliasIniFile->readVariable("tools", "convert"));
166  define("PATH_TO_FFMPEG", $ilIliasIniFile->readVariable("tools", "ffmpeg"));
167  define("PATH_TO_ZIP", $ilIliasIniFile->readVariable("tools", "zip"));
168  define("PATH_TO_MKISOFS", $ilIliasIniFile->readVariable("tools", "mkisofs"));
169  define("PATH_TO_UNZIP", $ilIliasIniFile->readVariable("tools", "unzip"));
170  define("PATH_TO_GHOSTSCRIPT", $ilIliasIniFile->readVariable("tools", "ghostscript"));
171  define("PATH_TO_JAVA", $ilIliasIniFile->readVariable("tools", "java"));
172  define("URL_TO_LATEX", $ilIliasIniFile->readVariable("tools", "latex"));
173  define("PATH_TO_FOP", $ilIliasIniFile->readVariable("tools", "fop"));
174  define("PATH_TO_LESSC", $ilIliasIniFile->readVariable("tools", "lessc"));
175  define("PATH_TO_PHANTOMJS", $ilIliasIniFile->readVariable("tools", "phantomjs"));
176 
177  if ($ilIliasIniFile->groupExists('error')) {
178  if ($ilIliasIniFile->variableExists('error', 'editor_url')) {
179  define("ERROR_EDITOR_URL", $ilIliasIniFile->readVariable('error', 'editor_url'));
180  }
181 
182  if ($ilIliasIniFile->variableExists('error', 'editor_path_translations')) {
183  define(
184  "ERROR_EDITOR_PATH_TRANSLATIONS",
185  $ilIliasIniFile->readVariable('error', 'editor_path_translations')
186  );
187  }
188  }
189 
190  // read virus scanner settings
191  switch ($ilIliasIniFile->readVariable("tools", "vscantype")) {
192  case "sophos":
193  define("IL_VIRUS_SCANNER", "Sophos");
194  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
195  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
196  break;
197 
198  case "antivir":
199  define("IL_VIRUS_SCANNER", "AntiVir");
200  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
201  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
202  break;
203 
204  case "clamav":
205  define("IL_VIRUS_SCANNER", "ClamAV");
206  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
207  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
208  break;
209  case "icap":
210  define("IL_VIRUS_SCANNER", "icap");
211  define("IL_ICAP_HOST", $ilIliasIniFile->readVariable("tools", "icap_host"));
212  define("IL_ICAP_PORT", $ilIliasIniFile->readVariable("tools", "icap_port"));
213  define("IL_ICAP_AV_COMMAND", $ilIliasIniFile->readVariable("tools", "icap_service_name"));
214  define("IL_ICAP_CLIENT", $ilIliasIniFile->readVariable("tools", "icap_client_path"));
215  break;
216 
217  default:
218  define("IL_VIRUS_SCANNER", "None");
219  define("IL_VIRUS_CLEAN_COMMAND", '');
220  break;
221  }
222 
224  define("IL_TIMEZONE", $tz);
225  }
226 
227  protected static function initResourceStorage(): void
228  {
229  global $DIC;
230  (new InitResourceStorage())->init($DIC);
231  }
232 
243  public static function bootstrapFilesystems(): void
244  {
245  global $DIC;
246 
247  $DIC['filesystem.security.sanitizing.filename'] = function (Container $c) {
249  $c->fileServiceSettings()
250  );
251  };
252 
253  $DIC['filesystem.factory'] = function ($c) {
254  return new \ILIAS\Filesystem\Provider\DelegatingFilesystemFactory($c['filesystem.security.sanitizing.filename']);
255  };
256 
257  $DIC['filesystem.web'] = function ($c) {
258  //web
259 
263  $delegatingFactory = $c['filesystem.factory'];
264  $webConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH . '/' . ILIAS_WEB_DIR . '/' . CLIENT_ID);
265  return $delegatingFactory->getLocal($webConfiguration);
266  };
267 
268  $DIC['filesystem.storage'] = function ($c) {
269  //storage
270 
274  $delegatingFactory = $c['filesystem.factory'];
275  $storageConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_DATA_DIR . '/' . CLIENT_ID);
276  return $delegatingFactory->getLocal($storageConfiguration);
277  };
278 
279  $DIC['filesystem.temp'] = function ($c) {
280  //temp
281 
285  $delegatingFactory = $c['filesystem.factory'];
286  $tempConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_DATA_DIR . '/' . CLIENT_ID . '/temp');
287  return $delegatingFactory->getLocal($tempConfiguration);
288  };
289 
290  $DIC['filesystem.customizing'] = function ($c) {
291  //customizing
292 
296  $delegatingFactory = $c['filesystem.factory'];
297  $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH . '/' . 'Customizing');
298  return $delegatingFactory->getLocal($customizingConfiguration);
299  };
300 
301  $DIC['filesystem.libs'] = function ($c) {
302  //customizing
303 
307  $delegatingFactory = $c['filesystem.factory'];
308  $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH . '/' . 'libs');
309  return $delegatingFactory->getLocal($customizingConfiguration, true);
310  };
311 
312  $DIC['filesystem.node_modules'] = function ($c) {
313  //customizing
314 
318  $delegatingFactory = $c['filesystem.factory'];
319  $customizingConfiguration = new \ILIAS\Filesystem\Provider\Configuration\LocalConfig(ILIAS_ABSOLUTE_PATH . '/' . 'node_modules');
320  return $delegatingFactory->getLocal($customizingConfiguration, true);
321  };
322 
323  $DIC['filesystem'] = function ($c) {
324  return new \ILIAS\Filesystem\FilesystemsImpl(
325  $c['filesystem.storage'],
326  $c['filesystem.web'],
327  $c['filesystem.temp'],
328  $c['filesystem.customizing'],
329  $c['filesystem.libs'],
330  $c['filesystem.node_modules']
331  );
332  };
333  }
334 
341  public static function initFileUploadService(\ILIAS\DI\Container $dic): void
342  {
343  $dic['upload.processor-manager'] = function ($c) {
344  return new PreProcessorManagerImpl();
345  };
346 
347  $dic['upload'] = function (\ILIAS\DI\Container $c) {
348  $fileUploadImpl = new \ILIAS\FileUpload\FileUploadImpl(
349  $c['upload.processor-manager'],
350  $c['filesystem'],
351  $c['http']
352  );
353  if ((defined('IL_VIRUS_SCANNER') && IL_VIRUS_SCANNER != "None") || (defined('IL_SCANNER_TYPE') && IL_SCANNER_TYPE == "1")) {
354  $fileUploadImpl->register(new ilVirusScannerPreProcessor(ilVirusScannerFactory::_getInstance()));
355  }
356 
357  $fileUploadImpl->register(new FilenameSanitizerPreProcessor());
358  $fileUploadImpl->register(
360  $c->fileServiceSettings(),
361  $c->language()->txt("msg_info_blacklisted")
362  )
363  );
364  $fileUploadImpl->register(new InsecureFilenameSanitizerPreProcessor());
365  $fileUploadImpl->register(new SVGBlacklistPreProcessor(
366  $c->language()->txt("upload_svg_rejection_message"),
367  $c->language()->txt("upload_svg_rejection_message_script"),
368  $c->language()->txt("upload_svg_rejection_message_base64"),
369  $c->language()->txt("upload_svg_rejection_message_elements")
370  ));
371 
372  return $fileUploadImpl;
373  };
374  }
375 
379  protected static function buildHTTPPath(): bool
380  {
381  global $DIC;
382 
383  if ($DIC['https']->isDetected()) {
384  $protocol = 'https://';
385  } else {
386  $protocol = 'http://';
387  }
388  $host = $_SERVER['HTTP_HOST'];
389 
390  $rq_uri = strip_tags($_SERVER['REQUEST_URI']);
391 
392  // security fix: this failed, if the URI contained "?" and following "/"
393  // -> we remove everything after "?"
394  if (is_int($pos = strpos($rq_uri, "?"))) {
395  $rq_uri = substr($rq_uri, 0, $pos);
396  }
397 
398  if (!defined('ILIAS_MODULE')) {
399  $path = pathinfo($rq_uri);
400  if (isset($path['extension']) && $path['extension'] !== '') {
401  $uri = dirname($rq_uri);
402  } else {
403  $uri = $rq_uri;
404  }
405  } else {
406  // if in module remove module name from HTTP_PATH
407  $path = dirname($rq_uri);
408 
409  // dirname cuts the last directory from a directory path e.g content/classes return content
411 
412  $dirs = explode('/', $module);
413  $uri = $path;
414  foreach ($dirs as $dir) {
415  $uri = dirname($uri);
416  }
417  }
418 
419  $ilias_http_path = ilContext::modifyHttpPath(implode('', [$protocol, $host, $uri]));
420 
421  // remove everything after the first .php in the path
422  $ilias_http_path = preg_replace('/(http|https)(:\/\/)(.*?\/.*?\.php).*/', '$1$2$3', $ilias_http_path);
423 
424  $f = new \ILIAS\Data\Factory();
425  $uri = $f->uri(ilFileUtils::removeTrailingPathSeparators($ilias_http_path));
426 
427  $base_URI = $uri->getBaseURI();
428 
429  return define('ILIAS_HTTP_PATH', $base_URI);
430  }
431 
436  protected static function determineClient(): void
437  {
438  if (defined('CLIENT_ID')) {
439  return;
440  }
441  global $DIC;
442  $df = new \ILIAS\Data\Factory();
443 
444  // check whether ini file object exists
445  if (!$DIC->isDependencyAvailable('iliasIni')) {
446  self::abortAndDie('Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.');
447  }
448 
449  // determine the available clientIds (default, request, cookie)
450  $default_client_id = $DIC->iliasIni()->readVariable('clients', 'default');
451 
452  if ($DIC->http()->wrapper()->query()->has('client_id')) {
453  $client_id_from_get = $DIC->http()->wrapper()->query()->retrieve(
454  'client_id',
455  self::getClientIdTransformation()
456  );
457  }
458  if ($DIC->http()->wrapper()->cookie()->has('ilClientId')) {
459  $client_id_from_cookie = $DIC->http()->wrapper()->cookie()->retrieve(
460  'ilClientId',
461  self::getClientIdTransformation()
462  );
463  }
464 
465  // set the clientId by availability: 1. request, 2. cookie, fallback to defined default
466  $client_id_to_use = '';
467  if (isset($client_id_from_get) && $client_id_from_get !== '') {
468  $client_id_to_use = $client_id_from_get;
469  }
470 
471  if ($client_id_to_use === '' && isset($client_id_from_cookie)) {
472  $client_id_to_use = $client_id_from_cookie;
473  }
474 
475  $client_id_to_use = $client_id_to_use ?: $default_client_id;
476 
477  define('CLIENT_ID', $df->clientId($client_id_to_use)->toString());
478  }
479 
480 
487  private static function getClientIdTransformation(): Transformation
488  {
489  return new class () implements Transformation {
493  public function transform($from): string
494  {
495  if (!is_string($from)) {
496  throw new InvalidArgumentException(__METHOD__ . " the argument is not a string.");
497  }
498  return strip_tags($from);
499  }
500 
504  public function applyTo(Result $result): Result
505  {
506  return $result->then(function ($value): Result {
507  try {
508  return new Ok($this->transform($value));
509  } catch (Exception $exception) {
510  return new Error($exception);
511  }
512  });
513  }
514 
518  public function __invoke($from): string
519  {
520  return $this->transform($from);
521  }
522  };
523  }
524 
534  protected static function initClientIniFile(): void
535  {
536  global $ilIliasIniFile;
537 
538  // check whether ILIAS_WEB_DIR is set.
539  if (ILIAS_WEB_DIR == "") {
540  self::abortAndDie("Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
541  }
542 
543  // check whether CLIENT_ID is set.
544  if (CLIENT_ID == "") {
545  self::abortAndDie("Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
546  }
547 
548  $ini_file = "/client.ini.php";
549  if (defined('CLIENT_WEB_DIR')) {
550  $ini_file = CLIENT_WEB_DIR . $ini_file;
551  } else {
552  $ini_file = "./" . ILIAS_WEB_DIR . "/" . CLIENT_ID . "/client.ini.php";
553  }
554 
555  // get settings from ini file
556  $ilClientIniFile = new ilIniFile($ini_file);
557  $ilClientIniFile->read();
558 
559  // invalid client id / client ini
560  if ($ilClientIniFile->ERROR != "") {
561  $default_client = $ilIliasIniFile->readVariable("clients", "default");
562  if (CLIENT_ID !== "") {
563  $mess = array("en" => "Client does not exist.",
564  "de" => "Mandant ist ungültig."
565  );
566  self::redirect("index.php?client_id=" . $default_client, '', $mess);
567  } else {
568  self::abortAndDie("Fatal Error: ilInitialisation::initClientIniFile initializing client ini file abborted with: " . $ilClientIniFile->ERROR);
569  }
570  }
571 
572  self::initGlobal("ilClientIniFile", $ilClientIniFile);
573  // set constants
574  define("DEBUG", (int) $ilClientIniFile->readVariable("system", "DEBUG"));
575  define("DEVMODE", (int) $ilClientIniFile->readVariable("system", "DEVMODE"));
576  define("SHOWNOTICES", (int) $ilClientIniFile->readVariable("system", "SHOWNOTICES"));
577  if (!defined("ROOT_FOLDER_ID")) {
578  define("ROOT_FOLDER_ID", (int) $ilClientIniFile->readVariable('system', 'ROOT_FOLDER_ID'));
579  }
580  if (!defined("SYSTEM_FOLDER_ID")) {
581  define("SYSTEM_FOLDER_ID", (int) $ilClientIniFile->readVariable('system', 'SYSTEM_FOLDER_ID'));
582  }
583  if (!defined("ROLE_FOLDER_ID")) {
584  define("ROLE_FOLDER_ID", (int) $ilClientIniFile->readVariable('system', 'ROLE_FOLDER_ID'));
585  }
586  define("MAIL_SETTINGS_ID", (int) $ilClientIniFile->readVariable('system', 'MAIL_SETTINGS_ID'));
587  $error_handler = $ilClientIniFile->readVariable('system', 'ERROR_HANDLER');
588  define("ERROR_HANDLER", $error_handler ?: "PRETTY_PAGE");
589 
590  // this is for the online help installation, which sets OH_REF_ID to the
591  // ref id of the online module
592  define("OH_REF_ID", (int) $ilClientIniFile->readVariable("system", "OH_REF_ID"));
593 
594  // see ilObject::TITLE_LENGTH, ilObject::DESC_LENGTH
595  // define ("MAXLENGTH_OBJ_TITLE",125);#$ilClientIniFile->readVariable('system','MAXLENGTH_OBJ_TITLE'));
596  // define ("MAXLENGTH_OBJ_DESC",$ilClientIniFile->readVariable('system','MAXLENGTH_OBJ_DESC'));
597 
598  if (!defined("CLIENT_DATA_DIR")) {
599  define("CLIENT_DATA_DIR", ILIAS_DATA_DIR . "/" . CLIENT_ID);
600  }
601  if (!defined("CLIENT_WEB_DIR")) {
602  define("CLIENT_WEB_DIR", ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . "/" . CLIENT_ID);
603  }
604  define("CLIENT_NAME", $ilClientIniFile->readVariable('client', 'name')); // Change SS
605 
606  $db_type = $ilClientIniFile->readVariable("db", "type");
607  if ($db_type === "") {
608  define("IL_DB_TYPE", ilDBConstants::TYPE_INNODB);
609  } else {
610  define("IL_DB_TYPE", $db_type);
611  }
612 
613  $ilGlobalCacheSettings = new ilGlobalCacheSettings();
614  $ilGlobalCacheSettings->readFromIniFile($ilClientIniFile);
615  ilGlobalCache::setup($ilGlobalCacheSettings);
616  }
617 
621  protected static function handleMaintenanceMode(): void
622  {
623  global $ilClientIniFile;
624 
625  if (!$ilClientIniFile->readVariable("client", "access")) {
626  $mess = array(
627  "en" => "The server is not available due to maintenance." .
628  " We apologise for any inconvenience.",
629  "de" => "Der Server ist aufgrund von Wartungsarbeiten aktuell nicht verf&uuml;gbar." .
630  " Wir bitten um Verst&auml;ndnis. Versuchen Sie es sp&auml;ter noch einmal."
631  );
632  $mess_id = "init_error_maintenance";
633 
634  if (ilContext::hasHTML() && is_file("./maintenance.html")) {
635  self::redirect("./maintenance.html", $mess_id, $mess);
636  } else {
637  $mess = self::translateMessage($mess_id, $mess);
638  self::abortAndDie($mess);
639  }
640  }
641  }
642 
646  protected static function initDatabase(): void
647  {
648  // build dsn of database connection and connect
650  $ilDB->initFromIniFile();
651  $ilDB->connect();
652 
653  self::initGlobal("ilDB", $ilDB);
654  }
655 
660  public static function setSessionHandler(): void
661  {
662  $db_session_handler = new ilSessionDBHandler();
663  if (!$db_session_handler->setSaveHandler()) {
664  self::abortAndDie("Cannot start session handling.");
665  }
666 
667  // Do not accept external session ids
668  if (!ilSession::_exists(session_id()) && !defined('IL_PHPUNIT_TEST')) {
669  // php7-todo, correct-with-php5-removal : alex, 1.3.2016: added if, please check
670  if (function_exists("session_status") && session_status() == PHP_SESSION_ACTIVE) {
671  session_regenerate_id();
672  }
673  }
674  }
675 
679  protected static function setCookieConstants(): void
680  {
682  $cookie_path = '/';
683  } elseif (isset($GLOBALS['COOKIE_PATH'])) {
684  // use a predefined cookie path from WebAccessChecker
685  $cookie_path = $GLOBALS['COOKIE_PATH'];
686  } else {
687  $cookie_path = dirname($_SERVER['PHP_SELF']);
688  }
689 
690  /* if ilias is called directly within the docroot $cookie_path
691  is set to '/' expecting on servers running under windows..
692  here it is set to '\'.
693  in both cases a further '/' won't be appended due to the following regex
694  */
695  $cookie_path .= (!preg_match("/[\/|\\\\]$/", $cookie_path)) ? "/" : "";
696 
697  if ($cookie_path == "\\") {
698  $cookie_path = '/';
699  }
700 
701  define('IL_COOKIE_HTTPONLY', true); // Default Value
702  define('IL_COOKIE_EXPIRE', 0);
703  define('IL_COOKIE_DOMAIN', '');
704  if (!defined('IL_COOKIE_PATH')) {
705  // Might be already defined by ./sso/index.php or other scripts (like those in ./Services/SAML/lib/*)
706  define('IL_COOKIE_PATH', $cookie_path);
707  }
708  }
709 
710  private static function setClientIdCookie(): void
711  {
712  if (defined('CLIENT_ID') &&
713  !defined('IL_PHPUNIT_TEST') &&
715  ilUtil::setCookie('ilClientId', CLIENT_ID);
716  }
717  }
718 
722  protected static function setSessionCookieParams(): void
723  {
724  global $ilSetting, $DIC;
725 
726  if (!defined('IL_COOKIE_SECURE')) {
727  // If this code is executed, we can assume that \ilHTTPS::enableSecureCookies was NOT called before
728  // \ilHTTPS::enableSecureCookies already executes session_set_cookie_params()
729 
730  $cookie_secure = !$ilSetting->get('https', '0') && $DIC['https']->isDetected();
731  define('IL_COOKIE_SECURE', $cookie_secure); // Default Value
732 
733  $cookie_parameters = [
734  'lifetime' => IL_COOKIE_EXPIRE,
735  'path' => IL_COOKIE_PATH,
736  'domain' => IL_COOKIE_DOMAIN,
737  'secure' => IL_COOKIE_SECURE,
738  'httponly' => IL_COOKIE_HTTPONLY,
739  ];
740 
741  if (
742  $cookie_secure &&
743  (!isset(session_get_cookie_params()['samesite']) || strtolower(session_get_cookie_params()['samesite']) !== 'strict')
744  ) {
745  $cookie_parameters['samesite'] = 'Lax';
746  }
747 
748  session_set_cookie_params($cookie_parameters);
749  }
750  }
751 
752  protected static function initMail(\ILIAS\DI\Container $c): void
753  {
754  $c["mail.mime.transport.factory"] = static function (\ILIAS\DI\Container $c) {
755  return new \ilMailMimeTransportFactory($c->settings(), $c->event());
756  };
757  $c["mail.mime.sender.factory"] = static function (\ILIAS\DI\Container $c) {
758  return new \ilMailMimeSenderFactory($c->settings());
759  };
760  $c["mail.texttemplates.service"] = static function (\ILIAS\DI\Container $c) {
761  return new \ilMailTemplateService(new \ilMailTemplateRepository($c->database()));
762  };
763  }
764 
765  protected static function initCron(\ILIAS\DI\Container $c): void
766  {
767  $c['cron.repository'] = static function (\ILIAS\DI\Container $c): ilCronJobRepository {
768  return new ilCronJobRepositoryImpl(
769  $c->database(),
770  $c->settings(),
771  $c->logger()->cron(),
772  $c['component.repository'],
773  $c['component.factory']
774  );
775  };
776 
777  $c['cron.manager'] = static function (\ILIAS\DI\Container $c): ilCronManager {
778  return new ilCronManagerImpl(
779  $c['cron.repository'],
780  $c->database(),
781  $c->settings(),
782  $c->logger()->cron(),
783  (new \ILIAS\Data\Factory())->clock()
784  );
785  };
786  }
787 
791  protected static function initCustomObjectIcons(\ILIAS\DI\Container $c): void
792  {
793  $c["object.customicons.factory"] = function ($c) {
794  return new ilObjectCustomIconFactory(
795  $c->filesystem()->web(),
796  $c->upload(),
797  $c['ilObjDataCache']
798  );
799  };
800  }
801 
802  protected static function initAvatar(\ILIAS\DI\Container $c): void
803  {
804  $c["user.avatar.factory"] = function ($c) {
805  return new \ilUserAvatarFactory($c);
806  };
807  }
808 
809  protected static function initTermsOfService(\ILIAS\DI\Container $c): void
810  {
811  $c['tos.criteria.type.factory'] = function (
815  $c->rbac()->review(),
816  $c['ilObjDataCache'],
818  );
819  };
820 
821  $c['tos.service'] = function (\ILIAS\DI\Container $c): ilTermsOfServiceHelper {
822  $persistence = new ilTermsOfServiceDataGatewayFactory();
823  $persistence->setDatabaseAdapter($c->database());
824  return new ilTermsOfServiceHelper(
825  $persistence,
826  $c['tos.document.evaluator'],
827  $c['tos.criteria.type.factory'],
828  new ilObjTermsOfService()
829  );
830  };
831 
832  $c['tos.document.evaluator'] = function (\ILIAS\DI\Container $c): ilTermsOfServiceDocumentEvaluation {
835  $c['tos.criteria.type.factory'],
836  $c->user(),
837  $c->logger()->tos()
838  ),
839  $c->user(),
840  $c->logger()->tos(),
841  ilTermsOfServiceDocument::orderBy('sorting')->get()
842  );
843  };
844  }
845 
846  protected static function initAccessibilityControlConcept(\ILIAS\DI\Container $c): void
847  {
848  $c['acc.criteria.type.factory'] = function (\ILIAS\DI\Container $c) {
849  return new ilAccessibilityCriterionTypeFactory($c->rbac()->review(), $c['ilObjDataCache']);
850  };
851 
852  $c['acc.document.evaluator'] = function (\ILIAS\DI\Container $c) {
855  $c['acc.criteria.type.factory'],
856  $c->user(),
857  $c->logger()->acc()
858  ),
859  $c->user(),
860  $c->logger()->acc(),
861  \ilAccessibilityDocument::orderBy('sorting')->get()
862  );
863  };
864  }
865 
870  protected static function initSettings(): void
871  {
872  global $ilSetting;
873 
874  self::initGlobal(
875  "ilSetting",
876  "ilSetting",
877  "Services/Administration/classes/class.ilSetting.php"
878  );
879 
880  // check correct setup
881  if (!$ilSetting->get("setup_ok")) {
882  self::abortAndDie("Setup is not completed. Please run setup routine again.");
883  }
884 
885  // set anonymous user & role id and system role id
886  define("ANONYMOUS_USER_ID", (int) $ilSetting->get("anonymous_user_id"));
887  define("ANONYMOUS_ROLE_ID", (int) $ilSetting->get("anonymous_role_id"));
888  define("SYSTEM_USER_ID", (int) $ilSetting->get("system_user_id"));
889  define("SYSTEM_ROLE_ID", (int) $ilSetting->get("system_role_id"));
890  define("USER_FOLDER_ID", 7);
891 
892  // recovery folder
893  define("RECOVERY_FOLDER_ID", (int) $ilSetting->get("recovery_folder_id"));
894 
895  // installation id
896  define("IL_INST_ID", $ilSetting->get("inst_id", '0'));
897 
898  // define default suffix replacements
899  define("SUFFIX_REPL_DEFAULT", "php,php3,php4,inc,lang,phtml,htaccess");
900  define("SUFFIX_REPL_ADDITIONAL", $ilSetting->get("suffix_repl_additional", ""));
901 
902  if (ilContext::usesHTTP()) {
903  self::buildHTTPPath();
904  }
905  }
906 
910  protected static function initStyle(): void
911  {
912  global $DIC;
913  $component_factory = $DIC["component.factory"];
914 
915  // load style definitions
916  self::initGlobal(
917  "styleDefinition",
918  "ilStyleDefinition",
919  "./Services/Style/System/classes/class.ilStyleDefinition.php"
920  );
921 
922  // add user interface hook for style initialisation
923  foreach ($component_factory->getActivePluginsInSlot("uihk") as $ui_plugin) {
924  $gui_class = $ui_plugin->getUIClassInstance();
925  $gui_class->modifyGUI("Services/Init", "init_style", array("styleDefinition" => $DIC->systemStyle()));
926  }
927  }
928 
932  public static function initUserAccount(): void
933  {
934  global $DIC;
935 
936  static $context_init;
937 
938  $uid = $GLOBALS['DIC']['ilAuthSession']->getUserId();
939  if ($uid) {
940  $DIC->user()->setId($uid);
941  $DIC->user()->read();
942  if (!isset($context_init)) {
943  if ($DIC->user()->isAnonymous()) {
944  $DIC->globalScreen()->tool()->context()->claim()->external();
945  } else {
946  $DIC->globalScreen()->tool()->context()->claim()->internal();
947  }
948  $context_init = true;
949  }
950  // init console log handler
951  ilLoggerFactory::getInstance()->initUser($DIC->user()->getLogin());
952  \ilOnlineTracking::updateAccess($DIC->user());
953  } else {
954  if (is_object($GLOBALS['ilLog'])) {
955  $GLOBALS['ilLog']->logStack();
956  }
957  self::abortAndDie("Init user account failed");
958  }
959  }
960 
964  protected static function initLocale(): void
965  {
966  global $ilSetting;
967 
968  if (trim($ilSetting->get("locale", '')) != "") {
969  $larr = explode(",", trim($ilSetting->get("locale")));
970  $ls = array();
971  $first = $larr[0];
972  foreach ($larr as $l) {
973  if (trim($l) != "") {
974  $ls[] = $l;
975  }
976  }
977  if (count($ls) > 0) {
978  setlocale(LC_ALL, $ls);
979 
980  // #15347 - making sure that floats are not changed
981  setlocale(LC_NUMERIC, "C");
982  }
983  }
984  }
985 
989  public static function goToPublicSection(): void
990  {
991  global $DIC;
992 
993  if (ANONYMOUS_USER_ID == "") {
994  self::abortAndDie("Public Section enabled, but no Anonymous user found.");
995  }
996 
997  $session_destroyed = false;
998  if ($DIC['ilAuthSession']->isExpired()) {
999  $session_destroyed = true;
1001  }
1002  if (!$DIC['ilAuthSession']->isAuthenticated()) {
1003  $session_destroyed = true;
1005  }
1006 
1007  if ($session_destroyed) {
1008  $GLOBALS['DIC']['ilAuthSession']->setAuthenticated(true, ANONYMOUS_USER_ID);
1009  }
1010 
1011  self::initUserAccount();
1012 
1013  $target = '';
1014  if ($DIC->http()->wrapper()->query()->has('target')) {
1015  $target = $DIC->http()->wrapper()->query()->retrieve(
1016  'target',
1017  $DIC->refinery()->kindlyTo()->string()
1018  );
1019  }
1020 
1021  // if target given, try to go there
1022  if (strlen($target)) {
1023  // when we are already "inside" goto.php no redirect is needed
1024  $current_script = substr(strrchr($_SERVER["PHP_SELF"], "/"), 1);
1025  if ($current_script == "goto.php") {
1026  return;
1027  }
1028  // goto will check if target is accessible or redirect to login
1029  self::redirect("goto.php?target=" . $_GET["target"]);
1030  }
1031 
1032  // we do not know if ref_id of request is accesible, so redirecting to root
1033  self::redirect(
1034  "ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=&ref_id=" . (defined(
1035  'ROOT_FOLDER_ID'
1036  ) ? (string) ROOT_FOLDER_ID : '0')
1037  );
1038  }
1039 
1043  protected static function goToLogin(): void
1044  {
1045  global $DIC;
1046 
1047  $session_expired = false;
1048  ilLoggerFactory::getLogger('init')->debug('Redirecting to login page.');
1049 
1050  if ($DIC['ilAuthSession']->isExpired()) {
1052  $session_expired = true;
1053  }
1054  if (!$DIC['ilAuthSession']->isAuthenticated()) {
1056  }
1057 
1058  $target = $DIC->http()->wrapper()->query()->has('target')
1059  ? $DIC->http()->wrapper()->query()->retrieve(
1060  'target',
1061  $DIC->refinery()->kindlyTo()->string()
1062  )
1063  : '';
1064 
1065  if (strlen($target)) {
1066  $target = "target=" . $target . "&";
1067  }
1068 
1069  $client_id = $DIC->http()->wrapper()->cookie()->retrieve(
1070  'ilClientId',
1071  $DIC->refinery()->byTrying([
1072  $DIC->refinery()->kindlyTo()->string(),
1073  $DIC->refinery()->always('')
1074  ])
1075  );
1076  $script = "login.php?" . $target . "client_id=" . $client_id;
1077  $script .= $session_expired ? "&session_expired=1" : "";
1078 
1079  self::redirect(
1080  $script,
1081  "init_error_authentication_fail",
1082  array(
1083  "en" => "Authentication failed.",
1084  "de" => "Authentifizierung fehlgeschlagen."
1085  )
1086  );
1087  }
1088 
1092  protected static function initLanguage(bool $a_use_user_language = true): void
1093  {
1094  global $DIC;
1095 
1099  global $rbacsystem;
1100 
1101  if ($a_use_user_language) {
1102  if ($DIC->offsetExists('lng')) {
1103  $DIC->offsetUnset('lng');
1104  }
1105  self::initGlobal('lng', ilLanguage::getGlobalInstance());
1106  } else {
1107  self::initGlobal('lng', ilLanguage::getFallbackInstance());
1108  }
1109  if (is_object($rbacsystem) && $DIC->offsetExists('tree')) {
1110  $rbacsystem->initMemberView();
1111  }
1112  }
1113 
1117  protected static function initAccessHandling(): void
1118  {
1119  self::initGlobal(
1120  'rbacreview',
1121  'ilRbacReview',
1122  './Services/AccessControl/classes/class.ilRbacReview.php',
1123  true
1124  );
1125 
1126  $rbacsystem = ilRbacSystem::getInstance();
1127  self::initGlobal('rbacsystem', $rbacsystem, null, true);
1128 
1129  self::initGlobal(
1130  'rbacadmin',
1131  'ilRbacAdmin',
1132  './Services/AccessControl/classes/class.ilRbacAdmin.php',
1133  true
1134  );
1135 
1136  self::initGlobal(
1137  'ilAccess',
1138  'ilAccess',
1139  './Services/AccessControl/classes/class.ilAccess.php',
1140  true
1141  );
1142  }
1143 
1147  protected static function initLog(): void
1148  {
1150 
1151  self::initGlobal("ilLog", $log);
1152  // deprecated
1153  self::initGlobal("log", $log);
1154  }
1155 
1159  protected static function initGlobal(
1160  string $a_name,
1161  $a_class,
1162  ?string $a_source_file = null,
1163  ?bool $destroy_existing = false
1164  ): void {
1165  global $DIC;
1166 
1167  if ($destroy_existing) {
1168  if (isset($GLOBALS[$a_name])) {
1169  unset($GLOBALS[$a_name]);
1170  }
1171  if (isset($DIC[$a_name])) {
1172  unset($DIC[$a_name]);
1173  }
1174  }
1175 
1176  $GLOBALS[$a_name] = is_object($a_class) ? $a_class : new $a_class();
1177 
1178  $DIC[$a_name] = static function (Container $c) use ($a_name) {
1179  return $GLOBALS[$a_name];
1180  };
1181  }
1182 
1183  protected static function abortAndDie(string $a_message): void
1184  {
1185  if (isset($GLOBALS['ilLog'])) {
1186  $GLOBALS['ilLog']->write("Fatal Error: ilInitialisation - " . $a_message);
1187  $GLOBALS['ilLog']->logStack();
1188  }
1189  die($a_message);
1190  }
1191 
1195  protected static function handleDevMode(): void
1196  {
1197  if ((defined(SHOWNOTICES) && SHOWNOTICES) || version_compare(PHP_VERSION, '8.0', '>=')) {
1198  error_reporting(-1);
1199  }
1200  }
1201 
1202  protected static bool $already_initialized = false;
1203 
1204  public static function reinitILIAS(): void
1205  {
1206  self::$already_initialized = false;
1207  self::initILIAS();
1208  }
1209 
1210  public static function reInitUser(): void
1211  {
1213  self::initSession();
1214  self::initUser();
1215 
1217  self::resumeUserSession();
1218  }
1219  }
1220  }
1221 
1225  public static function initILIAS(): void
1226  {
1227  if (self::$already_initialized) {
1228  return;
1229  }
1230 
1231  $GLOBALS["DIC"] = new Container();
1232  $GLOBALS["DIC"]["ilLoggerFactory"] = function ($c) {
1234  };
1235 
1236  self::$already_initialized = true;
1237 
1238  self::initCore();
1239  self::initHTTPServices($GLOBALS["DIC"]);
1240  if (ilContext::initClient()) {
1241  self::initClient();
1242  self::initFileUploadService($GLOBALS["DIC"]);
1243  self::initSession();
1244 
1245  if (ilContext::hasUser()) {
1246  self::initUser();
1247 
1249  self::resumeUserSession();
1250  }
1251  }
1252 
1253  // init after Auth otherwise breaks CAS
1254  self::includePhp5Compliance();
1255 
1256  // language may depend on user setting
1257  self::initLanguage(true);
1258  $GLOBALS['DIC']['tree']->initLangCode();
1259 
1260  self::initInjector($GLOBALS['DIC']);
1261  self::initBackgroundTasks($GLOBALS['DIC']);
1262  self::initKioskMode($GLOBALS['DIC']);
1263 
1264  if (ilContext::hasHTML()) {
1265  self::initHTML();
1266  }
1267  }
1268 
1269  // this MUST happen after everything else is initialized,
1270  // because this leads to rather unexpected behaviour which
1271  // is super hard to track down to this.
1272  self::replaceSuperGlobals($GLOBALS['DIC']);
1273  }
1274 
1278  protected static function initSession(): void
1279  {
1280  if (isset($GLOBALS['DIC']['ilAuthSession'])) {
1281  unset($GLOBALS['DIC']['ilAuthSession']);
1282  }
1283 
1284  $GLOBALS['DIC']['ilAuthSession'] = static function (Container $c): ilAuthSession {
1285  $auth_session = ilAuthSession::getInstance(
1286  $c['ilLoggerFactory']->getLogger('auth')
1287  );
1288  $auth_session->init();
1289  return $auth_session;
1290  };
1291  }
1292 
1296  public static function handleErrorReporting(): void
1297  {
1298  // push the error level as high as possible / sane
1299  error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
1300 
1301  // see handleDevMode() - error reporting might be overwritten again
1302  // but we need the client ini first
1303  }
1304 
1308  protected static function initCore(): void
1309  {
1310  global $ilErr;
1311 
1312  self::handleErrorReporting();
1313 
1314  // breaks CAS: must be included after CAS context isset in AuthUtils
1315  //self::includePhp5Compliance();
1316 
1317  self::requireCommonIncludes();
1318 
1319  $GLOBALS["DIC"]["ilias.version"] = (new ILIAS\Data\Factory())->version(ILIAS_VERSION_NUMERIC);
1320 
1321  // error handler
1322  self::initGlobal(
1323  "ilErr",
1324  "ilErrorHandling",
1325  "./Services/Init/classes/class.ilErrorHandling.php"
1326  );
1329  [
1330  $ilErr, 'errorHandler'
1331  ]
1332  );
1333 
1334  self::removeUnsafeCharacters();
1335 
1336  self::initIliasIniFile();
1337 
1338  define('IL_INITIAL_WD', getcwd());
1339 
1340  // deprecated
1341  self::initGlobal("ilias", "ILIAS", "./Services/Init/classes/class.ilias.php");
1342  }
1343 
1347  protected static function initClient(): void
1348  {
1349  global $https, $ilias, $DIC;
1350 
1351  self::setCookieConstants();
1352 
1353  self::determineClient();
1354 
1355  self::bootstrapFilesystems();
1356 
1357  self::initResourceStorage();
1358 
1359  self::initClientIniFile();
1360 
1361  // --- needs client ini
1362 
1363  $ilias->client_id = (string) CLIENT_ID;
1364 
1365  if (DEVMODE) {
1366  self::handleDevMode();
1367  }
1368 
1369  self::handleMaintenanceMode();
1370 
1371  self::initDatabase();
1372 
1373  self::initComponentService($DIC);
1374 
1375  // init dafault language
1376  self::initLanguage(false);
1377 
1378  // moved after databases
1379  self::initLog();
1380 
1381  self::initGlobal(
1382  "ilAppEventHandler",
1383  "ilAppEventHandler",
1384  "./Services/EventHandling/classes/class.ilAppEventHandler.php"
1385  );
1386 
1387  // there are rare cases where initILIAS is called twice for a request
1388  // example goto.php is called and includes ilias.php later
1389  // we must prevent that ilPluginAdmin is initialized twice in
1390  // this case, since this won't get the values out of plugin.php the
1391  // second time properly
1392  if (!isset($DIC["ilPluginAdmin"]) || !$DIC["ilPluginAdmin"] instanceof ilPluginAdmin) {
1393  self::initGlobal(
1394  "ilPluginAdmin",
1395  new ilPluginAdmin($DIC["component.repository"]),
1396  "./Services/Component/classes/class.ilPluginAdmin.php"
1397  );
1398  }
1399  self::initGlobal("https", "ilHTTPS", "./Services/Http/classes/class.ilHTTPS.php");
1400  self::initSettings();
1401  self::setSessionHandler();
1402  self::initMail($GLOBALS['DIC']);
1403  self::initCron($GLOBALS['DIC']);
1404  self::initAvatar($GLOBALS['DIC']);
1405  self::initCustomObjectIcons($GLOBALS['DIC']);
1406  self::initTermsOfService($GLOBALS['DIC']);
1407  self::initAccessibilityControlConcept($GLOBALS['DIC']);
1408 
1409  // --- needs settings
1410 
1411  self::initLocale();
1412 
1413  if (ilContext::usesHTTP()) {
1414  $https->enableSecureCookies();
1415  $https->checkProtocolAndRedirectIfNeeded();
1416  }
1417 
1418  // --- object handling
1419 
1420  self::initGlobal(
1421  "ilObjDataCache",
1422  "ilObjectDataCache",
1423  "./Services/Object/classes/class.ilObjectDataCache.php"
1424  );
1425 
1426  self::initGlobal(
1427  "objDefinition",
1428  "ilObjectDefinition",
1429  "./Services/Object/classes/class.ilObjectDefinition.php"
1430  );
1431 
1432  // $tree
1433  $tree = new ilTree(ROOT_FOLDER_ID);
1434  self::initGlobal("tree", $tree);
1435  unset($tree);
1436 
1437  self::setSessionCookieParams();
1438  self::setClientIdCookie();
1439 
1440  self::initRefinery($DIC);
1441 
1442  (new InitCtrlService())->init($DIC);
1443 
1444  // Init GlobalScreen
1445  self::initGlobalScreen($DIC);
1446  }
1447 
1451  protected static function initUser(): void
1452  {
1453  global $ilias, $ilUser;
1454 
1455  // $ilUser
1456  self::initGlobal(
1457  "ilUser",
1458  "ilObjUser",
1459  "./Services/User/classes/class.ilObjUser.php",
1460  true
1461  );
1462  $ilias->account = $ilUser;
1463 
1464  self::initAccessHandling();
1465  }
1466 
1470  public static function resumeUserSession(): void
1471  {
1472  global $DIC;
1473 
1476  }
1477 
1478  if (
1479  !$DIC['ilAuthSession']->isAuthenticated() or
1480  $DIC['ilAuthSession']->isExpired()
1481  ) {
1482  if ($GLOBALS['DIC']['ilAuthSession']->isExpired()) {
1484  }
1485  ilLoggerFactory::getLogger('init')->debug('Current session is invalid: ' . $GLOBALS['DIC']['ilAuthSession']->getId());
1486  $current_script = substr(strrchr($_SERVER["PHP_SELF"], "/"), 1);
1487  if (self::blockedAuthentication($current_script)) {
1488  ilLoggerFactory::getLogger('init')->debug('Authentication is started in current script.');
1489  // nothing todo: authentication is done in current script
1490  return;
1491  }
1492 
1493  self::handleAuthenticationFail();
1494  return;
1495  }
1496  // valid session
1497 
1498  self::initUserAccount();
1499  }
1500 
1504  protected static function handleAuthenticationSuccess(): void
1505  {
1509  global $ilUser;
1510 
1512  }
1513 
1517  protected static function handleAuthenticationFail(): void
1518  {
1519  global $DIC;
1520 
1521  ilLoggerFactory::getLogger('init')->debug('Handling of failed authentication.');
1522 
1523  // #10608
1524  if (
1527  throw new Exception("Authentication failed.");
1528  }
1529 
1530  if (($DIC->http()->request()->getQueryParams()['cmdMode'] ?? 0) === 'asynch') {
1531  $DIC->language()->loadLanguageModule('init');
1532  $DIC->http()->saveResponse(
1533  $DIC->http()->response()
1534  ->withStatus(403)
1535  ->withBody(Streams::ofString($DIC->language()->txt('init_error_authentication_fail')))
1536  );
1537  $DIC->http()->sendResponse();
1538  $DIC->http()->close();
1539  }
1540  if (
1541  $DIC['ilAuthSession']->isExpired() &&
1542  !\ilObjUser::_isAnonymous($DIC['ilAuthSession']->getUserId())
1543  ) {
1544  ilLoggerFactory::getLogger('init')->debug('Expired session found -> redirect to login page');
1545  self::goToLogin();
1546  return;
1547  }
1548  if (ilPublicSectionSettings::getInstance()->isEnabledForDomain($_SERVER['SERVER_NAME'])) {
1549  ilLoggerFactory::getLogger('init')->debug('Redirect to public section.');
1550  self::goToPublicSection();
1551  return;
1552  }
1553  ilLoggerFactory::getLogger('init')->debug('Redirect to login page.');
1554  self::goToLogin();
1555  }
1556 
1560  protected static function initHTTPServices(\ILIAS\DI\Container $container): void
1561  {
1562  $init_http = new InitHttpServices();
1563  $init_http->init($container);
1564  }
1565 
1569  private static function initGlobalScreen(\ILIAS\DI\Container $c): void
1570  {
1571  $c['global_screen'] = function () use ($c) {
1572  return new Services(
1573  new ilGSProviderFactory($c),
1574  $c->ui(),
1575  htmlentities(str_replace([" ", ".", "-"], "_", ILIAS_VERSION_NUMERIC))
1576  );
1577  };
1578  $c->globalScreen()->tool()->context()->stack()->clear();
1579  $c->globalScreen()->tool()->context()->claim()->main();
1580  }
1581 
1585  public static function initUIFramework(\ILIAS\DI\Container $c): void
1586  {
1587  $init_ui = new InitUIFramework();
1588  $init_ui->init($c);
1589 
1590  $component_repository = $c["component.repository"];
1591  $component_factory = $c["component.factory"];
1592  foreach ($component_repository->getPlugins() as $pl) {
1593  if (!$pl->isActive()) {
1594  continue;
1595  }
1596  $plugin = $component_factory->getPlugin($pl->getId());
1597  $c['ui.renderer'] = $plugin->exchangeUIRendererAfterInitialization($c);
1598 
1599  foreach ($c->keys() as $key) {
1600  if (strpos($key, "ui.factory") === 0) {
1601  $c[$key] = $plugin->exchangeUIFactoryAfterInitialization($key, $c);
1602  }
1603  }
1604  }
1605  }
1606 
1610  protected static function initRefinery(\ILIAS\DI\Container $container): void
1611  {
1612  $container['refinery'] = function ($container) {
1613  $dataFactory = new \ILIAS\Data\Factory();
1614  $language = $container['lng'];
1615 
1616  return new \ILIAS\Refinery\Factory($dataFactory, $language);
1617  };
1618  }
1619 
1623  protected static function replaceSuperGlobals(\ILIAS\DI\Container $container): void
1624  {
1626  $client_ini = $container['ilClientIniFile'];
1627 
1628  $replace_super_globals = (
1629  !$client_ini->variableExists('server', 'prevent_super_global_replacement') ||
1630  !(bool) $client_ini->readVariable('server', 'prevent_super_global_replacement')
1631  );
1632 
1633  if ($replace_super_globals) {
1634  $throwOnValueAssignment = defined('DEVMODE') && DEVMODE;
1635 
1636  $_GET = new SuperGlobalDropInReplacement($container['refinery'], $_GET, $throwOnValueAssignment);
1637  $_POST = new SuperGlobalDropInReplacement($container['refinery'], $_POST, $throwOnValueAssignment);
1638  $_COOKIE = new SuperGlobalDropInReplacement($container['refinery'], $_COOKIE, $throwOnValueAssignment);
1639  $_REQUEST = new SuperGlobalDropInReplacement($container['refinery'], $_REQUEST, $throwOnValueAssignment);
1640  }
1641  }
1642 
1643  protected static function initComponentService(\ILIAS\DI\Container $container): void
1644  {
1645  $init = new InitComponentService();
1646  $init->init($container);
1647  }
1648 
1652  protected static function initHTML(): void
1653  {
1654  global $ilUser, $DIC;
1655 
1656  if (ilContext::hasUser()) {
1657  // load style definitions
1658  // use the init function with plugin hook here, too
1659  self::initStyle();
1660  }
1661 
1662  self::initUIFramework($GLOBALS["DIC"]);
1663  $tpl = new ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
1664  self::initGlobal("tpl", $tpl);
1665 
1666  if (ilContext::hasUser()) {
1667  $dispatcher = new \ILIAS\Init\StartupSequence\StartUpSequenceDispatcher($DIC);
1668  $dispatcher->dispatch();
1669  }
1670 
1671  self::initGlobal(
1672  "ilNavigationHistory",
1673  "ilNavigationHistory",
1674  "Services/Navigation/classes/class.ilNavigationHistory.php"
1675  );
1676 
1677  self::initGlobal(
1678  "ilHelp",
1679  "ilHelpGUI",
1680  "Services/Help/classes/class.ilHelpGUI.php"
1681  );
1682 
1683  self::initGlobal(
1684  "ilToolbar",
1685  "ilToolbarGUI",
1686  "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php"
1687  );
1688 
1689  self::initGlobal(
1690  "ilLocator",
1691  "ilLocatorGUI",
1692  "./Services/Locator/classes/class.ilLocatorGUI.php"
1693  );
1694 
1695  self::initGlobal(
1696  "ilTabs",
1697  "ilTabsGUI",
1698  "./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php"
1699  );
1700 
1701  if (ilContext::hasUser()) {
1702 
1703  // set hits per page for all lists using table module
1704  $_GET['limit'] = (int) $ilUser->getPref('hits_per_page');
1705  ilSession::set('tbl_limit', $_GET['limit']);
1706 
1707  // the next line makes it impossible to save the offset somehow in a session for
1708  // a specific table (I tried it for the user administration).
1709  // its not posssible to distinguish whether it has been set to page 1 (=offset = 0)
1710  // or not set at all (then we want the last offset, e.g. being used from a session var).
1711  // So I added the wrapping if statement. Seems to work (hopefully).
1712  // Alex April 14th 2006
1713  if (isset($_GET['offset']) && $_GET['offset'] != "") { // added April 14th 2006
1714  $_GET['offset'] = (int) $_GET['offset']; // old code
1715  }
1716 
1717  self::initGlobal("lti", "ilLTIViewGUI", "./Services/LTI/classes/class.ilLTIViewGUI.php");
1718  $GLOBALS["DIC"]["lti"]->init();
1719  self::initKioskMode($GLOBALS["DIC"]);
1720  }
1721  }
1722 
1723  protected static function getCurrentCmd(): string
1724  {
1725  $cmd = $_POST['cmd'] ?? ($_GET['cmd'] ?? '');
1726 
1727  if (is_array($cmd)) {
1728  $cmd_keys = array_keys($cmd);
1729  $cmd = array_shift($cmd_keys) ?? '';
1730  }
1731 
1732  return $cmd;
1733  }
1734 
1738  protected static function blockedAuthentication(string $a_current_script): bool
1739  {
1740  global $DIC;
1741 
1743  ilLoggerFactory::getLogger('init')->debug('Blocked authentication for WAC request.');
1744  return true;
1745  }
1747  ilLoggerFactory::getLogger('init')->debug('Blocked authentication for sso request.');
1748  return true;
1749  }
1751  ilLoggerFactory::getLogger('init')->debug('Blocked authentication for webdav request');
1752  return true;
1753  }
1755  ilLoggerFactory::getLogger('init')->debug('Blocked authentication for shibboleth request.');
1756  return true;
1757  }
1759  ilLoggerFactory::getLogger('init')->debug('Blocked authentication for lti provider requests.');
1760  return true;
1761  }
1763  ilLoggerFactory::getLogger('init')->debug('Blocked authentication for SAML request.');
1764  return true;
1765  }
1766  if (
1767  $a_current_script == "register.php" ||
1768  $a_current_script == "pwassist.php" ||
1769  $a_current_script == "confirmReg.php" ||
1770  $a_current_script == "il_securimage_play.php" ||
1771  $a_current_script == "il_securimage_show.php" ||
1772  $a_current_script == 'login.php'
1773  ) {
1774  ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for script: ' . $a_current_script);
1775  return true;
1776  }
1777 
1778  $requestBaseClass = strtolower((string) ($_GET['baseClass'] ?? ''));
1779  if ($requestBaseClass == strtolower(ilStartUpGUI::class)) {
1780  $requestCmdClass = strtolower((string) ($_GET['cmdClass'] ?? ''));
1781  if (
1782  $requestCmdClass == strtolower(ilAccountRegistrationGUI::class) ||
1783  $requestCmdClass == strtolower(ilPasswordAssistanceGUI::class)
1784  ) {
1785  ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for cmdClass: ' . $requestCmdClass);
1786  return true;
1787  }
1788  $cmd = self::getCurrentCmd();
1789  if (
1790  $cmd == "showTermsOfService" ||
1791  $cmd == 'showAccountMigration' || $cmd == 'migrateAccount' ||
1792  $cmd == 'processCode' || $cmd == 'showLoginPage' || $cmd == 'showLogout' ||
1793  $cmd == 'doStandardAuthentication' || $cmd == 'doCasAuthentication'
1794  ) {
1795  ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for cmd: ' . $cmd);
1796  return true;
1797  }
1798  }
1799 
1800  $target = '';
1801  if ($DIC->http()->wrapper()->query()->has('target')) {
1802  // @todo refinery undefind
1803  $target = $_GET['target'];
1804  }
1805 
1806  // #12884
1807  if (
1808  ($a_current_script == "goto.php" && $target == "impr_0") ||
1809  $requestBaseClass == strtolower(ilImprintGUI::class)
1810  ) {
1811  ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for baseClass: ' . ($_GET['baseClass'] ?? ""));
1812  return true;
1813  }
1814 
1815  if (
1816  (strtolower($requestCmdClass ?? "") === strtolower(ilAccessibilityControlConceptGUI::class))
1817  ) {
1818  ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for cmdClass: ' . $requestCmdClass);
1819  return true;
1820  }
1821 
1822  if ($a_current_script == 'goto.php' && in_array($target, array(
1823  'usr_registration',
1824  'usr_nameassist',
1825  'usr_pwassist',
1826  'usr_agreement'
1827  ))) {
1828  ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for goto target: ' . $target);
1829  return true;
1830  }
1831  ilLoggerFactory::getLogger('auth')->debug('Authentication required');
1832  return false;
1833  }
1834 
1838  protected static function translateMessage(string $a_message_id, array $a_message_static = null): string
1839  {
1840  global $ilDB, $lng, $ilSetting, $ilClientIniFile, $ilUser;
1841 
1842  // current language
1843  if (!$lng) {
1844  $lang = "en";
1845  if ($ilUser) {
1846  $lang = $ilUser->getLanguage();
1847  } elseif (isset($_REQUEST["lang"])) {
1848  $lang = (string) $_REQUEST["lang"];
1849  } elseif ($ilSetting) {
1850  $lang = $ilSetting->get("language", '');
1851  } elseif ($ilClientIniFile) {
1852  $lang = $ilClientIniFile->readVariable("language", "default");
1853  }
1854  } else {
1855  $lang = $lng->getLangKey();
1856  }
1857 
1858  $message = "";
1859  if ($ilDB && $a_message_id) {
1860  if (!$lng) {
1861  $lng = new ilLanguage($lang);
1862  }
1863 
1864  $lng->loadLanguageModule("init");
1865  $message = $lng->txt($a_message_id);
1866  } elseif (is_array($a_message_static)) {
1867  if (!isset($a_message_static[$lang])) {
1868  $lang = "en";
1869  }
1870  $message = $a_message_static[$lang];
1871  }
1872  return $message;
1873  }
1874 
1878  protected static function redirect(
1879  string $a_target,
1880  string $a_message_id = '',
1881  array $a_message_static = null
1882  ): void {
1883  // #12739
1884  if (defined("ILIAS_HTTP_PATH") &&
1885  !stristr($a_target, ILIAS_HTTP_PATH)) {
1886  $a_target = ILIAS_HTTP_PATH . "/" . $a_target;
1887  }
1888 
1889  foreach (['ext_uid', 'soap_pw'] as $param) {
1890  if (false === strpos(
1891  $a_target,
1892  $param . '='
1893  ) && isset($GLOBALS['DIC']->http()->request()->getQueryParams()[$param])) {
1894  $a_target = \ilUtil::appendUrlParameterString($a_target, $param . '=' . \ilUtil::stripSlashes(
1895  $GLOBALS['DIC']->http()->request()->getQueryParams()[$param]
1896  ));
1897  }
1898  }
1899 
1901  ilUtil::redirect($a_target);
1902  } else {
1903  $message = self::translateMessage($a_message_id, $a_message_static);
1904 
1905  // user-directed linked message
1907  $link = self::translateMessage(
1908  "init_error_redirect_click",
1909  array("en" => 'Please click to continue.',
1910  "de" => 'Bitte klicken um fortzufahren.'
1911  )
1912  );
1913  $mess = $message .
1914  '<br /><a href="' . $a_target . '">' . $link . '</a>';
1915  } // plain text
1916  else {
1917  // not much we can do here
1918  $mess = $message;
1919 
1920  if (!trim($mess)) {
1921  $mess = self::translateMessage(
1922  "init_error_redirect_info",
1923  array("en" => 'Redirect not supported by context.',
1924  "de" => 'Weiterleitungen werden durch Kontext nicht unterstützt.'
1925  )
1926  ) .
1927  ' (' . $a_target . ')';
1928  }
1929  }
1930 
1931  self::abortAndDie($mess);
1932  }
1933  }
1934 
1935  public static function redirectToStartingPage(string $target = ''): void
1936  {
1937  global $DIC;
1938 
1939  // fallback, should never happen
1940  if ($DIC->user()->getId() === ANONYMOUS_USER_ID) {
1941  self::goToPublicSection();
1942  return;
1943  }
1944 
1945  if (
1946  $target === '' &&
1947  $DIC->http()->wrapper()->query()->has('target')
1948  ) {
1949  $target = $DIC->http()->wrapper()->query()->retrieve(
1950  'target',
1951  $DIC->refinery()->kindlyTo()->string()
1952  );
1953  }
1954 
1955  // for password change and incomplete profile
1956  // see ilDashboardGUI
1957  if ($target === '') {
1958  ilLoggerFactory::getLogger('init')->debug('Redirect to default starting page');
1959  $DIC->ctrl()->redirectToURL(ilUserUtil::getStartingPointAsUrl());
1960  } else {
1961  ilLoggerFactory::getLogger('init')->debug('Redirect to target: ' . $target);
1962  $DIC->ctrl()->redirectToURL("goto.php?target=" . $target);
1963  }
1964  }
1965 
1966  private static function initBackgroundTasks(\ILIAS\DI\Container $c): void
1967  {
1968  global $ilIliasIniFile;
1969 
1970  $n_of_tasks = $ilIliasIniFile->readVariable("background_tasks", "number_of_concurrent_tasks");
1971  $sync = $ilIliasIniFile->readVariable("background_tasks", "concurrency");
1972 
1973  $n_of_tasks = $n_of_tasks ?: 5;
1974  $sync = $sync ?: 'sync'; // The default value is sync.
1975 
1976  $c["bt.task_factory"] = function ($c) {
1977  return new \ILIAS\BackgroundTasks\Implementation\Tasks\BasicTaskFactory($c["di.injector"]);
1978  };
1979 
1980  $c["bt.persistence"] = function ($c) {
1981  return \ILIAS\BackgroundTasks\Implementation\Persistence\BasicPersistence::instance($c->database());
1982  };
1983 
1984  $c["bt.injector"] = function ($c) {
1985  return new \ILIAS\BackgroundTasks\Dependencies\Injector($c, new BaseDependencyMap());
1986  };
1987 
1988  $c["bt.task_manager"] = function ($c) use ($sync) {
1989  if ($sync == 'sync') {
1990  return new \ILIAS\BackgroundTasks\Implementation\TaskManager\SyncTaskManager($c["bt.persistence"]);
1991  } elseif ($sync == 'async') {
1992  return new \ILIAS\BackgroundTasks\Implementation\TaskManager\AsyncTaskManager($c["bt.persistence"]);
1993  } else {
1994  throw new ilException("The supported Background Task Managers are sync and async. $sync given.");
1995  }
1996  };
1997  }
1998 
1999  private static function initInjector(\ILIAS\DI\Container $c): void
2000  {
2001  $c["di.dependency_map"] = function ($c) {
2002  return new \ILIAS\BackgroundTasks\Dependencies\DependencyMap\BaseDependencyMap();
2003  };
2004 
2005  $c["di.injector"] = function ($c) {
2006  return new \ILIAS\BackgroundTasks\Dependencies\Injector($c, $c["di.dependency_map"]);
2007  };
2008  }
2009 
2010  private static function initKioskMode(\ILIAS\DI\Container $c): void
2011  {
2012  $c["service.kiosk_mode"] = function ($c) {
2013  return new ilKioskModeService(
2014  $c['ilCtrl'],
2015  $c['lng'],
2016  $c['ilAccess'],
2017  $c['objDefinition']
2018  );
2019  };
2020  }
2021 }
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.
$ilIliasIniFile
Definition: imgupload.php:32
$cookie_path
Definition: metadata.php:39
static handleMaintenanceMode()
handle maintenance mode
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static hasUser()
Based on user authentication?
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
static orderBy($orderBy, string $orderDirection='ASC')
const CONTEXT_WAC
const PEAR_ERROR_CALLBACK
Definition: PEAR.php:35
const CONTEXT_HTTP
HTTP Auth used for WebDAV and CalDAV If a special handling for WebDAV or CalDAV is required overwrite...
$c
Definition: cli.php:38
Class InitCtrlService wraps the initialization of ilCtrl.
static initRefinery(\ILIAS\DI\Container $container)
const ANONYMOUS_USER_ID
Definition: constants.php:27
static getLogger(string $a_component_id)
Get component logger.
const ILIAS_VERSION_NUMERIC
static includePhp5Compliance()
This is a hack for authentication.
static usesHTTP()
Uses HTTP aka browser.
static initFileUploadService(\ILIAS\DI\Container $dic)
Initializes the file upload service.
const ROOT_FOLDER_ID
Definition: constants.php:32
static initHTML()
init HTML output (level 3)
$lng
const CONTEXT_WEBDAV
static _exists(string $a_session_id)
Check whether session exists.
Class ChatMainBarProvider .
static initKioskMode(\ILIAS\DI\Container $c)
Class ilGlobalCacheSettings.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
Database Session Handling.
static setup(ilGlobalCacheSettings $ilGlobalCacheSettings)
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)
static setErrorHandling($mode=null, $options=null)
Sets how errors generated by this object should be handled.
Definition: PEAR.php:337
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.
Definition: Result.php:14
const SESSION_CLOSE_LOGIN
Interface ilTermsOfServiceSequentialDocumentEvaluation.
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 isAuthenticationForced()
Check if authentication is should be forced.
const CONTEXT_LTI_PROVIDER
static initDefaultTimeZone(ilIniFile $ini)
Initialize default timezone from system settings.
const CONTEXT_SHIBBOLETH
static goToPublicSection()
go to public section
static blockedAuthentication(string $a_current_script)
Block authentication based on current request.
static modifyHttpPath(string $httpPath)
Interface ilTermsOfServiceDocumentEvaluation.
static resumeUserSession()
Resume an existing user session.
static setSessionHandler()
set session handler to db Used in Soap/CAS
static initSession()
Init auth session.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
static getGlobalInstance()
Builds the global language object.
$ilErr
Definition: raiseError.php:17
$path
Definition: ltiservices.php:32
static removeTrailingPathSeparators(string $path)
$container
Definition: wac.php:14
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
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()
Class ilTermsOfServiceDataGatewayFactory.
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 initMail(\ILIAS\DI\Container $c)
static initCustomObjectIcons(\ILIAS\DI\Container $c)
const CONTEXT_SAML
static initUIFramework(\ILIAS\DI\Container $c)
init the ILIAS UI framework.
$_GET['client_id']
Definition: saml1-acs.php:21
$log
Definition: result.php:33
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.
Class HTTPServicesTest.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$param
Definition: xapitoken.php:46
const CLIENT_ID
Definition: constants.php:41
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Ok.php:16
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
string $key
Consumer key/client ID value.
Definition: System.php:193
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
const CLIENT_WEB_DIR
Definition: constants.php:47
static initLog()
Init log instance.
static initStyle()
provide $styleDefinition object
static getFallbackInstance()
Builds a global default language instance.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!isset($GLOBALS['ilGlobalStartTime'])||! $GLOBALS['ilGlobalStartTime']) global $DIC
static initClient()
Init client-based objects (level 1)
const ILIAS_DATA_DIR
Definition: constants.php:44
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.
$lang
Definition: xapiexit.php:26
Class ilTermsOfServiceHelper.
$https
Definition: imgupload.php:35
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.
global $ilSetting
Definition: privfeed.php:17
static setClosingContext(int $a_context)
set closing context (for statistics)
static initClient()
Init client.
Class ilMailTemplateRepository.
$ilUser
Definition: imgupload.php:34
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A transformation is a function from one datatype to another.
static initInjector(\ILIAS\DI\Container $c)
const IL_COOKIE_PATH(isset($_GET["client_id"]))
Definition: metadata.php:64
static getClientIdTransformation()
Refinery is not initialized early enough to provide a transformation to be used with the implementat...
static initComponentService(\ILIAS\DI\Container $container)
$dic
Definition: result.php:32
$client_id
Definition: ltiauth.php:68
Class ilObjTermsOfService.
const ILIAS_MODULE
Definition: server.php:14
$message
Definition: xapiexit.php:32
static goToLogin()
go to login
static initAccessibilityControlConcept(\ILIAS\DI\Container $c)
static getCountryCodes()
Get country codes (DIN EN 3166-1)
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.
$_COOKIE[session_name()]
Definition: xapitoken.php:54
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
static recursivelyRemoveUnsafeCharacters($var)
const CONTEXT_SOAP
static handleErrorReporting()
Set error reporting level.
static initSettings()
initialise $ilSettings object and define constants Used in Soap
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 initTermsOfService(\ILIAS\DI\Container $c)
const CONTEXT_APACHE_SSO
static initUser()
Init user / authentification (level 2)
static buildHTTPPath()
builds http path
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getRootLogger()
The unique root logger has a fixed error level.
const ILIAS_WEB_DIR
Definition: constants.php:45
static supportsRedirects()
Are redirects supported?
static handleDevMode()
Prepare developer tools.