ILIAS  release_4-4 Revision
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 ($a_auth_stat="")
 go to public section More...
 
static initILIAS ()
 ilias initialisation More...
 

Static Protected Member Functions

static removeUnsafeCharacters ()
 Remove unsafe characters from GET. More...
 
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 setCookieParams ()
 set session cookie params for path, domain, etc. More...
 
static initSettings ()
 initialise $ilSettings object and define constants More...
 
static initStyle ()
 provide $styleDefinition object More...
 
static initLocale ()
 Init Locale. More...
 
static goToLogin ($a_auth_stat="")
 go to login More...
 
static initLanguage ()
 $lng initialisation 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 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 authenticate ()
 Try authentication. 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, $a_message_static)
 Redirects to target url if context supports it. More...
 

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 27 of file class.ilInitialisation.php.

Member Function Documentation

◆ abortAndDie()

static ilInitialisation::abortAndDie (   $a_message)
staticprotected

Exit.

Parameters
string$a_message

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

References $GLOBALS.

870  {
871  if(is_object($GLOBALS['ilLog']))
872  {
873  $GLOBALS['ilLog']->write("Fatal Error: ilInitialisation - ".$a_message);
874  }
875  die($a_message);
876  }
$GLOBALS['ct_recipient']

◆ authenticate()

static ilInitialisation::authenticate ( )
staticprotected

Try authentication.

This will basically validate the current session

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

References $_GET, $ilCtrl, $ilErr, $ilSetting, $ilUser, $tpl, AUTH_EXPIRED, AUTH_IDLED, ilContext\CONTEXT_SOAP, ilContext\doAuthentication(), ilUtil\getStyleSheetLocation(), ilContext\getType(), ilContext\hasUser(), and ilSession\set().

1145  {
1146  global $ilAuth, $ilias, $ilErr;
1147 
1148  $current_script = substr(strrchr($_SERVER["PHP_SELF"], "/"), 1);
1149 
1150  if(self::blockedAuthentication($current_script))
1151  {
1152  return;
1153  }
1154 
1155  $oldSid = session_id();
1156 
1157  $ilAuth->start();
1158  $ilias->setAuthError($ilErr->getLastError());
1159 
1160  if(IS_PAYMENT_ENABLED)
1161  {
1162  // cart is "attached" to session, has to be updated
1163  $newSid = session_id();
1164  if($oldSid != $newSid)
1165  {
1166  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
1167  ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
1168  }
1169  }
1170 
1171  if($ilAuth->getAuth() && $ilAuth->getStatus() == '')
1172  {
1173  self::initUserAccount();
1174 
1175  self::handleAuthenticationSuccess();
1176  }
1177  else
1178  {
1179  if (!self::showingLoginForm($current_script))
1180  {
1181  // :TODO: should be moved to context?!
1182  $mandatory_auth = ($current_script != "shib_login.php"
1183  && $current_script != "shib_logout.php"
1184  && $current_script != "error.php"
1185  && $current_script != "chat.php"
1186  && $current_script != "index.php"); // #10316
1187 
1188  if($mandatory_auth)
1189  {
1190  self::handleAuthenticationFail();
1191  }
1192  }
1193  }
1194  }
+ 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 1341 of file class.ilInitialisation.php.

References $_GET, $_REQUEST, and $cmd.

