Public Member Functions | |
ilSetup ($a_auth, $a_auth_type) | |
constructor | |
init () | |
init setup load settings from ilias.ini if exists and sets some constants | |
saveNewClient () | |
saves client.ini & updates client list in ilias.ini | |
updateNewClient ($a_old_client_id) | |
update client.ini & move data dirs does not work correctly at this time - DISABLED | |
execQuery ($db, $str) | |
execute a query | |
createDatabase ($a_collation="") | |
create client database | |
installDatabase () | |
set the database data | |
checkIniFileExists () | |
check if inifile exists | |
checkWritable ($a_dir="..") | |
check for writable directory | |
checkCreatable ($a_dir="..") | |
check for permission to create new folders in specified directory | |
checkCookiesEnabled () | |
check cookies enabled | |
checkPHPVersion () | |
check for PHP version | |
checkAuth () | |
check authentication status | |
queryPreliminaries () | |
preliminaries | |
checkPreliminaries () | |
check all prliminaries | |
getPassword () | |
get setup master password | |
setPassword ($a_password) | |
set setup master password | |
loginAsClient ($a_auth_data) | |
process client login | |
loginAsAdmin ($a_password) | |
process setup admin login | |
newClient ($a_client_id=0) | |
creates a client object in $this->client | |
getStatus ($client=0) | |
coumpute client status | |
checkFinish (&$client) | |
check if client setup was finished | |
checkAccess (&$client) | |
check client access status | |
checkClientIni (&$client) | |
check client ini status | |
checkClientDatabase (&$client) | |
check client db status | |
checkClientLanguages (&$client) | |
check client installed languages status | |
checkClientContact (&$client) | |
check client contact data status | |
checkClientNIC (&$client) | |
check client nic status | |
isInstalled () | |
check if client's db is installed | |
isAuthenticated () | |
check if current user is authenticated | |
isAdmin () | |
check if current user is admin | |
saveMasterSetup ($a_formdata) | |
saves intial settings | |
updateMasterSettings ($a_formdata) | |
updates settings | |
checkToolsSetup ($a_formdata) | |
check pathes to 3rd party software | |
checkDataDirSetup ($a_formdata) | |
check datadir path | |
checkPasswordSetup ($a_formdata) | |
check setup password | |
checkLogSetup ($a_formdata) | |
check log path | |
getError () | |
get Error message | |
_ilSetup () | |
destructor | |
testConvert ($a_convert_path) | |
Check convert program. | |
testJava ($a_java_path) | |
Check JVM. | |
testZip ($a_zip_path) | |
Check zip program. | |
testUnzip ($a_unzip_path) | |
Check unzip program. | |
testHtmldoc ($a_htmldoc_path) | |
Check htmldoc program. | |
Data Fields | |
$ini | |
$ini_file_path | |
$error = "" | |
$ini_ilias_exists = false | |
$ini_client_exists = false | |
$setup_defaults | |
$ilias_nic_server = "http://homer.ilias.uni-koeln.de/ilias-nic/index.php" | |
$preliminaries_result = array() | |
$preliminaries = true | |
$SQL_FILE = "../sql/ilias3.sql" | |
$dsn = "" | |
$db | |
$setup_password | |
$default_client | |
$safe_mode | |
$safe_mode_exec_dir | |
$auth | |
$access_mode |
Definition at line 35 of file class.ilSetup.php.
ilSetup::_ilSetup | ( | ) |
destructor
Definition at line 1239 of file class.ilSetup.php.
{ //if ($this->ini->readVariable("db","type") != "") //{ // $this->db->disconnect(); //} return true; }
ilSetup::checkAccess | ( | &$ | client | ) |
check client access status
object | client |
Definition at line 707 of file class.ilSetup.php.
Referenced by getStatus().
{ if ($client->ini->readVariable("client","access") == "1") { $arr["status"] = true; $arr["comment"] = $this->lng->txt("online"); } else { $arr["status"] = false; $arr["comment"] = $this->lng->txt("disabled"); } return $arr; }
ilSetup::checkAuth | ( | ) |
check authentication status
Definition at line 456 of file class.ilSetup.php.
References $_SESSION.
{ if ($_SESSION["auth"] === true) { return true; } return false; }
ilSetup::checkClientContact | ( | &$ | client | ) |
check client contact data status
object | client |
Definition at line 809 of file class.ilSetup.php.
References $settings, and ilUtil::is_email().
Referenced by ilSetupGUI::displayContactData(), and getStatus().
{ $arr["status"] = true; $arr["comment"] = $this->lng->txt("filled_out"); $settings = $client->getAllSettings(); $client_name = $client->getName(); // check required fields if (empty($settings["admin_firstname"]) or empty($settings["admin_lastname"]) or empty($settings["admin_street"]) or empty($settings["admin_zipcode"]) or empty($settings["admin_country"]) or empty($settings["admin_city"]) or empty($settings["admin_phone"]) or empty($settings["admin_email"]) or empty($client_name) or empty($settings["inst_institution"])) { $arr["status"] = false; $arr["comment"] = $this->lng->txt("missing_data"); } // admin email if (!ilUtil::is_email($settings["admin_email"]) and $arr["status"] != false) { $arr["status"] = false; $arr["comment"] = $this->lng->txt("email_not_valid"); } return $arr; }
ilSetup::checkClientDatabase | ( | &$ | client | ) |
check client db status
object | client |
Definition at line 747 of file class.ilSetup.php.
Referenced by getStatus().
{ if (!$arr["status"] = $client->db_exists) { $arr["comment"] = $this->lng->txt("no_database"); return $arr; } if (!$arr["status"] = $client->db_installed) { $arr["comment"] = $this->lng->txt("db_not_installed"); return $arr; } // TODO: move this to client class!! $client->setup_ok = (bool) $client->getSetting("setup_ok"); $this->lng->setDbHandler($client->db); include_once "../classes/class.ilDBUpdate.php"; $dbupdate = new ilDBUpdate($client->db); if (!$arr["status"] = $dbupdate->getDBVersionStatus()) { $arr["comment"] = $this->lng->txt("db_needs_update"); $arr["update"] = true; return $arr; } $arr["comment"] = "version ".$dbupdate->getCurrentVersion(); return $arr; }
ilSetup::checkClientIni | ( | &$ | client | ) |
check client ini status
object | client |
Definition at line 728 of file class.ilSetup.php.
Referenced by getStatus().
{ if (!$arr["status"] = $client->init()) { $arr["comment"] = $client->getError(); } else { $arr["comment"] = "dir: /".ILIAS_WEB_DIR."/".$client->getId(); } return $arr; }
ilSetup::checkClientLanguages | ( | &$ | client | ) |
check client installed languages status
object | client |
Definition at line 784 of file class.ilSetup.php.
References $count.
Referenced by getStatus().
{ $installed_langs = $this->lng->getInstalledLanguages(); $count = count($installed_langs); if ($count < 1) { $arr["status"] = false; $arr["comment"] = $this->lng->txt("lang_none_installed"); } else { $arr["status"] = true; $arr["comment"] = $count." ".$this->lng->txt("languages_installed"); } return $arr; }
ilSetup::checkClientNIC | ( | &$ | client | ) |
check client nic status
object | client |
Definition at line 843 of file class.ilSetup.php.
References $settings.
Referenced by getStatus().
{ $settings = $client->getAllSettings(); if (!isset($settings["nic_enabled"])) { $arr["status"] = false; $arr["comment"] = $this->lng->txt("nic_not_disabled"); return $arr; } $arr["status"] = true; if ($settings["nic_enabled"] == "-1") { $arr["comment"] = $this->lng->txt("nic_reg_failed"); return $arr; } if (!$settings["nic_enabled"]) { $arr["comment"] = $this->lng->txt("nic_reg_disabled"); } else { $arr["comment"] = $this->lng->txt("nic_reg_enabled"); } return $arr; }
ilSetup::checkCookiesEnabled | ( | ) |
check cookies enabled
Definition at line 383 of file class.ilSetup.php.
References $sess.
Referenced by queryPreliminaries().
{ global $sess; if ($sess->usesCookies) { $arr["status"] = true; $arr["comment"] = ""; } else { $arr["status"] = false; $arr["comment"] = $this->lng->txt("pre_cookies_disabled"); } return $arr; }
ilSetup::checkCreatable | ( | $ | a_dir = ".." |
) |
check for permission to create new folders in specified directory
string | directory |
Definition at line 360 of file class.ilSetup.php.
Referenced by queryPreliminaries().
{ clearstatcache(); if (mkdir($a_dir."/crst879dldsk9d", 0774)) { $arr["status"] = true; $arr["comment"] = ""; rmdir($a_dir."/crst879dldsk9d"); } else { $arr["status"] = false; $arr["comment"] = $this->lng->txt("pre_folder_create_error"); } return $arr; }
ilSetup::checkDataDirSetup | ( | $ | a_formdata | ) |
check datadir path
array | form data |
Definition at line 1116 of file class.ilSetup.php.
References $webspace_dir, ilFile::deleteTrailingSlash(), and ilUtil::stripSlashes().
Referenced by ilSetupGUI::displayMasterSetup().
{ // remove trailing slash & convert backslashes to forwardslashes $datadir_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"]))); if (empty($datadir_path)) { $this->error = "no_path_datadir"; return false; } $webspace_dir = ILIAS_ABSOLUTE_PATH . "/data"; // datadir may not point to webspace dir or to any place under webspace_dir if (strpos($datadir_path,$webspace_dir) !== false) { $this->error = "datadir_webspacedir_match"; return false; } // create dir if ($a_formdata["chk_datadir_path"] == 1) { $dir_to_create = substr(strrchr($datadir_path, "/"), 1); $dir_to_check = substr($datadir_path,0,- strlen($dir_to_create)-1); if (is_writable($datadir_path)) { $this->error = "dir_exists_create"; return false; } if (!is_writable($dir_to_check)) { $this->error = "cannot_create_datadir_no_write_access"; return false; } } else // check set target dir { if (!is_writable($datadir_path)) { $this->error = "cannot_create_datadir_no_write_access"; return false; } } return true; }
ilSetup::checkFinish | ( | &$ | client | ) |
check if client setup was finished
object | client |
Definition at line 686 of file class.ilSetup.php.
Referenced by getStatus().
{ if ($client->getSetting("setup_ok")) { $arr["status"] = true; $arr["comment"] = $this->lng->txt("setup_finished"); } else { $arr["status"] = false; $arr["comment"] = $this->lng->txt("setup_not_finished"); } return $arr; }
ilSetup::checkIniFileExists | ( | ) |
check if inifile exists
Definition at line 327 of file class.ilSetup.php.
{
$a = @file_exists($this->INI_FILE);
return $a;
}
ilSetup::checkLogSetup | ( | $ | a_formdata | ) |
check log path
array | form data |
Definition at line 1193 of file class.ilSetup.php.
References ilFile::deleteTrailingSlash(), and ilUtil::stripSlashes().
Referenced by ilSetupGUI::changeMasterSettings(), and ilSetupGUI::displayMasterSetup().
{ // log path if (!isset($a_formdata["chk_log_status"])) { // remove trailing slash & convert backslashes to forwardslashes $log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"]))); if (empty($log_path)) { $this->error = "no_path_log"; return false; } if (!@touch($log_path)) { $this->error = "could_not_create_logfile"; return false; } } return true; }
ilSetup::checkPasswordSetup | ( | $ | a_formdata | ) |
check setup password
array | form data |
Definition at line 1171 of file class.ilSetup.php.
Referenced by ilSetupGUI::displayMasterSetup().
{ if (!$a_formdata["setup_pass"]) { $this->error = "no_setup_pass_given"; return false; } if ($a_formdata["setup_pass"] != $a_formdata["setup_pass2"]) { $this->error = "pass_does_not_match"; return false; } return true; }
ilSetup::checkPHPVersion | ( | ) |
check for PHP version
Definition at line 405 of file class.ilSetup.php.
Referenced by queryPreliminaries().
{ $version = phpversion(); $arr["version"] = $version; $first = (integer) substr($version,0,1); switch ($first) { case 2: case 3: $arr["status"] = false; $arr["comment"] = $this->lng->txt("pre_php_version_3"); break; case 4: $second = (integer) substr($version,2,1); if ($second >= 3) { $arr["status"] = true; $arr["comment"] = ""; } elseif ($second == 2) { $arr["status"] = false; $arr["comment"] = $this->lng->txt("pre_php_version_4.2"); } else { $arr["status"] = false; $arr["comment"] = $this->lng->txt("pre_php_version_4.1"); } break; case 5: $arr["status"] = true; $arr["comment"] = $this->lng->txt("pre_php_version_5"); break; default: $arr["status"] = true; $arr["comment"] = $this->lng->txt("pre_php_version_unknown"); break; } return $arr; }
ilSetup::checkPreliminaries | ( | ) |
check all prliminaries
Definition at line 488 of file class.ilSetup.php.
References queryPreliminaries().
Referenced by ilSetupGUI::cmdInstall().
{ $this->preliminaries_result = $this->queryPreliminaries(); foreach ($this->preliminaries_result as $val) { if ($val["status"] === false) { $this->preliminaries = false; return false; } } return true; }
ilSetup::checkToolsSetup | ( | $ | a_formdata | ) |
check pathes to 3rd party software
array | form data |
Definition at line 1011 of file class.ilSetup.php.
References ilUtil::stripSlashes(), testConvert(), testHtmldoc(), testJava(), testUnzip(), and testZip().
Referenced by ilSetupGUI::changeMasterSettings(), and ilSetupGUI::displayMasterSetup().
{ // convert path if (!isset($a_formdata["chk_convert_path"])) { // convert backslashes to forwardslashes $convert_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["convert_path"])); if (empty($convert_path)) { $this->error = "no_path_convert"; return false; } if (!$this->testConvert($convert_path)) { $this->error = "check_failed_convert"; return false; } } // zip path if (!isset($a_formdata["chk_zip_path"])) { // convert backslashes to forwardslashes $zip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["zip_path"])); if (empty($zip_path)) { $this->error = "no_path_zip"; return false; } if (!$this->testZip($zip_path)) { $this->error = "check_failed_zip"; return false; } } // unzip path if (!isset($a_formdata["chk_unzip_path"])) { // convert backslashes to forwardslashes $unzip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["unzip_path"])); if (empty($unzip_path)) { $this->error = "no_path_unzip"; return false; } if (!$this->testUnzip($unzip_path)) { $this->error = "check_failed_unzip"; return false; } } // java path if (!isset($a_formdata["chk_java_path"])) { // convert backslashes to forwardslashes $java_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["java_path"])); if (empty($java_path)) { $this->error = "no_path_java"; return false; } if (!$this->testJava($java_path)) { $this->error = "check_failed_java"; return false; } } // htmldoc path if (!isset($a_formdata["chk_htmldoc_path"])) { // convert backslashes to forwardslashes $htmldoc_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["htmldoc_path"])); if (empty($htmldoc_path)) { $this->error = "no_path_htmldoc"; return false; } if (!$this->testHtmldoc($htmldoc_path)) { $this->error = "check_failed_htmldoc"; return false; } } return true; }
ilSetup::checkWritable | ( | $ | a_dir = ".." |
) |
check for writable directory
string | directory |
Definition at line 338 of file class.ilSetup.php.
Referenced by queryPreliminaries().
{ clearstatcache(); if (is_writable($a_dir)) { $arr["status"] = true; $arr["comment"] = ""; } else { $arr["status"] = false; $arr["comment"] = $this->lng->txt("pre_folder_write_error"); } return $arr; }
ilSetup::createDatabase | ( | $ | a_collation = "" |
) |
create client database
Definition at line 251 of file class.ilSetup.php.
References $db.
Referenced by ilSetupGUI::displayDatabase().
{ if ($this->client->checkDatabaseExists()) { $this->error = $this->lng->txt("database_exists"); return false; } //create database $db = DB::connect($this->client->dsn_host); if (DB::isError($db)) { $this->error = "connection_failed"; return false; } if ($a_collation != "") { $sql = "CREATE DATABASE ".$this->client->getdbName(). " CHARACTER SET utf8". " COLLATE ".$a_collation; } else { $sql = "CREATE DATABASE ".$this->client->getdbName(); } $r = $db->query($sql); if (DB::isError($r)) { $this->error = "create_database_failed"; return false; } //database is created, now disconnect and reconnect $db->disconnect(); $this->client->db_exists = true; return true; }
ilSetup::execQuery | ( | $ | db, | |
$ | str | |||
) |
execute a query
string | ||
string |
Definition at line 220 of file class.ilSetup.php.
Referenced by installDatabase().
{ $sql = explode("\n",trim($str)); for ($i=0; $i<count($sql); $i++) { $sql[$i] = trim($sql[$i]); if ($sql[$i] != "" && substr($sql[$i],0,1)!="#") { //take line per line, until last char is ";" if (substr($sql[$i],-1)==";") { //query is complete $q .= " ".substr($sql[$i],0,-1); $r = $db->query($q); if ($r == false) return false; unset($q); } //if else { $q .= " ".$sql[$i]; } //else } //if } //for return true; }
ilSetup::getError | ( | ) |
get Error message
Definition at line 1221 of file class.ilSetup.php.
References $error.
Referenced by ilSetupGUI::displayDatabase(), ilSetupGUI::displayIni(), and ilSetupGUI::displayLogin().
{ if (empty($this->error)) { return false; } $error = $this->error; $this->error = ""; return $error; }
ilSetup::getPassword | ( | ) |
get setup master password
Definition at line 508 of file class.ilSetup.php.
Referenced by ilSetupGUI::changeMasterPassword().
{ return $this->ini->readVariable("setup","pass"); }
ilSetup::getStatus | ( | $ | client = 0 |
) |
coumpute client status
string | client id |
Definition at line 641 of file class.ilSetup.php.
References $status, checkAccess(), checkClientContact(), checkClientDatabase(), checkClientIni(), checkClientLanguages(), checkClientNIC(), and checkFinish().
Referenced by ilSetupGUI::changeDefaultClient(), ilSetupGUI::displayClientList(), ilSetupGUI::displayProcessPanel(), and ilSetupGUI::ilSetupGUI().
{ if (!is_object($client)) { if ($this->ini_client_exists) { $client =& $this->client; } else { $client = new ilClient(); } } $status = array(); $status["ini"] = $this->checkClientIni($client); $status["db"] = $this->checkClientDatabase($client); if ($status["db"]["status"] === false and $status["db"]["update"] !== true) { $status["lang"]["status"] = false; $status["lang"]["comment"] = $status["db"]["comment"]; $status["contact"]["status"] = false; $status["contact"]["comment"] = $status["db"]["comment"]; $status["nic"]["status"] = false; $status["nic"]["comment"] = $status["db"]["comment"]; } else { $status["lang"] = $this->checkClientLanguages($client); $status["contact"] = $this->checkClientContact($client); $status["nic"] = $this->checkClientNIC($client); $status["finish"] = $this->checkFinish($client); $status["access"] = $this->checkAccess($client); } //return value return $status; }
ilSetup::ilSetup | ( | $ | a_auth, | |
$ | a_auth_type | |||
) |
constructor
boolean | user is authenticated? (true) or not (false) | |
string | user is admin or common user |
Definition at line 86 of file class.ilSetup.php.
References $log, ilFile::deleteTrailingSlash(), and init().
Referenced by ilSetupGUI::ilSetupGUI().
{ global $log; $this->PEAR(); define("ILIAS_MODULE","setup"); $this->auth = ($a_auth) ? true : false; $this->access_mode = $a_auth_type; // safe mode status & exec_dir if ($this->safe_mode = ini_get("safe_mode")) { $this->safe_mode_exec_dir = ilFile::deleteTrailingSlash(ini_get("safe_mode_exec_dir")); } // Error Handling $this->error_obj = new ilErrorHandling(); $this->setErrorHandling(PEAR_ERROR_CALLBACK,array($this->error_obj,'errorHandler')); // set path to ilias.ini $this->ini_file_path = ILIAS_ABSOLUTE_PATH."/ilias.ini.php"; $this->setup_defaults = ILIAS_ABSOLUTE_PATH."/setup/ilias.master.ini.php"; // init setup.ini $this->ini_ilias_exists = $this->init(); if ($this->ini_ilias_exists) { if ($this->ini->readVariable("log","path") != "") { $log->path = $this->ini->readVariable("log","path"); } if ($this->ini->readVariable("log","file") != "") { $log->filename = $this->ini->readVariable("log","file"); } if ($this->ini->readVariable("log","enabled") != "") { $log->enabled = $this->ini->readVariable("log","enabled"); } } }
ilSetup::init | ( | ) |
init setup load settings from ilias.ini if exists and sets some constants
Definition at line 138 of file class.ilSetup.php.
Referenced by ilSetup().
{ // load data from setup.ini file $this->ini = new ilIniFile($this->ini_file_path); if (!$this->ini->read()) { $this->ini->GROUPS = parse_ini_file($this->setup_defaults,true); $this->error = get_class($this).": ".$this->ini->getError(); return false; } $this->setup_password = $this->ini->readVariable("setup","pass"); $this->default_client = $this->ini->readVariable("clients","default"); define("ILIAS_DATA_DIR",$this->ini->readVariable("clients","datadir")); define("ILIAS_WEB_DIR",$this->ini->readVariable("clients","path")); return true; }
ilSetup::installDatabase | ( | ) |
set the database data
Definition at line 296 of file class.ilSetup.php.
References $q, and execQuery().
Referenced by ilSetupGUI::displayDatabase().
{ if (!$this->client->checkDatabaseHost()) { $this->error = "no_connection_to_host"; return false; } if (!$this->client->connect()) { return false; } //take sql dump an put it in $q = file($this->SQL_FILE); $q = implode("\n",$q); if ($this->execQuery($this->client->db,$q) === false) { $this->error = "dump_error"; return false; } $this->client->db_installed = true; return true; }
ilSetup::isAdmin | ( | ) |
check if current user is admin
Definition at line 896 of file class.ilSetup.php.
Referenced by ilSetupGUI::displayFooter(), ilSetupGUI::displayHeader(), and ilSetupGUI::ilSetupGUI().
{ return ($this->access_mode == "admin") ? true : false; }
ilSetup::isAuthenticated | ( | ) |
check if current user is authenticated
Definition at line 887 of file class.ilSetup.php.
Referenced by ilSetupGUI::displayHeader(), and ilSetupGUI::ilSetupGUI().
{
return $this->auth;
}
ilSetup::isInstalled | ( | ) |
check if client's db is installed
Definition at line 878 of file class.ilSetup.php.
Referenced by ilSetupGUI::displayHeader(), ilSetupGUI::displayMasterSetup(), ilSetupGUI::ilSetupGUI(), and newClient().
{
return $this->ini_ilias_exists;
}
ilSetup::loginAsAdmin | ( | $ | a_password | ) |
process setup admin login
string | password |
Definition at line 596 of file class.ilSetup.php.
References $_SESSION.
Referenced by ilSetupGUI::displayLogin().
{ $a_password = md5($a_password); if ($this->ini->readVariable("setup","pass") == $a_password) { $_SESSION["auth"] = true; $_SESSION["access_mode"] = "admin"; return true; } return false; }
ilSetup::loginAsClient | ( | $ | a_auth_data | ) |
process client login
array |
Definition at line 536 of file class.ilSetup.php.
References $_SESSION, $q, and newClient().
Referenced by ilSetupGUI::displayLogin().
{ if (empty($a_auth_data["client_id"])) { $this->error = "no_client_id"; return false; } if (empty($a_auth_data["username"])) { $this->error = "no_username"; return false; } if (empty($a_auth_data["password"])) { $this->error = "no_password"; return false; } if (!$this->newClient($a_auth_data["client_id"])) { $this->error = "unknown_client_id"; unset($this->client); return false; } if (!$this->client->db_exists) { $this->error = "no_db_connect_consult_admin"; unset($this->client); return false; } $q = "SELECT usr_data.usr_id FROM usr_data ". "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id ". "LEFT JOIN settings ON settings.value = rbac_ua.rol_id ". "WHERE settings.keyword='system_role_id' ". "AND usr_data.login='".$a_auth_data["username"]."' ". "AND usr_data.passwd='".md5($a_auth_data["password"])."'"; $r = $this->client->db->query($q); if (!$r->numRows()) { $this->error = "login_invalid"; return false; } // all checks passed -> user valid $_SESSION["auth"] = true; $_SESSION["access_mode"] = "client"; $_SESSION["ClientId"] = $this->client->getId(); return true; }
ilSetup::newClient | ( | $ | a_client_id = 0 |
) |
creates a client object in $this->client
string | client id |
Definition at line 615 of file class.ilSetup.php.
References $_SESSION, and isInstalled().
Referenced by ilSetupGUI::cmdAdmin(), ilSetupGUI::displayIni(), ilSetupGUI::ilSetupGUI(), and loginAsClient().
{ if (!$this->isInstalled()) { return false; } $this->client = new ilClient($a_client_id); if (!$this->client->init()) { $this->error = get_class($this).": ".$this->client->getError(); $_SESSION["ClientId"] = ""; return false; } $_SESSION["ClientId"] = $a_client_id; return true; }
ilSetup::queryPreliminaries | ( | ) |
preliminaries
check if different things are ok for setting up ilias private
Definition at line 473 of file class.ilSetup.php.
References checkCookiesEnabled(), checkCreatable(), checkPHPVersion(), and checkWritable().
Referenced by checkPreliminaries().
{ $a = array(); $a["php"] = $this->checkPHPVersion(); $a["root"] = $this->checkWritable(); $a["create"] = $this->checkCreatable(); $a["cookies"] = $this->checkCookiesEnabled(); return $a; }
ilSetup::saveMasterSetup | ( | $ | a_formdata | ) |
saves intial settings
array | form data |
Definition at line 906 of file class.ilSetup.php.
References $_SESSION, ilFile::deleteTrailingSlash(), ilUtil::makeDir(), and ilUtil::stripSlashes().
Referenced by ilSetupGUI::displayMasterSetup().
{ $datadir_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"]))); if ($a_formdata["chk_datadir_path"] == 1) // mode create dir { if (!ilUtil::makeDir($datadir_path)) { $this->error = "create_datadir_failed"; return false; } } // create webspace dir if it does not exist if (!@file_exists(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path")) and !@is_dir(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path"))) { if (!ilUtil::makeDir(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path"))) { $this->error = "create_webdir_failed"; return false; } } $form_log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"]))); $log_path = substr($form_log_path,0,strrpos($form_log_path,"/")); $log_file = substr($form_log_path,strlen($log_path)+1); $this->ini->setVariable("server","http_path",ILIAS_HTTP_PATH); $this->ini->setVariable("server","absolute_path",ILIAS_ABSOLUTE_PATH); $this->ini->setVariable("clients", "datadir", $datadir_path); $this->ini->setVariable("tools", "convert", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["convert_path"]))); $this->ini->setVariable("tools", "zip", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["zip_path"]))); $this->ini->setVariable("tools", "unzip", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["unzip_path"]))); $this->ini->setVariable("tools", "java", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["java_path"]))); $this->ini->setVariable("tools", "htmldoc", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["htmldoc_path"]))); $this->ini->setVariable("tools", "vscantype", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["vscanner_type"]))); $this->ini->setVariable("tools", "scancommand", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["scan_command"]))); $this->ini->setVariable("tools", "cleancommand", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["clean_command"]))); $this->ini->setVariable("setup", "pass", md5($a_formdata["setup_pass"])); $this->ini->setVariable("log", "path", $log_path); $this->ini->setVariable("log", "file", $log_file); $this->ini->setVariable("log", "enabled", (isset($a_formdata["chk_log_status"])) ? "0" : 1); if (!$this->ini->write()) { $this->error = get_class($this).": ".$this->ini->getError(); return false; } // everything is fine. so we authenticate the user and set access mode to 'admin' $_SESSION["auth"] = true; $_SESSION["access_mode"] = "admin"; return true; }
ilSetup::saveNewClient | ( | ) |
saves client.ini & updates client list in ilias.ini
Definition at line 163 of file class.ilSetup.php.
References $_SESSION.
Referenced by ilSetupGUI::displayIni(), and updateNewClient().
{ // save client id to session $_SESSION["ClientId"] = $this->client->getId(); // create client if (!$this->client->create()) { $this->error = $this->client->getError(); return false; } //everything okay $this->ini_client_exists = true; return true; }
ilSetup::setPassword | ( | $ | a_password | ) |
set setup master password
string | password |
Definition at line 518 of file class.ilSetup.php.
Referenced by ilSetupGUI::changeMasterPassword().
{ $this->ini->setVariable("setup","pass",md5($a_password)); if ($this->ini->write() == false) { $this->error = $this->ini->getError(); return false; } return true; }
ilSetup::testConvert | ( | $ | a_convert_path | ) |
Check convert program.
string | convert path |
Definition at line 1254 of file class.ilSetup.php.
Referenced by checkToolsSetup().
{ // generate gif with convert if (file_exists(ILIAS_ABSOLUTE_PATH."/images/test.gif")) { unlink(ILIAS_ABSOLUTE_PATH."/images/test.gif"); } system($a_convert_path." ".ILIAS_ABSOLUTE_PATH."/images/test.jpg GIF:".ILIAS_ABSOLUTE_PATH."/images/test.gif"); // check wether convert generated file if (file_exists(ILIAS_ABSOLUTE_PATH."/images/test.gif")) { unlink(ILIAS_ABSOLUTE_PATH."/images/test.gif"); return true; } else { return false; } }
ilSetup::testHtmldoc | ( | $ | a_htmldoc_path | ) |
Check htmldoc program.
string | htmldoc_path |
Definition at line 1371 of file class.ilSetup.php.
Referenced by checkToolsSetup().
{ $curDir = getcwd(); chdir(ILIAS_ABSOLUTE_PATH); $html = "<html><head><title></title></head><body><p>test</p></body></html>"; $html_file = "htmldoc_test_file.html"; $fp = fopen( $html_file ,"wb"); fwrite($fp, $html); fclose($fp); $htmldoc = $a_htmldoc_path." "; $htmldoc .= "--no-toc "; $htmldoc .= "--no-jpeg "; $htmldoc .= "--webpage "; $htmldoc .= "--outfile htmldoc_test_file.pdf "; $htmldoc .= "--bodyfont Arial "; $htmldoc .= "--charset iso-8859-15 "; $htmldoc .= "--color "; $htmldoc .= "--size A4 "; // --landscape $htmldoc .= "--format pdf "; $htmldoc .= "--footer ... "; $htmldoc .= "--header ... "; $htmldoc .= "--left 60 "; // $htmldoc .= "--right 200 "; $htmldoc .= $html_file; exec($htmldoc); unlink(ILIAS_ABSOLUTE_PATH."/".$html_file); chdir($curDir); if (file_exists(ILIAS_ABSOLUTE_PATH."/htmldoc_test_file.pdf")) { unlink(ILIAS_ABSOLUTE_PATH."/htmldoc_test_file.pdf"); return true; } else { return false; } }
ilSetup::testJava | ( | $ | a_java_path | ) |
Check JVM.
string | java path |
Definition at line 1282 of file class.ilSetup.php.
Referenced by checkToolsSetup().
{ exec($a_java_path, $out, $back); unset($out); return ($back != 1) ? false : true; }
ilSetup::testUnzip | ( | $ | a_unzip_path | ) |
Check unzip program.
string | unzip_path |
Definition at line 1338 of file class.ilSetup.php.
Referenced by checkToolsSetup().
{ $curDir = getcwd(); chdir(ILIAS_ABSOLUTE_PATH); if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.zip")) { $unzipCmd = $a_unzip_path." unzip_test_file.zip"; exec($unzipCmd); } chdir($curDir); // check wether unzip extracted the test file or not if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt")) { unlink(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt"); return true; } else { return false; } }
ilSetup::testZip | ( | $ | a_zip_path | ) |
Check zip program.
string | zip path |
Definition at line 1297 of file class.ilSetup.php.
Referenced by checkToolsSetup().
{ // create test file and run zip $fp = fopen(ILIAS_ABSOLUTE_PATH."/test.dat", "w"); fwrite($fp, "test"); fclose($fp); if (file_exists(ILIAS_ABSOLUTE_PATH."/test.dat")) { $curDir = getcwd(); chdir(ILIAS_ABSOLUTE_PATH); $zipCmd = $a_zip_path." -m zip_test_file.zip test.dat"; exec($zipCmd); chdir($curDir); } // check wether zip generated test file or not if (file_exists(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip")) { unlink(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip"); return true; } else { unlink(ILIAS_ABSOLUTE_PATH."/test.dat"); return false; } }
ilSetup::updateMasterSettings | ( | $ | a_formdata | ) |
updates settings
array | form data |
Definition at line 967 of file class.ilSetup.php.
References ilFile::deleteTrailingSlash(), and ilUtil::stripSlashes().
Referenced by ilSetupGUI::changeMasterSettings().
{ $convert_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["convert_path"])); $zip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["zip_path"])); $unzip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["unzip_path"])); $java_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["java_path"])); $htmldoc_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["htmldoc_path"])); $fop_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["fop_path"])); $scan_type = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["vscanner_type"])); $scan_command = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["scan_command"])); $clean_command = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["clean_command"])); $this->ini->setVariable("tools", "convert", $convert_path); $this->ini->setVariable("tools", "zip", $zip_path); $this->ini->setVariable("tools", "unzip", $unzip_path); $this->ini->setVariable("tools", "java", $java_path); $this->ini->setVariable("tools", "htmldoc", $htmldoc_path); $this->ini->setVariable("tools", "fop", $fop_path); $this->ini->setVariable("tools", "vscantype", $scan_type); $this->ini->setVariable("tools", "scancommand", $scan_command); $this->ini->setVariable("tools", "cleancommand", $clean_command); $form_log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"]))); $log_path = substr($form_log_path,0,strrpos($form_log_path,"/")); $log_file = substr($form_log_path,strlen($log_path)+1); $this->ini->setVariable("log", "path", $log_path); $this->ini->setVariable("log", "file", $log_file); $this->ini->setVariable("log", "enabled", (isset($a_formdata["chk_log_status"])) ? "0" : 1); if (!$this->ini->write()) { $this->error = get_class($this).": ".$this->ini->getError(); return false; } return true; }
ilSetup::updateNewClient | ( | $ | a_old_client_id | ) |
update client.ini & move data dirs does not work correctly at this time - DISABLED
Definition at line 186 of file class.ilSetup.php.
References ilUtil::delDir(), and saveNewClient().
{ return true; //var_dump("<pre>",$this->client,"</pre>");exit; if ($a_old_client_id != $this->client->getId()) { // check for existing client dir if (file_exists(ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->client->getId())) { $this->raiseError($this->lng->txt("client_id_already_exists"),$this->error_obj->MESSAGE); } if (!$this->saveNewClient()) { $this->raiseError($this->lng->txt("save_error"),$this->error_obj->MESSAGE); } ilUtil::delDir(ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$a_old_client_id); ilUtil::delDir(ILIAS_DATA_DIR."/".$a_old_client_id); } //everything okay $this->ini_client_exists = true; return true; }
ilSetup::$access_mode |
Definition at line 78 of file class.ilSetup.php.
ilSetup::$auth |
Definition at line 77 of file class.ilSetup.php.
ilSetup::$db |
Definition at line 69 of file class.ilSetup.php.
Referenced by createDatabase(), ilSetupGUI::displayDeleteConfirmation(), and execQuery().
ilSetup::$default_client |
Definition at line 72 of file class.ilSetup.php.
ilSetup::$dsn = "" |
Definition at line 62 of file class.ilSetup.php.
ilSetup::$error = "" |
Definition at line 39 of file class.ilSetup.php.
Referenced by getError().
ilSetup::$ilias_nic_server = "http://homer.ilias.uni-koeln.de/ilias-nic/index.php" |
Definition at line 45 of file class.ilSetup.php.
ilSetup::$ini |
Definition at line 37 of file class.ilSetup.php.
Referenced by ilSetupGUI::displayDeleteConfirmation().
ilSetup::$ini_client_exists = false |
Definition at line 42 of file class.ilSetup.php.
ilSetup::$ini_file_path |
Definition at line 38 of file class.ilSetup.php.
ilSetup::$ini_ilias_exists = false |
Definition at line 41 of file class.ilSetup.php.
ilSetup::$preliminaries = true |
Definition at line 48 of file class.ilSetup.php.
ilSetup::$preliminaries_result = array() |
Definition at line 47 of file class.ilSetup.php.
ilSetup::$safe_mode |
Definition at line 74 of file class.ilSetup.php.
ilSetup::$safe_mode_exec_dir |
Definition at line 75 of file class.ilSetup.php.
ilSetup::$setup_defaults |
Definition at line 44 of file class.ilSetup.php.
ilSetup::$setup_password |
Definition at line 71 of file class.ilSetup.php.
ilSetup::$SQL_FILE = "../sql/ilias3.sql" |
Definition at line 55 of file class.ilSetup.php.