Public Member Functions | |
| ILIAS ($a_client_id=0) | |
| Constructor setup ILIAS global object public. | |
| _ILIAS () | |
| Destructor private. | |
| setAuthError ($a_error_obj) | |
| set authentication error (should be set after Auth->start() via $ilias->setAuthError($ilErr->getLastError()); | |
| & | getAuthError () |
| get (last) authentication error object | |
| getSetting ($a_keyword, $a_default_value=false) | |
| read one value from settingstable public | |
| deleteSetting ($a_keyword) | |
| delete one value from settingstable public | |
| getAllSettings () | |
| read all values from settingstable public | |
| setSetting ($a_key, $a_val) | |
| write one value to db-table settings public | |
| getFirstStyle ($a_skin) | |
| /// deprecated: Use $templates = $styleDefinition->getAllTemplates() instead | |
| checkTemplate ($a_name) | |
| check if a template name exists on the server | |
| & | getCurrentUser () |
| get current user account | |
| getClientId () | |
| raiseError ($a_msg, $a_err_obj) | |
| wrapper for downward compability | |
Data Fields | |
| $INI_FILE | |
| $dsn = "" | |
| $db | |
| $tplPath = "./templates/" | |
| $account | |
| $auth_params = array() | |
| $auth | |
| $ini = array() | |
| $error_obj | |
| $obj_factory | |
| $styles | |
| $skins | |
Definition at line 37 of file class.ilias.php.
| ILIAS::_ILIAS | ( | ) |
Destructor private.
Definition at line 392 of file class.ilias.php.
{
if ($this->ini->readVariable("db", "type") != "")
{
$this->db->disconnect();
}
return true;
}
| ILIAS::checkTemplate | ( | $ | a_name | ) |
check if a template name exists on the server
| string | template name |
Definition at line 615 of file class.ilias.php.
{
return file_exists($this->tplPath.$a_name);
}
| ILIAS::deleteSetting | ( | $ | a_keyword | ) |
delete one value from settingstable public
| string | keyword |
Definition at line 459 of file class.ilias.php.
References $query.
| ILIAS::getAllSettings | ( | ) |
read all values from settingstable public
Definition at line 473 of file class.ilias.php.
References $query, $res, and $row.
Referenced by ILIAS().
{
$query = "SELECT * FROM settings";
$res = $this->db->query($query);
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$arr[$row["keyword"]] = $row["value"];
//$arr[$row["keyword"]] = ilUtil::stripSlashes($row["value"]);
}
return $arr;
}
Here is the caller graph for this function:| & ILIAS::getAuthError | ( | ) |
get (last) authentication error object
Definition at line 417 of file class.ilias.php.
{
return $this->auth_error;
}
| ILIAS::getClientId | ( | ) |
Definition at line 628 of file class.ilias.php.
{
return $this->client_id;
}
| & ILIAS::getCurrentUser | ( | ) |
get current user account
Definition at line 623 of file class.ilias.php.
References account.
{
return $this->account;
}
| ILIAS::getFirstStyle | ( | $ | a_skin | ) |
/// deprecated: Use $templates = $styleDefinition->getAllTemplates() instead
skin system: get all available skins from template directory and store them in $this->skins public
skin system: get all available styles from current templates and store them in $this->styles public
| string | name of template set/directory name |
| string |
Definition at line 599 of file class.ilias.php.
{
if (!is_array($this->styles))
{
$this->getStyles($a_skin);
}
return $this->styles[0]["name"];
}
| ILIAS::getSetting | ( | $ | a_keyword, | |
| $ | a_default_value = false | |||
| ) |
read one value from settingstable public
| string | keyword | |
| string | default_value This value is returned, when no setting has been found for the keyword. |
Definition at line 430 of file class.ilias.php.
References $query, $res, and $row.
Referenced by ILIAS().
{
if ($a_keyword == "ilias_version")
{
return ILIAS_VERSION;
}
$query = "SELECT value FROM settings WHERE keyword='".$a_keyword."'";
$res = $this->db->query($query);
if ($res->numRows() > 0)
{
$row = $res->fetchRow();
return $row[0];
//return ilUtil::stripSlashes($row[0]);
}
else
{
return $a_default_value;
}
}
Here is the caller graph for this function:| ILIAS::ILIAS | ( | $ | a_client_id = 0 |
) |
Constructor setup ILIAS global object public.
Definition at line 130 of file class.ilias.php.
References $_COOKIE, $_POST, $_SESSION, $GLOBALS, $ilErr, $settings, ilAuthUtils::_getAuthModeOfUser(), ilRADIUSAuthentication::_getServers(), db_set_save_handler(), getAllSettings(), getSetting(), raiseError(), and ilUtil::redirect().
{
global $ilErr, $ilDB;
// load setup.ini
$this->ini_ilias = new ilIniFile("./ilias.ini.php");
$this->ini_ilias->read();
define("ILIAS_DATA_DIR",$this->ini_ilias->readVariable("clients","datadir"));
define("ILIAS_WEB_DIR",$this->ini_ilias->readVariable("clients","path"));
define ("ILIAS_HTTP_PATH",$this->ini_ilias->readVariable('server','http_path'));
define ("ILIAS_ABSOLUTE_PATH",$this->ini_ilias->readVariable('server','absolute_path'));
// logging
define ("ILIAS_LOG_DIR",$this->ini_ilias->readVariable("log","path"));
define ("ILIAS_LOG_FILE",$this->ini_ilias->readVariable("log","file"));
define ("ILIAS_LOG_ENABLED",$this->ini_ilias->readVariable("log","enabled"));
define ("ILIAS_LOG_LEVEL",$this->ini_ilias->readVariable("log","level"));
// read path + command for third party tools from ilias.ini
define ("PATH_TO_CONVERT",$this->ini_ilias->readVariable("tools","convert"));
define ("PATH_TO_ZIP",$this->ini_ilias->readVariable("tools","zip"));
define ("PATH_TO_UNZIP",$this->ini_ilias->readVariable("tools","unzip"));
define ("PATH_TO_JAVA",$this->ini_ilias->readVariable("tools","java"));
define ("PATH_TO_HTMLDOC",$this->ini_ilias->readVariable("tools","htmldoc"));
define ("PATH_TO_FOP",$this->ini_ilias->readVariable("tools","fop"));
// read virus scanner settings
switch ($this->ini_ilias->readVariable("tools", "vscantype"))
{
case "sophos":
define("IL_VIRUS_SCANNER", "Sophos");
define("IL_VIRUS_SCAN_COMMAND", $this->ini_ilias->readVariable("tools", "scancommand"));
define("IL_VIRUS_CLEAN_COMMAND", $this->ini_ilias->readVariable("tools", "cleancommand"));
break;
case "antivir":
define("IL_VIRUS_SCANNER", "AntiVir");
define("IL_VIRUS_SCAN_COMMAND", $this->ini_ilias->readVariable("tools", "scancommand"));
define("IL_VIRUS_CLEAN_COMMAND", $this->ini_ilias->readVariable("tools", "cleancommand"));
break;
default:
define("IL_VIRUS_SCANNER", "None");
break;
}
// set to default client if empty
if (!$a_client_id)
{
$this->client_id = $this->ini_ilias->readVariable("clients","default");
setcookie("ilClientId",$this->client_id);
$_COOKIE["ilClientId"] = $this->client_id;
}
else
{
$this->client_id = $_COOKIE["ilClientId"];
}
$this->INI_FILE = "./".ILIAS_WEB_DIR."/".$this->client_id."/client.ini.php";
// $this->PEAR();
// prepare file access to work with safe mode
umask(0117);
// get settings from ini file
$this->ini = new ilIniFile($this->INI_FILE);
$this->ini->read();
// if no ini-file found switch to setup routine
if ($this->ini->ERROR != "")
{
ilUtil::redirect("./setup/setup.php");
}
if (!$this->ini->readVariable("client","access"))
{
die("client disabled");
}
// set constants
define ("DEBUG",$this->ini->readVariable("system","DEBUG"));
define ("DEVMODE",$this->ini->readVariable("system","DEVMODE"));
define ("ROOT_FOLDER_ID",$this->ini->readVariable('system','ROOT_FOLDER_ID'));
define ("SYSTEM_FOLDER_ID",$this->ini->readVariable('system','SYSTEM_FOLDER_ID'));
define ("ROLE_FOLDER_ID",$this->ini->readVariable('system','ROLE_FOLDER_ID'));
define ("MAIL_SETTINGS_ID",$this->ini->readVariable('system','MAIL_SETTINGS_ID'));
define ("MAXLENGTH_OBJ_TITLE",$this->ini->readVariable('system','MAXLENGTH_OBJ_TITLE'));
define ("MAXLENGTH_OBJ_DESC",$this->ini->readVariable('system','MAXLENGTH_OBJ_DESC'));
define ("CLIENT_DATA_DIR",ILIAS_DATA_DIR."/".$this->client_id);
define ("CLIENT_WEB_DIR",ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->client_id);
define ("CLIENT_ID",$this->client_id);
// build dsn of database connection and connect
$this->dsn = $this->ini->readVariable("db","type").
"://".$this->ini->readVariable("db", "user").
":".$this->ini->readVariable("db", "pass").
"@".$this->ini->readVariable("db", "host").
"/".$this->ini->readVariable("db", "name");
$this->db = new ilDBx($this->dsn);
// Error Handling
$this->error_obj =& $ilErr;
// moved here from inc.header.php (db_set_save_handler needs db object)
$ilDB = $this->db;
$GLOBALS['ilDB'] =& $ilDB;
// set session.save_handler to "user" & set expiry time
if(ini_get('session.save_handler') != 'user')
{
ini_set("session.save_handler", "user");
}
// moved here from inc.header.php
if (!db_set_save_handler())
{
$message = "Please turn off Safe mode OR set session.save_handler to \"user\" in your php.ini";
$this->raiseError($message, $this->error_obj->FATAL);
}
// set anonymous user & role id and system role id
define ("ANONYMOUS_USER_ID",$this->getSetting("anonymous_user_id"));
define ("ANONYMOUS_ROLE_ID",$this->getSetting("anonymous_role_id"));
define ("SYSTEM_USER_ID",$this->getSetting("system_user_id"));
define ("SYSTEM_ROLE_ID",$this->getSetting("system_role_id"));
define ("RECOVERY_FOLDER_ID",$this->getSetting("recovery_folder_id"));
// installation id
define ("IL_INST_ID", $this->getSetting("inst_id"));
// define auth modes
define ("AUTH_LOCAL",1);
define ("AUTH_LDAP",2);
define ("AUTH_RADIUS",3);
define ("AUTH_SCRIPT",4);
define ("AUTH_SHIBBOLETH",5);
// get default auth mode
//$default_auth_mode = $this->getSetting("auth_mode");
define ("AUTH_DEFAULT", $this->getSetting("auth_mode") ? $this->getSetting("auth_mode") : AUTH_LOCAL);
// set local auth mode (1) in case database wasn't updated
/*if ($default_auth_mode === false)
{
$default_auth_mode = AUTH_LOCAL;
}*/
// determine authentication method if no session is found and username & password is posted
if (empty($_SESSION) ||
(!isset($_SESSION['_authsession']['registered']) ||
$_SESSION['_authsession']['registered'] !== true))
{
// no sesssion found
if ($_POST['username'] != '' and $_POST['password'] != '')
{
include_once(ILIAS_ABSOLUTE_PATH.'/classes/class.ilAuthUtils.php');
$user_auth_mode = ilAuthUtils::_getAuthModeOfUser($_POST['username'],$_POST['password'],$this->db);
}
}
// If Shibboleth is active and the user is authenticated
// we set auth_mode to Shibboleth
if (
$this->getSetting("shib_active")
&& $_SERVER[$this->getSetting("shib_login")]
)
{
define ("AUTH_CURRENT",AUTH_SHIBBOLETH);
}
else
{
define ("AUTH_CURRENT",$user_auth_mode);
}
switch (AUTH_CURRENT)
{
case AUTH_LOCAL:
// build option string for PEAR::Auth
$this->auth_params = array(
'dsn' => $this->dsn,
'table' => $this->ini->readVariable("auth", "table"),
'usernamecol' => $this->ini->readVariable("auth", "usercol"),
'passwordcol' => $this->ini->readVariable("auth", "passcol")
);
// We use MySQL as storage container
$this->auth = new Auth("DB", $this->auth_params,"",false);
break;
case AUTH_LDAP:
$settings = $this->getAllSettings();
// build option string for PEAR::Auth
$this->auth_params = array(
'host' => $settings["ldap_server"],
'port' => $settings["ldap_port"],
'basedn' => $settings["ldap_basedn"],
'userdn' => $settings["ldap_search_base"],
'useroc' => $settings["ldap_objectclass"],
'userattr' => $settings["ldap_login_key"]
);
$this->auth = new Auth("LDAP", $this->auth_params,"",false);
break;
case AUTH_RADIUS:
include_once('classes/class.ilRADIUSAuthentication.php');
$radius_servers = ilRADIUSAuthentication::_getServers($this->db);
$settings = $this->getAllSettings();
foreach ($radius_servers as $radius_server)
{
$rad_params['servers'][] = array($radius_server,$settings["radius_port"],$settings["radius_shared_secret"]);
}
// build option string for PEAR::Auth
//$this->auth_params = array($rad_params);
$this->auth_params = $rad_params;
$this->auth = new Auth("RADIUS", $this->auth_params,"",false);
break;
case AUTH_SHIBBOLETH:
$settings = $this->getAllSettings();
// build option string for SHIB::Auth
$this->auth_params = array();
$this->auth = new ShibAuth($this->auth_params,true);
break;
default:
// build option string for PEAR::Auth
$this->auth_params = array(
'dsn' => $this->dsn,
'table' => $this->ini->readVariable("auth", "table"),
'usernamecol' => $this->ini->readVariable("auth", "usercol"),
'passwordcol' => $this->ini->readVariable("auth", "passcol")
);
// We use MySQL as storage container
$this->auth = new Auth("DB", $this->auth_params,"",false);
break;
}
$this->auth->setIdle($this->ini->readVariable("session","expire"), false);
$this->auth->setExpire(0);
ini_set("session.cookie_lifetime", "0");
// create instance of object factory
require_once("classes/class.ilObjectFactory.php");
$this->obj_factory =& new ilObjectFactory();
}
Here is the call graph for this function:| ILIAS::raiseError | ( | $ | a_msg, | |
| $ | a_err_obj | |||
| ) |
wrapper for downward compability
Definition at line 636 of file class.ilias.php.
References $ilErr.
Referenced by ILIAS().
{
global $ilErr;
$ilErr->raiseError($a_msg,$a_err_obj);
}
Here is the caller graph for this function:| ILIAS::setAuthError | ( | $ | a_error_obj | ) |
set authentication error (should be set after Auth->start() via $ilias->setAuthError($ilErr->getLastError());
| object | $a_error_obj pear error object |
Definition at line 409 of file class.ilias.php.
{
$this->auth_error =& $a_error_obj;
}
| ILIAS::setSetting | ( | $ | a_key, | |
| $ | a_val | |||
| ) |
write one value to db-table settings public
| string | keyword | |
| string | value |
TODO: change to replace-statement
Definition at line 496 of file class.ilias.php.
{
$sql = "DELETE FROM settings WHERE keyword='".$a_key."'";
$r = $this->db->query($sql);
$sql = "INSERT INTO settings (keyword, value) VALUES ('".$a_key."','".addslashes($a_val)."')";
$r = $this->db->query($sql);
return true;
}
| ILIAS::$account |
Definition at line 71 of file class.ilias.php.
| ILIAS::$auth |
Definition at line 85 of file class.ilias.php.
| ILIAS::$auth_params = array() |
Definition at line 78 of file class.ilias.php.
| ILIAS::$db |
Definition at line 57 of file class.ilias.php.
| ILIAS::$dsn = "" |
Definition at line 50 of file class.ilias.php.
| ILIAS::$error_obj |
Definition at line 99 of file class.ilias.php.
| ILIAS::$ini = array() |
Definition at line 92 of file class.ilias.php.
| ILIAS::$INI_FILE |
Definition at line 43 of file class.ilias.php.
| ILIAS::$obj_factory |
Definition at line 107 of file class.ilias.php.
| ILIAS::$skins |
Definition at line 123 of file class.ilias.php.
| ILIAS::$styles |
Definition at line 115 of file class.ilias.php.
| ILIAS::$tplPath = "./templates/" |
Definition at line 64 of file class.ilias.php.
1.7.1