ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilInitialisation Class Reference

ILIAS Initialisation Utility Class perform basic setup: init database handler, load configuration file, init user authentification & error handler, load object type definitions. More...

+ Collaboration diagram for ilInitialisation:

Static Public Member Functions

static setSessionHandler ()
 set session handler to db
static initUserAccount ()
 Init user with current account id.
static goToPublicSection ($a_auth_stat="")
 go to public section
static initILIAS ()
 ilias initialisation

Static Protected Member Functions

static removeUnsafeCharacters ()
 Remove unsafe characters from GET.
static requireCommonIncludes ()
 get common include code files
static includePhp5Compliance ()
 This is a hack for authentication.
static initIliasIniFile ()
 This method provides a global instance of class ilIniFile for the ilias.ini.php file in variable $ilIliasIniFile.
static buildHTTPPath ()
 builds http path
static determineClient ()
 This method determines the current client and sets the constant CLIENT_ID.
static initClientIniFile ()
 This method provides a global instance of class ilIniFile for the client.ini.php file in variable $ilClientIniFile.
static handleMaintenanceMode ()
 handle maintenance mode
static initDatabase ()
 initialise database object $ilDB
static setCookieParams ()
 set session cookie params for path, domain, etc.
static initSettings ()
 initialise $ilSettings object and define constants
static initStyle ()
 provide $styleDefinition object
static checkUserAgreement (ilObjUser $a_user)
 Check user agreement for every request.
static initLocale ()
 Init Locale.
static goToLogin ($a_auth_stat="")
 go to login
static initLanguage ()
 $lng initialisation
static initAccessHandling ()
 $ilAccess and $rbac...
static initLog ()
 Init log instance.
static initGlobal ($a_name, $a_class, $a_source_file=null)
 Initialize global instance.
static abortAndDie ($a_message)
 Exit.
static handleDevMode ()
 Prepare developer tools.
static initCore ()
 Init core objects (level 0)
static initClient ()
 Init client-based objects (level 1)
static initUser ()
 Init user / authentification (level 2)
static authenticate ()
 Try authentication.
static initHTML ()
 init HTML output (level 3)
static getCurrentCmd ()
 Extract current cmd from request.
static blockedAuthentication ($a_current_script)
 Block authentication based on current request.
static showingLoginForm ($a_current_script)
 Is current view the login form?
static redirect ($a_target, $a_message_details)
 Redirects to target url if context supports it.

Detailed Description

ILIAS Initialisation Utility Class perform basic setup: init database handler, load configuration file, init user authentification & error handler, load object type definitions.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Sascha Hofmann shofm.nosp@m.ann@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$

Definition at line 27 of file class.ilInitialisation.php.

Member Function Documentation

static ilInitialisation::abortAndDie (   $a_message)
staticprotected

Exit.

Parameters
string$a_message

Definition at line 878 of file class.ilInitialisation.php.

References $GLOBALS.

Referenced by determineClient(), goToPublicSection(), handleMaintenanceMode(), initClientIniFile(), initSettings(), initUserAccount(), redirect(), and setSessionHandler().

{
if(is_object($GLOBALS['ilLog']))
{
$GLOBALS['ilLog']->write("Fatal Error: ilInitialisation - ".$a_message);
}
die($a_message);
}

+ Here is the caller graph for this function:

static ilInitialisation::authenticate ( )
staticprotected

Try authentication.

This will basically validate the current session

Definition at line 1153 of file class.ilInitialisation.php.

References $ilErr, and initUserAccount().

Referenced by initILIAS().

{
global $ilAuth, $ilias, $ilErr;
$current_script = substr(strrchr($_SERVER["PHP_SELF"], "/"), 1);
if(self::blockedAuthentication($current_script))
{
return;
}
$oldSid = session_id();
$ilAuth->start();
$ilias->setAuthError($ilErr->getLastError());
if(IS_PAYMENT_ENABLED)
{
// cart is "attached" to session, has to be updated
$newSid = session_id();
if($oldSid != $newSid)
{
include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
}
}
if($ilAuth->getAuth() && $ilAuth->getStatus() == '')
{
self::handleAuthenticationSuccess();
}
else
{
if (!self::showingLoginForm($current_script))
{
// :TODO: should be moved to context?!
$mandatory_auth = ($current_script != "shib_login.php"
&& $current_script != "shib_logout.php"
&& $current_script != "error.php"
&& $current_script != "chat.php"
&& $current_script != "index.php"); // #10316
if($mandatory_auth)
{
self::handleAuthenticationFail();
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::blockedAuthentication (   $a_current_script)
staticprotected

Block authentication based on current request.

Returns
boolean

Definition at line 1338 of file class.ilInitialisation.php.

References $_REQUEST, $cmd, and getCurrentCmd().

{
if($a_current_script == "register.php" ||
$a_current_script == "pwassist.php" ||
$a_current_script == "confirmReg.php")
{
return true;
}
if($_REQUEST["baseClass"] == "ilStartUpGUI")
{
$cmd_class = $_REQUEST["cmdClass"];
if($cmd_class == "ilaccountregistrationgui" ||
$cmd_class == "ilpasswordassistancegui")
{
return true;
}
if($cmd == "showUserAgreement" || $cmd == "showClientList" ||
$cmd == 'showAccountMigration' || $cmd == 'migrateAccount' ||
$cmd == 'processCode')
{
return true;
}
}
return false;
}

+ Here is the call graph for this function:

static ilInitialisation::buildHTTPPath ( )
staticprotected

builds http path

Definition at line 184 of file class.ilInitialisation.php.

References $dirs, $https, $path, ILIAS_MODULE, and ilUtil\removeTrailingPathSeparators().

Referenced by initSettings().

{
include_once './Services/Http/classes/class.ilHTTPS.php';
$https = new ilHTTPS();
if($https->isDetected())
{
$protocol = 'https://';
}
else
{
$protocol = 'http://';
}
$host = $_SERVER['HTTP_HOST'];
$rq_uri = $_SERVER['REQUEST_URI'];
// security fix: this failed, if the URI contained "?" and following "/"
// -> we remove everything after "?"
if (is_int($pos = strpos($rq_uri, "?")))
{
$rq_uri = substr($rq_uri, 0, $pos);
}
if(!defined('ILIAS_MODULE'))
{
$path = pathinfo($rq_uri);
if(!$path['extension'])
{
$uri = $rq_uri;
}
else
{
$uri = dirname($rq_uri);
}
}
else
{
// if in module remove module name from HTTP_PATH
$path = dirname($rq_uri);
// dirname cuts the last directory from a directory path e.g content/classes return content
$dirs = explode('/',$module);
$uri = $path;
foreach($dirs as $dir)
{
$uri = dirname($uri);
}
}
return define('ILIAS_HTTP_PATH',ilUtil::removeTrailingPathSeparators($protocol.$host.$uri));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::checkUserAgreement ( ilObjUser  $a_user)
staticprotected

Check user agreement for every request.

Parameters
ilObjUser$a_user

Definition at line 592 of file class.ilInitialisation.php.

References $_GET, $_POST, ilObjUser\checkTimeLimit(), ilObject\getId(), ilObjUser\hasAcceptedUserAgreement(), and redirect().

Referenced by initUserAccount().

{
// are we currently in user agreement acceptance?
if (strtolower($_GET["cmdClass"]) == "ilstartupgui" &&
(strtolower($_GET["cmd"]) == "getacceptance" ||
(is_array($_POST["cmd"]) &&
key($_POST["cmd"]) == "getAcceptance")))
{
return;
}
if(!$a_user->hasAcceptedUserAgreement() &&
$a_user->getId() != ANONYMOUS_USER_ID &&
$a_user->checkTimeLimit())
{
if(!defined('IL_CERT_SSO'))
{
self::redirect('ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&target='.$_GET['target'].'&cmd=getAcceptance',
'User Agreement not accepted.');
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::determineClient ( )
staticprotected

This method determines the current client and sets the constant CLIENT_ID.

Definition at line 244 of file class.ilInitialisation.php.

References $_COOKIE, $_GET, $client_id, $ilIliasIniFile, abortAndDie(), ilUtil\setCookie(), and ilUtil\stripSlashes().

Referenced by initClient().

{
// check whether ini file object exists
if (!is_object($ilIliasIniFile))
{
self::abortAndDie("Fatal Error: ilInitialisation::determineClient called without initialisation of ILIAS ini file object.");
}
// set to default client if empty
if ($_GET["client_id"] != "")
{
$_GET["client_id"] = ilUtil::stripSlashes($_GET["client_id"]);
if (!defined("IL_PHPUNIT_TEST"))
{
ilUtil::setCookie("ilClientId", $_GET["client_id"]);
}
}
else if (!$_COOKIE["ilClientId"])
{
// to do: ilias ini raus nehmen
$client_id = $ilIliasIniFile->readVariable("clients","default");
ilUtil::setCookie("ilClientId", $client_id);
}
if (!defined("IL_PHPUNIT_TEST"))
{
define ("CLIENT_ID", $_COOKIE["ilClientId"]);
}
else
{
define ("CLIENT_ID", $_GET["client_id"]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::getCurrentCmd ( )
staticprotected

Extract current cmd from request.

Returns
string

Definition at line 1320 of file class.ilInitialisation.php.

References $_REQUEST, and $cmd.

Referenced by blockedAuthentication().

{
$cmd = $_REQUEST["cmd"];
if(is_array($cmd))
{
return array_shift(array_keys($cmd));
}
else
{
return $cmd;
}
}

+ Here is the caller graph for this function:

static ilInitialisation::goToLogin (   $a_auth_stat = "")
staticprotected

go to login

Parameters
int$a_auth_stat

Definition at line 728 of file class.ilInitialisation.php.

References $_COOKIE, $_GET, AUTH_EXPIRED, AUTH_IDLED, redirect(), ilSession\SESSION_CLOSE_EXPIRE, ilSession\SESSION_CLOSE_LOGIN, and ilSession\setClosingContext().

{
global $ilAuth;
// close current session
if($a_auth_stat == AUTH_EXPIRED ||
$a_auth_stat == AUTH_IDLED)
{
}
else
{
}
$ilAuth->logout();
session_unset();
session_destroy();
$add = "";
if ($_GET["soap_pw"] != "")
{
$add = "&soap_pw=".$_GET["soap_pw"]."&ext_uid=".$_GET["ext_uid"];
}
$script = "login.php?target=".$_GET["target"]."&client_id=".$_COOKIE["ilClientId"].
"&auth_stat=".$a_auth_stat.$add;
self::redirect($script, "Authentication failed.");
}

+ Here is the call graph for this function:

static ilInitialisation::goToPublicSection (   $a_auth_stat = "")
static

go to public section

Parameters
int$a_auth_stat

Definition at line 650 of file class.ilInitialisation.php.

References $_GET, $_POST, ilAuthUtils\_initAuth(), abortAndDie(), AUTH_EXPIRED, AUTH_IDLED, initUserAccount(), redirect(), ilSession\SESSION_CLOSE_EXPIRE, ilSession\SESSION_CLOSE_PUBLIC, ilSession\setClosingContext(), and setSessionHandler().

Referenced by ilStartUpGUI\processIndexPHP(), and ilStartUpGUI\processStartingPage().

{
global $ilAuth;
if (ANONYMOUS_USER_ID == "")
{
self::abortAndDie("Public Section enabled, but no Anonymous user found.");
}
// logout and end previous session
if($a_auth_stat == AUTH_EXPIRED ||
$a_auth_stat == AUTH_IDLED)
{
}
else
{
}
$ilAuth->logout();
session_unset();
session_destroy();
// new session and login as anonymous
session_start();
$_POST["username"] = "anonymous";
$_POST["password"] = "anonymous";
// authenticate (anonymous)
$oldSid = session_id();
$ilAuth->start();
if (IS_PAYMENT_ENABLED)
{
$newSid = session_id();
if($oldSid != $newSid)
{
include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
}
}
if (!$ilAuth->getAuth())
{
self::abortAndDie("ANONYMOUS user with the object_id ".ANONYMOUS_USER_ID." not found!");
}
$mess = "Authentication failed.";
// if target given, try to go there
if ($_GET["target"] != "")
{
// when we are already "inside" goto.php no redirect is needed
$current_script = substr(strrchr($_SERVER["PHP_SELF"], "/"), 1);
if($current_script == "goto.php")
{
return;
}
// goto will check if target is accessible or redirect to login
self::redirect("goto.php?target=".$_GET["target"], $mess);
}
// we do not know if ref_id of request is accesible, so redirecting to root
$_GET["ref_id"] = ROOT_FOLDER_ID;
$_GET["cmd"] = "frameset";
self::redirect("ilias.php?baseClass=ilrepositorygui&reloadpublic=1&cmd=".
$_GET["cmd"]."&ref_id=".$_GET["ref_id"], $mess);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::handleDevMode ( )
staticprotected

Prepare developer tools.

Definition at line 890 of file class.ilInitialisation.php.

Referenced by initClient().

{
if(defined(SHOWNOTICES) && SHOWNOTICES)
{
// no further differentiating of php version regarding to 5.4 neccessary
// when the error reporting is set to E_ALL anyway
// remove notices from error reporting
if (version_compare(PHP_VERSION, '5.3.0', '>='))
{
error_reporting(E_ALL);
}
else
{
error_reporting(E_ALL);
}
}
include_once "include/inc.debug.php";
}

+ Here is the caller graph for this function:

static ilInitialisation::handleMaintenanceMode ( )
staticprotected

handle maintenance mode

Definition at line 373 of file class.ilInitialisation.php.

References abortAndDie(), ilContext\hasHTML(), and redirect().

Referenced by initClient().

{
global $ilClientIniFile;
if (!$ilClientIniFile->readVariable("client","access"))
{
$mess = "The server is not available due to maintenance.".
" We apologise for any inconvenience.";
if (ilContext::hasHTML() && is_file("./maintenance.html"))
{
self::redirect("./maintenance.html", $mess);
}
else
{
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::includePhp5Compliance ( )
staticprotected

This is a hack for authentication.

Since the phpCAS lib ships with its own compliance functions.

Definition at line 93 of file class.ilInitialisation.php.

References ilAuthFactory\CONTEXT_CAS, and ilAuthFactory\getContext().

Referenced by initILIAS().

{
// php5 downward complaince to php 4 dom xml and clone method
if (version_compare(PHP_VERSION,'5','>='))
{
include_once 'Services/Authentication/classes/class.ilAuthFactory.php';
{
require_once("include/inc.xml5compliance.php");
}
require_once("include/inc.xsl5compliance.php");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initAccessHandling ( )
staticprotected

$ilAccess and $rbac...

initialisation

Definition at line 822 of file class.ilInitialisation.php.

References ilRbacSystem\getInstance(), and initGlobal().

Referenced by initUser().

{
self::initGlobal("rbacreview", "ilRbacReview",
"./Services/AccessControl/classes/class.ilRbacReview.php");
require_once "./Services/AccessControl/classes/class.ilRbacSystem.php";
$rbacsystem = ilRbacSystem::getInstance();
self::initGlobal("rbacsystem", $rbacsystem);
self::initGlobal("rbacadmin", "ilRbacAdmin",
"./Services/AccessControl/classes/class.ilRbacAdmin.php");
self::initGlobal("ilAccess", "ilAccessHandler",
"./Services/AccessControl/classes/class.ilAccessHandler.php");
require_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initClient ( )
staticprotected

Init client-based objects (level 1)

Definition at line 1010 of file class.ilInitialisation.php.

References $GLOBALS, $https, determineClient(), handleDevMode(), handleMaintenanceMode(), initClientIniFile(), initDatabase(), initGlobal(), initLocale(), initLog(), initSettings(), setSessionHandler(), and ilContext\usesHTTP().

Referenced by initILIAS().

{
global $https, $ilias;
// --- needs client ini
$ilias->client_id = CLIENT_ID;
if (DEVMODE)
{
}
// --- needs database
self::initGlobal("ilAppEventHandler", "ilAppEventHandler",
"./Services/EventHandling/classes/class.ilAppEventHandler.php");
// there are rare cases where initILIAS is called twice for a request
// example goto.php is called and includes ilias.php later
// we must prevent that ilPluginAdmin is initialized twice in
// this case, since this won't get the values out of plugin.php the
// second time properly
if (!is_object($GLOBALS["ilPluginAdmin"]))
{
self::initGlobal("ilPluginAdmin", "ilPluginAdmin",
"./Services/Component/classes/class.ilPluginAdmin.php");
}
// --- needs settings
{
// $https
self::initGlobal("https", "ilHTTPS", "./Services/Http/classes/class.ilHTTPS.php");
$https->enableSecureCookies();
$https->checkPort();
}
// --- object handling
self::initGlobal("ilObjDataCache", "ilObjectDataCache",
"./Services/Object/classes/class.ilObjectDataCache.php");
// needed in ilObjectDefinition
require_once "./Services/Xml/classes/class.ilSaxParser.php";
self::initGlobal("objDefinition", "ilObjectDefinition",
"./Services/Object/classes/class.ilObjectDefinition.php");
// $tree
require_once "./Services/Tree/classes/class.ilTree.php";
$tree = new ilTree(ROOT_FOLDER_ID);
self::initGlobal("tree", $tree);
unset($tree);
self::initGlobal("ilCtrl", "ilCtrl",
"./Services/UICore/classes/class.ilCtrl.php");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initClientIniFile ( )
staticprotected

This method provides a global instance of class ilIniFile for the client.ini.php file in variable $ilClientIniFile.

It initializes a lot of constants accordingly to the settings in the client.ini.php file.

Preconditions: ILIAS_WEB_DIR and CLIENT_ID must be set.

Returns
boolean true, if no error occured with client init file otherwise false

Definition at line 291 of file class.ilInitialisation.php.

References $_COOKIE, $ilIliasIniFile, abortAndDie(), ILIAS_ABSOLUTE_PATH, ILIAS_WEB_DIR, initGlobal(), redirect(), and ilUtil\setCookie().

Referenced by initClient().

{
// check whether ILIAS_WEB_DIR is set.
if (ILIAS_WEB_DIR == "")
{
self::abortAndDie("Fatal Error: ilInitialisation::initClientIniFile called without ILIAS_WEB_DIR.");
}
// check whether CLIENT_ID is set.
if (CLIENT_ID == "")
{
self::abortAndDie("Fatal Error: ilInitialisation::initClientIniFile called without CLIENT_ID.");
}
$ini_file = "./".ILIAS_WEB_DIR."/".CLIENT_ID."/client.ini.php";
// get settings from ini file
require_once("./Services/Init/classes/class.ilIniFile.php");
$ilClientIniFile = new ilIniFile($ini_file);
$ilClientIniFile->read();
// invalid client id / client ini
if ($ilClientIniFile->ERROR != "")
{
$c = $_COOKIE["ilClientId"];
$default_client = $ilIliasIniFile->readVariable("clients","default");
ilUtil::setCookie("ilClientId", $default_client);
if (CLIENT_ID != "" && CLIENT_ID != $default_client)
{
self::redirect("index.php?client_id=".$default_client,
"Client does not exist.");
}
else
{
self::abortAndDie("Invalid client");
}
}
self::initGlobal("ilClientIniFile", $ilClientIniFile);
// set constants
define ("SESSION_REMINDER_LEADTIME", 30);
define ("DEBUG",$ilClientIniFile->readVariable("system","DEBUG"));
define ("DEVMODE",$ilClientIniFile->readVariable("system","DEVMODE"));
define ("SHOWNOTICES",$ilClientIniFile->readVariable("system","SHOWNOTICES"));
define ("ROOT_FOLDER_ID",$ilClientIniFile->readVariable('system','ROOT_FOLDER_ID'));
define ("SYSTEM_FOLDER_ID",$ilClientIniFile->readVariable('system','SYSTEM_FOLDER_ID'));
define ("ROLE_FOLDER_ID",$ilClientIniFile->readVariable('system','ROLE_FOLDER_ID'));
define ("MAIL_SETTINGS_ID",$ilClientIniFile->readVariable('system','MAIL_SETTINGS_ID'));
// this is for the online help installation, which sets OH_REF_ID to the
// ref id of the online module
define ("OH_REF_ID",$ilClientIniFile->readVariable("system","OH_REF_ID"));
define ("SYSTEM_MAIL_ADDRESS",$ilClientIniFile->readVariable('system','MAIL_SENT_ADDRESS')); // Change SS
define ("MAIL_REPLY_WARNING",$ilClientIniFile->readVariable('system','MAIL_REPLY_WARNING')); // Change SS
define ("MAXLENGTH_OBJ_TITLE",125);#$ilClientIniFile->readVariable('system','MAXLENGTH_OBJ_TITLE'));
define ("MAXLENGTH_OBJ_DESC",$ilClientIniFile->readVariable('system','MAXLENGTH_OBJ_DESC'));
define ("CLIENT_DATA_DIR",ILIAS_DATA_DIR."/".CLIENT_ID);
define ("CLIENT_WEB_DIR",ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".CLIENT_ID);
define ("CLIENT_NAME",$ilClientIniFile->readVariable('client','name')); // Change SS
$val = $ilClientIniFile->readVariable("db","type");
if ($val == "")
{
define ("IL_DB_TYPE", "mysql");
}
else
{
define ("IL_DB_TYPE", $val);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initCore ( )
staticprotected

Init core objects (level 0)

Definition at line 954 of file class.ilInitialisation.php.

References $_POST, $ilErr, ilSession\get(), initGlobal(), initIliasIniFile(), PEAR_ERROR_CALLBACK, removeUnsafeCharacters(), requireCommonIncludes(), setCookieParams(), and PEAR\setErrorHandling().

Referenced by initILIAS().

{
global $ilErr;
// remove notices from error reporting
if (version_compare(PHP_VERSION, '5.4.0', '>='))
{
// Prior to PHP 5.4.0 E_ALL does not include E_STRICT.
// With PHP 5.4.0 and above E_ALL >DOES< include E_STRICT.
error_reporting(((ini_get("error_reporting") & ~E_NOTICE) & ~E_DEPRECATED) & ~E_STRICT);
}
elseif (version_compare(PHP_VERSION, '5.3.0', '>='))
{
error_reporting((ini_get("error_reporting") & ~E_NOTICE) & ~E_DEPRECATED);
}
else
{
error_reporting(ini_get('error_reporting') & ~E_NOTICE);
}
// breaks CAS: must be included after CAS context isset in AuthUtils
//self::includePhp5Compliance();
// error handler
self::initGlobal("ilErr", "ilErrorHandling",
"./Services/Init/classes/class.ilErrorHandling.php");
$ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
// :TODO: obsolete?
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, "errorHandler"));
// workaround: load old post variables if error handler 'message' was called
include_once "Services/Authentication/classes/class.ilSession.php";
if (ilSession::get("message"))
{
$_POST = ilSession::get("post_vars");
}
// deprecated
self::initGlobal("ilias", "ILIAS", "./Services/Init/classes/class.ilias.php");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initDatabase ( )
staticprotected

initialise database object $ilDB

Definition at line 397 of file class.ilInitialisation.php.

References ilDBWrapperFactory\getWrapper(), and initGlobal().

Referenced by initClient().

{
// build dsn of database connection and connect
require_once("./Services/Database/classes/class.ilDBWrapperFactory.php");
$ilDB = ilDBWrapperFactory::getWrapper(IL_DB_TYPE);
$ilDB->initFromIniFile();
$ilDB->connect();
self::initGlobal("ilDB", $ilDB);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initGlobal (   $a_name,
  $a_class,
  $a_source_file = null 
)
staticprotected

Initialize global instance.

Parameters
string$a_name
string$a_class
string$a_source_file

Definition at line 860 of file class.ilInitialisation.php.

References $GLOBALS.

Referenced by initAccessHandling(), initClient(), initClientIniFile(), initCore(), initDatabase(), initHTML(), initIliasIniFile(), initLanguage(), initLog(), initSettings(), initStyle(), initUser(), and requireCommonIncludes().

{
if($a_source_file)
{
include_once $a_source_file;
$GLOBALS[$a_name] = new $a_class;
}
else
{
$GLOBALS[$a_name] = $a_class;
}
}

+ Here is the caller graph for this function:

static ilInitialisation::initHTML ( )
staticprotected

init HTML output (level 3)

Definition at line 1254 of file class.ilInitialisation.php.

References $_GET, $ilUser, $tpl, ilUtil\getStyleSheetLocation(), initGlobal(), initStyle(), and ilSession\set().

Referenced by initILIAS().

{
global $ilUser;
// load style definitions
// use the init function with plugin hook here, too
// $tpl
$tpl = new ilTemplate("tpl.main.html", true, true);
// load style sheet depending on user's settings
$location_stylesheet = ilUtil::getStyleSheetLocation();
$tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
require_once "./Services/UICore/classes/class.ilFrameTargetInfo.php";
self::initGlobal("ilNavigationHistory", "ilNavigationHistory",
"Services/Navigation/classes/class.ilNavigationHistory.php");
self::initGlobal("ilBrowser", "ilBrowser",
"./Services/Utilities/classes/class.ilBrowser.php");
self::initGlobal("ilHelp", "ilHelpGUI",
"Services/Help/classes/class.ilHelpGUI.php");
self::initGlobal("ilToolbar", "ilToolbarGUI",
"./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php");
self::initGlobal("ilLocator", "ilLocatorGUI",
"./Services/Locator/classes/class.ilLocatorGUI.php");
self::initGlobal("ilTabs", "ilTabsGUI",
"./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php");
// $ilMainMenu
include_once './Services/MainMenu/classes/class.ilMainMenuGUI.php';
$ilMainMenu = new ilMainMenuGUI("_top");
self::initGlobal("ilMainMenu", $ilMainMenu);
unset($ilMainMenu);
// :TODO: tableGUI related
// set hits per page for all lists using table module
$_GET['limit'] = (int) $ilUser->getPref('hits_per_page');
ilSession::set('tbl_limit', $_GET['limit']);
// the next line makes it impossible to save the offset somehow in a session for
// a specific table (I tried it for the user administration).
// its not posssible to distinguish whether it has been set to page 1 (=offset = 0)
// or not set at all (then we want the last offset, e.g. being used from a session var).
// So I added the wrapping if statement. Seems to work (hopefully).
// Alex April 14th 2006
if (isset($_GET['offset']) && $_GET['offset'] != "") // added April 14th 2006
{
$_GET['offset'] = (int) $_GET['offset']; // old code
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initILIAS ( )
static

ilias initialisation

Definition at line 914 of file class.ilInitialisation.php.

References authenticate(), ilContext\doAuthentication(), ilContext\hasHTML(), ilContext\hasUser(), includePhp5Compliance(), ilContext\initClient(), initClient(), initCore(), initHTML(), initLanguage(), initUser(), and ilECSTaskScheduler\start().

Referenced by ilSoapAdministration\getClientInfoXML(), ilSoapAdministration\getInstallationInfoXML(), ilCalendarRemoteAccessHandler\initIlias(), and ilSoapAdministration\initIlias().

{
global $tree;
{
{
{
}
}
// init after Auth otherwise breaks CAS
// language may depend on user setting
$tree->initLangCode();
{
include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php');
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initIliasIniFile ( )
staticprotected

This method provides a global instance of class ilIniFile for the ilias.ini.php file in variable $ilIliasIniFile.

It initializes a lot of constants accordingly to the settings in the ilias.ini.php file.

Definition at line 114 of file class.ilInitialisation.php.

References $ilIliasIniFile, and initGlobal().

Referenced by initCore().

{
require_once("./Services/Init/classes/class.ilIniFile.php");
$ilIliasIniFile = new ilIniFile("./ilias.ini.php");
$ilIliasIniFile->read();
self::initGlobal('ilIliasIniFile', $ilIliasIniFile);
// initialize constants
define("ILIAS_DATA_DIR",$ilIliasIniFile->readVariable("clients","datadir"));
define("ILIAS_WEB_DIR",$ilIliasIniFile->readVariable("clients","path"));
define("ILIAS_ABSOLUTE_PATH",$ilIliasIniFile->readVariable('server','absolute_path'));
// logging
define ("ILIAS_LOG_DIR",$ilIliasIniFile->readVariable("log","path"));
define ("ILIAS_LOG_FILE",$ilIliasIniFile->readVariable("log","file"));
define ("ILIAS_LOG_ENABLED",$ilIliasIniFile->readVariable("log","enabled"));
define ("ILIAS_LOG_LEVEL",$ilIliasIniFile->readVariable("log","level"));
define ("SLOW_REQUEST_TIME",$ilIliasIniFile->readVariable("log","slow_request_time"));
// read path + command for third party tools from ilias.ini
define ("PATH_TO_CONVERT",$ilIliasIniFile->readVariable("tools","convert"));
define ("PATH_TO_FFMPEG",$ilIliasIniFile->readVariable("tools","ffmpeg"));
define ("PATH_TO_ZIP",$ilIliasIniFile->readVariable("tools","zip"));
define ("PATH_TO_MKISOFS",$ilIliasIniFile->readVariable("tools","mkisofs"));
define ("PATH_TO_UNZIP",$ilIliasIniFile->readVariable("tools","unzip"));
define ("PATH_TO_JAVA",$ilIliasIniFile->readVariable("tools","java"));
define ("PATH_TO_HTMLDOC",$ilIliasIniFile->readVariable("tools","htmldoc"));
define ("URL_TO_LATEX",$ilIliasIniFile->readVariable("tools","latex"));
define ("PATH_TO_FOP",$ilIliasIniFile->readVariable("tools","fop"));
// read virus scanner settings
switch ($ilIliasIniFile->readVariable("tools", "vscantype"))
{
case "sophos":
define("IL_VIRUS_SCANNER", "Sophos");
define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
break;
case "antivir":
define("IL_VIRUS_SCANNER", "AntiVir");
define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
break;
case "clamav":
define("IL_VIRUS_SCANNER", "ClamAV");
define("IL_VIRUS_SCAN_COMMAND", $ilIliasIniFile->readVariable("tools", "scancommand"));
define("IL_VIRUS_CLEAN_COMMAND", $ilIliasIniFile->readVariable("tools", "cleancommand"));
break;
default:
define("IL_VIRUS_SCANNER", "None");
break;
}
$tz = $ilIliasIniFile->readVariable("server","timezone");
if ($tz != "")
{
if (function_exists('date_default_timezone_set'))
{
date_default_timezone_set($tz);
}
}
define ("IL_TIMEZONE", $ilIliasIniFile->readVariable("server","timezone"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initLanguage ( )
staticprotected

$lng initialisation

Definition at line 761 of file class.ilInitialisation.php.

References $_GET, $_POST, $ilSetting, $ilUser, $lng, ilSession\get(), ilLanguage\getInstalledLanguages(), initGlobal(), ilSession\set(), and ilUtil\stripSlashes().

Referenced by initILIAS().

{
global $ilUser, $ilSetting, $rbacsystem;
if (!ilSession::get("lang"))
{
if ($_GET['lang'])
{
$_GET['lang'] = $_GET['lang'];
}
else
{
if (is_object($ilUser))
{
$_GET['lang'] = $ilUser->getPref('language');
}
}
}
if (isset($_POST['change_lang_to']) && $_POST['change_lang_to'] != "")
{
$_GET['lang'] = ilUtil::stripSlashes($_POST['change_lang_to']);
}
// prefer personal setting when coming from login screen
// 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)
if (is_object($ilUser) && $ilUser->getId() != ANONYMOUS_USER_ID && $ilUser->getId() > 0)
{
ilSession::set('lang', $ilUser->getPref('language'));
}
ilSession::set('lang', (isset($_GET['lang']) && $_GET['lang']) ? $_GET['lang'] : ilSession::get('lang'));
// check whether lang selection is valid
require_once "./Services/Language/classes/class.ilLanguage.php";
if (!in_array(ilSession::get('lang'), $langs))
{
if (is_object($ilSetting) && $ilSetting->get('language') != '')
{
ilSession::set('lang', $ilSetting->get('language'));
}
else
{
ilSession::set('lang', $langs[0]);
}
}
$_GET['lang'] = ilSession::get('lang');
$lng = new ilLanguage(ilSession::get('lang'));
if(is_object($rbacsystem))
{
$rbacsystem->initMemberView();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initLocale ( )
staticprotected

Init Locale.

Definition at line 618 of file class.ilInitialisation.php.

References $GLOBALS, and $ilSetting.

Referenced by initClient().

{
global $ilSetting;
if (trim($ilSetting->get("locale") != ""))
{
$larr = explode(",", trim($ilSetting->get("locale")));
$ls = array();
$first = $larr[0];
foreach ($larr as $l)
{
if (trim($l) != "")
{
$ls[] = $l;
}
}
if (count($ls) > 0)
{
setlocale(LC_ALL, $ls);
if (class_exists("Collator"))
{
$GLOBALS["ilCollator"] = new Collator($first);
}
}
}
}

+ Here is the caller graph for this function:

static ilInitialisation::initLog ( )
staticprotected

Init log instance.

Definition at line 843 of file class.ilInitialisation.php.

References $log, and initGlobal().

Referenced by initClient().

{
require_once "./Services/Logging/classes/class.ilLog.php";
$log = new ilLog(ILIAS_LOG_DIR,ILIAS_LOG_FILE,CLIENT_ID,ILIAS_LOG_ENABLED,ILIAS_LOG_LEVEL);
// deprecated
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initSettings ( )
staticprotected

initialise $ilSettings object and define constants

Used in Soap

Definition at line 492 of file class.ilInitialisation.php.

References $ilSetting, ilPaymentSettings\_isPaymentEnabled(), abortAndDie(), buildHTTPPath(), initGlobal(), and ilContext\usesHTTP().

Referenced by initClient().

{
global $ilSetting;
self::initGlobal("ilSetting", "ilSetting",
"Services/Administration/classes/class.ilSetting.php");
// check correct setup
if (!$ilSetting->get("setup_ok"))
{
self::abortAndDie("Setup is not completed. Please run setup routine again.");
}
// set anonymous user & role id and system role id
define ("ANONYMOUS_USER_ID", $ilSetting->get("anonymous_user_id"));
define ("ANONYMOUS_ROLE_ID", $ilSetting->get("anonymous_role_id"));
define ("SYSTEM_USER_ID", $ilSetting->get("system_user_id"));
define ("SYSTEM_ROLE_ID", $ilSetting->get("system_role_id"));
define ("USER_FOLDER_ID", 7);
// recovery folder
define ("RECOVERY_FOLDER_ID", $ilSetting->get("recovery_folder_id"));
// installation id
define ("IL_INST_ID", $ilSetting->get("inst_id",0));
// define default suffix replacements
define ("SUFFIX_REPL_DEFAULT", "php,php3,php4,inc,lang,phtml,htaccess");
define ("SUFFIX_REPL_ADDITIONAL", $ilSetting->get("suffix_repl_additional"));
{
}
// payment setting
require_once('Services/Payment/classes/class.ilPaymentSettings.php');
define('IS_PAYMENT_ENABLED', ilPaymentSettings::_isPaymentEnabled());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initStyle ( )
staticprotected

provide $styleDefinition object

Definition at line 535 of file class.ilInitialisation.php.

References ilPluginAdmin\getPluginObject(), IL_COMP_SERVICE, and initGlobal().

Referenced by initHTML().

{
global $styleDefinition, $ilPluginAdmin;
// load style definitions
self::initGlobal("styleDefinition", "ilStyleDefinition",
"./Services/Style/classes/class.ilStyleDefinition.php");
// add user interface hook for style initialisation
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
foreach ($pl_names as $pl)
{
$ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
$gui_class = $ui_plugin->getUIClassInstance();
$gui_class->modifyGUI("Services/Init", "init_style", array("styleDefinition" => $styleDefinition));
}
$styleDefinition->startParsing();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initUser ( )
staticprotected

Init user / authentification (level 2)

Definition at line 1093 of file class.ilInitialisation.php.

References $_GET, $_POST, $_SESSION, $ilUser, ilSession\_destroy(), ilAuthUtils\_initAuth(), initAccessHandling(), initGlobal(), ilSession\SESSION_CLOSE_LOGIN, ilSession\set(), and ilContext\usesHTTP().

Referenced by initILIAS().

{
global $ilias, $ilAuth, $ilUser;
{
// allow login by submitting user data
// in query string when DEVMODE is enabled
if( DEVMODE
&& isset($_GET['username']) && strlen($_GET['username'])
&& isset($_GET['password']) && strlen($_GET['password'])
){
$_POST['username'] = $_GET['username'];
$_POST['password'] = $_GET['password'];
}
}
// $ilAuth
require_once "Auth/Auth.php";
require_once "./Services/AuthShibboleth/classes/class.ilShibboleth.php";
include_once("./Services/Authentication/classes/class.ilAuthUtils.php");
$ilias->auth = $ilAuth;
// $ilUser
self::initGlobal("ilUser", "ilObjUser",
"./Services/User/classes/class.ilObjUser.php");
$ilias->account =& $ilUser;
// force login
if ((isset($_GET["cmd"]) && $_GET["cmd"] == "force_login"))
{
$ilAuth->logout();
// we need to do this for the session statistics
// could we use session_destroy() instead?
// [this is done after every $ilAuth->logout() call elsewhere]
// :TODO: keep session because of cart content?
if(!isset($_GET['forceShoppingCartRedirect']))
{
$_SESSION = array();
}
else
{
ilSession::set("AccountId", "");
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::initUserAccount ( )
static

Init user with current account id.

Definition at line 558 of file class.ilInitialisation.php.

References $GLOBALS, $ilUser, abortAndDie(), checkUserAgreement(), ilSession\get(), and ilSession\set().

Referenced by authenticate(), and goToPublicSection().

{
global $ilUser;
// get user id
if (!ilSession::get("AccountId"))
{
ilSession::set("AccountId", $ilUser->checkUserId());
}
$uid = ilSession::get("AccountId");
if($uid)
{
$ilUser->setId($uid);
$ilUser->read();
// #10822 - Terms of service accepted?
}
else
{
if(is_object($GLOBALS['ilLog']))
{
$GLOBALS['ilLog']->logStack();
}
self::abortAndDie("Init user account failed");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::redirect (   $a_target,
  $a_message_details 
)
staticprotected

Redirects to target url if context supports it.

Parameters
string$a_target
string$a_message_details

Definition at line 1396 of file class.ilInitialisation.php.

References abortAndDie(), ilContext\hasHTML(), ilContext\supportsRedirects(), and ilContext\usesHTTP().

Referenced by checkUserAgreement(), goToLogin(), goToPublicSection(), handleMaintenanceMode(), and initClientIniFile().

{
// #12739
if(defined("ILIAS_HTTP_PATH") &&
!stristr($a_target, ILIAS_HTTP_PATH))
{
$a_target = ILIAS_HTTP_PATH."/".$a_target;
}
{
ilUtil::redirect($a_target);
}
else
{
// user-directed linked message
{
$mess = $a_message_details.
' Please <a href="'.$a_target.'">click here</a> to continue.';
}
// plain text
else
{
// not much we can do here
$mess = $a_message_details;
if(!trim($mess))
{
$mess = 'Redirect not supported by context ('.$a_target.')';
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::removeUnsafeCharacters ( )
staticprotected

Remove unsafe characters from GET.

Definition at line 32 of file class.ilInitialisation.php.

References $_GET.

Referenced by initCore().

{
// Remove unsafe characters from GET parameters.
// We do not need this characters in any case, so it is
// feasible to filter them everytime. POST parameters
// need attention through ilUtil::stripSlashes() and similar functions)
if (is_array($_GET))
{
foreach($_GET as $k => $v)
{
// \r\n used for IMAP MX Injection
// ' used for SQL Injection
$_GET[$k] = str_replace(array("\x00", "\n", "\r", "\\", "'", '"', "\x1a"), "", $v);
// this one is for XSS of any kind
$_GET[$k] = strip_tags($_GET[$k]);
}
}
}

+ Here is the caller graph for this function:

static ilInitialisation::requireCommonIncludes ( )
staticprotected

get common include code files

Definition at line 55 of file class.ilInitialisation.php.

References initGlobal(), and ilContext\usesTemplate().

Referenced by initCore().

{
// pear
require_once("include/inc.get_pear.php");
require_once("include/inc.check_pear.php");
require_once "PEAR.php";
// ilTemplate
{
// HTML_Template_IT support
@include_once "HTML/Template/ITX.php"; // new implementation
if (class_exists("HTML_Template_ITX"))
{
include_once "./Services/UICore/classes/class.ilTemplateHTMLITX.php";
}
else
{
include_once "HTML/ITX.php"; // old implementation
include_once "./Services/UICore/classes/class.ilTemplateITX.php";
}
require_once "./Services/UICore/classes/class.ilTemplate.php";
}
// really always required?
require_once "./Services/Utilities/classes/class.ilUtil.php";
require_once "./Services/Utilities/classes/class.ilFormat.php";
require_once "./Services/Calendar/classes/class.ilDatePresentation.php";
require_once "include/inc.ilias_version.php";
self::initGlobal("ilBench", "ilBenchmark", "./Services/Utilities/classes/class.ilBenchmark.php");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::setCookieParams ( )
staticprotected

set session cookie params for path, domain, etc.

Definition at line 437 of file class.ilInitialisation.php.

References $GLOBALS, ilAuthFactory\CONTEXT_HTTP, ilAuthFactory\getContext(), and IL_COOKIE_PATH.

Referenced by initCore().

{
include_once 'Services/Authentication/classes/class.ilAuthFactory.php';
{
$cookie_path = '/';
}
elseif ($GLOBALS['COOKIE_PATH'])
{
// use a predefined cookie path from WebAccessChecker
$cookie_path = $GLOBALS['COOKIE_PATH'];
}
else
{
$cookie_path = dirname( $_SERVER['PHP_SELF'] );
}
/* if ilias is called directly within the docroot $cookie_path
is set to '/' expecting on servers running under windows..
here it is set to '\'.
in both cases a further '/' won't be appended due to the following regex
*/
$cookie_path .= (!preg_match("/[\/|\\\\]$/", $cookie_path)) ? "/" : "";
if($cookie_path == "\\") $cookie_path = '/';
define('IL_COOKIE_EXPIRE',0);
define('IL_COOKIE_PATH',$cookie_path);
define('IL_COOKIE_DOMAIN','');
define('IL_COOKIE_SECURE',false); // Default Value
// session_set_cookie_params() supports 5th parameter
// only for php version 5.2.0 and above
if( version_compare(PHP_VERSION, '5.2.0', '>=') )
{
// PHP version >= 5.2.0
define('IL_COOKIE_HTTPONLY',false); // Default Value
session_set_cookie_params(
IL_COOKIE_EXPIRE, IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE, IL_COOKIE_HTTPONLY
);
}
else
{
// PHP version < 5.2.0
session_set_cookie_params(
IL_COOKIE_EXPIRE, IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::setSessionHandler ( )
static

set session handler to db

Used in Soap/CAS

Definition at line 413 of file class.ilInitialisation.php.

References ilSession\_exists(), and abortAndDie().

Referenced by goToPublicSection(), initClient(), and CASClient\renameSession().

{
if(ini_get('session.save_handler') != 'user')
{
ini_set("session.save_handler", "user");
}
require_once "Services/Authentication/classes/class.ilSessionDBHandler.php";
$db_session_handler = new ilSessionDBHandler();
if (!$db_session_handler->setSaveHandler())
{
self::abortAndDie("Please turn off Safe mode OR set session.save_handler to \"user\" in your php.ini");
}
// Do not accept external session ids
if (!ilSession::_exists(session_id()) && !defined('IL_PHPUNIT_TEST'))
{
session_regenerate_id();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilInitialisation::showingLoginForm (   $a_current_script)
staticprotected

Is current view the login form?

Returns
boolean

Definition at line 1374 of file class.ilInitialisation.php.

References $_REQUEST.

{
if($a_current_script == "login.php")
{
return true;
}
if($_REQUEST["baseClass"] == "ilStartUpGUI" &&
self::getCurrentCmd() == "showLogin")
{
return true;
}
return false;
}

The documentation for this class was generated from the following file: