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"));
140 define (
"PATH_TO_HTMLDOC",
$ilIliasIniFile->readVariable(
"tools",
"htmldoc"));
141 define (
"URL_TO_LATEX",
$ilIliasIniFile->readVariable(
"tools",
"latex"));
148 define(
"IL_VIRUS_SCANNER",
"Sophos");
149 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
150 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
154 define(
"IL_VIRUS_SCANNER",
"AntiVir");
155 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
156 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
160 define(
"IL_VIRUS_SCANNER",
"ClamAV");
161 define(
"IL_VIRUS_SCAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"scancommand"));
162 define(
"IL_VIRUS_CLEAN_COMMAND",
$ilIliasIniFile->readVariable(
"tools",
"cleancommand"));
166 define(
"IL_VIRUS_SCANNER",
"None");
173 if (function_exists(
'date_default_timezone_set'))
175 date_default_timezone_set($tz);
178 define (
"IL_TIMEZONE",
$ilIliasIniFile->readVariable(
"server",
"timezone"));
186 include_once
'./Services/Http/classes/class.ilHTTPS.php';
191 $protocol =
'https://';
195 $protocol =
'http://';
197 $host = $_SERVER[
'HTTP_HOST'];
199 $rq_uri = $_SERVER[
'REQUEST_URI'];
203 if (is_int($pos = strpos($rq_uri,
"?")))
205 $rq_uri = substr($rq_uri, 0, $pos);
208 if(!defined(
'ILIAS_MODULE'))
210 $path = pathinfo($rq_uri);
211 if(!
$path[
'extension'])
217 $uri = dirname($rq_uri);
223 $path = dirname($rq_uri);
229 $dirs = explode(
'/',$module);
231 foreach(
$dirs as $dir)
233 $uri = dirname($uri);
249 if (!is_object($ilIliasIniFile))
251 self::abortAndDie(
"Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.");
255 if (
$_GET[
"client_id"] !=
"")
258 if (!defined(
"IL_PHPUNIT_TEST"))
266 $client_id = $ilIliasIniFile->readVariable(
"clients",
"default");
269 if (!defined(
"IL_PHPUNIT_TEST"))
271 define (
"CLIENT_ID",
$_COOKIE[
"ilClientId"]);
275 define (
"CLIENT_ID",
$_GET[
"client_id"]);
298 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
304 self::abortAndDie(
"Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
307 $ini_file =
"./".ILIAS_WEB_DIR.
"/".CLIENT_ID.
"/client.ini.php";
310 require_once(
"./Services/Init/classes/class.ilIniFile.php");
311 $ilClientIniFile =
new ilIniFile($ini_file);
312 $ilClientIniFile->read();
315 if ($ilClientIniFile->ERROR !=
"")
318 $default_client = $ilIliasIniFile->readVariable(
"clients",
"default");
320 if (CLIENT_ID !=
"" && CLIENT_ID != $default_client)
323 "Client does not exist.");
334 define (
"SESSION_REMINDER_LEADTIME", 30);
335 define (
"DEBUG",$ilClientIniFile->readVariable(
"system",
"DEBUG"));
336 define (
"DEVMODE",$ilClientIniFile->readVariable(
"system",
"DEVMODE"));
337 define (
"SHOWNOTICES",$ilClientIniFile->readVariable(
"system",
"SHOWNOTICES"));
338 define (
"ROOT_FOLDER_ID",$ilClientIniFile->readVariable(
'system',
'ROOT_FOLDER_ID'));
339 define (
"SYSTEM_FOLDER_ID",$ilClientIniFile->readVariable(
'system',
'SYSTEM_FOLDER_ID'));
340 define (
"ROLE_FOLDER_ID",$ilClientIniFile->readVariable(
'system',
'ROLE_FOLDER_ID'));
341 define (
"MAIL_SETTINGS_ID",$ilClientIniFile->readVariable(
'system',
'MAIL_SETTINGS_ID'));
345 define (
"OH_REF_ID",$ilClientIniFile->readVariable(
"system",
"OH_REF_ID"));
347 define (
"SYSTEM_MAIL_ADDRESS",$ilClientIniFile->readVariable(
'system',
'MAIL_SENT_ADDRESS'));
348 define (
"MAIL_REPLY_WARNING",$ilClientIniFile->readVariable(
'system',
'MAIL_REPLY_WARNING'));
350 define (
"MAXLENGTH_OBJ_TITLE",125);#$ilClientIniFile->readVariable(
'system',
'MAXLENGTH_OBJ_TITLE'));
351 define (
"MAXLENGTH_OBJ_DESC",$ilClientIniFile->readVariable(
'system',
'MAXLENGTH_OBJ_DESC'));
353 define (
"CLIENT_DATA_DIR",ILIAS_DATA_DIR.
"/".CLIENT_ID);
355 define (
"CLIENT_NAME",$ilClientIniFile->readVariable(
'client',
'name'));
357 $val = $ilClientIniFile->readVariable(
"db",
"type");
360 define (
"IL_DB_TYPE",
"mysql");
364 define (
"IL_DB_TYPE", $val);
375 global $ilClientIniFile;
377 if (!$ilClientIniFile->readVariable(
"client",
"access"))
379 $mess =
"The server is not available due to maintenance.".
380 " We apologise for any inconvenience.";
400 require_once(
"./Services/Database/classes/class.ilDBWrapperFactory.php");
402 $ilDB->initFromIniFile();
415 if(ini_get(
'session.save_handler') !=
'user')
417 ini_set(
"session.save_handler",
"user");
420 require_once
"Services/Authentication/classes/class.ilSessionDBHandler.php";
422 if (!$db_session_handler->setSaveHandler())
424 self::abortAndDie(
"Please turn off Safe mode OR set session.save_handler to \"user\" in your php.ini");
430 session_regenerate_id();
439 include_once
'Services/Authentication/classes/class.ilAuthFactory.php';
447 $cookie_path =
$GLOBALS[
'COOKIE_PATH'];
451 $cookie_path = dirname( $_SERVER[
'PHP_SELF'] );
459 $cookie_path .= (!preg_match(
"/[\/|\\\\]$/", $cookie_path)) ?
"/" :
"";
461 if($cookie_path ==
"\\") $cookie_path =
'/';
463 define(
'IL_COOKIE_EXPIRE',0);
464 define(
'IL_COOKIE_PATH',$cookie_path);
465 define(
'IL_COOKIE_DOMAIN',
'');
466 define(
'IL_COOKIE_SECURE',
false);
470 if( version_compare(PHP_VERSION,
'5.2.0',
'>=') )
473 define(
'IL_COOKIE_HTTPONLY',
false);
474 session_set_cookie_params(
475 IL_COOKIE_EXPIRE,
IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE, IL_COOKIE_HTTPONLY
481 session_set_cookie_params(
482 IL_COOKIE_EXPIRE,
IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE
497 "Services/Administration/classes/class.ilSetting.php");
500 if (!$ilSetting->get(
"setup_ok"))
506 define (
"ANONYMOUS_USER_ID", $ilSetting->get(
"anonymous_user_id"));
507 define (
"ANONYMOUS_ROLE_ID", $ilSetting->get(
"anonymous_role_id"));
508 define (
"SYSTEM_USER_ID", $ilSetting->get(
"system_user_id"));
509 define (
"SYSTEM_ROLE_ID", $ilSetting->get(
"system_role_id"));
510 define (
"USER_FOLDER_ID", 7);
513 define (
"RECOVERY_FOLDER_ID", $ilSetting->get(
"recovery_folder_id"));
516 define (
"IL_INST_ID", $ilSetting->get(
"inst_id",0));
519 define (
"SUFFIX_REPL_DEFAULT",
"php,php3,php4,inc,lang,phtml,htaccess");
520 define (
"SUFFIX_REPL_ADDITIONAL", $ilSetting->get(
"suffix_repl_additional"));
528 require_once(
'Services/Payment/classes/class.ilPaymentSettings.php');
537 global $styleDefinition, $ilPluginAdmin;
541 "./Services/Style/classes/class.ilStyleDefinition.php");
544 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"UIComponent",
"uihk");
545 foreach ($pl_names as $pl)
548 $gui_class = $ui_plugin->getUIClassInstance();
549 $gui_class->modifyGUI(
"Services/Init",
"init_style", array(
"styleDefinition" => $styleDefinition));
552 $styleDefinition->startParsing();
571 $ilUser->setId($uid);
595 if (strtolower(
$_GET[
"cmdClass"]) ==
"ilstartupgui" &&
596 (strtolower(
$_GET[
"cmd"]) ==
"getacceptance" ||
597 (is_array(
$_POST[
"cmd"]) &&
598 key(
$_POST[
"cmd"]) ==
"getAcceptance")))
604 $a_user->
getId() != ANONYMOUS_USER_ID &&
607 if(!defined(
'IL_CERT_SSO'))
609 self::redirect(
'ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&target='.
$_GET[
'target'].
'&cmd=getAcceptance',
610 'User Agreement not accepted.');
622 if (trim($ilSetting->get(
"locale") !=
""))
624 $larr = explode(
",", trim($ilSetting->get(
"locale")));
627 foreach ($larr as $l)
636 setlocale(LC_ALL, $ls);
637 if (class_exists(
"Collator"))
639 $GLOBALS[
"ilCollator"] =
new Collator($first);
654 if (ANONYMOUS_USER_ID ==
"")
676 $_POST[
"username"] =
"anonymous";
677 $_POST[
"password"] =
"anonymous";
681 $oldSid = session_id();
683 if (IS_PAYMENT_ENABLED)
685 $newSid = session_id();
686 if($oldSid != $newSid)
688 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
689 ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
693 if (!$ilAuth->getAuth())
695 self::abortAndDie(
"ANONYMOUS user with the object_id ".ANONYMOUS_USER_ID.
" not found!");
700 $mess =
"Authentication failed.";
703 if (
$_GET[
"target"] !=
"")
706 $current_script = substr(strrchr($_SERVER[
"PHP_SELF"],
"/"), 1);
707 if($current_script ==
"goto.php")
717 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
718 $_GET[
"cmd"] =
"frameset";
719 self::redirect(
"ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=".
720 $_GET[
"cmd"].
"&ref_id=".
$_GET[
"ref_id"], $mess);
747 if (
$_GET[
"soap_pw"] !=
"")
749 $add =
"&soap_pw=".$_GET[
"soap_pw"].
"&ext_uid=".
$_GET[
"ext_uid"];
752 $script =
"login.php?target=".$_GET[
"target"].
"&client_id=".
$_COOKIE[
"ilClientId"].
753 "&auth_stat=".$a_auth_stat.$add;
773 if (is_object($ilUser))
775 $_GET[
'lang'] = $ilUser->getPref(
'language');
780 if (isset(
$_POST[
'change_lang_to']) &&
$_POST[
'change_lang_to'] !=
"")
787 if (is_object($ilUser) && $ilUser->getId() != ANONYMOUS_USER_ID && $ilUser->getId() > 0)
795 require_once
"./Services/Language/classes/class.ilLanguage.php";
799 if (is_object($ilSetting) && $ilSetting->get(
'language') !=
'')
813 if(is_object($rbacsystem))
815 $rbacsystem->initMemberView();
825 "./Services/AccessControl/classes/class.ilRbacReview.php");
827 require_once
"./Services/AccessControl/classes/class.ilRbacSystem.php";
832 "./Services/AccessControl/classes/class.ilRbacAdmin.php");
835 "./Services/AccessControl/classes/class.ilAccessHandler.php");
837 require_once
"./Services/AccessControl/classes/class.ilConditionHandler.php";
845 require_once
"./Services/Logging/classes/class.ilLog.php";
846 $log =
new ilLog(ILIAS_LOG_DIR,ILIAS_LOG_FILE,CLIENT_ID,ILIAS_LOG_ENABLED,ILIAS_LOG_LEVEL);
860 protected static function initGlobal($a_name, $a_class, $a_source_file = null)
864 include_once $a_source_file;
882 $GLOBALS[
'ilLog']->write(
"Fatal Error: ilInitialisation - ".$a_message);
892 if(defined(SHOWNOTICES) && SHOWNOTICES)
898 if (version_compare(PHP_VERSION,
'5.3.0',
'>='))
900 error_reporting(E_ALL);
904 error_reporting(E_ALL);
908 include_once
"include/inc.debug.php";
939 $tree->initLangCode();
943 include_once(
'./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
959 if (version_compare(PHP_VERSION,
'5.4.0',
'>='))
964 error_reporting(((ini_get(
"error_reporting") & ~E_NOTICE) & ~E_DEPRECATED) & ~E_STRICT);
966 elseif (version_compare(PHP_VERSION,
'5.3.0',
'>='))
968 error_reporting((ini_get(
"error_reporting") & ~E_NOTICE) & ~E_DEPRECATED);
972 error_reporting(ini_get(
'error_reporting') & ~E_NOTICE);
982 "./Services/Init/classes/class.ilErrorHandling.php");
989 include_once
"Services/Authentication/classes/class.ilSession.php";
1004 self::initGlobal(
"ilias",
"ILIAS",
"./Services/Init/classes/class.ilias.php");
1021 $ilias->client_id = CLIENT_ID;
1038 "./Services/EventHandling/classes/class.ilAppEventHandler.php");
1045 if (!is_object(
$GLOBALS[
"ilPluginAdmin"]))
1048 "./Services/Component/classes/class.ilPluginAdmin.php");
1063 self::initGlobal(
"https",
"ilHTTPS",
"./Services/Http/classes/class.ilHTTPS.php");
1064 $https->enableSecureCookies();
1065 $https->checkPort();
1072 "./Services/Object/classes/class.ilObjectDataCache.php");
1075 require_once
"./Services/Xml/classes/class.ilSaxParser.php";
1078 "./Services/Object/classes/class.ilObjectDefinition.php");
1081 require_once
"./Services/Tree/classes/class.ilTree.php";
1082 $tree =
new ilTree(ROOT_FOLDER_ID);
1087 "./Services/UICore/classes/class.ilCtrl.php");
1095 global $ilias, $ilAuth,
$ilUser;
1102 && isset(
$_GET[
'username']) && strlen(
$_GET[
'username'])
1103 && isset(
$_GET[
'password']) && strlen(
$_GET[
'password'])
1111 require_once
"Auth/Auth.php";
1112 require_once
"./Services/AuthShibboleth/classes/class.ilShibboleth.php";
1113 include_once(
"./Services/Authentication/classes/class.ilAuthUtils.php");
1115 $ilias->auth = $ilAuth;
1119 "./Services/User/classes/class.ilObjUser.php");
1126 if ((isset(
$_GET[
"cmd"]) &&
$_GET[
"cmd"] ==
"force_login"))
1136 if(!isset(
$_GET[
'forceShoppingCartRedirect']))
1155 global $ilAuth, $ilias,
$ilErr;
1157 $current_script = substr(strrchr($_SERVER[
"PHP_SELF"],
"/"), 1);
1159 if(self::blockedAuthentication($current_script))
1164 $oldSid = session_id();
1167 $ilias->setAuthError($ilErr->getLastError());
1169 if(IS_PAYMENT_ENABLED)
1172 $newSid = session_id();
1173 if($oldSid != $newSid)
1175 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
1176 ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
1180 if($ilAuth->getAuth() && $ilAuth->getStatus() ==
'')
1184 self::handleAuthenticationSuccess();
1188 if (!self::showingLoginForm($current_script))
1191 $mandatory_auth = ($current_script !=
"shib_login.php"
1192 && $current_script !=
"shib_logout.php"
1193 && $current_script !=
"error.php"
1194 && $current_script !=
"chat.php"
1195 && $current_script !=
"index.php");
1199 self::handleAuthenticationFail();
1208 protected static function handleAuthenticationSuccess()
1215 require_once
'Services/Tracking/classes/class.ilOnlineTracking.php';
1216 ilOnlineTracking::updateAccess($ilUser);
1222 protected static function handleAuthenticationFail()
1233 throw new Exception(
"Authentication failed.");
1236 $status = $ilAuth->getStatus();
1238 if($ilSetting->get(
'pub_section') &&
1240 $_GET[
'reloadpublic'] !=
'1'
1268 $tpl->setVariable(
"LOCATION_STYLESHEET",$location_stylesheet);
1270 require_once
"./Services/UICore/classes/class.ilFrameTargetInfo.php";
1273 "Services/Navigation/classes/class.ilNavigationHistory.php");
1276 "./Services/Utilities/classes/class.ilBrowser.php");
1279 "Services/Help/classes/class.ilHelpGUI.php");
1282 "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php");
1285 "./Services/Locator/classes/class.ilLocatorGUI.php");
1288 "./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php");
1291 include_once
'./Services/MainMenu/classes/class.ilMainMenuGUI.php';
1300 $_GET[
'limit'] = (int) $ilUser->getPref(
'hits_per_page');
1309 if (isset(
$_GET[
'offset']) &&
$_GET[
'offset'] !=
"")
1325 return array_shift(array_keys(
$cmd));
1340 if($a_current_script ==
"register.php" ||
1341 $a_current_script ==
"pwassist.php" ||
1342 $a_current_script ==
"confirmReg.php")
1347 if(
$_REQUEST[
"baseClass"] ==
"ilStartUpGUI")
1351 if($cmd_class ==
"ilaccountregistrationgui" ||
1352 $cmd_class ==
"ilpasswordassistancegui")
1358 if(
$cmd ==
"showUserAgreement" ||
$cmd ==
"showClientList" ||
1359 $cmd ==
'showAccountMigration' ||
$cmd ==
'migrateAccount' ||
1360 $cmd ==
'processCode')
1376 if($a_current_script ==
"login.php")
1381 if(
$_REQUEST[
"baseClass"] ==
"ilStartUpGUI" &&
1382 self::getCurrentCmd() ==
"showLogin")
1396 protected static function redirect($a_target, $a_message_details)
1399 if(defined(
"ILIAS_HTTP_PATH") &&
1400 !stristr($a_target, ILIAS_HTTP_PATH))
1402 $a_target = ILIAS_HTTP_PATH.
"/".$a_target;
1414 $mess = $a_message_details.
1415 ' Please <a href="'.$a_target.
'">click here</a> to continue.';
1421 $mess = $a_message_details;
1425 $mess =
'Redirect not supported by context ('.$a_target.
')';