ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilInitialisation Class Reference

ILIAS Initialisation Utility Class perform basic setup: init database handler, load configuration file, init user authentification & error handler, load object type definitions. More...

+ Collaboration diagram for ilInitialisation:

Static Public Member Functions

static setSessionHandler ()
 set session handler to db More...
 
static goToPublicSection ()
 go to public section More...
 
static reinitILIAS ()
 
static initILIAS ()
 ilias initialisation More...
 
static handleErrorReporting ()
 Set error reporting level. More...
 
static resumeUserSession ()
 Resume an existing user session. More...
 
static authenticate ()
 Try authentication. More...
 

Static Protected Member Functions

static removeUnsafeCharacters ()
 Remove unsafe characters from GET. More...
 
static recursivelyRemoveUnsafeCharacters ($var)
 
static requireCommonIncludes ()
 get common include code files More...
 
static includePhp5Compliance ()
 This is a hack for authentication. More...
 
static initIliasIniFile ()
 This method provides a global instance of class ilIniFile for the ilias.ini.php file in variable $ilIliasIniFile. More...
 
static buildHTTPPath ()
 builds http path More...
 
static determineClient ()
 This method determines the current client and sets the constant CLIENT_ID. More...
 
static initClientIniFile ()
 This method provides a global instance of class ilIniFile for the client.ini.php file in variable $ilClientIniFile. More...
 
static handleMaintenanceMode ()
 handle maintenance mode More...
 
static initDatabase ()
 initialise database object $ilDB More...
 
static setCookieConstants ()
 
static setSessionCookieParams ()
 set session cookie params More...
 
static initSettings ()
 initialise $ilSettings object and define constants More...
 
static initStyle ()
 provide $styleDefinition object More...
 
static initLocale ()
 Init Locale. More...
 
static goToLogin ()
 go to login More...
 
static initAccessHandling ()
 $ilAccess and $rbac... More...
 
static initLog ()
 Init log instance. More...
 
static initGlobal ($a_name, $a_class, $a_source_file=null)
 Initialize global instance. More...
 
static abortAndDie ($a_message)
 Exit. More...
 
static handleDevMode ()
 Prepare developer tools. More...
 
static initSession ()
 Init session. More...
 
static initCore ()
 Init core objects (level 0) More...
 
static initClient ()
 Init client-based objects (level 1) More...
 
static initUser ()
 Init user / authentification (level 2) More...
 
static initUIFramework (\ILIAS\DI\Container $c)
 init the ILIAS UI framework. More...
 
static initHTML ()
 init HTML output (level 3) More...
 
static getCurrentCmd ()
 Extract current cmd from request. More...
 
static blockedAuthentication ($a_current_script)
 Block authentication based on current request. More...
 
static showingLoginForm ($a_current_script)
 Is current view the login form? More...
 
static translateMessage ($a_message_id, array $a_message_static=null)
 Translate message if possible. More...
 
static redirect ($a_target, $a_message_id='', array $a_message_static=null)
 Redirects to target url if context supports it. More...
 

Static Protected Attributes

static $already_initialized
 

Detailed Description

ILIAS Initialisation Utility Class perform basic setup: init database handler, load configuration file, init user authentification & error handler, load object type definitions.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Sascha Hofmann shofm.nosp@m.ann@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$

Definition at line 29 of file class.ilInitialisation.php.

Member Function Documentation

◆ abortAndDie()

static ilInitialisation::abortAndDie (   $a_message)
staticprotected

Exit.

Parameters
string$a_message

Definition at line 799 of file class.ilInitialisation.php.

References $GLOBALS.

