7 $GLOBALS[
'ilGlobalStartTime'] = microtime();
10 include_once
"Services/Context/classes/class.ilContext.php";
40 foreach(
$_GET as $k => $v)
44 $_GET[$k] = str_replace(array(
"\x00",
"\n",
"\r",
"\\",
"'",
'"',
"\x1a"),
"", $v);
58 require_once(
"include/inc.get_pear.php");
59 require_once(
"include/inc.check_pear.php");
60 require_once
"PEAR.php";
66 @include_once
"HTML/Template/ITX.php";
67 if (class_exists(
"HTML_Template_ITX"))
69 include_once
"./Services/UICore/classes/class.ilTemplateHTMLITX.php";
73 include_once
"HTML/ITX.php";
74 include_once
"./Services/UICore/classes/class.ilTemplateITX.php";
76 require_once
"./Services/UICore/classes/class.ilTemplate.php";
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";
85 self::initGlobal(
"ilBench",
"ilBenchmark",
"./Services/Utilities/classes/class.ilBenchmark.php");
96 if (version_compare(PHP_VERSION,
'5',
'>='))
98 include_once
'Services/Authentication/classes/class.ilAuthFactory.php';
101 require_once(
"include/inc.xml5compliance.php");
103 require_once(
"include/inc.xsl5compliance.php");
116 require_once(
"./Services/Init/classes/class.ilIniFile.php");
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'));
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"));
134 define (
"PATH_TO_CONVERT",
$ilIliasIniFile->readVariable(
"tools",
"convert"));
135 define (
"PATH_TO_FFMPEG",
$ilIliasIniFile->readVariable(
"tools",
"ffmpeg"));
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"));
141 define (
"PATH_TO_HTMLDOC",
$ilIliasIniFile->readVariable(
"tools",
"htmldoc"));
142 define (
"URL_TO_LATEX",
$ilIliasIniFile->readVariable(
"tools",
"latex"));
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"));
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"));
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"));
167 define(
"IL_VIRUS_SCANNER",
"None");
174 if (function_exists(
'date_default_timezone_set'))
176 date_default_timezone_set($tz);
179 define (
"IL_TIMEZONE",
$ilIliasIniFile->readVariable(
"server",
"timezone"));
187 include_once
'./Services/Http/classes/class.ilHTTPS.php';
192 $protocol =
'https://';
196 $protocol =
'http://';
198 $host = $_SERVER[
'HTTP_HOST'];
200 $rq_uri = $_SERVER[
'REQUEST_URI'];
204 if (is_int($pos = strpos($rq_uri,
"?")))
206 $rq_uri = substr($rq_uri, 0, $pos);
209 if(!defined(
'ILIAS_MODULE'))
211 $path = pathinfo($rq_uri);
212 if(!
$path[
'extension'])
218 $uri = dirname($rq_uri);
224 $path = dirname($rq_uri);
230 $dirs = explode(
'/',$module);
232 foreach(
$dirs as $dir)
234 $uri = dirname($uri);
250 if (!is_object($ilIliasIniFile))
252 self::abortAndDie(
"Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.");
256 if (
$_GET[
"client_id"] !=
"")
259 if (!defined(
"IL_PHPUNIT_TEST"))
267 $client_id = $ilIliasIniFile->readVariable(
"clients",
"default");
270 if (!defined(
"IL_PHPUNIT_TEST"))
272 define (
"CLIENT_ID",
$_COOKIE[
"ilClientId"]);
276 define (
"CLIENT_ID",
$_GET[
"client_id"]);
299 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
305 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
308 $ini_file =
"./".ILIAS_WEB_DIR.
"/".CLIENT_ID.
"/client.ini.php";
311 require_once(
"./Services/Init/classes/class.ilIniFile.php");
312 $ilClientIniFile =
new ilIniFile($ini_file);
313 $ilClientIniFile->read();
316 if ($ilClientIniFile->ERROR !=
"")
319 $default_client = $ilIliasIniFile->readVariable(
"clients",
"default");
321 if (CLIENT_ID !=
"" && CLIENT_ID != $default_client)
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);
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'));
347 define (
"OH_REF_ID",$ilClientIniFile->readVariable(
"system",
"OH_REF_ID"));
349 define (
"SYSTEM_MAIL_ADDRESS",$ilClientIniFile->readVariable(
'system',
'MAIL_SENT_ADDRESS'));
350 define (
"MAIL_REPLY_WARNING",$ilClientIniFile->readVariable(
'system',
'MAIL_REPLY_WARNING'));
356 define (
"CLIENT_DATA_DIR",ILIAS_DATA_DIR.
"/".CLIENT_ID);
358 define (
"CLIENT_NAME",$ilClientIniFile->readVariable(
'client',
'name'));
360 $val = $ilClientIniFile->readVariable(
"db",
"type");
363 define (
"IL_DB_TYPE",
"mysql");
367 define (
"IL_DB_TYPE", $val);
378 global $ilClientIniFile;
380 if (!$ilClientIniFile->readVariable(
"client",
"access"))
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";
407 require_once(
"./Services/Database/classes/class.ilDBWrapperFactory.php");
409 $ilDB->initFromIniFile();
422 if(ini_get(
'session.save_handler') !=
'user')
424 ini_set(
"session.save_handler",
"user");
427 require_once
"Services/Authentication/classes/class.ilSessionDBHandler.php";
429 if (!$db_session_handler->setSaveHandler())
431 self::abortAndDie(
"Please turn off Safe mode OR set session.save_handler to \"user\" in your php.ini");
437 session_regenerate_id();
446 include_once
'Services/Authentication/classes/class.ilAuthFactory.php';
454 $cookie_path =
$GLOBALS[
'COOKIE_PATH'];
458 $cookie_path = dirname( $_SERVER[
'PHP_SELF'] );
466 $cookie_path .= (!preg_match(
"/[\/|\\\\]$/", $cookie_path)) ?
"/" :
"";
468 if($cookie_path ==
"\\") $cookie_path =
'/';
470 define(
'IL_COOKIE_EXPIRE',0);
471 define(
'IL_COOKIE_PATH',$cookie_path);
472 define(
'IL_COOKIE_DOMAIN',
'');
473 define(
'IL_COOKIE_SECURE',
false);
477 if( version_compare(PHP_VERSION,
'5.2.0',
'>=') )
480 define(
'IL_COOKIE_HTTPONLY',
true);
481 session_set_cookie_params(
482 IL_COOKIE_EXPIRE,
IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE, IL_COOKIE_HTTPONLY
488 session_set_cookie_params(
489 IL_COOKIE_EXPIRE,
IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE
504 "Services/Administration/classes/class.ilSetting.php");
507 if (!$ilSetting->get(
"setup_ok"))
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);
520 define (
"RECOVERY_FOLDER_ID", $ilSetting->get(
"recovery_folder_id"));
523 define (
"IL_INST_ID", $ilSetting->get(
"inst_id",0));
526 define (
"SUFFIX_REPL_DEFAULT",
"php,php3,php4,inc,lang,phtml,htaccess");
527 define (
"SUFFIX_REPL_ADDITIONAL", $ilSetting->get(
"suffix_repl_additional"));
535 require_once(
'Services/Payment/classes/class.ilPaymentSettings.php');
544 global $styleDefinition, $ilPluginAdmin;
548 "./Services/Style/classes/class.ilStyleDefinition.php");
551 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"UIComponent",
"uihk");
552 foreach ($pl_names as $pl)
555 $gui_class = $ui_plugin->getUIClassInstance();
556 $gui_class->modifyGUI(
"Services/Init",
"init_style", array(
"styleDefinition" => $styleDefinition));
559 $styleDefinition->startParsing();
565 public static function initUserAccount()
577 $ilUser->hasToAcceptTermsOfServiceInSession(
true);
583 $ilUser->setId($uid);
603 if (trim($ilSetting->get(
"locale") !=
""))
605 $larr = explode(
",", trim($ilSetting->get(
"locale")));
608 foreach ($larr as $l)
617 setlocale(LC_ALL, $ls);
618 if (class_exists(
"Collator"))
620 $GLOBALS[
"ilCollator"] =
new Collator($first);
635 if (ANONYMOUS_USER_ID ==
"")
657 $_POST[
"username"] =
"anonymous";
658 $_POST[
"password"] =
"anonymous";
662 $oldSid = session_id();
664 if (IS_PAYMENT_ENABLED)
666 $newSid = session_id();
667 if($oldSid != $newSid)
669 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
670 ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
674 if (!$ilAuth->getAuth())
676 self::abortAndDie(
"ANONYMOUS user with the object_id ".ANONYMOUS_USER_ID.
" not found!");
679 self::initUserAccount();
681 $mess_id =
"init_error_authentication_fail";
682 $mess = array(
"en" =>
"Authentication failed.",
683 "de" =>
"Authentifizierung fehlgeschlagen.");
686 if (
$_GET[
"target"] !=
"")
689 $current_script = substr(strrchr($_SERVER[
"PHP_SELF"],
"/"), 1);
690 if($current_script ==
"goto.php")
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);
730 if (
$_GET[
"soap_pw"] !=
"")
732 $add =
"&soap_pw=".$_GET[
"soap_pw"].
"&ext_uid=".
$_GET[
"ext_uid"];
735 $script =
"login.php?target=".$_GET[
"target"].
"&client_id=".
$_COOKIE[
"ilClientId"].
736 "&auth_stat=".$a_auth_stat.$add;
739 array(
"en" =>
"Authentication failed.",
740 "de" =>
"Authentifizierung fehlgeschlagen."));
758 if (is_object($ilUser))
760 $_GET[
'lang'] = $ilUser->getPref(
'language');
765 if (isset(
$_POST[
'change_lang_to']) &&
$_POST[
'change_lang_to'] !=
"")
772 if (is_object($ilUser) && $ilUser->getId() != ANONYMOUS_USER_ID && $ilUser->getId() > 0)
780 require_once
"./Services/Language/classes/class.ilLanguage.php";
784 if (is_object($ilSetting) && $ilSetting->get(
'language') !=
'')
798 if(is_object($rbacsystem))
800 $rbacsystem->initMemberView();
810 "./Services/AccessControl/classes/class.ilRbacReview.php");
812 require_once
"./Services/AccessControl/classes/class.ilRbacSystem.php";
817 "./Services/AccessControl/classes/class.ilRbacAdmin.php");
820 "./Services/AccessControl/classes/class.ilAccessHandler.php");
822 require_once
"./Services/AccessControl/classes/class.ilConditionHandler.php";
830 require_once
"./Services/Logging/classes/class.ilLog.php";
833 $log =
new ilLog(ILIAS_LOG_DIR,ILIAS_LOG_FILE,CLIENT_ID,ILIAS_LOG_ENABLED,ILIAS_LOG_LEVEL);
851 protected static function initGlobal($a_name, $a_class, $a_source_file = null)
855 include_once $a_source_file;
873 $GLOBALS[
'ilLog']->write(
"Fatal Error: ilInitialisation - ".$a_message);
883 if(defined(SHOWNOTICES) && SHOWNOTICES)
889 if (version_compare(PHP_VERSION,
'5.3.0',
'>='))
891 error_reporting(E_ALL);
895 error_reporting(E_ALL);
899 include_once
"include/inc.debug.php";
930 $tree->initLangCode();
934 include_once(
'./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
950 if (version_compare(PHP_VERSION,
'5.4.0',
'>='))
955 error_reporting(((ini_get(
"error_reporting") & ~E_NOTICE) & ~E_DEPRECATED) & ~E_STRICT);
957 elseif (version_compare(PHP_VERSION,
'5.3.0',
'>='))
959 error_reporting((ini_get(
"error_reporting") & ~E_NOTICE) & ~E_DEPRECATED);
963 error_reporting(ini_get(
'error_reporting') & ~E_NOTICE);
973 "./Services/Init/classes/class.ilErrorHandling.php");
980 include_once
"Services/Authentication/classes/class.ilSession.php";
995 self::initGlobal(
"ilias",
"ILIAS",
"./Services/Init/classes/class.ilias.php");
1012 $ilias->client_id = CLIENT_ID;
1029 "./Services/EventHandling/classes/class.ilAppEventHandler.php");
1036 if (!is_object(
$GLOBALS[
"ilPluginAdmin"]))
1039 "./Services/Component/classes/class.ilPluginAdmin.php");
1054 self::initGlobal(
"https",
"ilHTTPS",
"./Services/Http/classes/class.ilHTTPS.php");
1055 $https->enableSecureCookies();
1056 $https->checkPort();
1063 "./Services/Object/classes/class.ilObjectDataCache.php");
1066 require_once
"./Services/Xml/classes/class.ilSaxParser.php";
1069 "./Services/Object/classes/class.ilObjectDefinition.php");
1072 require_once
"./Services/Tree/classes/class.ilTree.php";
1073 $tree =
new ilTree(ROOT_FOLDER_ID);
1078 "./Services/UICore/classes/class.ilCtrl.php");
1086 global $ilias, $ilAuth,
$ilUser;
1093 && isset(
$_GET[
'username']) && strlen(
$_GET[
'username'])
1094 && isset(
$_GET[
'password']) && strlen(
$_GET[
'password'])
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;
1110 "./Services/User/classes/class.ilObjUser.php");
1117 if ((isset(
$_GET[
"cmd"]) &&
$_GET[
"cmd"] ==
"force_login"))
1127 if(!isset(
$_GET[
'forceShoppingCartRedirect']))
1146 global $ilAuth, $ilias,
$ilErr;
1148 $current_script = substr(strrchr($_SERVER[
"PHP_SELF"],
"/"), 1);
1150 if(self::blockedAuthentication($current_script))
1155 $oldSid = session_id();
1158 $ilias->setAuthError($ilErr->getLastError());
1160 if(IS_PAYMENT_ENABLED)
1163 $newSid = session_id();
1164 if($oldSid != $newSid)
1166 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
1167 ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
1171 if($ilAuth->getAuth() && $ilAuth->getStatus() ==
'')
1173 self::initUserAccount();
1175 self::handleAuthenticationSuccess();
1179 if (!self::showingLoginForm($current_script))
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");
1190 self::handleAuthenticationFail();
1199 protected static function handleAuthenticationSuccess()
1206 require_once
'Services/Tracking/classes/class.ilOnlineTracking.php';
1207 ilOnlineTracking::updateAccess($ilUser);
1213 protected static function handleAuthenticationFail()
1224 throw new Exception(
"Authentication failed.");
1227 $status = $ilAuth->getStatus();
1229 if($ilSetting->get(
'pub_section') &&
1231 $_GET[
'reloadpublic'] !=
'1'
1245 protected static function initHTML()
1264 require_once
'Services/User/classes/class.ilUserRequestTargetAdjustment.php';
1266 $request_adjuster->adjust();
1271 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
1273 require_once
"./Services/UICore/classes/class.ilFrameTargetInfo.php";
1276 "Services/Navigation/classes/class.ilNavigationHistory.php");
1279 "./Services/Utilities/classes/class.ilBrowser.php");
1282 "Services/Help/classes/class.ilHelpGUI.php");
1285 "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php");
1288 "./Services/Locator/classes/class.ilLocatorGUI.php");
1291 "./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php");
1294 include_once
'./Services/MainMenu/classes/class.ilMainMenuGUI.php';
1303 $_GET[
'limit'] = (int) $ilUser->getPref(
'hits_per_page');
1312 if (isset(
$_GET[
'offset']) &&
$_GET[
'offset'] !=
"")
1328 return array_shift(array_keys(
$cmd));
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")
1352 if(
$_REQUEST[
"baseClass"] ==
"ilStartUpGUI")
1356 if($cmd_class ==
"ilaccountregistrationgui" ||
1357 $cmd_class ==
"ilpasswordassistancegui")
1363 if(
$cmd ==
"showTermsOfService" ||
$cmd ==
"showClientList" ||
1364 $cmd ==
'showAccountMigration' ||
$cmd ==
'migrateAccount' ||
1365 $cmd ==
'processCode')
1372 if(($a_current_script ==
"goto.php" &&
$_GET[
"target"] ==
"impr_0") ||
1373 $_GET[
"baseClass"] ==
"ilImprintGUI")
1388 if($a_current_script ==
"login.php")
1393 if(
$_REQUEST[
"baseClass"] ==
"ilStartUpGUI" &&
1394 self::getCurrentCmd() ==
"showLogin")
1419 $lang = $ilUser->getLanguage();
1427 $lang = $ilSetting->get(
"language");
1429 else if($ilClientIniFile)
1431 $lang = $ilClientIniFile->readVariable(
"language",
"default");
1436 $lang = $lng->getLangKey();
1440 if($ilDB && $a_message_id)
1444 require_once
"./Services/Language/classes/class.ilLanguage.php";
1448 $lng->loadLanguageModule(
"init");
1449 $message = $lng->txt($a_message_id);
1451 else if(is_array($a_message_static))
1453 if(!isset($a_message_static[
$lang]))
1457 $message = $a_message_static[
$lang];
1460 return utf8_decode($message);
1470 protected static function redirect($a_target, $a_message_id, $a_message_static)
1473 if(defined(
"ILIAS_HTTP_PATH") &&
1474 !stristr($a_target, ILIAS_HTTP_PATH))
1476 $a_target = ILIAS_HTTP_PATH.
"/".$a_target;
1491 array(
"en" =>
'Please click to continue.',
1492 "de" =>
'Bitte klicken um fortzufahren.'));
1494 '<br /><a href="'.$a_target.
'">'.$link.
'</a>';
1505 array(
"en" =>
'Redirect not supported by context.',
1506 "de" =>
'Weiterleitungen werden durch Kontext nicht unterstützt.')).