00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00035
00036 include("include/inc.get_pear.php");
00037
00038
00039 require_once "classes/class.ilUtil.php";
00040 require_once "classes/class.ilBenchmark.php";
00041 $ilBench =& new ilBenchmark();
00042 $GLOBALS['ilBench'] =& $ilBench;
00043 $ilBench->start("Core", "HeaderInclude");
00044
00045
00046 $t_pagestart = ilUtil::StopWatch();
00047
00048 $ilBench->start("Core", "HeaderInclude_IncludeFiles");
00049
00050
00051 require_once "PEAR.php";
00052 require_once "DB.php";
00053 require_once "Auth/Auth.php";
00054
00055
00056 @include_once "HTML/ITX.php";
00057
00058 if (!class_exists("IntegratedTemplateExtension"))
00059 {
00060 include_once "HTML/Template/ITX.php";
00061
00062 include_once "classes/class.ilTemplateHTMLITX.php";
00063 }
00064 else
00065 {
00066
00067 include_once "classes/class.ilTemplateITX.php";
00068 }
00069 require_once "classes/class.ilTemplate.php";
00070
00071
00072 require_once "include/inc.db_session_handler.php";
00073 require_once "classes/class.ilIniFile.php";
00074 require_once "classes/class.ilDBx.php";
00075 require_once "classes/class.ilias.php";
00076 require_once "classes/class.ilObjUser.php";
00077 require_once "classes/class.ilFormat.php";
00078 require_once "classes/class.ilSaxParser.php";
00079 require_once "classes/class.ilObjectDefinition.php";
00080 require_once "classes/class.ilStyleDefinition.php";
00081 require_once "classes/class.perm.php";
00082 require_once "classes/class.ilTree.php";
00083 require_once "classes/class.ilLanguage.php";
00084 require_once "classes/class.ilLog.php";
00085 require_once "classes/class.ilMailbox.php";
00086 require_once "classes/class.ilCtrl.php";
00087 require_once "classes/class.ilConditionHandler.php";
00088 require_once "classes/class.ilBrowser.php";
00089 require_once "include/inc.ilias_version.php";
00090
00091
00092 require_once "classes/class.ilRbacAdmin.php";
00093 require_once "classes/class.ilRbacSystem.php";
00094 require_once "classes/class.ilRbacReview.php";
00095
00096
00097
00098 require_once "classes/class.ilLocatorGUI.php";
00099
00100
00101 require_once "classes/class.ilErrorHandling.php";
00102
00103 $ilBench->stop("Core", "HeaderInclude_IncludeFiles");
00104
00105 $ilBench->start("Core", "HeaderInclude_GetErrorHandler");
00106 $ilErr = new ilErrorHandling();
00107 $GLOBALS['ilErr'] =& $ilErr;
00108 $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK,array($ilErr,'errorHandler'));
00109 $ilBench->stop("Core", "HeaderInclude_GetErrorHandler");
00110
00111
00112 $ilBench->start("Core", "HeaderInclude_GetILIASObject");
00113 $ilias =& new ILIAS($_COOKIE["ilClientId"]);
00114 $GLOBALS['ilias'] =& $ilias;
00115 $ilBench->stop("Core", "HeaderInclude_GetILIASObject");
00116
00117 require_once './classes/class.ilHTTPS.php';
00118
00119 $https =& new ilHTTPS();
00120 $GLOBALS['https'] =& $https;
00121 $https->checkPort();
00122
00123
00124 $ilDB = $ilias->db;
00125 $GLOBALS['ilDB'] =& $ilDB;
00126 if (!db_set_save_handler())
00127 {
00128 $message = "Please turn off Safe mode OR set session.save_handler to \"user\" in your php.ini";
00129 $this->ilias->raiseError($message,$this->ilias->error_obj->WARNING);
00130 }
00131
00132
00133
00134 if ($_SESSION["message"])
00135 {
00136 $_POST = $_SESSION["post_vars"];
00137 }
00138
00139
00140
00141
00142 include_once "include/inc.debug.php";
00143
00144
00145
00146 $ilBench->start("Core", "HeaderInclude_Authentication");
00147 $ilias->auth->start();
00148 $ilBench->stop("Core", "HeaderInclude_Authentication");
00149
00150
00151 if ($_GET["cmd"] == "force_login")
00152 {
00153 $ilias->auth->logout();
00154 $_SESSION["AccountId"] = "";
00155 $ilias->auth->start();
00156 }
00157
00158
00159 $log = new ilLog(ILIAS_LOG_DIR,ILIAS_LOG_FILE,$ilias->getClientId(),ILIAS_LOG_ENABLED,ILIAS_LOG_LEVEL);
00160 $GLOBALS['log'] =& $log;
00161
00162
00163 $ilBench->start("Core", "HeaderInclude_getObjectDefinitions");
00164 $objDefinition = new ilObjectDefinition();
00165 $GLOBALS['objDefinition'] =& $objDefinition;
00166 $objDefinition->startParsing();
00167 $ilBench->stop("Core", "HeaderInclude_getObjectDefinitions");
00168
00169
00170
00171 $ilBench->start("Core", "HeaderInclude_getCurrentUser");
00172 $ilias->account = new ilObjUser();
00173 $ilBench->stop("Core", "HeaderInclude_getCurrentUser");
00174
00175
00176 $ilUser =& $ilias->account;
00177 $GLOBALS['ilUser'] =& $ilias->account;
00178 $ilCtrl = new ilCtrl();
00179 $GLOBALS['ilCtrl'] =& $ilCtrl;
00180 $ilLog =& $log;
00181 $GLOBALS['ilLog'] =& $ilLog;
00182
00183
00184 $script = substr(strrchr($_SERVER["PHP_SELF"],"/"),1);
00185
00186
00187
00188 if (AUTH_CURRENT == AUTH_LOCAL && !$ilias->auth->getAuth() && $script == "login.php" && $_POST["username"] != "")
00189
00190 {
00191 if (ilObjUser::_lookupHasIlias2Password($_POST["username"]))
00192 {
00193 if (ilObjUser::_switchToIlias3Password($_POST["username"], $_POST["password"]))
00194 {
00195 $ilias->auth->start();
00196 ilUtil::redirect("start.php");
00197 }
00198 }
00199 }
00200
00201 if ($ilias->auth->getAuth() && $ilias->account->isCurrentUserActive())
00202 {
00203 $ilBench->start("Core", "HeaderInclude_getCurrentUserAccountData");
00204
00205
00206 if (empty($_SESSION["AccountId"]))
00207 {
00208 $_SESSION["AccountId"] = $ilias->account->checkUserId();
00209
00210
00211 $rbacreview = new ilRbacReview();
00212 $GLOBALS['rbacreview'] =& $rbacreview;
00213 $_SESSION["RoleId"] = $rbacreview->assignedRoles($_SESSION["AccountId"]);
00214 }
00215 else
00216 {
00217
00218 $ilias->account->setId($_SESSION["AccountId"]);
00219 }
00220
00221
00222 $ilias->account->read();
00223
00224
00225
00226 if (!$ilias->account->hasAcceptedUserAgreement() &&
00227 $script != "view_usr_agreement.php" &&
00228 $script != "login.php" &&
00229 $ilias->account->getId() != ANONYMOUS_USER_ID)
00230 {
00231
00232 ilUtil::redirect("view_usr_agreement.php?cmd=getAcceptance");
00233 }
00234
00235
00236 if ($script == "login.php")
00237 {
00238 $ilias->account->refreshLogin();
00239 }
00240
00241
00242 $_SESSION["tbl_limit"] = ($_SESSION["tbl_limit"]) ? intval($_SESSION["tbl_limit"]) : intval($ilias->account->prefs["hits_per_page"]);
00243 $_GET["limit"] = ($_SESSION["tbl_limit"]) ? ($_SESSION["tbl_limit"]) : intval($ilias->account->prefs["hits_per_page"]);
00244 $_GET["offset"] = intval($_GET["offset"]);
00245
00246 $ilBench->stop("Core", "HeaderInclude_getCurrentUserAccountData");
00247 }
00248 elseif ($script != "login.php" and $script != "nologin.php" and $script != "index.php"
00249 and $script != "view_usr_agreement.php" and $script!= "register.php" and $script != "chat.php"
00250 and $script != "pwassist.php")
00251 {
00252
00253
00254
00255 $dirname = dirname($_SERVER["PHP_SELF"]);
00256 $ilurl = parse_url(ILIAS_HTTP_PATH);
00257 $subdir = substr(strstr($dirname,$ilurl["path"]),strlen($ilurl["path"]));
00258 $updir = "";
00259
00260 if ($subdir)
00261 {
00262 $num_subdirs = substr_count($subdir,"/");
00263
00264 for ($i=1;$i<=$num_subdirs;$i++)
00265 {
00266 $updir .= "../";
00267 }
00268 }
00269
00270 if ($ilias->auth->getAuth() && !$ilias->account->isCurrentUserActive())
00271 {
00272 $inactive = true;
00273 }
00274
00275 session_unset();
00276 session_destroy();
00277
00278 $return_to = urlencode(substr($_SERVER["REQUEST_URI"],strlen($ilurl["path"])+1));
00279
00280 if (($_GET["inactive"]) || $inactive)
00281 {
00282 ilUtil::redirect($updir."index.php?reload=true&inactive=true&return_to=".$return_to);
00283 }
00284 else
00285 {
00286 ilUtil::redirect($updir."index.php?reload=true&return_to=".$return_to);
00287 }
00288 }
00289
00290
00291 $ilBench->start("Core", "HeaderInclude_initLanguage");
00292 $lang_key = ($_GET["lang"]) ? $_GET["lang"] : $ilias->account->prefs["language"];
00293 $lng = new ilLanguage($lang_key);
00294 $GLOBALS['lng'] =& $lng;
00295 $ilBench->stop("Core", "HeaderInclude_initLanguage");
00296
00297
00298
00299 $ilBench->start("Core", "HeaderInclude_initRBAC");
00300 $rbacsystem = new ilRbacSystem();
00301 $GLOBALS['rbacsystem'] =& $rbacsystem;
00302 $rbacadmin = new ilRbacAdmin();
00303 $GLOBALS['rbacadmin'] =& $rbacadmin;
00304 $rbacreview = new ilRbacReview();
00305 $GLOBALS['rbacreview'] =& $rbacreview;
00306 $ilBench->stop("Core", "HeaderInclude_initRBAC");
00307
00308
00309
00310 $_GET["ref_id"] = $_GET["ref_id"] ? $_GET["ref_id"] : ROOT_FOLDER_ID;
00311
00312
00313 $tree = new ilTree(ROOT_FOLDER_ID);
00314 $GLOBALS['tree'] =& $tree;
00315
00316
00317 $tpl = new ilTemplate("tpl.main.html", true, true);
00318 $GLOBALS['tpl'] =& $tpl;
00319
00320
00321
00322
00323 if ( !isset($_SESSION["locator_level"]) )
00324 {
00325 $_SESSION["locator_data"] = array();
00326 $_SESSION["locator_level"] = -1;
00327 }
00328
00329 $ilias_locator = new ilLocatorGUI();
00330 $GLOBALS['ilias_locator'] =& $ilias_locator;
00331
00332
00333 $ilBench->start("Core", "HeaderInclude_getStyleDefinitions");
00334 $styleDefinition = new ilStyleDefinition();
00335 $GLOBALS['styleDefinition'] =& $styleDefinition;
00336 $styleDefinition->startParsing();
00337 $ilBench->stop("Core", "HeaderInclude_getStyleDefinitions");
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360 $location_stylesheet = ilUtil::getStyleSheetLocation();
00361 $tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
00362 $tpl->setVariable("LOCATION_JAVASCRIPT",dirname($location_stylesheet));
00363
00364
00365 if ($mail_id = ilMailbox::hasNewMail($_SESSION["AccountId"]))
00366 {
00367 $mbox = new ilMailbox($_SESSION["AccountId"]);
00368 $mail =& new ilMail($_SESSION['AccountId']);
00369 if($rbacsystem->checkAccess('mail_visible',$mail->getMailObjectReferenceId()))
00370 {
00371 $folder_id = $mbox->getInboxFolder();
00372
00373 $_SESSION["infopanel"] = array ("link" => "mail_frameset.php?target=".
00374 htmlentities(urlencode("mail_read.php?mobj_id=".$folder_id."&mail_id=".$mail_id)),
00375 "text" => "new_mail"
00376
00377 );
00378 }
00379 }
00380
00381
00382 if (version_compare(PHP_VERSION,'5','>='))
00383 {
00384 require_once("include/inc.xml5compliance.php");
00385 }
00386
00387
00388 if (version_compare(PHP_VERSION,'5','>='))
00389 {
00390 require_once("include/inc.xsl5compliance.php");
00391 }
00392
00393
00394 $ilBrowser = new ilBrowser();
00395 $GLOBALS['ilBrowser'] =& $ilBrowser;
00396
00397 $ilBench->stop("Core", "HeaderInclude");
00398 $ilBench->save();
00399 ?>