800  {
801  if(is_object($GLOBALS['ilLog']))
802  {
803  $GLOBALS['ilLog']->write("Fatal Error: ilInitialisation - ".$a_message);
804  }
805  die($a_message);
806  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

◆ authenticate()

static ilInitialisation::authenticate ( )
static

Try authentication.

This will basically validate the current session

Definition at line 1108 of file class.ilInitialisation.php.

References $_SERVER, $GLOBALS, $ilErr, $ilSetting, $ilUser, ilContext\CONTEXT_SOAP, ilContext\CONTEXT_WAC, ilLoggerFactory\getLogger(), and ilContext\getType().

1109  {
1110  global $ilAuth, $ilias, $ilErr;
1111 
1112  $current_script = substr(strrchr($_SERVER["PHP_SELF"], "/"), 1);
1113 
1114  if(self::blockedAuthentication($current_script))
1115  {
1116  return;
1117  }
1118 
1119  $oldSid = session_id();
1120 
1121  $ilAuth->start();
1122  $ilias->setAuthError($ilErr->getLastError());
1123 
1124  if($ilAuth->getAuth() && $ilAuth->getStatus() == '')
1125  {
1126  self::initUserAccount();
1127 
1128  self::handleAuthenticationSuccess();
1129  }
1130  else
1131  {
1132  if (!self::showingLoginForm($current_script))
1133  {
1134  // :TODO: should be moved to context?!
1135  $mandatory_auth = ($current_script != "shib_login.php"
1136  && $current_script != "shib_logout.php"
1137  && $current_script != "error.php"
1138  && $current_script != "chat.php"
1139  && $current_script != "wac.php"
1140  && $current_script != "index.php"); // #10316
1141 
1142  if($mandatory_auth)
1143  {
1144  self::handleAuthenticationFail();
1145  }
1146  }
1147  }
1148  }
global $ilErr
Definition: raiseError.php:16
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
+ Here is the call graph for this function:

◆ blockedAuthentication()

static ilInitialisation::blockedAuthentication (   $a_current_script)
staticprotected

Block authentication based on current request.

Returns
boolean

Definition at line 1334 of file class.ilInitialisation.php.

References $_GET, $cmd, ilContext\CONTEXT_APACHE_SSO, ilContext\CONTEXT_SHIBBOLETH, ilContext\CONTEXT_WAC, ilContext\CONTEXT_WEBDAV, ilLoggerFactory\getLogger(), and ilContext\getType().

1335  {
1337  {
1338  ilLoggerFactory::getLogger('init')->debug('Blocked authentication for WAC request.');
1339  return true;
1340  }
1342  {
1343  ilLoggerFactory::getLogger('init')->debug('Blocked authentication for sso request.');
1344  return true;
1345  }
1347  {
1348  ilLoggerFactory::getLogger('init')->debug('Blocked authentication for webdav request');
1349  return true;
1350  }
1352  {
1353  ilLoggerFactory::getLogger('init')->debug('Blocked authentication for shibboleth request.');
1354  return true;
1355  }
1356 
1357  if(
1358  $a_current_script == "register.php" ||
1359  $a_current_script == "pwassist.php" ||
1360  $a_current_script == "confirmReg.php" ||
1361  $a_current_script == "il_securimage_play.php" ||
1362  $a_current_script == "il_securimage_show.php" ||
1363  $a_current_script == 'login.php'
1364  )
1365  {
1366  ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for script: ' . $a_current_script);
1367  return true;
1368  }
1369 
1370  if($_REQUEST["baseClass"] == "ilStartUpGUI")
1371  {
1372  $cmd_class = $_REQUEST["cmdClass"];
1373 
1374  if($cmd_class == "ilaccountregistrationgui" ||
1375  $cmd_class == "ilpasswordassistancegui")
1376  {
1377  ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for cmdClass: ' . $cmd_class);
1378  return true;
1379  }
1380 
1381  $cmd = self::getCurrentCmd();
1382  if(
1383  $cmd == "showTermsOfService" || $cmd == "showClientList" ||
1384  $cmd == 'showAccountMigration' || $cmd == 'migrateAccount' ||
1385  $cmd == 'processCode' || $cmd == 'showLoginPage' || $cmd == 'doStandardAuthentication' || $cmd == 'doCasAuthentication'
1386  )
1387  {
1388  ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for cmd: ' . $cmd);
1389  return true;
1390  }
1391  }
1392 
1393  // #12884
1394  if(($a_current_script == "goto.php" && $_GET["target"] == "impr_0") ||
1395  $_GET["baseClass"] == "ilImprintGUI")
1396  {
1397  ilLoggerFactory::getLogger('auth')->debug('Blocked authentication for baseClass: ' . $_GET['baseClass']);
1398  return true;
1399  }
1400  ilLoggerFactory::getLogger('auth')->debug('Authentication required');
1401  return false;
1402  }
const CONTEXT_WAC
$_GET["client_id"]
const CONTEXT_WEBDAV
$cmd
Definition: sahs_server.php:35
const CONTEXT_SHIBBOLETH
static getLogger($a_component_id)
Get component logger.
static getType()
Get context type.
const CONTEXT_APACHE_SSO
+ Here is the call graph for this function:

◆ buildHTTPPath()

static ilInitialisation::buildHTTPPath ( )
staticprotected

builds http path

Definition at line 169 of file class.ilInitialisation.php.

References $_SERVER, $https, $path, ilContext\CONTEXT_APACHE_SSO, defined, ilContext\getType(), ILIAS_MODULE, and ilUtil\removeTrailingPathSeparators().

170  {
171  include_once './Services/Http/classes/class.ilHTTPS.php';
172  $https = new ilHTTPS();
173 
174  if($https->isDetected())
175  {
176  $protocol = 'https://';
177  }
178  else
179  {
180  $protocol = 'http://';
181  }
182  $host = $_SERVER['HTTP_HOST'];
183 
184  $rq_uri = strip_tags($_SERVER['REQUEST_URI']);
185 
186  // security fix: this failed, if the URI contained "?" and following "/"
187  // -> we remove everything after "?"
188  if (is_int($pos = strpos($rq_uri, "?")))
189  {
190  $rq_uri = substr($rq_uri, 0, $pos);
191  }
192 
193  if(!defined('ILIAS_MODULE'))
194  {
195  $path = pathinfo($rq_uri);
196  if(!$path['extension'])
197  {
198  $uri = $rq_uri;
199  }
200  else
201  {
202  $uri = dirname($rq_uri);
203  }
204  }
205  else
206  {
207  // if in module remove module name from HTTP_PATH
208  $path = dirname($rq_uri);
209 
210  // dirname cuts the last directory from a directory path e.g content/classes return content
211 
213 
214  $dirs = explode('/',$module);
215  $uri = $path;
216  foreach($dirs as $dir)
217  {
218  $uri = dirname($uri);
219  }
220  }
222  {
223  return define('ILIAS_HTTP_PATH',ilUtil::removeTrailingPathSeparators(dirname($protocol.$host.$uri)));
224 
225  }
226  return define('ILIAS_HTTP_PATH',ilUtil::removeTrailingPathSeparators($protocol.$host.$uri));
227  }
$path
Definition: aliased.php:25
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
HTTPS.
$https
Definition: imgupload.php:19
static removeTrailingPathSeparators($path)
const ILIAS_MODULE
Definition: server.php:14
static getType()
Get context type.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
const CONTEXT_APACHE_SSO
+ Here is the call graph for this function:

◆ determineClient()

static ilInitialisation::determineClient ( )
staticprotected

This method determines the current client and sets the constant CLIENT_ID.

Definition at line 233 of file class.ilInitialisation.php.

References $_COOKIE, $_GET, $client_id, $ilIliasIniFile, defined, ilUtil\setCookie(), ilUtil\stripSlashes(), and ilContext\supportsPersistentSessions().

234  {
235  global $ilIliasIniFile;
236 
237  // check whether ini file object exists
238  if (!is_object($ilIliasIniFile))
239  {
240  self::abortAndDie("Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.");
241  }
242 
243  // set to default client if empty
244  if ($_GET["client_id"] != "")
245  {
246  $_GET["client_id"] = ilUtil::stripSlashes($_GET["client_id"]);
247  if (!defined("IL_PHPUNIT_TEST"))
248  {
250  {
251  ilUtil::setCookie("ilClientId", $_GET["client_id"]);
252  }
253  }
254  }
255  else if (!$_COOKIE["ilClientId"])
256  {
257  // to do: ilias ini raus nehmen
258  $client_id = $ilIliasIniFile->readVariable("clients","default");
259  ilUtil::setCookie("ilClientId", $client_id);
260  }
261  if (!defined("IL_PHPUNIT_TEST") && ilContext::supportsPersistentSessions())
262  {
263 
264  define ("CLIENT_ID", $_COOKIE["ilClientId"]);
265  }
266  else
267  {
268  define ("CLIENT_ID", $_GET["client_id"]);
269  }
270  }
$_GET["client_id"]
static setCookie($a_cookie_name, $a_cookie_value='', $a_also_set_super_global=true, $a_set_cookie_invalid=false)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static supportsPersistentSessions()
Check if context supports persistent session handling.
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
$ilIliasIniFile
$client_id
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
+ Here is the call graph for this function:

◆ getCurrentCmd()

static ilInitialisation::getCurrentCmd ( )
staticprotected

Extract current cmd from request.

Returns
string

Definition at line 1316 of file class.ilInitialisation.php.

References $cmd.

1317  {
1318  $cmd = $_REQUEST["cmd"];
1319  if(is_array($cmd))
1320  {
1321  return array_shift(array_keys($cmd));
1322  }
1323  else
1324  {
1325  return $cmd;
1326  }
1327  }
$cmd
Definition: sahs_server.php:35

◆ goToLogin()

static ilInitialisation::goToLogin ( )
staticprotected

go to login

Parameters
int$a_auth_stat

Definition at line 691 of file class.ilInitialisation.php.

References $_COOKIE, $GLOBALS, array, ilLoggerFactory\getLogger(), ilSession\SESSION_CLOSE_EXPIRE, ilSession\SESSION_CLOSE_LOGIN, and ilSession\setClosingContext().

692  {
693  ilLoggerFactory::getLogger('init')->debug('Redirecting to login page.');
694 
695  if($GLOBALS['DIC']['ilAuthSession']->isExpired())
696  {
698  }
699  if(!$GLOBALS['DIC']['ilAuthSession']->isAuthenticated())
700  {
702  }
703 
704  $script = "login.php?target=".$_GET["target"]."&client_id=".$_COOKIE["ilClientId"].
705  "&auth_stat=".$a_auth_stat;
706 
707  self::redirect(
708  $script,
709  "init_error_authentication_fail",
710  array(
711  "en" => "Authentication failed.",
712  "de" => "Authentifizierung fehlgeschlagen.")
713  );
714  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
const SESSION_CLOSE_LOGIN
const SESSION_CLOSE_EXPIRE
Create styles array
The data for the language used.
static setClosingContext($a_context)
set closing context (for statistics)
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

◆ goToPublicSection()

static ilInitialisation::goToPublicSection ( )
static

go to public section

Parameters
int$a_auth_stat

Definition at line 631 of file class.ilInitialisation.php.

References $_GET, $_SERVER, $GLOBALS, ilSession\SESSION_CLOSE_EXPIRE, ilSession\SESSION_CLOSE_PUBLIC, and ilSession\setClosingContext().

Referenced by ilAuthUtils\handleForcedAuthentication(), ilStartUpGUI\processIndexPHP(), and redirect().

632  {
633  global $ilAuth;
634 
635  if (ANONYMOUS_USER_ID == "")
636  {
637  self::abortAndDie("Public Section enabled, but no Anonymous user found.");
638  }
639 
640  $session_destroyed = false;
641  if($GLOBALS['DIC']['ilAuthSession']->isExpired())
642  {
643  $session_destroyed = true;
645  }
646  if(!$GLOBALS['DIC']['ilAuthSession']->isAuthenticated())
647  {
648  $session_destroyed = true;
650  }
651 
652  if($session_destroyed)
653  {
654  $GLOBALS['DIC']['ilAuthSession']->setAuthenticated(true, ANONYMOUS_USER_ID);
655  }
656 
657  self::initUserAccount();
658 
659  // if target given, try to go there
660  if(strlen($_GET["target"]))
661  {
662  // when we are already "inside" goto.php no redirect is needed
663  $current_script = substr(strrchr($_SERVER["PHP_SELF"], "/"), 1);
664  if($current_script == "goto.php")
665  {
666  return;
667  }
668  // goto will check if target is accessible or redirect to login
669  self::redirect("goto.php?target=".$_GET["target"]);
670  }
671 
672  // check access of root folder otherwise redirect to login
673  #if(!$GLOBALS['DIC']->rbac()->system()->checkAccess('read', ROOT_FOLDER_ID))
674  #{
675  # return self::goToLogin();
676  #}
677 
678  // we do not know if ref_id of request is accesible, so redirecting to root
679  $_GET["ref_id"] = ROOT_FOLDER_ID;
680  $_GET["cmd"] = "frameset";
681  self::redirect(
682  "ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=".
683  $_GET["cmd"]."&ref_id=".$_GET["ref_id"]);
684  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
const SESSION_CLOSE_EXPIRE
const SESSION_CLOSE_PUBLIC
static setClosingContext($a_context)
set closing context (for statistics)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleDevMode()

static ilInitialisation::handleDevMode ( )
staticprotected

Prepare developer tools.

Definition at line 811 of file class.ilInitialisation.php.

References defined.

812  {
813  if(defined(SHOWNOTICES) && SHOWNOTICES)
814  {
815  // no further differentiating of php version regarding to 5.4 neccessary
816  // when the error reporting is set to E_ALL anyway
817 
818  // add notices to error reporting
819  error_reporting(E_ALL);
820  }
821 
822  if(defined('DEBUGTOOLS') && DEBUGTOOLS)
823  {
824  include_once "include/inc.debug.php";
825  }
826  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ handleErrorReporting()

static ilInitialisation::handleErrorReporting ( )
static

Set error reporting level.

Definition at line 920 of file class.ilInitialisation.php.

Referenced by ilWebAccessCheckerDelivery\handleRequest().

921  {
922  // push the error level as high as possible / sane
923  error_reporting(E_ALL & ~E_NOTICE);
924 
925  // see handleDevMode() - error reporting might be overwritten again
926  // but we need the client ini first
927  }
+ Here is the caller graph for this function:

◆ handleMaintenanceMode()

static ilInitialisation::handleMaintenanceMode ( )
staticprotected

handle maintenance mode

Definition at line 376 of file class.ilInitialisation.php.

References array, and ilContext\hasHTML().

377  {
378  global $ilClientIniFile;
379 
380  if (!$ilClientIniFile->readVariable("client","access"))
381  {
382  $mess = array("en" => "The server is not available due to maintenance.".
383  " We apologise for any inconvenience.",
384  "de" => "Der Server ist aufgrund von Wartungsarbeiten nicht verfügbar.".
385  " Wir bitten um Verständnis.");
386  $mess_id = "init_error_maintenance";
387 
388  if (ilContext::hasHTML() && is_file("./maintenance.html"))
389  {
390  self::redirect("./maintenance.html", $mess_id, $mess);
391  }
392  else
393  {
394  $mess = self::translateMessage($mess_id, $mess);
395  self::abortAndDie($mess);
396  }
397  }
398  }
static hasHTML()
Has HTML output.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ includePhp5Compliance()

static ilInitialisation::includePhp5Compliance ( )
staticprotected

This is a hack for authentication.

Since the phpCAS lib ships with its own compliance functions.

Definition at line 87 of file class.ilInitialisation.php.

References ilAuthFactory\CONTEXT_CAS, and ilAuthFactory\getContext().

88  {
89  include_once 'Services/Authentication/classes/class.ilAuthFactory.php';
91  {
92  require_once("include/inc.xml5compliance.php");
93  }
94  require_once("include/inc.xsl5compliance.php");
95  }
+ Here is the call graph for this function:

◆ initAccessHandling()

static ilInitialisation::initAccessHandling ( )
staticprotected

$ilAccess and $rbac...

initialisation

Definition at line 737 of file class.ilInitialisation.php.

References ilRbacSystem\getInstance().

738  {
739  self::initGlobal("rbacreview", "ilRbacReview",
740  "./Services/AccessControl/classes/class.ilRbacReview.php");
741 
742  require_once "./Services/AccessControl/classes/class.ilRbacSystem.php";
743  $rbacsystem = ilRbacSystem::getInstance();
744  self::initGlobal("rbacsystem", $rbacsystem);
745 
746  self::initGlobal("rbacadmin", "ilRbacAdmin",
747  "./Services/AccessControl/classes/class.ilRbacAdmin.php");
748 
749  self::initGlobal("ilAccess", "ilAccessHandler",
750  "./Services/AccessControl/classes/class.ilAccessHandler.php");
751 
752  require_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
753  }
+ Here is the call graph for this function:

◆ initClient()

static ilInitialisation::initClient ( )
staticprotected

Init client-based objects (level 1)

Definition at line 972 of file class.ilInitialisation.php.

References $GLOBALS, $https, and ilContext\usesHTTP().

973  {
974  global $https, $ilias;
975 
976  self::setCookieConstants();
977 
978  self::determineClient();
979 
980  self::initClientIniFile();
981 
982 
983  // --- needs client ini
984 
985  $ilias->client_id = CLIENT_ID;
986 
987  if (DEVMODE)
988  {
989  self::handleDevMode();
990  }
991 
992 
993  self::handleMaintenanceMode();
994 
995  self::initDatabase();
996 
997  // moved after databases
998  self::initLog();
999 
1000  self::initGlobal("ilAppEventHandler", "ilAppEventHandler",
1001  "./Services/EventHandling/classes/class.ilAppEventHandler.php");
1002 
1003  // there are rare cases where initILIAS is called twice for a request
1004  // example goto.php is called and includes ilias.php later
1005  // we must prevent that ilPluginAdmin is initialized twice in
1006  // this case, since this won't get the values out of plugin.php the
1007  // second time properly
1008  if (!is_object($GLOBALS["ilPluginAdmin"]))
1009  {
1010  self::initGlobal("ilPluginAdmin", "ilPluginAdmin",
1011  "./Services/Component/classes/class.ilPluginAdmin.php");
1012  }
1013 
1014  self::setSessionHandler();
1015 
1016  self::initSettings();
1017 
1018 
1019  // --- needs settings
1020 
1021  self::initLocale();
1022 
1023  if(ilContext::usesHTTP())
1024  {
1025  // $https
1026  self::initGlobal("https", "ilHTTPS", "./Services/Http/classes/class.ilHTTPS.php");
1027  $https->enableSecureCookies();
1028  $https->checkPort();
1029  }
1030 
1031 
1032  // --- object handling
1033 
1034  self::initGlobal("ilObjDataCache", "ilObjectDataCache",
1035  "./Services/Object/classes/class.ilObjectDataCache.php");
1036 
1037  // needed in ilObjectDefinition
1038  require_once "./Services/Xml/classes/class.ilSaxParser.php";
1039 
1040  self::initGlobal("objDefinition", "ilObjectDefinition",
1041  "./Services/Object/classes/class.ilObjectDefinition.php");
1042 
1043  // $tree
1044  require_once "./Services/Tree/classes/class.ilTree.php";
1045  $tree = new ilTree(ROOT_FOLDER_ID);
1046  self::initGlobal("tree", $tree);
1047  unset($tree);
1048 
1049  self::initGlobal("ilCtrl", "ilCtrl",
1050  "./Services/UICore/classes/class.ilCtrl.php");
1051 
1052  self::setSessionCookieParams();
1053  }
static usesHTTP()
Uses HTTP aka browser.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$https
Definition: imgupload.php:19
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the call graph for this function:

◆ initClientIniFile()

static ilInitialisation::initClientIniFile ( )
staticprotected

This method provides a global instance of class ilIniFile for the client.ini.php file in variable $ilClientIniFile.

It initializes a lot of constants accordingly to the settings in the client.ini.php file.

Preconditions: ILIAS_WEB_DIR and CLIENT_ID must be set.

Returns
boolean true, if no error occured with client init file otherwise false

Definition at line 284 of file class.ilInitialisation.php.

References $_COOKIE, $ilIliasIniFile, array, ilUtil\setCookie(), and ilGlobalCache\setup().

285  {
286  global $ilIliasIniFile;
287 
288  // check whether ILIAS_WEB_DIR is set.
289  if (ILIAS_WEB_DIR == "")
290  {
291  self::abortAndDie("Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
292  }
293 
294  // check whether CLIENT_ID is set.
295  if (CLIENT_ID == "")
296  {
297  self::abortAndDie("Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
298  }
299 
300  $ini_file = "./".ILIAS_WEB_DIR."/".CLIENT_ID."/client.ini.php";
301 
302  // get settings from ini file
303  require_once("./Services/Init/classes/class.ilIniFile.php");
304  $ilClientIniFile = new ilIniFile($ini_file);
305  $ilClientIniFile->read();
306 
307  // invalid client id / client ini
308  if ($ilClientIniFile->ERROR != "")
309  {
310  $c = $_COOKIE["ilClientId"];
311  $default_client = $ilIliasIniFile->readVariable("clients","default");
312  ilUtil::setCookie("ilClientId", $default_client);
313  if (CLIENT_ID != "" && CLIENT_ID != $default_client)
314  {
315  $mess = array("en" => "Client does not exist.",
316  "de" => "Mandant ist ungültig.");
317  self::redirect("index.php?client_id=".$default_client, null, $mess);
318  }
319  else
320  {
321  self::abortAndDie("Fatal Error: ilInitialisation::initClientIniFile initializing client ini file abborted with: ". $ilClientIniFile->ERROR);
322  }
323  }
324 
325  self::initGlobal("ilClientIniFile", $ilClientIniFile);
326 
327  // set constants
328  define ("SESSION_REMINDER_LEADTIME", 30);
329  define ("DEBUG",$ilClientIniFile->readVariable("system","DEBUG"));
330  define ("DEVMODE",$ilClientIniFile->readVariable("system","DEVMODE"));
331  define ("SHOWNOTICES",$ilClientIniFile->readVariable("system","SHOWNOTICES"));
332  define ("DEBUGTOOLS",$ilClientIniFile->readVariable("system","DEBUGTOOLS"));
333  define ("ROOT_FOLDER_ID",$ilClientIniFile->readVariable('system','ROOT_FOLDER_ID'));
334  define ("SYSTEM_FOLDER_ID",$ilClientIniFile->readVariable('system','SYSTEM_FOLDER_ID'));
335  define ("ROLE_FOLDER_ID",$ilClientIniFile->readVariable('system','ROLE_FOLDER_ID'));
336  define ("MAIL_SETTINGS_ID",$ilClientIniFile->readVariable('system','MAIL_SETTINGS_ID'));
337  $error_handler = $ilClientIniFile->readVariable('system', 'ERROR_HANDLER');
338  define ("ERROR_HANDLER",$error_handler ? $error_handler : "PRETTY_PAGE");
339 
340  // this is for the online help installation, which sets OH_REF_ID to the
341  // ref id of the online module
342  define ("OH_REF_ID",$ilClientIniFile->readVariable("system","OH_REF_ID"));
343 
344  define ("SYSTEM_MAIL_ADDRESS",$ilClientIniFile->readVariable('system','MAIL_SENT_ADDRESS')); // Change SS
345  define ("MAIL_REPLY_WARNING",$ilClientIniFile->readVariable('system','MAIL_REPLY_WARNING')); // Change SS
346 
347  // see ilObject::TITLE_LENGTH, ilObject::DESC_LENGTH
348  // define ("MAXLENGTH_OBJ_TITLE",125);#$ilClientIniFile->readVariable('system','MAXLENGTH_OBJ_TITLE'));
349  // define ("MAXLENGTH_OBJ_DESC",$ilClientIniFile->readVariable('system','MAXLENGTH_OBJ_DESC'));
350 
351  define ("CLIENT_DATA_DIR",ILIAS_DATA_DIR."/".CLIENT_ID);
352  define ("CLIENT_WEB_DIR",ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".CLIENT_ID);
353  define ("CLIENT_NAME",$ilClientIniFile->readVariable('client','name')); // Change SS
354 
355  $val = $ilClientIniFile->readVariable("db","type");
356  if ($val == "")
357  {
358  define ("IL_DB_TYPE", "mysql");
359  }
360  else
361  {
362  define ("IL_DB_TYPE", $val);
363  }
364 
365  require_once('./Services/GlobalCache/classes/Settings/class.ilGlobalCacheSettings.php');
366  $ilGlobalCacheSettings = new ilGlobalCacheSettings();
367  $ilGlobalCacheSettings->readFromIniFile($ilClientIniFile);
368  ilGlobalCache::setup($ilGlobalCacheSettings);
369 
370  return true;
371  }
Class ilGlobalCacheSettings.
static setup(ilGlobalCacheSettings $ilGlobalCacheSettings)
static setCookie($a_cookie_name, $a_cookie_value='', $a_also_set_super_global=true, $a_set_cookie_invalid=false)
Create styles array
The data for the language used.
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
$ilIliasIniFile
INIFile Parser.
+ Here is the call graph for this function:

◆ initCore()

static ilInitialisation::initCore ( )
staticprotected

Init core objects (level 0)

Definition at line 932 of file class.ilInitialisation.php.

References $_POST, $ilErr, array, ilSession\get(), and PEAR_ERROR_CALLBACK.

933  {
934  global $ilErr;
935 
936  self::handleErrorReporting();
937 
938  // breaks CAS: must be included after CAS context isset in AuthUtils
939  //self::includePhp5Compliance();
940 
941  self::requireCommonIncludes();
942 
943 
944  // error handler
945  self::initGlobal("ilErr", "ilErrorHandling",
946  "./Services/Init/classes/class.ilErrorHandling.php");
947  $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
948 
949  // :TODO: obsolete?
950  // PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, "errorHandler"));
951 
952  // workaround: load old post variables if error handler 'message' was called
953  include_once "Services/Authentication/classes/class.ilSession.php";
954  if (ilSession::get("message"))
955  {
956  $_POST = ilSession::get("post_vars");
957  }
958 
959  self::removeUnsafeCharacters();
960 
961  self::initIliasIniFile();
962 
963  define('IL_INITIAL_WD', getcwd());
964 
965  // deprecated
966  self::initGlobal("ilias", "ILIAS", "./Services/Init/classes/class.ilias.php");
967  }
global $ilErr
Definition: raiseError.php:16
const PEAR_ERROR_CALLBACK
Definition: PEAR.php:35
static get($a_var)
Get a value.
Create styles array
The data for the language used.
$_POST["username"]
+ Here is the call graph for this function:

◆ initDatabase()

static ilInitialisation::initDatabase ( )
staticprotected

initialise database object $ilDB

Definition at line 404 of file class.ilInitialisation.php.

References $ilDB.

405  {
406  // build dsn of database connection and connect
407  require_once("./Services/Database/classes/class.ilDBWrapperFactory.php");
408  $ilDB = ilDBWrapperFactory::getWrapper(IL_DB_TYPE);
409  $ilDB->initFromIniFile();
410  $ilDB->connect();
411 
412  self::initGlobal("ilDB", $ilDB);
413  }
global $ilDB

◆ initGlobal()

static ilInitialisation::initGlobal (   $a_name,
  $a_class,
  $a_source_file = null 
)
staticprotected

Initialize global instance.

Parameters
string$a_name
string$a_class
string$a_source_file

Definition at line 775 of file class.ilInitialisation.php.

References $DIC, and $GLOBALS.

776  {
777  global $DIC;
778 
779  if($a_source_file)
780  {
781  include_once $a_source_file;
782  $GLOBALS[$a_name] = new $a_class;
783  }
784  else
785  {
786  $GLOBALS[$a_name] = $a_class;
787  }
788 
789  $DIC[$a_name] = function ($c) use ($a_name) {
790  return $GLOBALS[$a_name];
791  };
792  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $DIC

◆ initHTML()

static ilInitialisation::initHTML ( )
staticprotected

init HTML output (level 3)

Definition at line 1230 of file class.ilInitialisation.php.

References $_GET, $GLOBALS, $ilUser, $tpl, ilUtil\getStyleSheetLocation(), ilContext\hasUser(), and ilSession\set().

1231  {
1232  global $ilUser;
1233 
1234  if(ilContext::hasUser())
1235  {
1236  // load style definitions
1237  // use the init function with plugin hook here, too
1238  self::initStyle();
1239  }
1240 
1241  self::initUIFramework($GLOBALS["DIC"]);
1242 
1243  // $tpl
1244  $tpl = new ilTemplate("tpl.main.html", true, true);
1245  self::initGlobal("tpl", $tpl);
1246 
1247  if (ilContext::hasUser()) {
1248  require_once 'Services/User/classes/class.ilUserRequestTargetAdjustment.php';
1249  $request_adjuster = new ilUserRequestTargetAdjustment($ilUser, $GLOBALS['DIC']['ilCtrl']);
1250  $request_adjuster->adjust();
1251  }
1252 
1253 
1254  // load style sheet depending on user's settings
1255  $location_stylesheet = ilUtil::getStyleSheetLocation();
1256  $tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
1257 
1258  require_once "./Services/UICore/classes/class.ilFrameTargetInfo.php";
1259 
1260  self::initGlobal("ilNavigationHistory", "ilNavigationHistory",
1261  "Services/Navigation/classes/class.ilNavigationHistory.php");
1262 
1263  self::initGlobal("ilBrowser", "ilBrowser",
1264  "./Services/Utilities/classes/class.ilBrowser.php");
1265 
1266  self::initGlobal("ilHelp", "ilHelpGUI",
1267  "Services/Help/classes/class.ilHelpGUI.php");
1268 
1269  self::initGlobal("ilToolbar", "ilToolbarGUI",
1270  "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php");
1271 
1272  self::initGlobal("ilLocator", "ilLocatorGUI",
1273  "./Services/Locator/classes/class.ilLocatorGUI.php");
1274 
1275  self::initGlobal("ilTabs", "ilTabsGUI",
1276  "./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php");
1277 
1278  if(ilContext::hasUser())
1279  {
1280  // $ilMainMenu
1281  include_once './Services/MainMenu/classes/class.ilMainMenuGUI.php';
1282  $ilMainMenu = new ilMainMenuGUI("_top");
1283  self::initGlobal("ilMainMenu", $ilMainMenu);
1284  unset($ilMainMenu);
1285 
1286 
1287  // :TODO: tableGUI related
1288 
1289  // set hits per page for all lists using table module
1290  $_GET['limit'] = (int) $ilUser->getPref('hits_per_page');
1291  ilSession::set('tbl_limit', $_GET['limit']);
1292 
1293  // the next line makes it impossible to save the offset somehow in a session for
1294  // a specific table (I tried it for the user administration).
1295  // its not posssible to distinguish whether it has been set to page 1 (=offset = 0)
1296  // or not set at all (then we want the last offset, e.g. being used from a session var).
1297  // So I added the wrapping if statement. Seems to work (hopefully).
1298  // Alex April 14th 2006
1299  if (isset($_GET['offset']) && $_GET['offset'] != "") // added April 14th 2006
1300  {
1301  $_GET['offset'] = (int) $_GET['offset']; // old code
1302  }
1303  }
1304  else
1305  {
1306  // several code parts rely on ilObjUser being always included
1307  include_once "Services/User/classes/class.ilObjUser.php";
1308  }
1309  }
Handles display of the main menu.
static hasUser()
Based on user authentication?
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static set($a_var, $a_val)
Set a value.
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:18
Class ilUserAccountMaintenanceEnforcement.
+ Here is the call graph for this function:

◆ initILIAS()

static ilInitialisation::initILIAS ( )
static

ilias initialisation

Definition at line 839 of file class.ilInitialisation.php.

References $GLOBALS, $tpl, ilLoggerFactory\getInstance(), ilUtil\getStyleSheetLocation(), ilContext\hasHTML(), ilContext\hasUser(), ilContext\initClient(), ilECSTaskScheduler\start(), and ilContext\supportsPersistentSessions().

Referenced by ilSoapAdministration\getClientInfoXML(), ilSoapAdministration\getInstallationInfoXML(), ilCalendarRemoteAccessHandler\initIlias(), ilWebAccessChecker\initILIAS(), and ilSoapAdministration\initIlias().

840  {
841  if (self::$already_initialized)
842  {
843  // workaround for bug #17990
844  // big mess. we prevent double initialisations with ILIAS 5.1, which is good, but...
845  // the style service uses $_GET["ref_id"] to determine
846  // the context styles. $_GET["ref_id"] is "corrected" by the "goto" procedure and which calls
847  // initILIAS again.
848  // we need a mechanism that detemines our repository context and stores that in an information object
849  // usable by the style component afterwars. This needs new concepts and a refactoring.
851  {
852  global $tpl;
853  if (is_object($tpl))
854  {
855  // load style sheet depending on user's settings
856  $location_stylesheet = ilUtil::getStyleSheetLocation();
857  $tpl->setVariable("LOCATION_STYLESHEET", $location_stylesheet);
858  }
859  }
860 
861  return;
862  }
863 
864  $GLOBALS["DIC"] = new \ILIAS\DI\Container();
865  $GLOBALS["DIC"]["ilLoggerFactory"] = function($c) {
867  };
868 
869  self::$already_initialized = true;
870 
871  self::initCore();
872 
874  {
875  self::initClient();
876  self::initSession();
877 
878  if (ilContext::hasUser())
879  {
880  self::initUser();
881 
883  {
884  self::resumeUserSession();
885  }
886  }
887 
888  // init after Auth otherwise breaks CAS
889  self::includePhp5Compliance();
890 
891  // language may depend on user setting
892  self::initLanguage();
893  $GLOBALS['DIC']['tree']->initLangCode();
894 
895  if(ilContext::hasHTML())
896  {
897  include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
899 
900  self::initHTML();
901  }
902  }
903  }
static hasUser()
Based on user authentication?
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $tpl
Definition: ilias.php:8
static start()
Start task scheduler for each server instance.
static hasHTML()
Has HTML output.
static supportsPersistentSessions()
Check if context supports persistent session handling.
static initClient()
Init client.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initIliasIniFile()

static ilInitialisation::initIliasIniFile ( )
staticprotected

This method provides a global instance of class ilIniFile for the ilias.ini.php file in variable $ilIliasIniFile.

It initializes a lot of constants accordingly to the settings in the ilias.ini.php file.

Definition at line 104 of file class.ilInitialisation.php.

References $ilIliasIniFile, $tz, and ilTimeZone\initDefaultTimeZone().

105  {
106  require_once("./Services/Init/classes/class.ilIniFile.php");
107  $ilIliasIniFile = new ilIniFile("./ilias.ini.php");
108  $ilIliasIniFile->read();
109  self::initGlobal('ilIliasIniFile', $ilIliasIniFile);
110 
111  // initialize constants
112  define("ILIAS_DATA_DIR",$ilIliasIniFile->readVariable("clients","datadir"));
113  define("ILIAS_WEB_DIR",$ilIliasIniFile->readVariable("clients","path"));
114  define("ILIAS_ABSOLUTE_PATH",$ilIliasIniFile->readVariable('server','absolute_path'));
115 
116  // logging
117  define ("ILIAS_LOG_DIR",$ilIliasIniFile->readVariable("log","path"));
118  define ("ILIAS_LOG_FILE",$ilIliasIniFile->readVariable("log","file"));
119  define ("ILIAS_LOG_ENABLED",$ilIliasIniFile->readVariable("log","enabled"));
120  define ("ILIAS_LOG_LEVEL",$ilIliasIniFile->readVariable("log","level"));
121  define ("SLOW_REQUEST_TIME",$ilIliasIniFile->readVariable("log","slow_request_time"));
122 
123  // read path + command for third party tools from ilias.ini
124  define ("PATH_TO_CONVERT",$ilIliasIniFile->readVariable("tools","convert"));
125  define ("PATH_TO_FFMPEG",$ilIliasIniFile->readVariable("tools","ffmpeg"));
126  define ("PATH_TO_ZIP",$ilIliasIniFile->readVariable("tools","zip"));
127  define ("PATH_TO_MKISOFS",$ilIliasIniFile->readVariable("tools","mkisofs"));
128  define ("PATH_TO_UNZIP",$ilIliasIniFile->readVariable("tools","unzip"));
129  define ("PATH_TO_GHOSTSCRIPT",$ilIliasIniFile->readVariable("tools","ghostscript"));
130  define ("PATH_TO_JAVA",$ilIliasIniFile->readVariable("tools","java"));
131  define ("URL_TO_LATEX",$ilIliasIniFile->readVariable("tools","latex"));
132  define ("PATH_TO_FOP",$ilIliasIniFile->readVariable("tools","fop"));
133  define ("PATH_TO_LESSC",$ilIliasIniFile->readVariable("tools","lessc"));
134 
135  // read virus scanner settings
136  switch ($ilIliasIniFile->readVariable("tools", "vscantype"))
137  {
138  case "sophos":
139  define("IL_VIRUS_SCANNER", "Sophos");
140  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
141  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
142  break;
143 
144  case "antivir":
145  define("IL_VIRUS_SCANNER", "AntiVir");
146  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
147  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
148  break;
149 
150  case "clamav":
151  define("IL_VIRUS_SCANNER", "ClamAV");
152  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
153  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
154  break;
155 
156  default:
157  define("IL_VIRUS_SCANNER", "None");
158  break;
159  }
160 
161  include_once './Services/Calendar/classes/class.ilTimeZone.php';
163  define ("IL_TIMEZONE", $tz);
164  }
static initDefaultTimeZone(ilIniFile $ini)
Initialize default timezone from system settings.
$ilIliasIniFile
INIFile Parser.
+ Here is the call graph for this function:

◆ initLocale()

static ilInitialisation::initLocale ( )
staticprotected

Init Locale.

Definition at line 592 of file class.ilInitialisation.php.

References $GLOBALS, $ilSetting, $l, and array.

593  {
594  global $ilSetting;
595 
596  if (trim($ilSetting->get("locale") != ""))
597  {
598  $larr = explode(",", trim($ilSetting->get("locale")));
599  $ls = array();
600  $first = $larr[0];
601  foreach ($larr as $l)
602  {
603  if (trim($l) != "")
604  {
605  $ls[] = $l;
606  }
607  }
608  if (count($ls) > 0)
609  {
610  setlocale(LC_ALL, $ls);
611 
612  // #15347 - making sure that floats are not changed
613  setlocale(LC_NUMERIC, "C");
614 
615  if (class_exists("Collator"))
616  {
617  $GLOBALS["ilCollator"] = new Collator($first);
618  $GLOBALS["DIC"]["ilCollator"] = function($c) {
619  return $GLOBALS["ilCollator"];
620  };
621  }
622  }
623  }
624  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
global $l
Definition: afr.php:30
global $ilSetting
Definition: privfeed.php:17

◆ initLog()

static ilInitialisation::initLog ( )
staticprotected

Init log instance.

Definition at line 758 of file class.ilInitialisation.php.

References $log, and ilLoggerFactory\getRootLogger().

759  {
760  include_once './Services/Logging/classes/public/class.ilLoggerFactory.php';
762 
763  self::initGlobal("ilLog", $log);
764  // deprecated
765  self::initGlobal("log", $log);
766  }
static getRootLogger()
The unique root logger has a fixed error level.
+ Here is the call graph for this function:

◆ initSession()

static ilInitialisation::initSession ( )
staticprotected

Init session.

Definition at line 908 of file class.ilInitialisation.php.

References $GLOBALS, and ilAuthSession\getInstance().

909  {
910  include_once './Services/Authentication/classes/class.ilAuthSession.php';
911  self::initGlobal('ilAuthSession', ilAuthSession::getInstance());
912 
913  $GLOBALS['DIC']['ilAuthSession']->init();
914  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static getInstance()
Get instance.
+ Here is the call graph for this function:

◆ initSettings()

static ilInitialisation::initSettings ( )
staticprotected

initialise $ilSettings object and define constants

Used in Soap

Definition at line 502 of file class.ilInitialisation.php.

References $ilSetting, and ilContext\usesHTTP().

503  {
504  global $ilSetting;
505 
506  self::initGlobal("ilSetting", "ilSetting",
507  "Services/Administration/classes/class.ilSetting.php");
508 
509  // check correct setup
510  if (!$ilSetting->get("setup_ok"))
511  {
512  self::abortAndDie("Setup is not completed. Please run setup routine again.");
513  }
514 
515  // set anonymous user & role id and system role id
516  define ("ANONYMOUS_USER_ID", $ilSetting->get("anonymous_user_id"));
517  define ("ANONYMOUS_ROLE_ID", $ilSetting->get("anonymous_role_id"));
518  define ("SYSTEM_USER_ID", $ilSetting->get("system_user_id"));
519  define ("SYSTEM_ROLE_ID", $ilSetting->get("system_role_id"));
520  define ("USER_FOLDER_ID", 7);
521 
522  // recovery folder
523  define ("RECOVERY_FOLDER_ID", $ilSetting->get("recovery_folder_id"));
524 
525  // installation id
526  define ("IL_INST_ID", $ilSetting->get("inst_id",0));
527 
528  // define default suffix replacements
529  define ("SUFFIX_REPL_DEFAULT", "php,php3,php4,inc,lang,phtml,htaccess");
530  define ("SUFFIX_REPL_ADDITIONAL", $ilSetting->get("suffix_repl_additional"));
531 
532  if(ilContext::usesHTTP())
533  {
534  self::buildHTTPPath();
535  }
536  }
static usesHTTP()
Uses HTTP aka browser.
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ initStyle()

static ilInitialisation::initStyle ( )
staticprotected

provide $styleDefinition object

Definition at line 541 of file class.ilInitialisation.php.

References $GLOBALS, $ilUser, array, ilLoggerFactory\getInstance(), ilPluginAdmin\getPluginObject(), and IL_COMP_SERVICE.

542  {
543  global $styleDefinition, $ilPluginAdmin;
544 
545  // load style definitions
546  self::initGlobal("styleDefinition", "ilStyleDefinition",
547  "./Services/Style/System/classes/class.ilStyleDefinition.php");
548 
549  // add user interface hook for style initialisation
550  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
551  foreach ($pl_names as $pl)
552  {
553  $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
554  $gui_class = $ui_plugin->getUIClassInstance();
555  $gui_class->modifyGUI("Services/Init", "init_style", array("styleDefinition" => $styleDefinition));
556  }
557  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
Create styles array
The data for the language used.
const IL_COMP_SERVICE
+ Here is the call graph for this function:

◆ initUIFramework()

static ilInitialisation::initUIFramework ( \ILIAS\DI\Container  $c)
staticprotected

init the ILIAS UI framework.

Definition at line 1201 of file class.ilInitialisation.php.

1201  {
1202  $c["ui.factory"] = function ($c) {
1203  return new ILIAS\UI\Implementation\Factory();
1204  };
1205  $c["ui.renderer"] = function($c) {
1207  ( $c["ui.factory"]
1208  , $c["ui.template_factory"]
1209  , $c["ui.resource_registry"]
1210  , $c["lng"]
1211  , $c["ui.javascript_binding"]
1212  );
1213  };
1214  $c["ui.template_factory"] = function($c) {
1216  ( $c["tpl"]
1217  );
1218  };
1219  $c["ui.resource_registry"] = function($c) {
1221  };
1222  $c["ui.javascript_binding"] = function($c) {
1224  };
1225  }
Wraps global ilTemplate to provide JavaScriptBinding.

◆ initUser()

static ilInitialisation::initUser ( )
staticprotected

Init user / authentification (level 2)

Definition at line 1058 of file class.ilInitialisation.php.

References $ilUser.

1059  {
1060  global $ilias, $ilUser;
1061 
1062  // $ilUser
1063  self::initGlobal(
1064  "ilUser",
1065  "ilObjUser",
1066  "./Services/User/classes/class.ilObjUser.php"
1067  );
1068  $ilias->account = $ilUser;
1069 
1070  self::initAccessHandling();
1071  }
$ilUser
Definition: imgupload.php:18

◆ recursivelyRemoveUnsafeCharacters()

static ilInitialisation::recursivelyRemoveUnsafeCharacters (   $var)
staticprotected

Definition at line 43 of file class.ilInitialisation.php.

References array.

43  {
44  if (is_array($var)) {
45  $mod = [];
46  foreach ($var as $k => $v) {
47  $k = self::recursivelyRemoveUnsafeCharacters($k);
48  $mod[$k] = self::recursivelyRemoveUnsafeCharacters($v);
49  }
50  return $mod;
51  }
52  return strip_tags(
53  str_replace(
54  array("\x00", "\n", "\r", "\\", "'", '"', "\x1a"),
55  "",
56  $var
57  )
58  );
59  }
Create styles array
The data for the language used.

◆ redirect()

static ilInitialisation::redirect (   $a_target,
  $a_message_id = '',
array  $a_message_static = null 
)
staticprotected

Redirects to target url if context supports it.

Parameters
string$a_target
string$a_message_id
array$a_message_details

Definition at line 1493 of file class.ilInitialisation.php.

References $_GET, $ilUser, array, defined, ilUserUtil\getStartingPointAsUrl(), goToPublicSection(), ilContext\hasHTML(), ilUtil\redirect(), ilContext\supportsRedirects(), and ilContext\usesHTTP().

1494  {
1495  // #12739
1496  if(defined("ILIAS_HTTP_PATH") &&
1497  !stristr($a_target, ILIAS_HTTP_PATH))
1498  {
1499  $a_target = ILIAS_HTTP_PATH."/".$a_target;
1500  }
1501 
1503  {
1504  ilUtil::redirect($a_target);
1505  }
1506  else
1507  {
1508  $message = self::translateMessage($a_message_id, $a_message_static);
1509 
1510  // user-directed linked message
1512  {
1513  $link = self::translateMessage("init_error_redirect_click",
1514  array("en" => 'Please click to continue.',
1515  "de" => 'Bitte klicken um fortzufahren.'));
1516  $mess = $message.
1517  '<br /><a href="'.$a_target.'">'.$link.'</a>';
1518  }
1519  // plain text
1520  else
1521  {
1522  // not much we can do here
1523  $mess = $message;
1524 
1525  if(!trim($mess))
1526  {
1527  $mess = self::translateMessage("init_error_redirect_info",
1528  array("en" => 'Redirect not supported by context.',
1529  "de" => 'Weiterleitungen werden durch Kontext nicht unterstützt.')).
1530  ' ('.$a_target.')';
1531  }
1532  }
1533 
1534  self::abortAndDie($mess);
1535  }
1536  }
static usesHTTP()
Uses HTTP aka browser.
static hasHTML()
Has HTML output.
Create styles array
The data for the language used.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
static redirect($a_script)
http redirect to other script
static supportsRedirects()
Are redirects supported?
+ Here is the call graph for this function:

◆ reinitILIAS()

static ilInitialisation::reinitILIAS ( )
static

Definition at line 831 of file class.ilInitialisation.php.

Referenced by ilWebAccessChecker\setHeader().

831  {
832  self::$already_initialized = false;
833  self::initILIAS();
834  }
+ Here is the caller graph for this function:

◆ removeUnsafeCharacters()

static ilInitialisation::removeUnsafeCharacters ( )
staticprotected

Remove unsafe characters from GET.

Definition at line 34 of file class.ilInitialisation.php.

References $_GET.

35  {
36  // Remove unsafe characters from GET parameters.
37  // We do not need this characters in any case, so it is
38  // feasible to filter them everytime. POST parameters
39  // need attention through ilUtil::stripSlashes() and similar functions)
40  $_GET = self::recursivelyRemoveUnsafeCharacters($_GET);
41  }
$_GET["client_id"]

◆ requireCommonIncludes()

static ilInitialisation::requireCommonIncludes ( )
staticprotected

get common include code files

Definition at line 64 of file class.ilInitialisation.php.

References ilContext\usesTemplate().

65  {
66  // ilTemplate
68  {
69  require_once "./Services/UICore/classes/class.ilTemplate.php";
70  }
71 
72  // really always required?
73  require_once "./Services/Utilities/classes/class.ilUtil.php";
74  require_once "./Services/Calendar/classes/class.ilDatePresentation.php";
75  require_once "include/inc.ilias_version.php";
76 
77  include_once './Services/Authentication/classes/class.ilAuthUtils.php';
78 
79  self::initGlobal("ilBench", "ilBenchmark", "./Services/Utilities/classes/class.ilBenchmark.php");
80  }
static usesTemplate()
Uses template engine.
+ Here is the call graph for this function:

◆ resumeUserSession()

static ilInitialisation::resumeUserSession ( )
static

Resume an existing user session.

Definition at line 1076 of file class.ilInitialisation.php.

References $_SERVER, $GLOBALS, ilLoggerFactory\getLogger(), and ilAuthUtils\handleForcedAuthentication().

1077  {
1078  include_once './Services/Authentication/classes/class.ilAuthUtils.php';
1080  {
1081  }
1082 
1083  if(
1084  !$GLOBALS['DIC']['ilAuthSession']->isAuthenticated() or
1085  $GLOBALS['DIC']['ilAuthSession']->isExpired()
1086  )
1087  {
1088  ilLoggerFactory::getLogger('init')->debug('Current session is invalid: ' . $GLOBALS['DIC']['ilAuthSession']->getId());
1089  $current_script = substr(strrchr($_SERVER["PHP_SELF"], "/"), 1);
1090  if(self::blockedAuthentication($current_script))
1091  {
1092  ilLoggerFactory::getLogger('init')->debug('Authentication is started in current script.');
1093  // nothing todo: authentication is done in current script
1094  return;
1095  }
1096  return self::handleAuthenticationFail();
1097  }
1098  // valid session
1099  return self::initUserAccount();
1100 
1101  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static handleForcedAuthentication()
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

◆ setCookieConstants()

static ilInitialisation::setCookieConstants ( )
staticprotected

Definition at line 448 of file class.ilInitialisation.php.

References $_SERVER, $cookie_path, $GLOBALS, ilAuthFactory\CONTEXT_HTTP, and ilAuthFactory\getContext().

449  {
450  include_once 'Services/Authentication/classes/class.ilAuthFactory.php';
452  {
453  $cookie_path = '/';
454  }
455  else if($GLOBALS['COOKIE_PATH'])
456  {
457  // use a predefined cookie path from WebAccessChecker
458  $cookie_path = $GLOBALS['COOKIE_PATH'];
459  }
460  else
461  {
462  $cookie_path = dirname( $_SERVER['PHP_SELF'] );
463  }
464 
465  /* if ilias is called directly within the docroot $cookie_path
466  is set to '/' expecting on servers running under windows..
467  here it is set to '\'.
468  in both cases a further '/' won't be appended due to the following regex
469  */
470  $cookie_path .= (!preg_match("/[\/|\\\\]$/", $cookie_path)) ? "/" : "";
471 
472  if($cookie_path == "\\") $cookie_path = '/';
473 
474  define('IL_COOKIE_HTTPONLY', true); // Default Value
475  define('IL_COOKIE_EXPIRE', 0);
476  define('IL_COOKIE_PATH', $cookie_path);
477  define('IL_COOKIE_DOMAIN', '');
478  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$cookie_path
Definition: index.php:6
+ Here is the call graph for this function:

◆ setSessionCookieParams()

static ilInitialisation::setSessionCookieParams ( )
staticprotected

set session cookie params

Definition at line 483 of file class.ilInitialisation.php.

References $ilSetting, ilHTTPS\getInstance(), and IL_COOKIE_PATH.

484  {
485  global $ilSetting;
486 
487  // TODO: Has to be revised/moved
488  include_once './Services/Http/classes/class.ilHTTPS.php';
489  $cookie_secure = !$ilSetting->get('https', 0) && ilHTTPS::getInstance()->isDetected();
490  define('IL_COOKIE_SECURE', $cookie_secure); // Default Value
491 
492  session_set_cookie_params(
493  IL_COOKIE_EXPIRE, IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE, IL_COOKIE_HTTPONLY
494  );
495  }
const IL_COOKIE_PATH(isset($_GET["client_id"]))
Definition: index.php:26
static getInstance()
Get https instance.
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ setSessionHandler()

static ilInitialisation::setSessionHandler ( )
static

set session handler to db

Used in Soap/CAS

Definition at line 420 of file class.ilInitialisation.php.

References ilSession\_exists(), and defined.

421  {
422  if(ini_get('session.save_handler') != 'user')
423  {
424  ini_set("session.save_handler", "user");
425  }
426 
427  require_once "Services/Authentication/classes/class.ilSessionDBHandler.php";
428  $db_session_handler = new ilSessionDBHandler();
429  if (!$db_session_handler->setSaveHandler())
430  {
431  self::abortAndDie("Please turn off Safe mode OR set session.save_handler to \"user\" in your php.ini");
432  }
433 
434  // Do not accept external session ids
435  if (!ilSession::_exists(session_id()) && !defined('IL_PHPUNIT_TEST'))
436  {
437  // php7-todo, correct-with-php5-removal : alex, 1.3.2016: added if, please check
438  if(function_exists("session_status") && session_status() == PHP_SESSION_ACTIVE)
439  {
440  session_regenerate_id();
441  }
442  }
443  }
Database Session Handling.
static _exists($a_session_id)
Check whether session exists.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
+ Here is the call graph for this function:

◆ showingLoginForm()

static ilInitialisation::showingLoginForm (   $a_current_script)
staticprotected

Is current view the login form?

Returns
boolean

Definition at line 1409 of file class.ilInitialisation.php.

1410  {
1411  if($a_current_script == "login.php")
1412  {
1413  return true;
1414  }
1415 
1416  if($_REQUEST["baseClass"] == "ilStartUpGUI" &&
1417  self::getCurrentCmd() == "showLoginPage")
1418  {
1419  return true;
1420  }
1421 
1422  return false;
1423  }

◆ translateMessage()

static ilInitialisation::translateMessage (   $a_message_id,
array  $a_message_static = null 
)
staticprotected

Translate message if possible.

Parameters
string$a_message_id
array$a_message_static
Returns
string

Definition at line 1432 of file class.ilInitialisation.php.

References $ilDB, $ilSetting, $ilUser, $lang, $lng, and string.

1433  {
1434  global $ilDB, $lng, $ilSetting, $ilClientIniFile, $ilUser;
1435 
1436  // current language
1437  if(!$lng)
1438  {
1439  $lang = "en";
1440  if($ilUser)
1441  {
1442  $lang = $ilUser->getLanguage();
1443  }
1444  else if($_REQUEST["lang"])
1445  {
1446  $lang = (string)$_REQUEST["lang"];
1447  }
1448  else if($ilSetting)
1449  {
1450  $lang = $ilSetting->get("language");
1451  }
1452  else if($ilClientIniFile)
1453  {
1454  $lang = $ilClientIniFile->readVariable("language", "default");
1455  }
1456  }
1457  else
1458  {
1459  $lang = $lng->getLangKey();
1460  }
1461 
1462  $message = "";
1463  if($ilDB && $a_message_id)
1464  {
1465  if(!$lng)
1466  {
1467  require_once "./Services/Language/classes/class.ilLanguage.php";
1468  $lng = new ilLanguage($lang);
1469  }
1470 
1471  $lng->loadLanguageModule("init");
1472  $message = $lng->txt($a_message_id);
1473  }
1474  else if(is_array($a_message_static))
1475  {
1476  if(!isset($a_message_static[$lang]))
1477  {
1478  $lang = "en";
1479  }
1480  $message = $a_message_static[$lang];
1481  }
1482 
1483  return utf8_decode($message);
1484  }
Add rich text string
The name of the decorator.
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
global $lng
Definition: privfeed.php:17
global $ilDB
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
language handling

Field Documentation

◆ $already_initialized

ilInitialisation::$already_initialized
staticprotected

Definition at line 828 of file class.ilInitialisation.php.


The documentation for this class was generated from the following file: