00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00039 class ilInitialisation
00040 {
00041
00045 function removeUnsafeCharacters()
00046 {
00047
00048
00049
00050
00051 if (is_array($_GET))
00052 {
00053 foreach($_GET as $k => $v)
00054 {
00055
00056
00057 $_GET[$k] = str_replace(array("\x00", "\n", "\r", "\\", "'", '"', "\x1a"), "", $v);
00058
00059
00060 $_GET[$k] = strip_tags($_GET[$k]);
00061 }
00062 }
00063 }
00064
00068 function requireCommonIncludes()
00069 {
00070 global $ilBench;
00071
00072
00073 require_once("include/inc.get_pear.php");
00074 require_once("include/inc.check_pear.php");
00075
00076
00077 require_once "./Services/Utilities/classes/class.ilUtil.php";
00078 require_once "classes/class.ilBenchmark.php";
00079 $ilBench =& new ilBenchmark();
00080 $GLOBALS['ilBench'] =& $ilBench;
00081
00082 $ilBench->start("Core", "HeaderInclude");
00083
00084
00085 $GLOBALS['t_pagestart'] = ilUtil::StopWatch();
00086
00087 $ilBench->start("Core", "HeaderInclude_IncludeFiles");
00088
00089
00090 require_once "PEAR.php";
00091 require_once "DB.php";
00092 require_once "Auth/Auth.php";
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 @include_once "HTML/Template/ITX.php";
00108 if (class_exists("HTML_Template_ITX"))
00109 {
00110 include_once "classes/class.ilTemplateHTMLITX.php";
00111 }
00112 else
00113 {
00114 include_once "HTML/ITX.php";
00115 include_once "classes/class.ilTemplateITX.php";
00116 }
00117
00118 require_once "classes/class.ilTemplate.php";
00119
00120
00121 require_once "include/inc.db_session_handler.php";
00122 require_once "classes/class.ilDBx.php";
00123 require_once "./Services/AuthShibboleth/classes/class.ilShibboleth.php";
00124 require_once "classes/class.ilias.php";
00125 require_once './Services/User/classes/class.ilObjUser.php';
00126 require_once "classes/class.ilFormat.php";
00127 require_once "classes/class.ilSaxParser.php";
00128 require_once "classes/class.ilObjectDefinition.php";
00129 require_once "classes/class.ilStyleDefinition.php";
00130 require_once "./Services/Tree/classes/class.ilTree.php";
00131 require_once "./Services/Language/classes/class.ilLanguage.php";
00132 require_once "./Services/Logging/classes/class.ilLog.php";
00133 require_once "Services/Mail/classes/class.ilMailbox.php";
00134 require_once "classes/class.ilCtrl.php";
00135 require_once "classes/class.ilConditionHandler.php";
00136 require_once "classes/class.ilBrowser.php";
00137 require_once "classes/class.ilFrameTargetInfo.php";
00138 require_once "Services/Navigation/classes/class.ilNavigationHistory.php";
00139 require_once "Services/Help/classes/class.ilHelp.php";
00140 require_once "include/inc.ilias_version.php";
00141
00142
00143 require_once "./Services/AccessControl/classes/class.ilAccessHandler.php";
00144 require_once "./Services/AccessControl/classes/class.ilRbacAdmin.php";
00145 require_once "./Services/AccessControl/classes/class.ilRbacSystem.php";
00146 require_once "./Services/AccessControl/classes/class.ilRbacReview.php";
00147
00148
00149 require_once "classes/class.ilObjectDataCache.php";
00150 require_once 'Services/Tracking/classes/class.ilOnlineTracking.php';
00151
00152
00153
00154 require_once "classes/class.ilLocatorGUI.php";
00155
00156
00157 require_once "classes/class.ilErrorHandling.php";
00158
00159
00160 if (version_compare(PHP_VERSION,'5','>='))
00161 {
00162 require_once("include/inc.xml5compliance.php");
00163
00164
00165 require_once("include/inc.xsl5compliance.php");
00166 require_once("include/inc.php4compliance.php");
00167 }
00168 else
00169 {
00170 require_once("include/inc.php5compliance.php");
00171 }
00172
00173 $ilBench->stop("Core", "HeaderInclude_IncludeFiles");
00174 }
00175
00183 function initIliasIniFile()
00184 {
00185 global $ilIliasIniFile;
00186
00187 require_once("classes/class.ilIniFile.php");
00188 $ilIliasIniFile = new ilIniFile("./ilias.ini.php");
00189 $GLOBALS['ilIliasIniFile'] =& $ilIliasIniFile;
00190 $ilIliasIniFile->read();
00191
00192
00193 define("ILIAS_DATA_DIR",$ilIliasIniFile->readVariable("clients","datadir"));
00194 define("ILIAS_WEB_DIR",$ilIliasIniFile->readVariable("clients","path"));
00195 define("ILIAS_ABSOLUTE_PATH",$ilIliasIniFile->readVariable('server','absolute_path'));
00196
00197
00198 define ("ILIAS_LOG_DIR",$ilIliasIniFile->readVariable("log","path"));
00199 define ("ILIAS_LOG_FILE",$ilIliasIniFile->readVariable("log","file"));
00200 define ("ILIAS_LOG_ENABLED",$ilIliasIniFile->readVariable("log","enabled"));
00201 define ("ILIAS_LOG_LEVEL",$ilIliasIniFile->readVariable("log","level"));
00202
00203
00204 define ("PATH_TO_CONVERT",$ilIliasIniFile->readVariable("tools","convert"));
00205 define ("PATH_TO_ZIP",$ilIliasIniFile->readVariable("tools","zip"));
00206 define ("PATH_TO_UNZIP",$ilIliasIniFile->readVariable("tools","unzip"));
00207 define ("PATH_TO_JAVA",$ilIliasIniFile->readVariable("tools","java"));
00208 define ("PATH_TO_HTMLDOC",$ilIliasIniFile->readVariable("tools","htmldoc"));
00209 define ("URL_TO_LATEX",$ilIliasIniFile->readVariable("tools","latex"));
00210 define ("PATH_TO_FOP",$ilIliasIniFile->readVariable("tools","fop"));
00211
00212
00213 switch ($ilIliasIniFile->readVariable("tools", "vscantype"))
00214 {
00215 case "sophos":
00216 define("IL_VIRUS_SCANNER", "Sophos");
00217 define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
00218 define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
00219 break;
00220
00221 case "antivir":
00222 define("IL_VIRUS_SCANNER", "AntiVir");
00223 define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
00224 define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
00225 break;
00226
00227 case "clamav":
00228 define("IL_VIRUS_SCANNER", "ClamAV");
00229 define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
00230 define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
00231 break;
00232
00233 default:
00234 define("IL_VIRUS_SCANNER", "None");
00235 break;
00236 }
00237
00238
00239 }
00240
00247 function buildHTTPPath()
00248 {
00249 include_once 'classes/class.ilHTTPS.php';
00250 $https = new ilHTTPS();
00251
00252 if($https->isDetected())
00253 {
00254 $protocol = 'https://';
00255 }
00256 else
00257 {
00258 $protocol = 'http://';
00259 }
00260 $host = $_SERVER['HTTP_HOST'];
00261
00262 $rq_uri = $_SERVER['REQUEST_URI'];
00263
00264
00265
00266 if (is_int($pos = strpos($rq_uri, "?")))
00267 {
00268 $rq_uri = substr($rq_uri, 0, $pos);
00269 }
00270
00271 if(!defined('ILIAS_MODULE'))
00272 {
00273 $path = pathinfo($rq_uri);
00274 if(!$path['extension'])
00275 {
00276 $uri = $rq_uri;
00277 }
00278 else
00279 {
00280 $uri = dirname($rq_uri);
00281 }
00282 }
00283 else
00284 {
00285
00286 $path = dirname($rq_uri);
00287
00288
00289
00290 $module = ilUtil::removeTrailingPathSeparators(ILIAS_MODULE);
00291
00292 $dirs = explode('/',$module);
00293 $uri = $path;
00294 foreach($dirs as $dir)
00295 {
00296 $uri = dirname($uri);
00297 }
00298 }
00299
00300 return define('ILIAS_HTTP_PATH',ilUtil::removeTrailingPathSeparators($protocol.$host.$uri));
00301 }
00302
00303
00308 function determineClient()
00309 {
00310 global $ilIliasIniFile;
00311
00312
00313 if (!is_object($ilIliasIniFile))
00314 {
00315 die ("Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.");
00316 }
00317
00318
00319 if ($_GET["client_id"] != "")
00320 {
00321 setcookie("ilClientId", $_GET["client_id"]);
00322 $_COOKIE["ilClientId"] = $_GET["client_id"];
00323 }
00324 else if (!$_COOKIE["ilClientId"])
00325 {
00326
00327 $client_id = $ilIliasIniFile->readVariable("clients","default");
00328 setcookie("ilClientId", $client_id);
00329 $_COOKIE["ilClientId"] = $client_id;
00330
00331 }
00332
00333 define ("CLIENT_ID", $_COOKIE["ilClientId"]);
00334 }
00335
00348 function initClientIniFile()
00349 {
00350 global $ilClientIniFile;
00351
00352
00353 if (ILIAS_WEB_DIR == "")
00354 {
00355 die ("Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
00356 }
00357
00358
00359 if (CLIENT_ID == "")
00360 {
00361 die ("Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
00362 }
00363
00364 $ini_file = "./".ILIAS_WEB_DIR."/".CLIENT_ID."/client.ini.php";
00365
00366
00367 require_once("classes/class.ilIniFile.php");
00368 $ilClientIniFile = new ilIniFile($ini_file);
00369 $GLOBALS['ilClientIniFile'] =& $ilClientIniFile;
00370 $ilClientIniFile->read();
00371
00372
00373 if ($ilClientIniFile->ERROR != "")
00374 {
00375 return false;
00376 }
00377
00378
00379 define ("DEBUG",$ilClientIniFile->readVariable("system","DEBUG"));
00380 define ("DEVMODE",$ilClientIniFile->readVariable("system","DEVMODE"));
00381 define ("ROOT_FOLDER_ID",$ilClientIniFile->readVariable('system','ROOT_FOLDER_ID'));
00382 define ("SYSTEM_FOLDER_ID",$ilClientIniFile->readVariable('system','SYSTEM_FOLDER_ID'));
00383 define ("ROLE_FOLDER_ID",$ilClientIniFile->readVariable('system','ROLE_FOLDER_ID'));
00384 define ("MAIL_SETTINGS_ID",$ilClientIniFile->readVariable('system','MAIL_SETTINGS_ID'));
00385
00386 define ("SYSTEM_MAIL_ADDRESS",$ilClientIniFile->readVariable('system','MAIL_SENT_ADDRESS'));
00387 define ("MAIL_REPLY_WARNING",$ilClientIniFile->readVariable('system','MAIL_REPLY_WARNING'));
00388
00389 define ("MAXLENGTH_OBJ_TITLE",125);#$ilClientIniFile->readVariable('system','MAXLENGTH_OBJ_TITLE'));
00390 define ("MAXLENGTH_OBJ_DESC",$ilClientIniFile->readVariable('system','MAXLENGTH_OBJ_DESC'));
00391
00392 define ("CLIENT_DATA_DIR",ILIAS_DATA_DIR."/".CLIENT_ID);
00393 define ("CLIENT_WEB_DIR",ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".CLIENT_ID);
00394 define ("CLIENT_NAME",$ilClientIniFile->readVariable('client','name'));
00395
00396
00397 define ("IL_DSN", $ilClientIniFile->readVariable("db","type").
00398 "://".$ilClientIniFile->readVariable("db", "user").
00399 ":".$ilClientIniFile->readVariable("db", "pass").
00400 "@".$ilClientIniFile->readVariable("db", "host").
00401 "/".$ilClientIniFile->readVariable("db", "name"));
00402
00403 return true;
00404 }
00405
00409 function handleMaintenanceMode()
00410 {
00411 global $ilClientIniFile;
00412
00413 if (!$ilClientIniFile->readVariable("client","access"))
00414 {
00415 if (is_file("./maintenance.html"))
00416 {
00417 ilUtil::redirect("./maintenance.html");
00418 }
00419 else
00420 {
00421
00422 die('<br /><p style="text-align:center;">The server is not '.
00423 'available due to maintenance. We apologise for any inconvenience.</p>');
00424 }
00425 }
00426 }
00427
00433 function initDatabase()
00434 {
00435 global $ilDB;
00436
00437
00438 if (IL_DSN == "")
00439 {
00440 die ("Fatal Error: ilInitialisation::initDatabase called without IL_DSN.");
00441 }
00442
00443
00444 require_once("classes/class.ilDBx.php");
00445 $ilDB = new ilDBx(IL_DSN);
00446 $GLOBALS['ilDB'] =& $ilDB;
00447 }
00448
00452 function initEventHandling()
00453 {
00454 global $ilAppEventHandler;
00455
00456
00457 require_once("./Services/EventHandling/classes/class.ilAppEventHandler.php");
00458 $ilAppEventHandler = new ilAppEventHandler();
00459 $GLOBALS['ilAppEventHandler'] =& $ilAppEventHandler;
00460 }
00461
00465 function setSessionHandler()
00466 {
00467 global $ilErr;
00468
00469
00470 if(ini_get('session.save_handler') != 'user')
00471 {
00472 ini_set("session.save_handler", "user");
00473 }
00474 if (!db_set_save_handler())
00475 {
00476 die("Please turn off Safe mode OR set session.save_handler to \"user\" in your php.ini");
00477 }
00478
00479 }
00480
00484 function initSettings()
00485 {
00486 global $ilSetting;
00487
00488 require_once("Services/Administration/classes/class.ilSetting.php");
00489 $ilSetting = new ilSetting();
00490 $GLOBALS['ilSetting'] =& $ilSetting;
00491
00492
00493 define ("ANONYMOUS_USER_ID", $ilSetting->get("anonymous_user_id"));
00494 define ("ANONYMOUS_ROLE_ID", $ilSetting->get("anonymous_role_id"));
00495 define ("SYSTEM_USER_ID", $ilSetting->get("system_user_id"));
00496 define ("SYSTEM_ROLE_ID", $ilSetting->get("system_role_id"));
00497
00498
00499 define ("RECOVERY_FOLDER_ID", $ilSetting->get("recovery_folder_id"));
00500
00501
00502 define ("IL_INST_ID", $ilSetting->get("inst_id",0));
00503
00504
00505 define ("SUFFIX_REPL_DEFAULT", "php,php3,php4,inc,lang,phtml,htaccess");
00506 define ("SUFFIX_REPL_ADDITIONAL", $ilSetting->get("suffix_repl_additional"));
00507
00508 $this->buildHTTPPath();
00509 }
00510
00511
00515 function determineScriptAndUpDir()
00516 {
00517 $this->script = substr(strrchr($_SERVER["PHP_SELF"],"/"),1);
00518 $dirname = dirname($_SERVER["PHP_SELF"]);
00519 $ilurl = @parse_url(ILIAS_HTTP_PATH);
00520 $subdir = substr(strstr($dirname,$ilurl["path"]),strlen($ilurl["path"]));
00521 $updir = "";
00522
00523 if ($subdir)
00524 {
00525 $num_subdirs = substr_count($subdir,"/");
00526
00527 for ($i=1;$i<=$num_subdirs;$i++)
00528 {
00529 $updir .= "../";
00530 }
00531 }
00532 $this->updir = $updir;
00533 }
00534
00538 function initStyle()
00539 {
00540 global $ilBench, $styleDefinition;
00541
00542
00543 $ilBench->start("Core", "HeaderInclude_getStyleDefinitions");
00544 $styleDefinition = new ilStyleDefinition();
00545 $GLOBALS['styleDefinition'] =& $styleDefinition;
00546 $styleDefinition->startParsing();
00547 $ilBench->stop("Core", "HeaderInclude_getStyleDefinitions");
00548 }
00549
00550
00554 function handleStyle()
00555 {
00556 global $styleDefinition;
00557
00558 if ($_GET['skin'] && $_GET['style'])
00559 {
00560 include_once("classes/class.ilObjStyleSettings.php");
00561 if ($styleDefinition->styleExists($_GET['skin'], $_GET['style']) &&
00562 ilObjStyleSettings::_lookupActivatedStyle($_GET['skin'], $_GET['style']))
00563 {
00564 $_SESSION['skin'] = $_GET['skin'];
00565 $_SESSION['style'] = $_GET['style'];
00566 }
00567 }
00568 if ($_SESSION['skin'] && $_SESSION['style'])
00569 {
00570 include_once("classes/class.ilObjStyleSettings.php");
00571 if ($styleDefinition->styleExists($_SESSION['skin'], $_SESSION['style']) &&
00572 ilObjStyleSettings::_lookupActivatedStyle($_SESSION['skin'], $_SESSION['style']))
00573 {
00574 $ilias->account->skin = $_SESSION['skin'];
00575 $ilias->account->prefs['style'] = $_SESSION['style'];
00576 }
00577 }
00578 }
00579
00580 function initUserAccount()
00581 {
00582 global $ilUser, $ilLog, $ilAuth;
00583
00584
00585 if (empty($_SESSION["AccountId"]))
00586 {
00587 $_SESSION["AccountId"] = $ilUser->checkUserId();
00588
00589
00590
00591 #$rbacreview = new ilRbacReview();
00592 #$GLOBALS['rbacreview'] =& $rbacreview;
00593 #$_SESSION["RoleId"] = $rbacreview->assignedRoles($_SESSION["AccountId"]);
00594 }
00595 else
00596 {
00597
00598 $ilUser->setId($_SESSION["AccountId"]);
00599 }
00600
00601
00602 $ilUser->read();
00603 }
00604
00605 function checkUserClientIP()
00606 {
00607 global $ilUser, $ilLog, $ilAuth, $ilias;
00608
00609
00610 $clientip = $ilUser->getClientIP();
00611 if (trim($clientip) != "" and $clientip != $_SERVER["REMOTE_ADDR"])
00612 {
00613 $ilLog ->logError(1,
00614 $ilias->account->getLogin().":".$_SERVER["REMOTE_ADDR"].":".$message);
00615 $ilAuth->logout();
00616 @session_destroy();
00617 ilUtil::redirect("login.php?wrong_ip=true");
00618 }
00619 }
00620
00621 function checkUserAgreement()
00622 {
00623 global $ilUser, $ilAuth;
00624
00625
00626 $in_user_agreement = false;
00627 if (strtolower($_GET["cmdClass"]) == "ilstartupgui" &&
00628 (strtolower($_GET["cmd"]) == "getacceptance" ||
00629 (is_array($_POST["cmd"]) &&
00630 key($_POST["cmd"]) == "getAcceptance")))
00631 {
00632 $in_user_agreement = true;
00633 }
00634
00635
00636
00637 if (!$ilUser->hasAcceptedUserAgreement() &&
00638 $ilAuth->getAuth() &&
00639 !$in_user_agreement &&
00640 $ilUser->getId() != ANONYMOUS_USER_ID)
00641 {
00642 ilUtil::redirect("ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&target=".$_GET["target"]."&cmd=getAcceptance");
00643 }
00644 }
00645
00646
00650 function goToPublicSection()
00651 {
00652 global $ilAuth;
00653
00654
00655 $ilAuth->logout();
00656 session_unset();
00657 session_destroy();
00658
00659
00660 $this->setSessionHandler();
00661 session_start();
00662 $_POST["username"] = "anonymous";
00663 $_POST["password"] = "anonymous";
00664 ilAuthUtils::_initAuth();
00665 $ilAuth->start();
00666
00667 if (ANONYMOUS_USER_ID == "")
00668 {
00669 die ("Public Section enabled, but no Anonymous user found.");
00670 }
00671 if (!$ilAuth->getAuth())
00672 {
00673 die("ANONYMOUS user with the object_id ".ANONYMOUS_USER_ID." not found!");
00674 }
00675
00676
00677 if ($_GET["target"] != "")
00678 {
00679 $this->initUserAccount();
00680
00681
00682 include_once("Services/Init/classes/class.ilStartUpGUI.php");
00683 if (ilStartUpGUI::_checkGoto($_GET["target"]))
00684 {
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695 return true;
00696 #ilUtil::redirect(ILIAS_HTTP_PATH.
00697 # "/goto.php?target=".$_GET["target"].$survey_parameter);
00698 }
00699 else
00700 {
00701 $this->goToLogin();
00702 }
00703 }
00704
00705 $_GET["ref_id"] = ROOT_FOLDER_ID;
00706
00707 $_GET["cmd"] = "frameset";
00708 $jump_script = "repository.php";
00709
00710 $script = $this->updir.$jump_script."?reloadpublic=1&cmd=".$_GET["cmd"]."&ref_id=".$_GET["ref_id"];
00711
00712
00713
00714 echo "<script language=\"Javascript\">\ntop.location.href = \"".$script."\";\n</script>\n".
00715 'Please click <a href="'.$script.'">here</a> if you are not redirected automatically.';
00716 exit;
00717 }
00718
00719
00723 function goToLogin($a_auth_stat = "")
00724 {
00725 global $PHP_SELF;
00726
00727 session_unset();
00728 session_destroy();
00729
00730 $add = "";
00731 if ($_GET["soap_pw"] != "")
00732 {
00733 $add = "&soap_pw=".$_GET["soap_pw"]."&ext_uid=".$_GET["ext_uid"];
00734 }
00735
00736 $script = $this->updir."login.php?target=".$_GET["target"]."&client_id=".$_COOKIE["ilClientId"].
00737 "&auth_stat=".$a_auth_stat.$add;
00738
00739
00740
00741
00742
00743
00744
00745 if (is_int(strpos($PHP_SELF, "goto.php")) && $_GET["soap_pw"] == "" &&
00746 $_GET["reloadpublic"] != "1")
00747 {
00748 $script = $this->updir."goto.php?target=".$_GET["target"]."&client_id=".CLIENT_ID.
00749 "&reloadpublic=1";
00750 }
00751
00752 echo "<script language=\"Javascript\">\ntop.location.href = \"".$script."\";\n</script>\n".
00753 'Please click <a href="'.$script.'">here</a> if you are not redirected automatically.';
00754
00755 exit;
00756
00757 }
00758
00762 function initLanguage()
00763 {
00764 global $ilBench, $lng, $ilUser, $ilSetting;
00765
00766
00767 $ilBench->start("Core", "HeaderInclude_initLanguage");
00768
00769 if (is_null($_SESSION['lang']))
00770 {
00771 if ($_GET["lang"])
00772 {
00773 $_GET["lang"] = $_GET["lang"];
00774 }
00775 else
00776 {
00777 if (is_object($ilUser))
00778 {
00779 $_GET["lang"] = $ilUser->getPref("language");
00780 }
00781 }
00782 }
00783
00784 if ($_POST['change_lang_to'] != "")
00785 {
00786 $_GET['lang'] = ilUtil::stripSlashes($_POST['change_lang_to']);
00787 }
00788
00789 $_SESSION['lang'] = ($_GET['lang']) ? $_GET['lang'] : $_SESSION['lang'];
00790
00791
00792
00793 if (is_object($ilUser) && $ilUser->getId() != ANONYMOUS_USER_ID && $ilUser->getId() > 0)
00794 {
00795 $_SESSION['lang'] = $ilUser->getPref("language");
00796 }
00797
00798
00799 $langs = ilLanguage::getInstalledLanguages();
00800 if (!in_array($_SESSION['lang'], $langs))
00801 {
00802 if (is_object($ilSetting) && $ilSetting->get("language") != "")
00803 {
00804 $_SESSION['lang'] = $ilSetting->get("language");
00805 }
00806 else
00807 {
00808 $_SESSION['lang'] = $langs[0];
00809 }
00810 }
00811 $_GET['lang'] = $_SESSION['lang'];
00812
00813 $lng = new ilLanguage($_SESSION['lang']);
00814 $GLOBALS['lng'] =& $lng;
00815 $ilBench->stop("Core", "HeaderInclude_initLanguage");
00816
00817 }
00818
00822 function initAccessHandling()
00823 {
00824 global $ilBench, $rbacsystem, $rbacadmin, $rbacreview;
00825
00826 $ilBench->start("Core", "HeaderInclude_initRBAC");
00827 $rbacsystem = new ilRbacSystem();
00828 $GLOBALS['rbacsystem'] =& $rbacsystem;
00829 $rbacadmin = new ilRbacAdmin();
00830 $GLOBALS['rbacadmin'] =& $rbacadmin;
00831 $rbacreview = new ilRbacReview();
00832 $GLOBALS['rbacreview'] =& $rbacreview;
00833 $ilAccess =& new ilAccessHandler();
00834 $GLOBALS["ilAccess"] =& $ilAccess;
00835 $ilBench->stop("Core", "HeaderInclude_initRBAC");
00836 }
00837
00838
00843 function initILIAS($context = "web")
00844 {
00845 global $ilDB, $ilUser, $ilLog, $ilErr, $ilClientIniFile, $ilIliasIniFile,
00846 $ilSetting, $ilias, $https, $ilObjDataCache,
00847 $ilLog, $objDefinition, $lng, $ilCtrl, $ilBrowser, $ilHelp,
00848 $ilTabs, $ilMainMenu, $rbacsystem, $ilNavigationHistory;
00849
00850
00851 $this->removeUnsafeCharacters();
00852
00853
00854 $this->requireCommonIncludes();
00855 global $ilBench;
00856
00857
00858 $ilBench->start("Core", "HeaderInclude_GetErrorHandler");
00859 $ilErr = new ilErrorHandling();
00860 $GLOBALS['ilErr'] =& $ilErr;
00861 $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK,array($ilErr,'errorHandler'));
00862 $ilBench->stop("Core", "HeaderInclude_GetErrorHandler");
00863
00864
00865
00866 umask(0117);
00867
00868
00869
00870 $this->initIliasIniFile();
00871
00872
00873
00874 $this->determineClient();
00875
00876
00877 $this->initEventHandling();
00878
00879
00880 if (!$this->initClientIniFile())
00881 {
00882 $c = $_COOKIE["ilClientId"];
00883 setcookie("ilClientId", $ilIliasIniFile->readVariable("clients","default"));
00884 $_COOKIE["ilClientId"] = $ilIliasIniFile->readVariable("clients","default");
00885 if (CLIENT_ID != "" && CLIENT_ID != $ilIliasIniFile->readVariable("clients","default"))
00886 {
00887 ilUtil::redirect("index.php?client_id=".$ilIliasIniFile->readVariable("clients","default"));
00888 }
00889 else
00890 {
00891 echo ("Client $c does not exist. ".'Please <a href="./index.php">click here</a> to return to the default client.');
00892 }
00893 exit;
00894
00895
00896 }
00897
00898
00899
00900 $this->handleMaintenanceMode();
00901
00902
00903 $this->initDatabase();
00904
00905
00906 $this->setSessionHandler();
00907
00908
00909 $this->initSettings();
00910
00911
00912
00913 $this->initLog();
00914
00915
00916 require_once './classes/class.ilHTTPS.php';
00917 $https =& new ilHTTPS();
00918 $GLOBALS['https'] =& $https;
00919 $https->enableSecureCookies();
00920 $https->checkPort();
00921
00922
00923 include_once("./Services/Authentication/classes/class.ilAuthUtils.php");
00924 ilAuthUtils::_initAuth();
00925 global $ilAuth;
00926
00927
00928 if (!db_session_exists(session_id()))
00929 {
00930 $_GET["PHPSESSID"] == "";
00931 session_regenerate_id();
00932 }
00933
00934
00935 global $ilias, $ilBench;
00936 $ilBench->start("Core", "HeaderInclude_GetILIASObject");
00937 $ilias = & new ILIAS();
00938 $GLOBALS['ilias'] =& $ilias;
00939 $ilBench->stop("Core", "HeaderInclude_GetILIASObject");
00940
00941
00942 if (DEVMODE)
00943 {
00944 if (function_exists("xdebug_start_trace"))
00945 {
00946
00947 }
00948 }
00949
00950
00951 $ilObjDataCache = new ilObjectDataCache();
00952 $GLOBALS['ilObjDataCache'] =& $ilObjDataCache;
00953
00954
00955 if ($_SESSION["message"])
00956 {
00957 $_POST = $_SESSION["post_vars"];
00958 }
00959
00960
00961
00962 require_once "include/inc.debug.php";
00963
00964
00965
00966 $ilBench->start("Core", "HeaderInclude_getObjectDefinitions");
00967 $objDefinition = new ilObjectDefinition();
00968 $GLOBALS['objDefinition'] =& $objDefinition;
00969 $objDefinition->startParsing();
00970 $ilBench->stop("Core", "HeaderInclude_getObjectDefinitions");
00971
00972
00973 $this->initAccessHandling();
00974
00975
00976 $tree = new ilTree(ROOT_FOLDER_ID);
00977 $GLOBALS['tree'] =& $tree;
00978
00979
00980 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, "errorHandler"));
00981 $ilBench->start("Core", "HeaderInclude_Authentication");
00982
00983 $ilAuth->start();
00984
00985 $ilias->setAuthError($ilErr->getLastError());
00986 $ilBench->stop("Core", "HeaderInclude_Authentication");
00987
00988
00989 if ($_GET["cmd"] == "force_login" || $this->script == "login.php")
00990 {
00991 $ilAuth->logout();
00992 $_SESSION["AccountId"] = "";
00993 $ilAuth->start();
00994 $ilias->setAuthError($ilErr->getLastError());
00995 }
00996
00997
00998 if (!$ilias->getSetting("setup_ok"))
00999 {
01000 die("Setup is not completed. Please run setup routine again.");
01001 }
01002
01003
01004 $ilBench->start("Core", "HeaderInclude_getCurrentUser");
01005 $ilUser = new ilObjUser();
01006 $ilias->account =& $ilUser;
01007 $GLOBALS['ilUser'] =& $ilUser;
01008 $ilBench->stop("Core", "HeaderInclude_getCurrentUser");
01009
01010
01011
01012 $ilCtrl = new ilCtrl();
01013 $GLOBALS['ilCtrl'] =& $ilCtrl;
01014
01015
01016
01017 $this->determineScriptAndUpDir();
01018
01019
01020 $this->initStyle();
01021 if (in_array($this->script,
01022 array("login.php", "register.php", "view_usr_agreement.php"))
01023 || $_GET["baseClass"] == "ilStartUpGUI")
01024 {
01025 $this->handleStyle();
01026 }
01027
01028
01029
01030
01031
01032
01033 if (AUTH_CURRENT == AUTH_LOCAL && !$ilAuth->getAuth() && $this->script == "login.php" && $_POST["username"] != "")
01034 {
01035 if (ilObjUser::_lookupHasIlias2Password(ilUtil::stripSlashes($_POST["username"])))
01036 {
01037 if (ilObjUser::_switchToIlias3Password(
01038 ilUtil::stripSlashes($_POST["username"]),
01039 ilUtil::stripSlashes($_POST["password"])))
01040 {
01041 $ilAuth->start();
01042 $ilias->setAuthError($ilErr->getLastError());
01043 ilUtil::redirect("index.php");
01044 }
01045 }
01046 }
01047
01048
01049
01050
01051
01052
01053
01054 if ($ilAuth->getAuth() && $ilias->account->isCurrentUserActive())
01055 {
01056
01057 $ilBench->start("Core", "HeaderInclude_getCurrentUserAccountData");
01058
01059
01060 $this->initUserAccount();
01061
01062
01063 $this->checkUserClientIP();
01064
01065
01066 $this->checkUserAgreement();
01067
01068
01069 if ($this->script == "login.php" ||
01070 $_GET["baseClass"] == "ilStartUpGUI")
01071 {
01072 $ilUser->refreshLogin();
01073 }
01074
01075
01076 $_GET['limit'] = $_SESSION['tbl_limit'] = (int) $ilUser->getPref('hits_per_page');
01077
01078
01079
01080
01081
01082
01083
01084 if ($_GET['offset'] != "")
01085 {
01086 $_GET['offset'] = (int) $_GET['offset'];
01087 }
01088
01089 $ilBench->stop("Core", "HeaderInclude_getCurrentUserAccountData");
01090 }
01091 elseif (
01092 $this->script != "login.php"
01093 and $this->script != "shib_login.php"
01094 and $this->script != "error.php"
01095 and $this->script != "index.php"
01096 and $this->script != "view_usr_agreement.php"
01097 and $this->script != "register.php"
01098 and $this->script != "chat.php"
01099 and $this->script != "pwassist.php"
01100 )
01101 {
01102
01103
01104
01105
01106
01107 if ($ilAuth->getAuth() && !$ilUser->isCurrentUserActive())
01108 {
01109 $inactive = true;
01110 }
01111
01112
01113
01114
01115
01116 if ($_GET["baseClass"] != "ilStartUpGUI")
01117 {
01118
01119 $this->initLanguage();
01120
01121 if ($ilSetting->get("pub_section") &&
01122 ($ilAuth->getStatus() == "" || $ilAuth->getStatus() == AUTH_EXPIRED ||
01123 $ilAuth->getStatus() == AUTH_IDLED) &&
01124 $_GET["reloadpublic"] != "1")
01125 {
01126 $this->goToPublicSection();
01127 }
01128 else
01129 {
01130 if ($context == "web")
01131 {
01132
01133 $this->goToLogin($ilAuth->getStatus());
01134 exit;
01135 } else {
01136
01137 return;
01138 }
01139
01140 }
01141
01142
01143 }
01144 }
01145
01146
01147
01148
01149
01150
01151 $this->initLanguage();
01152
01153
01154 $GLOBALS['tree']->initLangCode();
01155
01156
01157 $tpl = new ilTemplate("tpl.main.html", true, true);
01158 $GLOBALS['tpl'] =& $tpl;
01159
01160
01161
01162
01163 if ( !isset($_SESSION["locator_level"]) )
01164 {
01165 $_SESSION["locator_data"] = array();
01166 $_SESSION["locator_level"] = -1;
01167 }
01168
01169 $ilias_locator = new ilLocatorGUI();
01170 $ilLocator = new ilLocatorGUI();
01171 $GLOBALS['ilias_locator'] =& $ilias_locator;
01172 $GLOBALS['ilLocator'] =& $ilLocator;
01173
01174
01175 $ilBench->start("Core", "HeaderInclude_getStyleDefinitions");
01176 $styleDefinition = new ilStyleDefinition();
01177 $GLOBALS['styleDefinition'] =& $styleDefinition;
01178 $styleDefinition->startParsing();
01179 $ilBench->stop("Core", "HeaderInclude_getStyleDefinitions");
01180
01181
01182 $location_stylesheet = ilUtil::getStyleSheetLocation();
01183 $tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
01184
01185
01186 $ilNavigationHistory = new ilNavigationHistory();
01187 $GLOBALS['ilNavigationHistory'] =& $ilNavigationHistory;
01188
01189
01190
01191
01192 $ilBrowser = new ilBrowser();
01193 $GLOBALS['ilBrowser'] =& $ilBrowser;
01194
01195
01196 $ilHelp = new ilHelp();
01197 $GLOBALS['ilHelp'] =& $ilHelp;
01198
01199
01200 include_once 'classes/class.ilTabsGUI.php';
01201 $ilTabs = new ilTabsGUI();
01202 $GLOBALS['ilTabs'] =& $ilTabs;
01203
01204
01205 include_once 'classes/class.ilMainMenuGUI.php';
01206 $ilMainMenu = new ilMainMenuGUI("_top");
01207 $GLOBALS['ilMainMenu'] =& $ilMainMenu;
01208
01209
01210 ilOnlineTracking::_updateAccess($ilUser->getId());
01211
01212 $ilBench->stop("Core", "HeaderInclude");
01213 $ilBench->save();
01214
01215 }
01216
01220 function initFeed()
01221 {
01222 global $ilDB, $ilUser, $ilLog, $ilErr, $ilClientIniFile, $ilIliasIniFile,
01223 $ilSetting, $ilias, $https, $ilObjDataCache,
01224 $ilLog, $objDefinition, $lng, $ilCtrl, $ilBrowser, $ilHelp,
01225 $ilTabs, $ilMainMenu, $rbacsystem, $ilNavigationHistory;
01226
01227
01228 $this->removeUnsafeCharacters();
01229
01230
01231 $this->requireCommonIncludes();
01232 global $ilBench;
01233
01234
01235 $this->initEventHandling();
01236
01237
01238 $ilBench->start("Core", "HeaderInclude_GetErrorHandler");
01239 $ilErr = new ilErrorHandling();
01240 $GLOBALS['ilErr'] =& $ilErr;
01241 $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK,array($ilErr,'errorHandler'));
01242 $ilBench->stop("Core", "HeaderInclude_GetErrorHandler");
01243
01244
01245 umask(0117);
01246
01247
01248 $this->initIliasIniFile();
01249
01250
01251 $this->determineClient();
01252
01253
01254 if (!$this->initClientIniFile())
01255 {
01256 $c = $_COOKIE["ilClientId"];
01257 setcookie("ilClientId", $ilIliasIniFile->readVariable("clients","default"));
01258 $_COOKIE["ilClientId"] = $ilIliasIniFile->readVariable("clients","default");
01259 echo ("Client $c does not exist. Please reload this page to return to the default client.");
01260 exit;
01261 }
01262
01263
01264 $this->handleMaintenanceMode();
01265
01266
01267 $this->initDatabase();
01268
01269
01270 $ilObjDataCache = new ilObjectDataCache();
01271 $GLOBALS['ilObjDataCache'] =& $ilObjDataCache;
01272
01273
01274 $this->initSettings();
01275
01276
01277 $tree = new ilTree(ROOT_FOLDER_ID);
01278 $GLOBALS['tree'] =& $tree;
01279
01280
01281 $lng = new ilLanguage($ilClientIniFile->readVariable("language","default"));
01282 $GLOBALS['lng'] =& $lng;
01283
01284 }
01285
01286 function initLog() {
01287 global $ilLog;
01288 $log = new ilLog(ILIAS_LOG_DIR,ILIAS_LOG_FILE,CLIENT_ID,ILIAS_LOG_ENABLED,ILIAS_LOG_LEVEL);
01289 $GLOBALS['log'] =& $log;
01290 $ilLog =& $log;
01291 $GLOBALS['ilLog'] =& $ilLog;
01292 }
01293
01294 function initILIASObject() {
01295 global $ilias, $ilBench;
01296 $ilBench->start("Core", "HeaderInclude_GetILIASObject");
01297 $ilias = & new ILIAS();
01298 $GLOBALS['ilias'] =& $ilias;
01299 $ilBench->stop("Core", "HeaderInclude_GetILIASObject");
01300
01301 }
01302 }
01303 ?>