Public Member Functions | Data Fields

ILIAS Class Reference

Public Member Functions

 ILIAS ($a_client_id=0)
 Constructor setup ILIAS global object public.
 _ILIAS ()
 Destructor private.
 getSetting ($a_keyword)
 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

Detailed Description

Definition at line 37 of file class.ilias.php.


Member Function Documentation

ILIAS::_ILIAS (  ) 

Destructor private.

Returns:
boolean

Definition at line 350 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

Parameters:
string template name
Returns:
boolean true if file exists public

Definition at line 548 of file class.ilias.php.

        {
                return file_exists($this->tplPath.$a_name);
        }

ILIAS::deleteSetting ( a_keyword  ) 

delete one value from settingstable public

Parameters:
string keyword
Returns:
string value

Definition at line 393 of file class.ilias.php.

References $query.

        {
                $query = "DELETE FROM settings WHERE keyword = '".$a_keyword."'";
                $this->db->query($query);

                return true;
        }

ILIAS::getAllSettings (  ) 

read all values from settingstable public

Returns:
array keyword/value pairs

Definition at line 407 of file class.ilias.php.

References $query, $res, $row, and ilUtil::stripSlashes().

Referenced by ILIAS().

        {
                $query = "SELECT * FROM settings";
                $res = $this->db->query($query);

                while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $arr[$row["keyword"]] = ilUtil::stripSlashes($row["value"]);
                }

                return $arr;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ILIAS::getClientId (  ) 

Definition at line 561 of file class.ilias.php.

        {
                return $this->client_id;
        }

& ILIAS::getCurrentUser (  ) 

get current user account

Definition at line 556 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

Returns:
boolean false if no skin was found
Author:
Peter Gabriel <pgabriel@databay.de> /// deprecated: use ilStyleDefinition()->getStyles() instead

skin system: get all available styles from current templates and store them in $this->styles public

Parameters:
string name of template set/directory name
Returns:
boolean false if no style was found
Author:
Peter Gabriel <pgabriel@databay.de> get first available stylesheet from skindirectory
Parameters:
string 
Returns:
string style name public

Definition at line 532 of file class.ilias.php.

        {
                if (!is_array($this->styles))
                {
                        $this->getStyles($a_skin);
                }

                return $this->styles[0]["name"];
        }

ILIAS::getSetting ( a_keyword  ) 

read one value from settingstable public

Parameters:
string keyword
Returns:
string value

Definition at line 366 of file class.ilias.php.

References $query, $res, $row, and ilUtil::stripSlashes().

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 ilUtil::stripSlashes($row[0]);
                }
                else
                {
                        return false;
                }
        }

Here is the call graph for this function:

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, $GLOBALS, $ilErr, $settings, db_set_save_handler(), getAllSettings(), getSetting(), 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->ilias->raiseError($message,$this->ilias->error_obj->WARNING);
                }

                // 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"));
                
                // auth modes
                define ("AUTH_LOCAL",1);
                define ("AUTH_LDAP",2);
                define ("AUTH_RADIUS",3);
                define ("AUTH_SCRIPT",4);

                $auth_mode = $this->getSetting("auth_mode");

                // set local auth mode (1) in case database wasn't updated
                if ($auth_mode === false)
                {
                        $auth_mode = AUTH_LOCAL;
                }
                
                define ("AUTH_CURRENT",$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;
                                
                        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;

                }
                
                /*
                ini_set("session.gc_maxlifetime",$this->ini->readVariable("session","expire"));
                ini_set("session.cookie_lifetime",$this->ini->readVariable("session","expire"));
                */
                //ini_set("session.gc_maxlifetime", 10);
                //ini_set("session.cookie_lifetime", 10);

                $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 569 of file class.ilias.php.

References $ilErr.

        {
                global $ilErr;

                $ilErr->raiseError($a_msg,$a_err_obj);
        }

ILIAS::setSetting ( a_key,
a_val 
)

write one value to db-table settings public

Parameters:
string keyword
string value
Returns:
boolean true on success

TODO: change to replace-statement

Definition at line 429 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;
        }


Field Documentation

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.


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