1342  {
1343  if($a_current_script == "register.php" ||
1344  $a_current_script == "pwassist.php" ||
1345  $a_current_script == "confirmReg.php" ||
1346  $a_current_script == "il_securimage_play.php" ||
1347  $a_current_script == "il_securimage_show.php")
1348  {
1349  return true;
1350  }
1351 
1352  if($_REQUEST["baseClass"] == "ilStartUpGUI")
1353  {
1354  $cmd_class = $_REQUEST["cmdClass"];
1355 
1356  if($cmd_class == "ilaccountregistrationgui" ||
1357  $cmd_class == "ilpasswordassistancegui")
1358  {
1359  return true;
1360  }
1361 
1362  $cmd = self::getCurrentCmd();
1363  if($cmd == "showTermsOfService" || $cmd == "showClientList" ||
1364  $cmd == 'showAccountMigration' || $cmd == 'migrateAccount' ||
1365  $cmd == 'processCode')
1366  {
1367  return true;
1368  }
1369  }
1370 
1371  // #12884
1372  if(($a_current_script == "goto.php" && $_GET["target"] == "impr_0") ||
1373  $_GET["baseClass"] == "ilImprintGUI")
1374  {
1375  return true;
1376  }
1377 
1378  return false;
1379  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

◆ buildHTTPPath()

static ilInitialisation::buildHTTPPath ( )
staticprotected

builds http path

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

References $dirs, $https, $path, ILIAS_MODULE, and ilUtil\removeTrailingPathSeparators().

186  {
187  include_once './Services/Http/classes/class.ilHTTPS.php';
188  $https = new ilHTTPS();
189 
190  if($https->isDetected())
191  {
192  $protocol = 'https://';
193  }
194  else
195  {
196  $protocol = 'http://';
197  }
198  $host = $_SERVER['HTTP_HOST'];
199 
200  $rq_uri = $_SERVER['REQUEST_URI'];
201 
202  // security fix: this failed, if the URI contained "?" and following "/"
203  // -> we remove everything after "?"
204  if (is_int($pos = strpos($rq_uri, "?")))
205  {
206  $rq_uri = substr($rq_uri, 0, $pos);
207  }
208 
209  if(!defined('ILIAS_MODULE'))
210  {
211  $path = pathinfo($rq_uri);
212  if(!$path['extension'])
213  {
214  $uri = $rq_uri;
215  }
216  else
217  {
218  $uri = dirname($rq_uri);
219  }
220  }
221  else
222  {
223  // if in module remove module name from HTTP_PATH
224  $path = dirname($rq_uri);
225 
226  // dirname cuts the last directory from a directory path e.g content/classes return content
227 
229 
230  $dirs = explode('/',$module);
231  $uri = $path;
232  foreach($dirs as $dir)
233  {
234  $uri = dirname($uri);
235  }
236  }
237 
238  return define('ILIAS_HTTP_PATH',ilUtil::removeTrailingPathSeparators($protocol.$host.$uri));
239  }
const ILIAS_MODULE
Definition: payment.php:15
global $https
Definition: imgupload.php:15
HTTPS.
static removeTrailingPathSeparators($path)
$path
Definition: index.php:22
$dirs
+ 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 245 of file class.ilInitialisation.php.

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

246  {
247  global $ilIliasIniFile;
248 
249  // check whether ini file object exists
250  if (!is_object($ilIliasIniFile))
251  {
252  self::abortAndDie("Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.");
253  }
254 
255  // set to default client if empty
256  if ($_GET["client_id"] != "")
257  {
258  $_GET["client_id"] = ilUtil::stripSlashes($_GET["client_id"]);
259  if (!defined("IL_PHPUNIT_TEST"))
260  {
261  ilUtil::setCookie("ilClientId", $_GET["client_id"]);
262  }
263  }
264  else if (!$_COOKIE["ilClientId"])
265  {
266  // to do: ilias ini raus nehmen
267  $client_id = $ilIliasIniFile->readVariable("clients","default");
268  ilUtil::setCookie("ilClientId", $client_id);
269  }
270  if (!defined("IL_PHPUNIT_TEST"))
271  {
272  define ("CLIENT_ID", $_COOKIE["ilClientId"]);
273  }
274  else
275  {
276  define ("CLIENT_ID", $_GET["client_id"]);
277  }
278  }
$_GET["client_id"]
$_COOKIE["ilClientId"]
Definition: cron.php:11
static setCookie($a_cookie_name, $a_cookie_value='', $a_also_set_super_global=true, $a_set_cookie_invalid=false)
global $ilIliasIniFile
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$client_id
+ Here is the call graph for this function:

◆ getCurrentCmd()

static ilInitialisation::getCurrentCmd ( )
staticprotected

Extract current cmd from request.

Returns
string

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

References $_REQUEST, and $cmd.

1324  {
1325  $cmd = $_REQUEST["cmd"];
1326  if(is_array($cmd))
1327  {
1328  return array_shift(array_keys($cmd));
1329  }
1330  else
1331  {
1332  return $cmd;
1333  }
1334  }
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

◆ goToLogin()

static ilInitialisation::goToLogin (   $a_auth_stat = "")
staticprotected

go to login

Parameters
int$a_auth_stat

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

References $_COOKIE, $_GET, AUTH_EXPIRED, AUTH_IDLED, ilSession\SESSION_CLOSE_EXPIRE, ilSession\SESSION_CLOSE_LOGIN, and ilSession\setClosingContext().

712  {
713  global $ilAuth;
714 
715  // close current session
716  if($a_auth_stat == AUTH_EXPIRED ||
717  $a_auth_stat == AUTH_IDLED)
718  {
720  }
721  else
722  {
724  }
725  $ilAuth->logout();
726  session_unset();
727  session_destroy();
728 
729  $add = "";
730  if ($_GET["soap_pw"] != "")
731  {
732  $add = "&soap_pw=".$_GET["soap_pw"]."&ext_uid=".$_GET["ext_uid"];
733  }
734 
735  $script = "login.php?target=".$_GET["target"]."&client_id=".$_COOKIE["ilClientId"].
736  "&auth_stat=".$a_auth_stat.$add;
737 
738  self::redirect($script, "init_error_authentication_fail",
739  array("en" => "Authentication failed.",
740  "de" => "Authentifizierung fehlgeschlagen."));
741  }
$_GET["client_id"]
$_COOKIE["ilClientId"]
Definition: cron.php:11
const SESSION_CLOSE_LOGIN
const SESSION_CLOSE_EXPIRE
const AUTH_IDLED
Returned if session exceeds idle time.
Definition: Auth.php:30
static setClosingContext($a_context)
set closing context (for statistics)
const AUTH_EXPIRED
Returned if session has expired.
Definition: Auth.php:34
+ Here is the call graph for this function:

◆ goToPublicSection()

static ilInitialisation::goToPublicSection (   $a_auth_stat = "")
static

go to public section

Parameters
int$a_auth_stat

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

References $_GET, $_POST, ilAuthUtils\_initAuth(), AUTH_EXPIRED, AUTH_IDLED, ilSession\SESSION_CLOSE_EXPIRE, ilSession\SESSION_CLOSE_PUBLIC, and ilSession\setClosingContext().

Referenced by ilStartUpGUI\processIndexPHP().

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  // logout and end previous session
641  if($a_auth_stat == AUTH_EXPIRED ||
642  $a_auth_stat == AUTH_IDLED)
643  {
645  }
646  else
647  {
649  }
650  $ilAuth->logout();
651  session_unset();
652  session_destroy();
653 
654  // new session and login as anonymous
655  self::setSessionHandler();
656  session_start();
657  $_POST["username"] = "anonymous";
658  $_POST["password"] = "anonymous";
660 
661  // authenticate (anonymous)
662  $oldSid = session_id();
663  $ilAuth->start();
664  if (IS_PAYMENT_ENABLED)
665  {
666  $newSid = session_id();
667  if($oldSid != $newSid)
668  {
669  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
670  ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
671  }
672  }
673 
674  if (!$ilAuth->getAuth())
675  {
676  self::abortAndDie("ANONYMOUS user with the object_id ".ANONYMOUS_USER_ID." not found!");
677  }
678 
679  self::initUserAccount();
680 
681  $mess_id = "init_error_authentication_fail";
682  $mess = array("en" => "Authentication failed.",
683  "de" => "Authentifizierung fehlgeschlagen.");
684 
685  // if target given, try to go there
686  if ($_GET["target"] != "")
687  {
688  // when we are already "inside" goto.php no redirect is needed
689  $current_script = substr(strrchr($_SERVER["PHP_SELF"], "/"), 1);
690  if($current_script == "goto.php")
691  {
692  return;
693  }
694 
695  // goto will check if target is accessible or redirect to login
696  self::redirect("goto.php?target=".$_GET["target"], $mess_id, $mess);
697  }
698 
699  // we do not know if ref_id of request is accesible, so redirecting to root
700  $_GET["ref_id"] = ROOT_FOLDER_ID;
701  $_GET["cmd"] = "frameset";
702  self::redirect("ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=".
703  $_GET["cmd"]."&ref_id=".$_GET["ref_id"], $mess_id, $mess);
704  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
const SESSION_CLOSE_EXPIRE
_initAuth()
initialises $ilAuth
const SESSION_CLOSE_PUBLIC
const AUTH_IDLED
Returned if session exceeds idle time.
Definition: Auth.php:30
static setClosingContext($a_context)
set closing context (for statistics)
const AUTH_EXPIRED
Returned if session has expired.
Definition: Auth.php:34
+ 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 881 of file class.ilInitialisation.php.

882  {
883  if(defined(SHOWNOTICES) && SHOWNOTICES)
884  {
885  // no further differentiating of php version regarding to 5.4 neccessary
886  // when the error reporting is set to E_ALL anyway
887 
888  // remove notices from error reporting
889  if (version_compare(PHP_VERSION, '5.3.0', '>='))
890  {
891  error_reporting(E_ALL);
892  }
893  else
894  {
895  error_reporting(E_ALL);
896  }
897  }
898 
899  include_once "include/inc.debug.php";
900  }

◆ handleMaintenanceMode()

static ilInitialisation::handleMaintenanceMode ( )
staticprotected

handle maintenance mode

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

References 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.
+ 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 93 of file class.ilInitialisation.php.

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

94  {
95  // php5 downward complaince to php 4 dom xml and clone method
96  if (version_compare(PHP_VERSION,'5','>='))
97  {
98  include_once 'Services/Authentication/classes/class.ilAuthFactory.php';
100  {
101  require_once("include/inc.xml5compliance.php");
102  }
103  require_once("include/inc.xsl5compliance.php");
104  }
105  }
+ Here is the call graph for this function:

◆ initAccessHandling()

static ilInitialisation::initAccessHandling ( )
staticprotected

$ilAccess and $rbac...

initialisation

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

References ilRbacSystem\getInstance().

808  {
809  self::initGlobal("rbacreview", "ilRbacReview",
810  "./Services/AccessControl/classes/class.ilRbacReview.php");
811 
812  require_once "./Services/AccessControl/classes/class.ilRbacSystem.php";
813  $rbacsystem = ilRbacSystem::getInstance();
814  self::initGlobal("rbacsystem", $rbacsystem);
815 
816  self::initGlobal("rbacadmin", "ilRbacAdmin",
817  "./Services/AccessControl/classes/class.ilRbacAdmin.php");
818 
819  self::initGlobal("ilAccess", "ilAccessHandler",
820  "./Services/AccessControl/classes/class.ilAccessHandler.php");
821 
822  require_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
823  }
+ Here is the call graph for this function:

◆ initClient()

static ilInitialisation::initClient ( )
staticprotected

Init client-based objects (level 1)

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

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

1002  {
1003  global $https, $ilias;
1004 
1005  self::determineClient();
1006 
1007  self::initClientIniFile();
1008 
1009 
1010  // --- needs client ini
1011 
1012  $ilias->client_id = CLIENT_ID;
1013 
1014  if (DEVMODE)
1015  {
1016  self::handleDevMode();
1017  }
1018 
1019  self::initLog();
1020 
1021  self::handleMaintenanceMode();
1022 
1023  self::initDatabase();
1024 
1025 
1026  // --- needs database
1027 
1028  self::initGlobal("ilAppEventHandler", "ilAppEventHandler",
1029  "./Services/EventHandling/classes/class.ilAppEventHandler.php");
1030 
1031  // there are rare cases where initILIAS is called twice for a request
1032  // example goto.php is called and includes ilias.php later
1033  // we must prevent that ilPluginAdmin is initialized twice in
1034  // this case, since this won't get the values out of plugin.php the
1035  // second time properly
1036  if (!is_object($GLOBALS["ilPluginAdmin"]))
1037  {
1038  self::initGlobal("ilPluginAdmin", "ilPluginAdmin",
1039  "./Services/Component/classes/class.ilPluginAdmin.php");
1040  }
1041 
1042  self::setSessionHandler();
1043 
1044  self::initSettings();
1045 
1046 
1047  // --- needs settings
1048 
1049  self::initLocale();
1050 
1051  if(ilContext::usesHTTP())
1052  {
1053  // $https
1054  self::initGlobal("https", "ilHTTPS", "./Services/Http/classes/class.ilHTTPS.php");
1055  $https->enableSecureCookies();
1056  $https->checkPort();
1057  }
1058 
1059 
1060  // --- object handling
1061 
1062  self::initGlobal("ilObjDataCache", "ilObjectDataCache",
1063  "./Services/Object/classes/class.ilObjectDataCache.php");
1064 
1065  // needed in ilObjectDefinition
1066  require_once "./Services/Xml/classes/class.ilSaxParser.php";
1067 
1068  self::initGlobal("objDefinition", "ilObjectDefinition",
1069  "./Services/Object/classes/class.ilObjectDefinition.php");
1070 
1071  // $tree
1072  require_once "./Services/Tree/classes/class.ilTree.php";
1073  $tree = new ilTree(ROOT_FOLDER_ID);
1074  self::initGlobal("tree", $tree);
1075  unset($tree);
1076 
1077  self::initGlobal("ilCtrl", "ilCtrl",
1078  "./Services/UICore/classes/class.ilCtrl.php");
1079  }
static usesHTTP()
Uses HTTP aka browser.
global $https
Definition: imgupload.php:15
$GLOBALS['ct_recipient']
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 292 of file class.ilInitialisation.php.

References $_COOKIE, $ilIliasIniFile, ILIAS_ABSOLUTE_PATH, ILIAS_WEB_DIR, and ilUtil\setCookie().

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

◆ initCore()

static ilInitialisation::initCore ( )
staticprotected

Init core objects (level 0)

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

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

946  {
947  global $ilErr;
948 
949  // remove notices from error reporting
950  if (version_compare(PHP_VERSION, '5.4.0', '>='))
951  {
952  // Prior to PHP 5.4.0 E_ALL does not include E_STRICT.
953  // With PHP 5.4.0 and above E_ALL >DOES< include E_STRICT.
954 
955  error_reporting(((ini_get("error_reporting") & ~E_NOTICE) & ~E_DEPRECATED) & ~E_STRICT);
956  }
957  elseif (version_compare(PHP_VERSION, '5.3.0', '>='))
958  {
959  error_reporting((ini_get("error_reporting") & ~E_NOTICE) & ~E_DEPRECATED);
960  }
961  else
962  {
963  error_reporting(ini_get('error_reporting') & ~E_NOTICE);
964  }
965  // breaks CAS: must be included after CAS context isset in AuthUtils
966  //self::includePhp5Compliance();
967 
968  self::requireCommonIncludes();
969 
970 
971  // error handler
972  self::initGlobal("ilErr", "ilErrorHandling",
973  "./Services/Init/classes/class.ilErrorHandling.php");
974  $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
975 
976  // :TODO: obsolete?
977  PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, "errorHandler"));
978 
979  // workaround: load old post variables if error handler 'message' was called
980  include_once "Services/Authentication/classes/class.ilSession.php";
981  if (ilSession::get("message"))
982  {
983  $_POST = ilSession::get("post_vars");
984  }
985 
986  self::removeUnsafeCharacters();
987 
988  self::setCookieParams();
989 
990 
991  self::initIliasIniFile();
992 
993 
994  // deprecated
995  self::initGlobal("ilias", "ILIAS", "./Services/Init/classes/class.ilias.php");
996  }
$_POST['username']
Definition: cron.php:12
setErrorHandling($mode=null, $options=null)
Sets how errors generated by this object should be handled.
Definition: PEAR.php:335
const PEAR_ERROR_CALLBACK
Definition: PEAR.php:35
static get($a_var)
Get a value.
+ 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 ilDBWrapperFactory\getWrapper().

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  }
static getWrapper($a_type, $a_inactive_mysqli=null)
+ Here is the call graph for this function:

