ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilInitialisation.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
40 {
41 
46  {
47  // Remove unsafe characters from GET parameters.
48  // We do not need this characters in any case, so it is
49  // feasible to filter them everytime. POST parameters
50  // need attention through ilUtil::stripSlashes() and similar functions)
51  if (is_array($_GET))
52  {
53  foreach($_GET as $k => $v)
54  {
55  // \r\n used for IMAP MX Injection
56  // ' used for SQL Injection
57  $_GET[$k] = str_replace(array("\x00", "\n", "\r", "\\", "'", '"', "\x1a"), "", $v);
58 
59  // this one is for XSS of any kind
60  $_GET[$k] = strip_tags($_GET[$k]);
61  }
62  }
63  }
64 
69  {
70  global $ilBench;
71 
72  // get pear
73  require_once("include/inc.get_pear.php");
74  require_once("include/inc.check_pear.php");
75 
76  //include class.util first to start StopWatch
77  require_once "./Services/Utilities/classes/class.ilUtil.php";
78  require_once "classes/class.ilBenchmark.php";
79  $ilBench = new ilBenchmark();
80  $GLOBALS['ilBench'] = $ilBench;
81 
82  // BEGIN Usability: Measure response time until footer is displayed on form
83  // The stop statement is in class.ilTemplate.php function addILIASfooter()
84  $ilBench->start("Core", "ElapsedTimeUntilFooter");
85  // END Usability: Measure response time until footer is displayed on form
86 
87  $ilBench->start("Core", "HeaderInclude");
88 
89  // start the StopWatch
90  $GLOBALS['t_pagestart'] = ilUtil::StopWatch();
91 
92  $ilBench->start("Core", "HeaderInclude_IncludeFiles");
93 //echo ":".class_exists("HTML_Template_ITX").":";
94  // Major PEAR Includes
95  require_once "PEAR.php";
96  //require_once "DB.php";
97  require_once "Auth/Auth.php";
98 
99  // HTML_Template_IT support
100  // (location changed with 4.3.2 & higher)
101 /* @include_once "HTML/ITX.php"; // old implementation
102  if (!class_exists("IntegratedTemplateExtension"))
103  {
104  include_once "HTML/Template/ITX.php";
105  include_once "classes/class.ilTemplateHTMLITX.php";
106  }
107  else
108  {
109  include_once "classes/class.ilTemplateITX.php";
110  }*/
111 
112  @include_once "HTML/Template/ITX.php"; // new implementation
113  if (class_exists("HTML_Template_ITX"))
114  {
115  include_once "classes/class.ilTemplateHTMLITX.php";
116  }
117  else
118  {
119  include_once "HTML/ITX.php"; // old implementation
120  include_once "classes/class.ilTemplateITX.php";
121  }
122 
123  require_once "classes/class.ilTemplate.php";
124 
125  //include classes and function libraries
126  require_once "include/inc.db_session_handler.php";
127  require_once "classes/class.ilDBx.php";
128  require_once "./Services/AuthShibboleth/classes/class.ilShibboleth.php";
129  require_once "classes/class.ilias.php";
130  require_once './Services/User/classes/class.ilObjUser.php';
131  require_once "classes/class.ilFormat.php";
132  require_once "./Services/Calendar/classes/class.ilDatePresentation.php";
133  require_once "classes/class.ilSaxParser.php";
134  require_once "./Services/Object/classes/class.ilObjectDefinition.php";
135  require_once "./Services/Style/classes/class.ilStyleDefinition.php";
136  require_once "./Services/Tree/classes/class.ilTree.php";
137  require_once "./Services/Language/classes/class.ilLanguage.php";
138  require_once "./Services/Logging/classes/class.ilLog.php";
139  require_once "Services/Mail/classes/class.ilMailbox.php";
140  require_once "classes/class.ilCtrl.php";
141  require_once "classes/class.ilConditionHandler.php";
142  require_once "classes/class.ilBrowser.php";
143  require_once "classes/class.ilFrameTargetInfo.php";
144  require_once "Services/Navigation/classes/class.ilNavigationHistory.php";
145  require_once "Services/Help/classes/class.ilHelp.php";
146  require_once "include/inc.ilias_version.php";
147 
148  //include role based access control system
149  require_once "./Services/AccessControl/classes/class.ilAccessHandler.php";
150  require_once "./Services/AccessControl/classes/class.ilRbacAdmin.php";
151  require_once "./Services/AccessControl/classes/class.ilRbacSystem.php";
152  require_once "./Services/AccessControl/classes/class.ilRbacReview.php";
153 
154  // include object_data cache
155  require_once "classes/class.ilObjectDataCache.php";
156  require_once 'Services/Tracking/classes/class.ilOnlineTracking.php';
157 
158  // ### AA 03.10.29 added new LocatorGUI class ###
159  //include LocatorGUI
160  require_once "classes/class.ilLocatorGUI.php";
161 
162  // include error_handling
163  require_once "classes/class.ilErrorHandling.php";
164 
165  // php5 downward complaince to php 4 dom xml and clone method
166  if (version_compare(PHP_VERSION,'5','>='))
167  {
168  require_once("include/inc.xml5compliance.php");
169  //require_once("Services/CAS/phpcas/source/CAS/domxml-php4-php5.php");
170 
171  require_once("include/inc.xsl5compliance.php");
172  require_once("include/inc.php4compliance.php");
173  }
174  else
175  {
176  require_once("include/inc.php5compliance.php");
177  }
178 
179  $ilBench->stop("Core", "HeaderInclude_IncludeFiles");
180  }
181 
189  function initIliasIniFile()
190  {
191  global $ilIliasIniFile;
192 
193  require_once("classes/class.ilIniFile.php");
194  $ilIliasIniFile = new ilIniFile("./ilias.ini.php");
195  $GLOBALS['ilIliasIniFile'] =& $ilIliasIniFile;
196  $ilIliasIniFile->read();
197 
198  // initialize constants
199  define("ILIAS_DATA_DIR",$ilIliasIniFile->readVariable("clients","datadir"));
200  define("ILIAS_WEB_DIR",$ilIliasIniFile->readVariable("clients","path"));
201  define("ILIAS_ABSOLUTE_PATH",$ilIliasIniFile->readVariable('server','absolute_path'));
202 
203  // logging
204  define ("ILIAS_LOG_DIR",$ilIliasIniFile->readVariable("log","path"));
205  define ("ILIAS_LOG_FILE",$ilIliasIniFile->readVariable("log","file"));
206  define ("ILIAS_LOG_ENABLED",$ilIliasIniFile->readVariable("log","enabled"));
207  define ("ILIAS_LOG_LEVEL",$ilIliasIniFile->readVariable("log","level"));
208 
209  // read path + command for third party tools from ilias.ini
210  define ("PATH_TO_CONVERT",$ilIliasIniFile->readVariable("tools","convert"));
211  define ("PATH_TO_ZIP",$ilIliasIniFile->readVariable("tools","zip"));
212  define ("PATH_TO_UNZIP",$ilIliasIniFile->readVariable("tools","unzip"));
213  define ("PATH_TO_JAVA",$ilIliasIniFile->readVariable("tools","java"));
214  define ("PATH_TO_HTMLDOC",$ilIliasIniFile->readVariable("tools","htmldoc"));
215  define ("URL_TO_LATEX",$ilIliasIniFile->readVariable("tools","latex"));
216  define ("PATH_TO_FOP",$ilIliasIniFile->readVariable("tools","fop"));
217 
218  // read virus scanner settings
219  switch ($ilIliasIniFile->readVariable("tools", "vscantype"))
220  {
221  case "sophos":
222  define("IL_VIRUS_SCANNER", "Sophos");
223  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
224  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
225  break;
226 
227  case "antivir":
228  define("IL_VIRUS_SCANNER", "AntiVir");
229  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
230  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
231  break;
232 
233  case "clamav":
234  define("IL_VIRUS_SCANNER", "ClamAV");
235  define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
236  define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
237  break;
238 
239  default:
240  define("IL_VIRUS_SCANNER", "None");
241  break;
242  }
243 
244  //$this->buildHTTPPath();
245  }
246 
253  function buildHTTPPath()
254  {
255  include_once 'classes/class.ilHTTPS.php';
256  $https = new ilHTTPS();
257 
258  if($https->isDetected())
259  {
260  $protocol = 'https://';
261  }
262  else
263  {
264  $protocol = 'http://';
265  }
266  $host = $_SERVER['HTTP_HOST'];
267 
268  $rq_uri = $_SERVER['REQUEST_URI'];
269 
270  // security fix: this failed, if the URI contained "?" and following "/"
271  // -> we remove everything after "?"
272  if (is_int($pos = strpos($rq_uri, "?")))
273  {
274  $rq_uri = substr($rq_uri, 0, $pos);
275  }
276 
277  if(!defined('ILIAS_MODULE'))
278  {
279  $path = pathinfo($rq_uri);
280  if(!$path['extension'])
281  {
282  $uri = $rq_uri;
283  }
284  else
285  {
286  $uri = dirname($rq_uri);
287  }
288  }
289  else
290  {
291  // if in module remove module name from HTTP_PATH
292  $path = dirname($rq_uri);
293 
294  // dirname cuts the last directory from a directory path e.g content/classes return content
295 
297 
298  $dirs = explode('/',$module);
299  $uri = $path;
300  foreach($dirs as $dir)
301  {
302  $uri = dirname($uri);
303  }
304  }
305 
306  return define('ILIAS_HTTP_PATH',ilUtil::removeTrailingPathSeparators($protocol.$host.$uri));
307  }
308 
309 
314  function determineClient()
315  {
316  global $ilIliasIniFile;
317 
318  // check whether ini file object exists
319  if (!is_object($ilIliasIniFile))
320  {
321  die ("Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.");
322  }
323 
324  // set to default client if empty
325  if ($_GET["client_id"] != "")
326  {
327  setcookie("ilClientId", $_GET["client_id"]);
328  $_COOKIE["ilClientId"] = $_GET["client_id"];
329  }
330  else if (!$_COOKIE["ilClientId"])
331  {
332  // to do: ilias ini raus nehmen
333  $client_id = $ilIliasIniFile->readVariable("clients","default");
334  setcookie("ilClientId", $client_id);
335  $_COOKIE["ilClientId"] = $client_id;
336 //echo "set cookie";
337  }
338 //echo "-".$_COOKIE["ilClientId"]."-";
339  define ("CLIENT_ID", $_COOKIE["ilClientId"]);
340  }
341 
354  function initClientIniFile()
355  {
356  global $ilClientIniFile;
357 
358  // check whether ILIAS_WEB_DIR is set.
359  if (ILIAS_WEB_DIR == "")
360  {
361  die ("Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
362  }
363 
364  // check whether CLIENT_ID is set.
365  if (CLIENT_ID == "")
366  {
367  die ("Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
368  }
369 
370  $ini_file = "./".ILIAS_WEB_DIR."/".CLIENT_ID."/client.ini.php";
371 
372  // get settings from ini file
373  require_once("classes/class.ilIniFile.php");
374  $ilClientIniFile = new ilIniFile($ini_file);
375  $GLOBALS['ilClientIniFile'] =& $ilClientIniFile;
376  $ilClientIniFile->read();
377 
378  // if no ini-file found switch to setup routine
379  if ($ilClientIniFile->ERROR != "")
380  {
381  return false;
382  }
383 
384  // set constants
385  define ("DEBUG",$ilClientIniFile->readVariable("system","DEBUG"));
386  define ("DEVMODE",$ilClientIniFile->readVariable("system","DEVMODE"));
387  define ("ROOT_FOLDER_ID",$ilClientIniFile->readVariable('system','ROOT_FOLDER_ID'));
388  define ("SYSTEM_FOLDER_ID",$ilClientIniFile->readVariable('system','SYSTEM_FOLDER_ID'));
389  define ("ROLE_FOLDER_ID",$ilClientIniFile->readVariable('system','ROLE_FOLDER_ID'));
390  define ("MAIL_SETTINGS_ID",$ilClientIniFile->readVariable('system','MAIL_SETTINGS_ID'));
391 
392  define ("SYSTEM_MAIL_ADDRESS",$ilClientIniFile->readVariable('system','MAIL_SENT_ADDRESS')); // Change SS
393  define ("MAIL_REPLY_WARNING",$ilClientIniFile->readVariable('system','MAIL_REPLY_WARNING')); // Change SS
394 
395  define ("MAXLENGTH_OBJ_TITLE",125);#$ilClientIniFile->readVariable('system','MAXLENGTH_OBJ_TITLE'));
396  define ("MAXLENGTH_OBJ_DESC",$ilClientIniFile->readVariable('system','MAXLENGTH_OBJ_DESC'));
397 
398  define ("CLIENT_DATA_DIR",ILIAS_DATA_DIR."/".CLIENT_ID);
399  define ("CLIENT_WEB_DIR",ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".CLIENT_ID);
400  define ("CLIENT_NAME",$ilClientIniFile->readVariable('client','name')); // Change SS
401 
402  // build dsn of database connection and connect
403  define ("IL_DSN", $ilClientIniFile->readVariable("db","type").
404  "://".$ilClientIniFile->readVariable("db", "user").
405  ":".$ilClientIniFile->readVariable("db", "pass").
406  "@".$ilClientIniFile->readVariable("db", "host").
407  "/".$ilClientIniFile->readVariable("db", "name"));
408 
409  return true;
410  }
411 
416  {
417  global $ilClientIniFile;
418 
419  if (!$ilClientIniFile->readVariable("client","access"))
420  {
421  if (is_file("./maintenance.html"))
422  {
423  ilUtil::redirect("./maintenance.html");
424  }
425  else
426  {
427  // to do: include standard template here
428  die('<br /><p style="text-align:center;">The server is not '.
429  'available due to maintenance. We apologise for any inconvenience.</p>');
430  }
431  }
432  }
433 
439  function initDatabase()
440  {
441  global $ilDB;
442 
443  // check whether ILIAS_WEB_DIR is set.
444  if (IL_DSN == "")
445  {
446  die ("Fatal Error: ilInitialisation::initDatabase called without IL_DSN.");
447  }
448 
449  // build dsn of database connection and connect
450  require_once("classes/class.ilDBx.php");
451  $ilDB = new ilDBx(IL_DSN);
452  $GLOBALS['ilDB'] =& $ilDB;
453  }
454 
458  function initEventHandling()
459  {
460  global $ilAppEventHandler;
461 
462  // build dsn of database connection and connect
463  require_once("./Services/EventHandling/classes/class.ilAppEventHandler.php");
464  $ilAppEventHandler = new ilAppEventHandler();
465  $GLOBALS['ilAppEventHandler'] =& $ilAppEventHandler;
466  }
467 
471  function setSessionHandler()
472  {
473  global $ilErr;
474 
475  // set session handler
476  if(ini_get('session.save_handler') != 'user')
477  {
478  ini_set("session.save_handler", "user");
479  }
480  if (!db_set_save_handler())
481  {
482  die("Please turn off Safe mode OR set session.save_handler to \"user\" in your php.ini");
483  }
484 
485  }
486 
490  function initSettings()
491  {
492  global $ilSetting;
493 
494  require_once("Services/Administration/classes/class.ilSetting.php");
495  $ilSetting = new ilSetting();
496  $GLOBALS['ilSetting'] =& $ilSetting;
497 
498  // set anonymous user & role id and system role id
499  define ("ANONYMOUS_USER_ID", $ilSetting->get("anonymous_user_id"));
500  define ("ANONYMOUS_ROLE_ID", $ilSetting->get("anonymous_role_id"));
501  define ("SYSTEM_USER_ID", $ilSetting->get("system_user_id"));
502  define ("SYSTEM_ROLE_ID", $ilSetting->get("system_role_id"));
503 
504  // recovery folder
505  define ("RECOVERY_FOLDER_ID", $ilSetting->get("recovery_folder_id"));
506 
507  // installation id
508  define ("IL_INST_ID", $ilSetting->get("inst_id",0));
509 
510  // define default suffix replacements
511  define ("SUFFIX_REPL_DEFAULT", "php,php3,php4,inc,lang,phtml,htaccess");
512  define ("SUFFIX_REPL_ADDITIONAL", $ilSetting->get("suffix_repl_additional"));
513 
514  $this->buildHTTPPath();
515  }
516 
517 
522  {
523  $this->script = substr(strrchr($_SERVER["PHP_SELF"],"/"),1);
524  $dirname = dirname($_SERVER["PHP_SELF"]);
525  $ilurl = @parse_url(ILIAS_HTTP_PATH);
526  if (!$ilurl["path"])
527  {
528  $ilurl["path"] = "/";
529  }
530  $subdir = substr(strstr($dirname,$ilurl["path"]),strlen($ilurl["path"]));
531  $updir = "";
532 
533  if ($subdir)
534  {
535  $num_subdirs = substr_count($subdir,"/");
536 
537  for ($i=1;$i<=$num_subdirs;$i++)
538  {
539  $updir .= "../";
540  }
541  }
542  $this->updir = $updir;
543  }
544 
548  function initStyle()
549  {
550  global $ilBench, $styleDefinition;
551 
552  // load style definitions
553  $ilBench->start("Core", "HeaderInclude_getStyleDefinitions");
554  $styleDefinition = new ilStyleDefinition();
555  $GLOBALS['styleDefinition'] =& $styleDefinition;
556  $styleDefinition->startParsing();
557  $ilBench->stop("Core", "HeaderInclude_getStyleDefinitions");
558  }
559 
560 
564  function handleStyle()
565  {
566  global $styleDefinition;
567 
568  if ($_GET['skin'] && $_GET['style'])
569  {
570  include_once("./Services/Style/classes/class.ilObjStyleSettings.php");
571  if ($styleDefinition->styleExists($_GET['skin'], $_GET['style']) &&
573  {
574  $_SESSION['skin'] = $_GET['skin'];
575  $_SESSION['style'] = $_GET['style'];
576  }
577  }
578  if ($_SESSION['skin'] && $_SESSION['style'])
579  {
580  include_once("./Services/Style/classes/class.ilObjStyleSettings.php");
581  if ($styleDefinition->styleExists($_SESSION['skin'], $_SESSION['style']) &&
583  {
584  $ilias->account->skin = $_SESSION['skin'];
585  $ilias->account->prefs['style'] = $_SESSION['style'];
586  }
587  }
588  }
589 
590  function initUserAccount()
591  {
592  global $ilUser, $ilLog, $ilAuth;
593 
594  //get user id
595  if (empty($_SESSION["AccountId"]))
596  {
597  $_SESSION["AccountId"] = $ilUser->checkUserId();
598 
599  // assigned roles are stored in $_SESSION["RoleId"]
600  // DISABLED smeyer 20070510
601  #$rbacreview = new ilRbacReview();
602  #$GLOBALS['rbacreview'] =& $rbacreview;
603  #$_SESSION["RoleId"] = $rbacreview->assignedRoles($_SESSION["AccountId"]);
604  } // TODO: do we need 'else' here?
605  else
606  {
607  // init user
608  $ilUser->setId($_SESSION["AccountId"]);
609  }
610 
611  // load account data of current user
612  $ilUser->read();
613  }
614 
615  function checkUserClientIP()
616  {
617  global $ilUser, $ilLog, $ilAuth, $ilias;
618 
619  // check client ip
620  $clientip = $ilUser->getClientIP();
621  if (trim($clientip) != "")
622  {
623  $clientip = preg_replace("/[^0-9.?*,:]+/","",$clientip);
624  $clientip = str_replace(".","\\.",$clientip);
625  $clientip = str_replace(Array("?","*",","), Array("[0-9]","[0-9]*","|"), $clientip);
626  if (!preg_match("/^".$clientip."$/", $_SERVER["REMOTE_ADDR"]))
627  {
628  $ilLog ->logError(1,
629  $ilias->account->getLogin().":".$_SERVER["REMOTE_ADDR"].":".$message);
630  $ilAuth->logout();
631  @session_destroy();
632  ilUtil::redirect("login.php?wrong_ip=true");
633  }
634  }
635  }
636 
638  {
639  global $ilUser, $ilAuth;
640 
641  // are we currently in user agreement acceptance?
642  $in_user_agreement = false;
643  if (strtolower($_GET["cmdClass"]) == "ilstartupgui" &&
644  (strtolower($_GET["cmd"]) == "getacceptance" ||
645  (is_array($_POST["cmd"]) &&
646  key($_POST["cmd"]) == "getAcceptance")))
647  {
648  $in_user_agreement = true;
649  }
650 
651  // check wether user has accepted the user agreement
652  // echo "-".$script;
653  if (!$ilUser->hasAcceptedUserAgreement() &&
654  $ilAuth->getAuth() &&
655  !$in_user_agreement &&
656  $ilUser->getId() != ANONYMOUS_USER_ID)
657  {
658  ilUtil::redirect("ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&target=".$_GET["target"]."&cmd=getAcceptance");
659  }
660  }
661 
662 
666  function goToPublicSection()
667  {
668  global $ilAuth;
669 
670  // logout and end previous session
671  $ilAuth->logout();
672  session_unset();
673  session_destroy();
674 
675  // new session and login as anonymous
676  $this->setSessionHandler();
677  session_start();
678  $_POST["username"] = "anonymous";
679  $_POST["password"] = "anonymous";
681  $ilAuth->start();
682 
683  if (ANONYMOUS_USER_ID == "")
684  {
685  die ("Public Section enabled, but no Anonymous user found.");
686  }
687  if (!$ilAuth->getAuth())
688  {
689  die("ANONYMOUS user with the object_id ".ANONYMOUS_USER_ID." not found!");
690  }
691 
692  // BEGIN WebDAV: Don't do a redirect to the public area, if the user
693  // performs a get request.
694  /*
695  if (ilPlugin::isPluginActive('ilUsabilityPlugin'))
696  {
697  if ($_SERVER['REQUEST_METHOD'] == 'GET')
698  {
699  $_SESSION["AccountId"] = ANONYMOUS_USER_ID;
700  $this->initUserAccount();
701  return;
702  }
703  }
704  */
705  // END WebDAV: Don't do a redirect to the public area, if the user
706 
707  // if target given, try to go there
708  if ($_GET["target"] != "")
709  {
710  $this->initUserAccount();
711 
712  // target is accessible -> goto target
713  include_once("Services/Init/classes/class.ilStartUpGUI.php");
714  if (ilStartUpGUI::_checkGoto($_GET["target"]))
715  {
716  // Disabled: GET parameter is kept, since no redirect. smeyer
717  // additional parameter capturing for survey access codes
718  /*
719  $survey_parameter = "";
720  if (array_key_exists("accesscode", $_GET))
721  {
722  $survey_parameter = "&accesscode=" . $_GET["accesscode"];
723  }
724  */
725  // Disabled redirect for public section
726  return true;
727  #ilUtil::redirect(ILIAS_HTTP_PATH.
728  # "/goto.php?target=".$_GET["target"].$survey_parameter);
729  }
730  else // target is not accessible -> login
731  {
732  $this->goToLogin();
733  }
734  }
735 
736  $_GET["ref_id"] = ROOT_FOLDER_ID;
737 
738  $_GET["cmd"] = "frameset";
739  $jump_script = "repository.php";
740 
741  $script = $this->updir.$jump_script."?reloadpublic=1&cmd=".$_GET["cmd"]."&ref_id=".$_GET["ref_id"];
742 
743  // todo do it better, if JS disabled
744  //echo "<script language=\"Javascript\">\ntop.location.href = \"".$script."\";\n</script>\n";
745  echo "<script language=\"Javascript\">\ntop.location.href = \"".$script."\";\n</script>\n".
746  'Please click <a href="'.$script.'">here</a> if you are not redirected automatically.';
747  exit;
748  }
749 
750 
754  function goToLogin($a_auth_stat = "")
755  {
756  global $PHP_SELF;
757 
758  session_unset();
759  session_destroy();
760 
761  $add = "";
762  if ($_GET["soap_pw"] != "")
763  {
764  $add = "&soap_pw=".$_GET["soap_pw"]."&ext_uid=".$_GET["ext_uid"];
765  }
766 
767  $script = $this->updir."login.php?target=".$_GET["target"]."&client_id=".$_COOKIE["ilClientId"].
768  "&auth_stat=".$a_auth_stat.$add;
769 
770  // todo do it better, if JS disabled
771  // + this is, when session "ends", so
772  // we should try to prevent some information about current
773  // location
774  //
775  // check whether we are currently doing a goto call
776  if (is_int(strpos($PHP_SELF, "goto.php")) && $_GET["soap_pw"] == "" &&
777  $_GET["reloadpublic"] != "1")
778  {
779  $script = $this->updir."goto.php?target=".$_GET["target"]."&client_id=".CLIENT_ID.
780  "&reloadpublic=1";
781  }
782 
783  echo "<script language=\"Javascript\">\ntop.location.href = \"".$script."\";\n</script>\n".
784  'Please click <a href="'.$script.'">here</a> if you are not redirected automatically.';
785 
786  exit;
787 
788  }
789 
793  function initLanguage()
794  {
795  global $ilBench, $lng, $ilUser, $ilSetting;
796 
797  //init language
798  $ilBench->start("Core", "HeaderInclude_initLanguage");
799 
800  if (is_null($_SESSION['lang']))
801  {
802  if ($_GET["lang"])
803  {
804  $_GET["lang"] = $_GET["lang"];
805  }
806  else
807  {
808  if (is_object($ilUser))
809  {
810  $_GET["lang"] = $ilUser->getPref("language");
811  }
812  }
813  }
814 
815  if ($_POST['change_lang_to'] != "")
816  {
817  $_GET['lang'] = ilUtil::stripSlashes($_POST['change_lang_to']);
818  }
819 
820  $_SESSION['lang'] = ($_GET['lang']) ? $_GET['lang'] : $_SESSION['lang'];
821 
822  // prefer personal setting when coming from login screen
823  // Added check for ilUser->getId > 0 because it is 0 when the language is changed and the user agreement should be displayes (Helmut Schottm��ller, 2006-10-14)
824  if (is_object($ilUser) && $ilUser->getId() != ANONYMOUS_USER_ID && $ilUser->getId() > 0)
825  {
826  $_SESSION['lang'] = $ilUser->getPref("language");
827  }
828 
829  // check whether lang selection is valid
831  if (!in_array($_SESSION['lang'], $langs))
832  {
833  if (is_object($ilSetting) && $ilSetting->get("language") != "")
834  {
835  $_SESSION['lang'] = $ilSetting->get("language");
836  }
837  else
838  {
839  $_SESSION['lang'] = $langs[0];
840  }
841  }
842  $_GET['lang'] = $_SESSION['lang'];
843 
844  $lng = new ilLanguage($_SESSION['lang']);
845  $GLOBALS['lng'] =& $lng;
846  $ilBench->stop("Core", "HeaderInclude_initLanguage");
847 
848  }
849 
854  {
855  global $ilBench, $rbacsystem, $rbacadmin, $rbacreview;
856 
857  $ilBench->start("Core", "HeaderInclude_initRBAC");
858  $rbacsystem = new ilRbacSystem();
859  $GLOBALS['rbacsystem'] =& $rbacsystem;
860  $rbacadmin = new ilRbacAdmin();
861  $GLOBALS['rbacadmin'] =& $rbacadmin;
862  $rbacreview = new ilRbacReview();
863  $GLOBALS['rbacreview'] =& $rbacreview;
864  $ilAccess = new ilAccessHandler();
865  $GLOBALS["ilAccess"] =& $ilAccess;
866  $ilBench->stop("Core", "HeaderInclude_initRBAC");
867  }
868 
869 
874  function initILIAS($context = "web")
875  {
876  global $ilDB, $ilUser, $ilLog, $ilErr, $ilClientIniFile, $ilIliasIniFile,
877  $ilSetting, $ilias, $https, $ilObjDataCache,
878  $ilLog, $objDefinition, $lng, $ilCtrl, $ilBrowser, $ilHelp,
879  $ilTabs, $ilMainMenu, $rbacsystem, $ilNavigationHistory;
880 
881  // remove unsafe characters
882  $this->removeUnsafeCharacters();
883 
884  // error reporting
885  // remove notices from error reporting
886  if (version_compare(PHP_VERSION, '5.3.0', '>='))
887  {
888  error_reporting((ini_get("error_reporting") & ~E_NOTICE) & ~E_DEPRECATED);
889  }
890  else
891  {
892  error_reporting(ini_get('error_reporting') & ~E_NOTICE);
893  }
894 
895  // include common code files
896  $this->requireCommonIncludes();
897  global $ilBench;
898 
899  // set error handler (to do: check preconditions for error handler to work)
900  $ilBench->start("Core", "HeaderInclude_GetErrorHandler");
901  $ilErr = new ilErrorHandling();
902  $GLOBALS['ilErr'] =& $ilErr;
903  $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK,array($ilErr,'errorHandler'));
904  $ilBench->stop("Core", "HeaderInclude_GetErrorHandler");
905 
906 
907  // prepare file access to work with safe mode (has been done in class ilias before)
908  umask(0117);
909 
910 
911  // $ilIliasIniFile initialisation
912  $this->initIliasIniFile();
913 
914 
915  // CLIENT_ID determination
916  $this->determineClient();
917 
918  // $ilAppEventHandler initialisation
919  $this->initEventHandling();
920 
921  // $ilClientIniFile initialisation
922  if (!$this->initClientIniFile())
923  {
924  $c = $_COOKIE["ilClientId"];
925  setcookie("ilClientId", $ilIliasIniFile->readVariable("clients","default"));
926  $_COOKIE["ilClientId"] = $ilIliasIniFile->readVariable("clients","default");
927  if (CLIENT_ID != "" && CLIENT_ID != $ilIliasIniFile->readVariable("clients","default"))
928  {
929  ilUtil::redirect("index.php?client_id=".$ilIliasIniFile->readVariable("clients","default"));
930  }
931  else
932  {
933  echo ("Client $c does not exist. ".'Please <a href="./index.php">click here</a> to return to the default client.');
934  }
935  exit;
936  //ilUtil::redirect("./setup/setup.php"); // to do: this could fail in subdirectories
937  // this is also source of a bug (see mantis)
938  }
939 
940 
941  // maintenance mode
942  $this->handleMaintenanceMode();
943 
944  // $ilDB initialisation
945  $this->initDatabase();
946 
947  // init plugin admin class
948  include_once("./Services/Component/classes/class.ilPluginAdmin.php");
949  $ilPluginAdmin = new ilPluginAdmin();
950  $GLOBALS['ilPluginAdmin'] = $ilPluginAdmin;
951 
952  // set session handler
953  $this->setSessionHandler();
954 
955  // $ilSetting initialisation
956  $this->initSettings();
957 
958 
959  // $ilLog initialisation
960  $this->initLog();
961 
962  // $https initialisation
963  require_once './classes/class.ilHTTPS.php';
964  $https = new ilHTTPS();
965  $GLOBALS['https'] =& $https;
966  $https->enableSecureCookies();
967  $https->checkPort();
968 
969  // $ilAuth initialisation
970  include_once("./Services/Authentication/classes/class.ilAuthUtils.php");
972  global $ilAuth;
973 
974  // Do not accept external session ids
975  if ($_GET["PHPSESSID"] != "")
976  {
977  $_GET["PHPSESSID"] == "";
978  session_regenerate_id();
979  }
980 
981  // $ilias initialisation
982  global $ilias, $ilBench;
983  $ilBench->start("Core", "HeaderInclude_GetILIASObject");
984  $ilias = new ILIAS();
985  $GLOBALS['ilias'] =& $ilias;
986  $ilBench->stop("Core", "HeaderInclude_GetILIASObject");
987 
988  // test: trace function calls in debug mode
989  if (DEVMODE)
990  {
991  if (function_exists("xdebug_start_trace"))
992  {
993  //xdebug_start_trace("/tmp/test.txt");
994  }
995  }
996 
997  // $ilObjDataCache initialisation
998  $ilObjDataCache = new ilObjectDataCache();
999  $GLOBALS['ilObjDataCache'] =& $ilObjDataCache;
1000 
1001  // workaround: load old post variables if error handler 'message' was called
1002  if ($_SESSION["message"])
1003  {
1004  $_POST = $_SESSION["post_vars"];
1005  }
1006 
1007 
1008  // put debugging functions here
1009  require_once "include/inc.debug.php";
1010 
1011 
1012  // $objDefinition initialisation
1013  $ilBench->start("Core", "HeaderInclude_getObjectDefinitions");
1014  $objDefinition = new ilObjectDefinition();
1015  $GLOBALS['objDefinition'] =& $objDefinition;
1016 // $objDefinition->startParsing();
1017  $ilBench->stop("Core", "HeaderInclude_getObjectDefinitions");
1018 
1019  // $ilAccess and $rbac... initialisation
1020  $this->initAccessHandling();
1021 
1022  // init tree
1023  $tree = new ilTree(ROOT_FOLDER_ID);
1024  $GLOBALS['tree'] =& $tree;
1025 
1026  // authenticate & start session
1027  PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, "errorHandler"));
1028  $ilBench->start("Core", "HeaderInclude_Authentication");
1029 //var_dump($_SESSION);
1033  $ilAuth->start();
1034 //var_dump($_SESSION);
1035  $ilias->setAuthError($ilErr->getLastError());
1036  $ilBench->stop("Core", "HeaderInclude_Authentication");
1037 
1038  // workaround: force login
1039  if ($_GET["cmd"] == "force_login" || $this->script == "login.php")
1040  {
1041  $ilAuth->logout();
1042  $_SESSION = array();
1043  $_SESSION["AccountId"] = "";
1044  $ilAuth->start();
1045  $ilias->setAuthError($ilErr->getLastError());
1046  }
1047 
1048  // check correct setup
1049  if (!$ilias->getSetting("setup_ok"))
1050  {
1051  die("Setup is not completed. Please run setup routine again.");
1052  }
1053 
1054  // $ilUser initialisation (1)
1055  $ilBench->start("Core", "HeaderInclude_getCurrentUser");
1056  $ilUser = new ilObjUser();
1057  $ilias->account =& $ilUser;
1058  $GLOBALS['ilUser'] =& $ilUser;
1059  $ilBench->stop("Core", "HeaderInclude_getCurrentUser");
1060 
1061 
1062  // $ilCtrl initialisation
1063  $ilCtrl = new ilCtrl();
1064  $GLOBALS['ilCtrl'] =& $ilCtrl;
1065 
1066  // determin current script and up-path to main directory
1067  // (sets $this->script and $this->updir)
1068  $this->determineScriptAndUpDir();
1069 
1070  // $styleDefinition initialisation and style handling for login and co.
1071  $this->initStyle();
1072  if (in_array($this->script,
1073  array("login.php", "register.php", "view_usr_agreement.php"))
1074  || $_GET["baseClass"] == "ilStartUpGUI")
1075  {
1076  $this->handleStyle();
1077  }
1078 
1079 
1080  // handle ILIAS 2 imported users:
1081  // check ilias 2 password, if authentication failed
1082  // only if AUTH_LOCAL
1083 //echo "A";
1084  if (AUTH_CURRENT == AUTH_LOCAL && !$ilAuth->getAuth() && $this->script == "login.php" && $_POST["username"] != "")
1085  {
1087  {
1089  ilUtil::stripSlashes($_POST["username"]),
1090  ilUtil::stripSlashes($_POST["password"])))
1091  {
1092  $ilAuth->start();
1093  $ilias->setAuthError($ilErr->getLastError());
1094  ilUtil::redirect("index.php");
1095  }
1096  }
1097  }
1098 
1099 //echo $_POST; exit;
1100  //
1101  // SUCCESSFUL AUTHENTICATION
1102  //
1103 //echo "<br>B-".$ilAuth->getAuth()."-".$ilAuth->_sessionName."-";
1104 //var_dump ($session[_authsession]);
1105  if ($ilAuth->getAuth() && $ilias->account->isCurrentUserActive())
1106  {
1107 //echo "C"; exit;
1108  $ilBench->start("Core", "HeaderInclude_getCurrentUserAccountData");
1109 //var_dump($_SESSION);
1110  // get user data
1111  $this->initUserAccount();
1112 //var_dump($_SESSION);
1113  // check client IP of user
1114  $this->checkUserClientIP();
1115 
1116  // check user agreement
1117  $this->checkUserAgreement();
1118 
1119  // update last_login date once the user logged in
1120  if ($this->script == "login.php" ||
1121  $_GET["baseClass"] == "ilStartUpGUI")
1122  {
1123  // determine first login of user for setting an indicator
1124  // which still is available in PersonalDesktop, Repository, ...
1125  // (last login date is set to current date in next step)
1126  require_once('Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1127  $security_settings = ilSecuritySettings::_getInstance();
1128  if( $security_settings->isPasswordChangeOnFirstLoginEnabled() &&
1129  '0000-00-00 00:00:00' == (string)$ilUser->getLastLogin() &&
1130  '0000-00-00 00:00:00' == (string)$ilUser->getApproveDate() )
1131  {
1132  $ilUser->resetLastPasswordChange();
1133  }
1134 
1135  $ilUser->refreshLogin();
1136  }
1137 
1138  // differentiate account security mode
1139  require_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1140  $security_settings = ilSecuritySettings::_getInstance();
1141  if( $security_settings->getAccountSecurityMode() ==
1143  {
1144  // reset counter for failed logins
1145  ilObjUser::_resetLoginAttempts( $ilUser->getId() );
1146  }
1147 
1148  // set hits per page for all lists using table module
1149  $_GET['limit'] = $_SESSION['tbl_limit'] = (int) $ilUser->getPref('hits_per_page');
1150 
1151  // the next line makes it impossible to save the offset somehow in a session for
1152  // a specific table (I tried it for the user administration).
1153  // its not posssible to distinguish whether it has been set to page 1 (=offset = 0)
1154  // or not set at all (then we want the last offset, e.g. being used from a session var).
1155  // So I added the wrapping if statement. Seems to work (hopefully).
1156  // Alex April 14th 2006
1157  if ($_GET['offset'] != "") // added April 14th 2006
1158  {
1159  $_GET['offset'] = (int) $_GET['offset']; // old code
1160  }
1161 
1162  $ilBench->stop("Core", "HeaderInclude_getCurrentUserAccountData");
1163  }
1164  elseif (
1165  $this->script != "login.php"
1166  and $this->script != "shib_login.php"
1167  and $this->script != "error.php"
1168  and $this->script != "index.php"
1169  and $this->script != "view_usr_agreement.php"
1170  and $this->script != "register.php"
1171  and $this->script != "chat.php"
1172  and $this->script != "pwassist.php"
1173  )
1174  {
1175  //
1176  // AUTHENTICATION FAILED
1177  //
1178 
1179  // If ILIAS is accessed by a WebDAV client,
1180  // request login again.
1181  if ($context == "webdav")
1182  {
1183  $ilAuth->logout();
1184  $ilAuth->start();
1185 
1186  // $lng initialisation, in case authentication succeeds
1187  $this->initLanguage();
1188 
1189  return;
1190  }
1191 
1192  // authentication failed due to inactive user?
1193  if ($ilAuth->getAuth() && !$ilUser->isCurrentUserActive())
1194  {
1195  $inactive = true;
1196  }
1197 
1198  // jump to public section (to do: is this always the indended
1199  // behaviour, login could be another possibility (including
1200  // message)
1201 //echo "-".$_GET["baseClass"]."-";
1202  if ($_GET["baseClass"] != "ilStartUpGUI")
1203  {
1204  // $lng initialisation
1205  $this->initLanguage();
1206 
1207  if ($ilSetting->get("pub_section") &&
1208  ($ilAuth->getStatus() == "" || $ilAuth->getStatus() == AUTH_EXPIRED ||
1209  $ilAuth->getStatus() == AUTH_IDLED) &&
1210  $_GET["reloadpublic"] != "1")
1211  {
1212  $this->goToPublicSection();
1213  }
1214  else
1215  {
1216  if ($context == "web")
1217  {
1218  // normal access by webinterface
1219  $this->goToLogin($ilAuth->getStatus());
1220  exit;
1221  } else {
1222  // called by soapAuthenticationLdap
1223  return;
1224  }
1225 
1226  }
1227  // we should not get here => public section needs no redirect smeyer
1228  // exit;
1229  }
1230  }
1231  else if(!$ilAuth->getAuth())
1232  {
1233  require_once('./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1234  // differentiate account security mode
1235  $security = ilSecuritySettings::_getInstance();
1236  if( $security->getAccountSecurityMode() ==
1238  {
1239  if($_POST['username'] && $ilUser->getId() == 0)
1240  {
1241  $username = ilUtil::stripSlashes( $_POST['username'] );
1242  $usr_id = ilObjUser::_lookupId( $username );
1243 
1244  if( $usr_id != ANONYMOUS_USER_ID )
1245  {
1247 
1248  $login_attempts = ilObjUser::_getLoginAttempts( $usr_id );
1249  $max_attempts = $security->getLoginMaxAttempts();
1250 
1251  if( $login_attempts >= $max_attempts &&
1252  $usr_id != SYSTEM_USER_ID &&
1253  $max_attempts > 0 )
1254  {
1255  ilObjUser::_setUserInactive( $usr_id );
1256  }
1257  }
1258  }
1259  }
1260  }
1261 
1262  //
1263  // SUCCESSFUL AUTHENTICATED or NON-AUTH-AREA (Login, Registration, ...)
1264  //
1265 
1266  // $lng initialisation
1267  $this->initLanguage();
1268 
1269  // store user language in tree
1270  $GLOBALS['tree']->initLangCode();
1271 
1272  // instantiate main template
1273  $tpl = new ilTemplate("tpl.main.html", true, true);
1274  $GLOBALS['tpl'] =& $tpl;
1275 
1276 
1277  // ### AA 03.10.29 added new LocatorGUI class ###
1278  // when locator data array does not exist, initialise
1279  if ( !isset($_SESSION["locator_level"]) )
1280  {
1281  $_SESSION["locator_data"] = array();
1282  $_SESSION["locator_level"] = -1;
1283  }
1284  // initialise global ilias_locator object
1285  $ilias_locator = new ilLocatorGUI(); // deprecated
1286  $ilLocator = new ilLocatorGUI();
1287  $GLOBALS['ilias_locator'] =& $ilias_locator; // deprecated
1288  $GLOBALS['ilLocator'] =& $ilLocator;
1289 
1290  // load style definitions
1291  $ilBench->start("Core", "HeaderInclude_getStyleDefinitions");
1292  $styleDefinition = new ilStyleDefinition();
1293  $GLOBALS['styleDefinition'] =& $styleDefinition;
1294  $styleDefinition->startParsing();
1295  $ilBench->stop("Core", "HeaderInclude_getStyleDefinitions");
1296 
1297  // load style sheet depending on user's settings
1298  $location_stylesheet = ilUtil::getStyleSheetLocation();
1299  $tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
1300 
1301  // Init Navigation History
1302  $ilNavigationHistory = new ilNavigationHistory();
1303  $GLOBALS['ilNavigationHistory'] =& $ilNavigationHistory;
1304 
1305  // init infopanel
1306 
1307  // provide global browser information
1308  $ilBrowser = new ilBrowser();
1309  $GLOBALS['ilBrowser'] =& $ilBrowser;
1310 
1311  // provide global help object
1312  $ilHelp = new ilHelp();
1313  $GLOBALS['ilHelp'] =& $ilHelp;
1314 
1315  // main tabs gui
1316  include_once 'classes/class.ilTabsGUI.php';
1317  $ilTabs = new ilTabsGUI();
1318  $GLOBALS['ilTabs'] =& $ilTabs;
1319 
1320  // main menu
1321  include_once 'classes/class.ilMainMenuGUI.php';
1322  $ilMainMenu = new ilMainMenuGUI("_top");
1323  $GLOBALS['ilMainMenu'] =& $ilMainMenu;
1324 
1325  // Store online time of user
1326  ilOnlineTracking::_updateAccess($ilUser->getId());
1327 
1328  // ECS Tasks
1329  include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
1330  $scheduler = ilECSTaskScheduler::_getInstance();
1331  $scheduler->start();
1332 
1333  $ilBench->stop("Core", "HeaderInclude");
1334  $ilBench->save();
1335 
1336  }
1337 
1341  function initFeed()
1342  {
1343  global $ilDB, $ilUser, $ilLog, $ilErr, $ilClientIniFile, $ilIliasIniFile,
1344  $ilSetting, $ilias, $https, $ilObjDataCache,
1345  $ilLog, $objDefinition, $lng, $ilCtrl, $ilBrowser, $ilHelp,
1346  $ilTabs, $ilMainMenu, $rbacsystem, $ilNavigationHistory;
1347 
1348  // remove unsafe characters
1349  $this->removeUnsafeCharacters();
1350 
1351  // include common code files
1352  $this->requireCommonIncludes();
1353  global $ilBench;
1354 
1355  // $ilAppEventHandler initialisation
1356  $this->initEventHandling();
1357 
1358  // set error handler (to do: check preconditions for error handler to work)
1359  $ilBench->start("Core", "HeaderInclude_GetErrorHandler");
1360  $ilErr = new ilErrorHandling();
1361  $GLOBALS['ilErr'] =& $ilErr;
1362  $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK,array($ilErr,'errorHandler'));
1363  $ilBench->stop("Core", "HeaderInclude_GetErrorHandler");
1364 
1365  // prepare file access to work with safe mode (has been done in class ilias before)
1366  umask(0117);
1367 
1368  // $ilIliasIniFile initialisation
1369  $this->initIliasIniFile();
1370 
1371  // CLIENT_ID determination
1372  $this->determineClient();
1373 
1374  // $ilClientIniFile initialisation
1375  if (!$this->initClientIniFile())
1376  {
1377  $c = $_COOKIE["ilClientId"];
1378  setcookie("ilClientId", $ilIliasIniFile->readVariable("clients","default"));
1379  $_COOKIE["ilClientId"] = $ilIliasIniFile->readVariable("clients","default");
1380  echo ("Client $c does not exist. Please reload this page to return to the default client.");
1381  exit;
1382  }
1383 
1384  // maintenance mode
1385  $this->handleMaintenanceMode();
1386 
1387  // $ilDB initialisation
1388  $this->initDatabase();
1389 
1390  // init plugin admin class
1391  include_once("./Services/Component/classes/class.ilPluginAdmin.php");
1392  $ilPluginAdmin = new ilPluginAdmin();
1393  $GLOBALS['ilPluginAdmin'] = $ilPluginAdmin;
1394 
1395  // $ilObjDataCache initialisation
1396  $ilObjDataCache = new ilObjectDataCache();
1397  $GLOBALS['ilObjDataCache'] =& $ilObjDataCache;
1398 
1399  // init settings
1400  $this->initSettings();
1401 
1402  // init tree
1403  $tree = new ilTree(ROOT_FOLDER_ID);
1404  $GLOBALS['tree'] =& $tree;
1405 
1406  // init language
1407  $lng = new ilLanguage($ilClientIniFile->readVariable("language","default"));
1408  $GLOBALS['lng'] =& $lng;
1409 
1410  }
1411 
1412  function initLog() {
1413  global $ilLog;
1414  $log = new ilLog(ILIAS_LOG_DIR,ILIAS_LOG_FILE,CLIENT_ID,ILIAS_LOG_ENABLED,ILIAS_LOG_LEVEL);
1415  $GLOBALS['log'] =& $log;
1416  $ilLog =& $log;
1417  $GLOBALS['ilLog'] =& $ilLog;
1418  }
1419 
1420  function initILIASObject() {
1421  global $ilias, $ilBench;
1422  $ilBench->start("Core", "HeaderInclude_GetILIASObject");
1423  $ilias = new ILIAS();
1424  $GLOBALS['ilias'] =& $ilias;
1425  $ilBench->stop("Core", "HeaderInclude_GetILIASObject");
1426 //var_dump($_SESSION);
1427  }
1428 }
1429 ?>