◆ 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 851 of file class.ilInitialisation.php.

References $GLOBALS.

852  {
853  if($a_source_file)
854  {
855  include_once $a_source_file;
856  $GLOBALS[$a_name] = new $a_class;
857  }
858  else
859  {
860  $GLOBALS[$a_name] = $a_class;
861  }
862  }
$GLOBALS['ct_recipient']

◆ initILIAS()

static ilInitialisation::initILIAS ( )
static

ilias initialisation

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

References ilContext\doAuthentication(), ilContext\hasHTML(), ilContext\hasUser(), ilContext\initClient(), and ilECSTaskScheduler\start().

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

906  {
907  global $tree;
908 
909  self::initCore();
910 
912  {
913  self::initClient();
914 
915  if (ilContext::hasUser())
916  {
917  self::initUser();
918 
920  {
921  self::authenticate();
922  }
923  }
924 
925  // init after Auth otherwise breaks CAS
926  self::includePhp5Compliance();
927 
928  // language may depend on user setting
929  self::initLanguage();
930  $tree->initLangCode();
931 
932  if(ilContext::hasHTML())
933  {
934  include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
936 
937  self::initHTML();
938  }
939  }
940  }
static hasUser()
Based on user authentication?
static start()
Start task scheduler for each server instance.
static hasHTML()
Has HTML output.
static initClient()
Init client.
static doAuthentication()
Try authentication.
+ 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 114 of file class.ilInitialisation.php.

References $ilIliasIniFile.

115  {
116  require_once("./Services/Init/classes/class.ilIniFile.php");
117  $ilIliasIniFile = new ilIniFile("./ilias.ini.php");
118  $ilIliasIniFile->read();
119  self::initGlobal('ilIliasIniFile', $ilIliasIniFile);
120 
121  // initialize constants
122  define("ILIAS_DATA_DIR",$ilIliasIniFile->readVariable("clients","datadir"));
123  define("ILIAS_WEB_DIR",$ilIliasIniFile->readVariable("clients","path"));
124  define("ILIAS_ABSOLUTE_PATH",$ilIliasIniFile->readVariable('server','absolute_path'));
125 
126  // logging
127  define ("ILIAS_LOG_DIR",$ilIliasIniFile->readVariable("log","path"));
128  define ("ILIAS_LOG_FILE",$ilIliasIniFile->readVariable("log","file"));
129  define ("ILIAS_LOG_ENABLED",$ilIliasIniFile->readVariable("log","enabled"));
130  define ("ILIAS_LOG_LEVEL",$ilIliasIniFile->readVariable("log","level"));
131  define ("SLOW_REQUEST_TIME",$ilIliasIniFile->readVariable("log","slow_request_time"));
132 
133  // read path + command for third party tools from ilias.ini
134  define ("PATH_TO_CONVERT",$ilIliasIniFile->readVariable("tools","convert"));
135  define ("PATH_TO_FFMPEG",$ilIliasIniFile->readVariable("tools","ffmpeg"));
136  define ("PATH_TO_ZIP",$ilIliasIniFile->readVariable("tools","zip"));
137  define ("PATH_TO_MKISOFS",$ilIliasIniFile->readVariable("tools","mkisofs"));
138  define ("PATH_TO_UNZIP",$ilIliasIniFile->readVariable("tools","unzip"));
139  define ("PATH_TO_GHOSTSCRIPT",$ilIliasIniFile->readVariable("tools","ghostscript"));
140  define ("PATH_TO_JAVA",$ilIliasIniFile->readVariable("tools","java"));
141  define ("PATH_TO_HTMLDOC",$ilIliasIniFile->readVariable("tools","htmldoc"));
142  define ("URL_TO_LATEX",$ilIliasIniFile->readVariable("tools","latex"));
143  define ("PATH_TO_FOP",$ilIliasIniFile->readVariable("tools","fop"));
144 
145  // read virus scanner settings
146  switch ($ilIliasIniFile->readVariable("tools", "vscantype"))
147  {
148  case "sophos":
149  define("IL_VIRUS_SCANNER", "Sophos");
150  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
151  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
152  break;
153 
154  case "antivir":
155  define("IL_VIRUS_SCANNER", "AntiVir");
156  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
157  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
158  break;
159 
160  case "clamav":
161  define("IL_VIRUS_SCANNER", "ClamAV");
162  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
163  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
164  break;
165 
166  default:
167  define("IL_VIRUS_SCANNER", "None");
168  break;
169  }
170 
171  $tz = $ilIliasIniFile->readVariable("server","timezone");
172  if ($tz != "")
173  {
174  if (function_exists('date_default_timezone_set'))
175  {
176  date_default_timezone_set($tz);
177  }
178  }
179  define ("IL_TIMEZONE", $ilIliasIniFile->readVariable("server","timezone"));
180  }
global $ilIliasIniFile
INIFile Parser.

◆ initLanguage()

static ilInitialisation::initLanguage ( )
staticprotected

$lng initialisation

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

References $_GET, $_POST, $ilSetting, $ilUser, $lng, ilSession\get(), ilLanguage\getInstalledLanguages(), ilSession\set(), and ilUtil\stripSlashes().

747  {
748  global $ilUser, $ilSetting, $rbacsystem;
749 
750  if (!ilSession::get("lang"))
751  {
752  if ($_GET['lang'])
753  {
754  $_GET['lang'] = $_GET['lang'];
755  }
756  else
757  {
758  if (is_object($ilUser))
759  {
760  $_GET['lang'] = $ilUser->getPref('language');
761  }
762  }
763  }
764 
765  if (isset($_POST['change_lang_to']) && $_POST['change_lang_to'] != "")
766  {
767  $_GET['lang'] = ilUtil::stripSlashes($_POST['change_lang_to']);
768  }
769 
770  // prefer personal setting when coming from login screen
771  // Added check for ilUser->getId > 0 because it is 0 when the language is changed and the terms of service should be displayes (Helmut Schottm��ller, 2006-10-14)
772  if (is_object($ilUser) && $ilUser->getId() != ANONYMOUS_USER_ID && $ilUser->getId() > 0)
773  {
774  ilSession::set('lang', $ilUser->getPref('language'));
775  }
776 
777  ilSession::set('lang', (isset($_GET['lang']) && $_GET['lang']) ? $_GET['lang'] : ilSession::get('lang'));
778 
779  // check whether lang selection is valid
780  require_once "./Services/Language/classes/class.ilLanguage.php";
782  if (!in_array(ilSession::get('lang'), $langs))
783  {
784  if (is_object($ilSetting) && $ilSetting->get('language') != '')
785  {
786  ilSession::set('lang', $ilSetting->get('language'));
787  }
788  else
789  {
790  ilSession::set('lang', $langs[0]);
791  }
792  }
793  $_GET['lang'] = ilSession::get('lang');
794 
795  $lng = new ilLanguage(ilSession::get('lang'));
796  self::initGlobal('lng', $lng);
797 
798  if(is_object($rbacsystem))
799  {
800  $rbacsystem->initMemberView();
801  }
802  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
global $lng
Definition: privfeed.php:40
language handling
+ Here is the call graph for this function:

◆ initLocale()

static ilInitialisation::initLocale ( )
staticprotected

Init Locale.

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

References $GLOBALS, and $ilSetting.

600  {
601  global $ilSetting;
602 
603  if (trim($ilSetting->get("locale") != ""))
604  {
605  $larr = explode(",", trim($ilSetting->get("locale")));
606  $ls = array();
607  $first = $larr[0];
608  foreach ($larr as $l)
609  {
610  if (trim($l) != "")
611  {
612  $ls[] = $l;
613  }
614  }
615  if (count($ls) > 0)
616  {
617  setlocale(LC_ALL, $ls);
618  if (class_exists("Collator"))
619  {
620  $GLOBALS["ilCollator"] = new Collator($first);
621  }
622  }
623  }
624  }
$GLOBALS['ct_recipient']
global $ilSetting
Definition: privfeed.php:40

◆ initLog()

static ilInitialisation::initLog ( )
staticprotected

Init log instance.

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

References $log.

829  {
830  require_once "./Services/Logging/classes/class.ilLog.php";
831  try
832  {
833  $log = new ilLog(ILIAS_LOG_DIR,ILIAS_LOG_FILE,CLIENT_ID,ILIAS_LOG_ENABLED,ILIAS_LOG_LEVEL);
834  }
835  catch(ilLogException $e)
836  {
837  self::abortAndDie($e->getMessage());
838  }
839  self::initGlobal("ilLog", $log);
840  // deprecated
841  self::initGlobal("log", $log);
842  }
ILIAS Log exception class.
logging
Definition: class.ilLog.php:18

◆ initSettings()

static ilInitialisation::initSettings ( )
staticprotected

initialise $ilSettings object and define constants

Used in Soap

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

References $ilSetting, ilPaymentSettings\_isPaymentEnabled(), and ilContext\usesHTTP().

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

◆ initStyle()

static ilInitialisation::initStyle ( )
staticprotected

provide $styleDefinition object

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

References $GLOBALS, $ilUser, ilSession\get(), ilPluginAdmin\getPluginObject(), IL_COMP_SERVICE, and ilSession\set().

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

◆ initUser()

static ilInitialisation::initUser ( )
staticprotected

Init user / authentification (level 2)

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

References $_GET, $_POST, $_SESSION, $ilUser, ilSession\_destroy(), ilAuthUtils\_initAuth(), ilSession\SESSION_CLOSE_LOGIN, ilSession\set(), and ilContext\usesHTTP().

1085  {
1086  global $ilias, $ilAuth, $ilUser;
1087 
1088  if(ilContext::usesHTTP())
1089  {
1090  // allow login by submitting user data
1091  // in query string when DEVMODE is enabled
1092  if( DEVMODE
1093  && isset($_GET['username']) && strlen($_GET['username'])
1094  && isset($_GET['password']) && strlen($_GET['password'])
1095  ){
1096  $_POST['username'] = $_GET['username'];
1097  $_POST['password'] = $_GET['password'];
1098  }
1099  }
1100 
1101  // $ilAuth
1102  require_once "Auth/Auth.php";
1103  require_once "./Services/AuthShibboleth/classes/class.ilShibboleth.php";
1104  include_once("./Services/Authentication/classes/class.ilAuthUtils.php");
1106  $ilias->auth = $ilAuth;
1107 
1108  // $ilUser
1109  self::initGlobal("ilUser", "ilObjUser",
1110  "./Services/User/classes/class.ilObjUser.php");
1111  $ilias->account =& $ilUser;
1112 
1113  self::initAccessHandling();
1114 
1115 
1116  // force login
1117  if ((isset($_GET["cmd"]) && $_GET["cmd"] == "force_login"))
1118  {
1119  $ilAuth->logout();
1120 
1121  // we need to do this for the session statistics
1122  // could we use session_destroy() instead?
1123  // [this is done after every $ilAuth->logout() call elsewhere]
1125 
1126  // :TODO: keep session because of cart content?
1127  if(!isset($_GET['forceShoppingCartRedirect']))
1128  {
1129  $_SESSION = array();
1130  }
1131  else
1132  {
1133  ilSession::set("AccountId", "");
1134  }
1135  }
1136 
1137  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static _destroy($a_session_id, $a_closing_context=null, $a_expired_at=null)
Destroy session.
$_POST['username']
Definition: cron.php:12
static usesHTTP()
Uses HTTP aka browser.
$_GET["client_id"]
const SESSION_CLOSE_LOGIN
static set($a_var, $a_val)
Set a value.
_initAuth()
initialises $ilAuth
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ redirect()

static ilInitialisation::redirect (   $a_target,
  $a_message_id,
  $a_message_static 
)
staticprotected

Redirects to target url if context supports it.

Parameters
string$a_target
string$a_message_id
array$a_message_details

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

References ilContext\hasHTML(), ilUtil\redirect(), ilContext\supportsRedirects(), and ilContext\usesHTTP().

1471  {
1472  // #12739
1473  if(defined("ILIAS_HTTP_PATH") &&
1474  !stristr($a_target, ILIAS_HTTP_PATH))
1475  {
1476  $a_target = ILIAS_HTTP_PATH."/".$a_target;
1477  }
1478 
1480  {
1481  ilUtil::redirect($a_target);
1482  }
1483  else
1484  {
1485  $message = self::translateMessage($a_message_id, $a_message_static);
1486 
1487  // user-directed linked message
1489  {
1490  $link = self::translateMessage("init_error_redirect_click",
1491  array("en" => 'Please click to continue.',
1492  "de" => 'Bitte klicken um fortzufahren.'));
1493  $mess = $message.
1494  '<br /><a href="'.$a_target.'">'.$link.'</a>';
1495  }
1496  // plain text
1497  else
1498  {
1499  // not much we can do here
1500  $mess = $message;
1501 
1502  if(!trim($mess))
1503  {
1504  $mess = self::translateMessage("init_error_redirect_info",
1505  array("en" => 'Redirect not supported by context.',
1506  "de" => 'Weiterleitungen werden durch Kontext nicht unterstützt.')).
1507  ' ('.$a_target.')';
1508  }
1509  }
1510 
1511  self::abortAndDie($mess);
1512  }
1513  }
static usesHTTP()
Uses HTTP aka browser.
static hasHTML()
Has HTML output.
static redirect($a_script)
http redirect to other script
static supportsRedirects()
Are redirects supported?
+ Here is the call graph for this function:

◆ removeUnsafeCharacters()

static ilInitialisation::removeUnsafeCharacters ( )
staticprotected

Remove unsafe characters from GET.

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

References $_GET.

33  {
34  // Remove unsafe characters from GET parameters.
35  // We do not need this characters in any case, so it is
36  // feasible to filter them everytime. POST parameters
37  // need attention through ilUtil::stripSlashes() and similar functions)
38  if (is_array($_GET))
39  {
40  foreach($_GET as $k => $v)
41  {
42  // \r\n used for IMAP MX Injection
43  // ' used for SQL Injection
44  $_GET[$k] = str_replace(array("\x00", "\n", "\r", "\\", "'", '"', "\x1a"), "", $v);
45 
46  // this one is for XSS of any kind
47  $_GET[$k] = strip_tags($_GET[$k]);
48  }
49  }
50  }
$_GET["client_id"]

◆ requireCommonIncludes()

static ilInitialisation::requireCommonIncludes ( )
staticprotected

get common include code files

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

References ilContext\usesTemplate().

56  {
57  // pear
58  require_once("include/inc.get_pear.php");
59  require_once("include/inc.check_pear.php");
60  require_once "PEAR.php";
61 
62  // ilTemplate
64  {
65  // HTML_Template_IT support
66  @include_once "HTML/Template/ITX.php"; // new implementation
67  if (class_exists("HTML_Template_ITX"))
68  {
69  include_once "./Services/UICore/classes/class.ilTemplateHTMLITX.php";
70  }
71  else
72  {
73  include_once "HTML/ITX.php"; // old implementation
74  include_once "./Services/UICore/classes/class.ilTemplateITX.php";
75  }
76  require_once "./Services/UICore/classes/class.ilTemplate.php";
77  }
78 
79  // really always required?
80  require_once "./Services/Utilities/classes/class.ilUtil.php";
81  require_once "./Services/Utilities/classes/class.ilFormat.php";
82  require_once "./Services/Calendar/classes/class.ilDatePresentation.php";
83  require_once "include/inc.ilias_version.php";
84 
85  self::initGlobal("ilBench", "ilBenchmark", "./Services/Utilities/classes/class.ilBenchmark.php");
86  }
static usesTemplate()
Uses template engine.
+ Here is the call graph for this function:

◆ setCookieParams()

static ilInitialisation::setCookieParams ( )
staticprotected

set session cookie params for path, domain, etc.

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

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

445  {
446  include_once 'Services/Authentication/classes/class.ilAuthFactory.php';
448  {
449  $cookie_path = '/';
450  }
451  elseif ($GLOBALS['COOKIE_PATH'])
452  {
453  // use a predefined cookie path from WebAccessChecker
454  $cookie_path = $GLOBALS['COOKIE_PATH'];
455  }
456  else
457  {
458  $cookie_path = dirname( $_SERVER['PHP_SELF'] );
459  }
460 
461  /* if ilias is called directly within the docroot $cookie_path
462  is set to '/' expecting on servers running under windows..
463  here it is set to '\'.
464  in both cases a further '/' won't be appended due to the following regex
465  */
466  $cookie_path .= (!preg_match("/[\/|\\\\]$/", $cookie_path)) ? "/" : "";
467 
468  if($cookie_path == "\\") $cookie_path = '/';
469 
470  define('IL_COOKIE_EXPIRE',0);
471  define('IL_COOKIE_PATH',$cookie_path);
472  define('IL_COOKIE_DOMAIN','');
473  define('IL_COOKIE_SECURE',false); // Default Value
474 
475  // session_set_cookie_params() supports 5th parameter
476  // only for php version 5.2.0 and above
477  if( version_compare(PHP_VERSION, '5.2.0', '>=') )
478  {
479  // PHP version >= 5.2.0
480  define('IL_COOKIE_HTTPONLY',true); // Default Value
481  session_set_cookie_params(
482  IL_COOKIE_EXPIRE, IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE, IL_COOKIE_HTTPONLY
483  );
484  }
485  else
486  {
487  // PHP version < 5.2.0
488  session_set_cookie_params(
489  IL_COOKIE_EXPIRE, IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE
490  );
491  }
492  }
const IL_COOKIE_PATH
Definition: index.php:6
$GLOBALS['ct_recipient']
+ 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().

Referenced by CASClient\renameSession().

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  session_regenerate_id();
438  }
439  }
Database Session Handling.
static _exists($a_session_id)
Check whether session exists.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showingLoginForm()

static ilInitialisation::showingLoginForm (   $a_current_script)
staticprotected

Is current view the login form?

Returns
boolean

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

References $_REQUEST.

1387  {
1388  if($a_current_script == "login.php")
1389  {
1390  return true;
1391  }
1392 
1393  if($_REQUEST["baseClass"] == "ilStartUpGUI" &&
1394  self::getCurrentCmd() == "showLogin")
1395  {
1396  return true;
1397  }
1398 
1399  return false;
1400  }
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

◆ 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 1409 of file class.ilInitialisation.php.

References $_REQUEST, $ilSetting, $ilUser, $lang, and $lng.

1410  {
1411  global $ilDB, $lng, $ilSetting, $ilClientIniFile, $ilUser;
1412 
1413  // current language
1414  if(!$lng)
1415  {
1416  $lang = "en";
1417  if($ilUser)
1418  {
1419  $lang = $ilUser->getLanguage();
1420  }
1421  else if($_REQUEST["lang"])
1422  {
1423  $lang = (string)$_REQUEST["lang"];
1424  }
1425  else if($ilSetting)
1426  {
1427  $lang = $ilSetting->get("language");
1428  }
1429  else if($ilClientIniFile)
1430  {
1431  $lang = $ilClientIniFile->readVariable("language", "default");
1432  }
1433  }
1434  else
1435  {
1436  $lang = $lng->getLangKey();
1437  }
1438 
1439  $message = "";
1440  if($ilDB && $a_message_id)
1441  {
1442  if(!$lng)
1443  {
1444  require_once "./Services/Language/classes/class.ilLanguage.php";
1445  $lng = new ilLanguage($lang);
1446  }
1447 
1448  $lng->loadLanguageModule("init");
1449  $message = $lng->txt($a_message_id);
1450  }
1451  else if(is_array($a_message_static))
1452  {
1453  if(!isset($a_message_static[$lang]))
1454  {
1455  $lang = "en";
1456  }
1457  $message = $a_message_static[$lang];
1458  }
1459 
1460  return utf8_decode($message);
1461  }
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
global $lng
Definition: privfeed.php:40
language handling
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

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