4include_once(
"./setup/classes/class.ilDBConnections.php");
 
   76                define(
"ILIAS_MODULE",
"setup");
 
   78                $this->auth = ($this->
checkAuth()) ? 
true : 
false;
 
   79                $this->access_mode = $a_auth_type;
 
   82                if ($this->safe_mode = ini_get(
"safe_mode"))
 
   96                $this->ini_ilias_exists = $this->
init();
 
   98                if ($this->ini_ilias_exists)
 
  100                        if ($this->ini->readVariable(
"log",
"path") != 
"")
 
  102                                $log->path = $this->ini->readVariable(
"log",
"path");
 
  105                        if ($this->ini->readVariable(
"log",
"file") != 
"")
 
  107                                $log->filename = $this->ini->readVariable(
"log",
"file");
 
  110                        if ($this->ini->readVariable(
"log",
"enabled") != 
"")
 
  112                                $log->enabled = $this->ini->readVariable(
"log",
"enabled");
 
  128                $this->client = $a_cl;
 
  147                $this->ini = 
new ilIniFile($this->ini_file_path);
 
  149                if (!$this->ini->read())
 
  151                        $this->ini->GROUPS = parse_ini_file($this->setup_defaults,
true);
 
  152                        $this->
error = get_class($this).
": ".$this->ini->getError();
 
  156                $this->setup_password = $this->ini->readVariable(
"setup",
"pass");
 
  157                $this->default_client = $this->ini->readVariable(
"clients",
"default");
 
  159                define(
"ILIAS_DATA_DIR",$this->ini->readVariable(
"clients",
"datadir"));
 
  160                define(
"ILIAS_WEB_DIR",$this->ini->readVariable(
"clients",
"path"));
 
  172                $_SESSION[
"ClientId"] = $this->client->getId();
 
  175                if (!$this->client->create())
 
  177                        $this->
error = $this->client->getError();
 
  182                $this->ini_client_exists = 
true;
 
  197                if ($a_old_client_id != $this->client->getId())
 
  202                                $this->
raiseError($this->lng->txt(
"client_id_already_exists"),$this->error_obj->MESSAGE);
 
  207                                $this->
raiseError($this->lng->txt(
"save_error"),$this->error_obj->MESSAGE);
 
  215                $this->ini_client_exists = 
true;
 
  226                if ($this->client->checkDatabaseExists())
 
  228                        $this->
error = $this->lng->txt(
"database_exists");
 
  232                $this->client->getDB()->connectHost(
true);
 
  235                $db = $this->client->getDB();
 
  238                        $this->
error = 
"connection_failed";
 
  242                $r = 
$db->createDatabase($this->client->getdbName(),
 
  243                        "utf8", $a_collation);
 
  247                        $this->
error = 
"create_database_failed";
 
  254                $this->client->db_exists = 
true;
 
  270                if (!$this->client->connect())
 
  276                if ($this->
readDump($this->client->db, $this->SQL_FILE))
 
  278                        $this->client->db_installed = 
true;
 
  290                while( !feof( $fp ) )
 
  309                if (
$db->getDBType() == 
"mysql")
 
  311                        $fp = fopen(
$file, 
'r');
 
  316                                $line = trim($this->
getline($fp, 
"\n"));
 
  318                                if ($line != 
"" && substr($line,0,1)!=
"#" 
  319                                        && substr($line,0,1)!=
"-")
 
  322                                        if (substr($line,-1)==
";")
 
  325                                                $q .= 
" ".substr($line,0,-1);
 
  328                                                if (
$db->getErrorNo() > 0)
 
  330                                                        echo 
"<br />ERROR: ".$db->getError().
 
  347                #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage(); 
  348                if (in_array(
$db->getDBType(), array(
"oracle", 
"postgres", 
"innodb")))
 
  350                        if(@is_dir(
'./setup/sql/ilDBTemplate'))
 
  352                                include_once 
'./Services/Database/classes/class.ilArrayTableDataParser.php';
 
  353                                include_once 
'./Services/Xml/exceptions/class.ilSaxParserException.php';
 
  357                                        eval(file_get_contents(
'./setup/sql/ilDBTemplate/'.
$file));
 
  361                                                #$parser = new ilSimpleXMLTableDataParser('./setup/sql/ilDBTemplate/'.$file.'.xml'); 
  362                                                $parser->startParsing();
 
  363                                                #echo 'Table: '.$file.', memory: '.memory_get_peak_usage().' peak: '.memory_get_peak_usage().'<br />';flush(); 
  374                                include_once(
"./setup/sql/ilDBTemplate.php");
 
  375                                setupILIASDatabase();
 
  378                #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage(); 
  389                $a = @file_exists($this->INI_FILE);
 
  401                if (is_writable(
"."))
 
  403                        $arr[
"status"] = 
true;
 
  406                        $arr[
"comment"] = getcwd();
 
  411                        $arr[
"status"] = 
false;
 
  412                        $arr[
"comment"] = $this->lng->txt(
"pre_folder_write_error");
 
  415                        $arr[
"comment"] = getcwd().
": ".$arr[
"comment"];
 
  430                if (@mkdir($a_dir.
"/crst879dldsk9d", 0774))
 
  432                        $arr[
"status"] = 
true;
 
  433                        $arr[
"comment"] = 
"";
 
  435                        @rmdir($a_dir.
"/crst879dldsk9d");
 
  439                        $arr[
"status"] = 
false;
 
  442                        $arr[
"comment"] = getcwd().
": ".$this->lng->txt(
"pre_folder_create_error");
 
  457                if (
$sess->usesCookies)
 
  459                        $arr[
"status"] = 
true;
 
  460                        $arr[
"comment"] = 
"";
 
  464                        $arr[
"status"] = 
false;
 
  465                        $arr[
"comment"] = $this->lng->txt(
"pre_cookies_disabled");
 
  477                $version =  PHP_VERSION;
 
  479                $arr[
"status"] = 
true;
 
  480                $arr[
"comment"] = 
"PHP ".$version;
 
  481                if (version_compare($version, 
'5.3.0', 
'<'))
 
  483                        $arr[
"status"] = 
false;
 
  484                        $arr[
"comment"] = 
"PHP ".$version.
". ".$this->lng->txt(
"pre_php_version_too_low");
 
  498                if (function_exists(
"mysql_query"))
 
  500                        $arr[
"status"] = 
true;
 
  501                        $arr[
"comment"] = $this->lng->txt(
"pre_mysql_4_1_or_higher");
 
  505                        $arr[
"status"] = 
false;
 
  506                        $arr[
"comment"] = $this->lng->txt(
"pre_mysql_missing");
 
  535                if (class_exists(
"DOMDocument"))
 
  537                        $arr[
"status"] = 
true;
 
  541                        $arr[
"status"] = 
false;
 
  542                        $arr[
"comment"] = $this->lng->txt(
"pre_dom_missing");
 
  556                if (class_exists(
"XSLTProcessor"))
 
  558                        $arr[
"status"] = 
true;
 
  562                        $arr[
"status"] = 
false;
 
  563                        $arr[
"comment"] = sprintf($this->lng->txt(
"pre_xsl_missing"),
 
  564                                "http://php.net/manual/en/book.xsl.php");
 
  578                if (function_exists(
"imagefill") && function_exists(
"imagecolorallocate"))
 
  580                        $arr[
"status"] = 
true;
 
  584                        $arr[
"status"] = 
false;
 
  585                        $arr[
"comment"] = sprintf($this->lng->txt(
"pre_gd_missing"),
 
  586                                "http://php.net/manual/en/book.image.php");
 
  600                $limit = ini_get(
"memory_limit");
 
  603                if (is_int(strpos($limit, 
"M")))
 
  605                        $limit_n = (int) $limit;
 
  614                        $arr[
"status"] = 
true;
 
  615                        $arr[
"comment"] = $limit.
". ".$this->lng->txt(
"pre_memory_limit_recommend");
 
  619                        $arr[
"status"] = 
false;
 
  620                        $arr[
"comment"] = $limit.
". ".$this->lng->txt(
"pre_memory_limit_too_low");
 
  632                $load_comments = ini_get(
"opcache.load_comments");
 
  633                if($load_comments == 1) {
 
  634                        $arr[
"status"] = 
true;
 
  636                        $arr[
"status"] = 
false;
 
  637                        $arr[
"comment"] = $this->lng->txt(
"pre_opcache_comments");
 
  678                foreach ($this->preliminaries_result as $val)
 
  680                        if ($val[
"status"] === 
false)
 
  682                                $this->preliminaries = 
false;
 
  696                return $this->ini->readVariable(
"setup",
"pass");
 
  706                $this->ini->setVariable(
"setup",
"pass",md5($a_password));
 
  708                if ($this->ini->write() == 
false)
 
  710                        $this->
error = $this->ini->getError();
 
  726                if (empty($a_auth_data[
"client_id"]))
 
  728                        $this->
error = 
"no_client_id";
 
  732                if (empty($a_auth_data[
"username"]))
 
  734                        $this->
error = 
"no_username";
 
  738                if (empty($a_auth_data[
"password"]))
 
  740                        $this->
error = 
"no_password";
 
  744                if (!$this->
newClient($a_auth_data[
"client_id"]))
 
  746                        $this->
error = 
"unknown_client_id";
 
  747                        unset($this->client);
 
  751                if (!$this->client->db_exists)
 
  753                        $this->
error = 
"no_db_connect_consult_admin";
 
  754                        unset($this->client);
 
  758                $s1 = $this->client->db->query(
"SELECT value from settings WHERE keyword = ".
 
  759                        $this->client->db->quote(
'system_role_id',
'text'));
 
  760                $r1 = $this->client->db->fetchAssoc($s1);
 
  761                $system_role_id = $r1[
"value"];
 
  764                if($this->client->db->tableColumnExists(
'usr_data', 
'passwd_enc_type'))
 
  766                        $add_usrfields .= 
' , usr_data.passwd_enc_type, usr_data.passwd_salt ';
 
  768                $q = 
"SELECT usr_data.usr_id, usr_data.passwd $add_usrfields " .
 
  770                        "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id " .
 
  771                        "WHERE rbac_ua.rol_id = " . $this->client->db->quote((
int)$system_role_id, 
'integer') . 
" " .
 
  772                        "AND usr_data.login=" . $this->client->db->quote($a_auth_data[
"username"], 
'text');
 
  773                $r = $this->client->db->query($q);
 
  774                if(!$this->client->db->numRows($r))
 
  776                        $this->
error = 
'login_invalid';
 
  780                $data = $this->client->db->fetchAssoc($r);
 
  782                global $ilClientIniFile;
 
  784                $ilClientIniFile = $this->client->ini;
 
  786                require_once 
'Services/User/classes/class.ilUserPasswordManager.php';
 
  790                        require_once 
'setup/classes/class.ilObjSetupUser.php';
 
  793                        $user->setPasswordEncodingType(
$data[
'passwd_enc_type']);
 
  794                        $user->setPasswordSalt(
$data[
'passwd_salt']);
 
  800                        $password_valid =  
$data[
'passwd'] == md5($a_auth_data[
'password']);
 
  807                        $_SESSION[
'auth_path']   = ILIAS_HTTP_PATH;
 
  809                        $_SESSION[
'ClientId']    = $this->client->getId();
 
  814                        $this->
error = 
'login_invalid';
 
  826                $a_password = md5($a_password);
 
  828                if ($this->ini->readVariable(
"setup",
"pass") == $a_password)
 
  831                        $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
 
  851                $this->client = 
new ilClient($a_client_id, $this->db_connections);
 
  853                if (!$this->client->init())
 
  856                        $this->
error = get_class($this).
": ".$this->client->getError();
 
  875                        if ($this->ini_client_exists)
 
  888                if ($status[
"db"][
"status"] === 
false and $status[
"db"][
"update"] !== 
true)
 
  892                        $status[
"lang"][
"status"] = 
false;
 
  893                        $status[
"lang"][
"comment"] = $status[
"db"][
"comment"];
 
  894                        $status[
"contact"][
"status"] = 
false;
 
  895                        $status[
"contact"][
"comment"] = $status[
"db"][
"comment"];
 
  897                        $status[
"proxy"][
"status"] = 
false;
 
  898                        $status[
"proxy"][
"comment"] = $status[
"db"][
"comment"];
 
  900                        $status[
"nic"][
"status"] = 
false;
 
  901                        $status[
"nic"][
"comment"] = $status[
"db"][
"comment"];
 
  925                if (
$client->getSetting(
"setup_ok"))
 
  927                        $arr[
"status"] = 
true;
 
  932                        $arr[
"status"] = 
false;
 
  933                        $arr[
"comment"] = $this->lng->txt(
"setup_not_finished");
 
  946                if (
$client->ini->readVariable(
"client",
"access") == 
"1")
 
  948                        $arr[
"status"] = 
true;
 
  949                        $arr[
"comment"] = $this->lng->txt(
"online");
 
  953                        $arr[
"status"] = 
false;
 
  954                        $arr[
"comment"] = $this->lng->txt(
"disabled");
 
  967                if (!$arr[
"status"] = 
$client->init())
 
  969                        $arr[
"comment"] = 
$client->getError();
 
  986                if (!$arr[
"status"] = 
$client->db_exists)
 
  988                        $arr[
"comment"] = $this->lng->txt(
"no_database");
 
  992                if (!$arr[
"status"] = 
$client->db_installed)
 
  994                        $arr[
"comment"] = $this->lng->txt(
"db_not_installed");
 
 1002                include_once 
"./Services/Database/classes/class.ilDBUpdate.php";
 
 1004                $this->lng->setDbHandler(
$client->db);
 
 1007                if (!$arr[
"status"] = $dbupdate->getDBVersionStatus())
 
 1009                        $arr[
"comment"] = $this->lng->txt(
"db_needs_update");
 
 1010                        $arr[
"update"] = 
true;
 
 1013                else if ($dbupdate->hotfixAvailable())
 
 1015                        $arr[
"status"] = 
false;
 
 1016                        $arr[
"comment"] = $this->lng->txt(
"hotfix_available");
 
 1017                        $arr[
"update"] = 
true;
 
 1020                else if ($dbupdate->customUpdatesAvailable())
 
 1022                        $arr[
"status"] = 
false;
 
 1023                        $arr[
"comment"] = $this->lng->txt(
"custom_updates_available");
 
 1024                        $arr[
"update"] = 
true;
 
 1030                $cset = 
$ilDB->query(
"SELECT count(*) as cnt FROM ctrl_calls");
 
 1031                $crec = 
$ilDB->fetchAssoc($cset);
 
 1032                if ($crec[
"cnt"] == 0)
 
 1034                        $arr[
"status"] = 
false;
 
 1035                        $arr[
"comment"] = $this->lng->txt(
"db_control_structure_missing");
 
 1036                        $arr[
"update"] = 
true;
 
 1051                require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
 
 1058                $query = 
"SELECT keyword, value FROM settings WHERE ".$db->in(
'keyword', $fields, 
false, 
'text');
 
 1064                        if( 
$row[
'value'] != 
'' )
 
 1069                if (count($rows) != count($fields))
 
 1071                        if($a_as_bool) 
return false;
 
 1072                        $arr[
"status"] = 
false;
 
 1073                        $arr[
"comment"] = $this->lng->txt(
"session_management_not_configured");
 
 1077                        if($a_as_bool) 
return true;
 
 1078                        $arr[
"status"] = 
true;
 
 1079                        $arr[
"comment"] = $this->lng->txt(
"session_management_configured");
 
 1094                $fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
 
 1096                $query = 
"SELECT keyword, value FROM settings WHERE ".$db->in(
'keyword', $fields, 
false, 
'text');
 
 1099                $proxy_settings = array();
 
 1100                $already_saved = 
false;
 
 1103                        $already_saved = 
true;
 
 1104                        $proxy_settings[
$row[
'keyword']] = 
$row[
'value'];
 
 1109                        $arr[
"status"] = 
false;
 
 1110                        $arr[
"comment"] = $this->lng->txt(
"proxy");
 
 1111                        $arr[
"text"] = $this->lng->txt(
"proxy");
 
 1113                else if((
bool)$proxy_settings[
"proxy_status"] == 
false)
 
 1115                        $arr[
"status"] = 
true;
 
 1116                        $arr[
"comment"] = $this->lng->txt(
"proxy_disabled");
 
 1117                        $arr[
"text"] = $this->lng->txt(
"proxy_disabled");
 
 1121                        $arr[
"status"] = 
true;
 
 1122                        $arr[
"comment"] = $this->lng->txt(
"proxy_activated_configurated");
 
 1123                        $arr[
"text"] = $this->lng->txt(
"proxy_activated_configurated");
 
 1136                $installed_langs = $this->lng->getInstalledLanguages();
 
 1138                $count = count($installed_langs);
 
 1142                        $arr[
"status"] = 
false;
 
 1143                        $arr[
"comment"] = $this->lng->txt(
"lang_none_installed");
 
 1147                        $arr[
"status"] = 
true;
 
 1161                $arr[
"status"] = 
true;
 
 1164                $settings = 
$client->getAllSettings();
 
 1165                $client_name = 
$client->getName();
 
 1168                if (empty($settings[
"admin_firstname"]) or empty($settings[
"admin_lastname"]) or
 
 1169                        empty($settings[
"admin_email"]) or empty($client_name))
 
 1171                        $arr[
"status"] = 
false;
 
 1172                        $arr[
"comment"] = $this->lng->txt(
"missing_data");
 
 1176                if (!
ilUtil::is_email($settings[
"admin_email"]) and $arr[
"status"] != 
false)
 
 1178                        $arr[
"status"] = 
false;
 
 1179                        $arr[
"comment"] = $this->lng->txt(
"email_not_valid");
 
 1192                $settings = 
$client->getAllSettings();
 
 1194                if (!isset($settings[
"nic_enabled"]))
 
 1196                        $arr[
"status"] = 
false;
 
 1197                        $arr[
"comment"] = $this->lng->txt(
"nic_not_disabled");
 
 1201                $arr[
"status"] = 
true;
 
 1203                if ($settings[
"nic_enabled"] == 
"-1")
 
 1205                        $arr[
"comment"] = $this->lng->txt(
"nic_reg_failed");
 
 1209                if (!$settings[
"nic_enabled"])
 
 1211                        $arr[
"comment"] = $this->lng->txt(
"nic_reg_disabled");
 
 1215                        $arr[
"comment"] = $this->lng->txt(
"nic_reg_enabled");
 
 1216                        if ($settings[
"inst_id"] <= 0)
 
 1218                                $arr[
"status"] = 
false;
 
 1249                return ($this->access_mode == 
"admin") ? true : 
false;
 
 1261                if ($a_formdata[
"chk_datadir_path"] == 1)       
 
 1265                                $this->
error = 
"create_datadir_failed";
 
 1275                                $this->
error = 
"create_webdir_failed";
 
 1281                $log_path = substr($form_log_path,0,strrpos($form_log_path,
"/"));
 
 1282                $log_file = substr($form_log_path,strlen($log_path)+1);
 
 1284                $this->ini->setVariable(
"server",
"http_path",ILIAS_HTTP_PATH);
 
 1286                $this->ini->setVariable(
"server",
"timezone",preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
 
 1287                $this->ini->setVariable(
"clients", 
"datadir", $datadir_path);
 
 1288                $this->ini->setVariable(
"tools", 
"convert", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"convert_path"])));
 
 1289                $this->ini->setVariable(
"tools", 
"zip", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"zip_path"])));
 
 1290                $this->ini->setVariable(
"tools", 
"unzip", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"unzip_path"])));
 
 1291                $this->ini->setVariable(
"tools", 
"ghostscript", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"])));
 
 1292                $this->ini->setVariable(
"tools", 
"java", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"java_path"])));
 
 1293                $this->ini->setVariable(
"tools", 
"htmldoc", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"htmldoc_path"])));
 
 1295                $this->ini->setVariable(
"tools", 
"ffmpeg", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ffmpeg_path"])));
 
 1297                $this->ini->setVariable(
"tools", 
"vscantype", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"vscanner_type"])));
 
 1298                $this->ini->setVariable(
"tools", 
"scancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"scan_command"])));
 
 1299                $this->ini->setVariable(
"tools", 
"cleancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"])));
 
 1300                $this->ini->setVariable(
"setup", 
"pass", md5($a_formdata[
"setup_pass"]));
 
 1301                $this->ini->setVariable(
"log", 
"path", $log_path);
 
 1302                $this->ini->setVariable(
"log", 
"file", $log_file);
 
 1303                $this->ini->setVariable(
"log", 
"enabled", ($a_formdata[
"chk_log_status"]) ? 
"0" : 1);
 
 1305                $this->ini->setVariable(
"https",
"auto_https_detect_enabled", ($a_formdata[
"auto_https_detect_enabled"]) ? 1 : 0);
 
 1306                $this->ini->setVariable(
"https",
"auto_https_detect_header_name", $a_formdata[
"auto_https_detect_header_name"]);
 
 1307                $this->ini->setVariable(
"https",
"auto_https_detect_header_value", $a_formdata[
"auto_https_detect_header_value"]);
 
 1309                if (!$this->ini->write())
 
 1311                        $this->
error = get_class($this).
": ".$this->ini->getError();
 
 1317                $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
 
 1333                $ghostscript_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
 
 1342                $clean_command = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"]));
 
 1344                $this->ini->setVariable(
"tools", 
"convert", $convert_path);
 
 1345                $this->ini->setVariable(
"tools", 
"zip", $zip_path);
 
 1346                $this->ini->setVariable(
"tools", 
"unzip", $unzip_path);
 
 1347                $this->ini->setVariable(
"tools", 
"ghostscript", $ghostscript_path);
 
 1348                $this->ini->setVariable(
"tools", 
"java", $java_path);
 
 1349                $this->ini->setVariable(
"tools", 
"htmldoc", $htmldoc_path);
 
 1351                $this->ini->setVariable(
"tools", 
"ffmpeg", $ffmpeg_path);
 
 1352                $this->ini->setVariable(
"tools", 
"latex", $latex_url);
 
 1353                $this->ini->setVariable(
"tools", 
"fop", $fop_path);
 
 1354                $this->ini->setVariable(
"tools", 
"vscantype", $scan_type);
 
 1355                $this->ini->setVariable(
"tools", 
"scancommand", $scan_command);
 
 1356                $this->ini->setVariable(
"tools", 
"cleancommand", $clean_command);
 
 1359                $log_path = substr($form_log_path,0,strrpos($form_log_path,
"/"));
 
 1360                $log_file = substr($form_log_path,strlen($log_path)+1);
 
 1362                $this->ini->setVariable(
"log", 
"path", $log_path);
 
 1363                $this->ini->setVariable(
"log", 
"file", $log_file);
 
 1364                $this->ini->setVariable(
"log", 
"enabled", ($a_formdata[
"chk_log_status"]) ? 
"0" : 1);
 
 1365                $this->ini->setVariable(
"server",
"timezone",preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
 
 1367                $this->ini->setVariable(
"https",
"auto_https_detect_enabled",($a_formdata[
"auto_https_detect_enabled"]) ? 1 : 0);
 
 1368                $this->ini->setVariable(
"https",
"auto_https_detect_header_name", $a_formdata[
"auto_https_detect_header_name"]);
 
 1369                $this->ini->setVariable(
"https",
"auto_https_detect_header_value", $a_formdata[
"auto_https_detect_header_value"]);
 
 1371                if (!$this->ini->write())
 
 1373                        $this->
error = get_class($this).
": ".$this->ini->getError();
 
 1388                if (!isset($a_formdata[
"chk_convert_path"]))
 
 1393                        if (($err = $this->
testConvert($convert_path)) != 
"")
 
 1395                                $this->
error = $err;
 
 1401                if (!isset($a_formdata[
"chk_zip_path"]))
 
 1406                        if (empty($zip_path))
 
 1408                                $this->
error = 
"no_path_zip";
 
 1412                        if (!$this->
testZip($zip_path))
 
 1414                                $this->
error = 
"check_failed_zip";
 
 1420                if (!isset($a_formdata[
"chk_unzip_path"]))
 
 1425                        if (empty($unzip_path))
 
 1427                                $this->
error = 
"no_path_unzip";
 
 1433                                $this->
error = 
"check_failed_unzip";
 
 1439                if (!isset($a_formdata[
"chk_ghostscript_path"]))
 
 1442                        $ghostscript_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
 
 1446                                $this->
error = $err;
 
 1452                if (!isset($a_formdata[
"chk_java_path"]))
 
 1457                        if (empty($java_path))
 
 1459                                $this->
error = 
"no_path_java";
 
 1465                                $this->
error = 
"check_failed_java";
 
 1471                if (!isset($a_formdata[
"chk_htmldoc_path"]))
 
 1476                        if (empty($htmldoc_path))
 
 1478                                $this->
error = 
"no_path_htmldoc";
 
 1484                                $this->
error = 
"check_failed_htmldoc";
 
 1506                if (!isset($a_formdata[
"chk_ffmpeg_path"]))
 
 1511                        if (empty($ffmpeg_path))
 
 1513                                $this->
error = 
"no_path_ffmpeg";
 
 1517                        if (!$this->testFFMpeg($ffmpeg_path))
 
 1519                                $this->
error = 
"check_failed_ffmpeg";
 
 1525                if (!isset($a_formdata[
"chk_latex_url"]))
 
 1528                        if (empty($latex_url))
 
 1530                                $this->
error = 
"no_latex_url";
 
 1536                                $this->
error = 
"check_failed_latex";
 
 1554                if (empty($datadir_path))
 
 1556                        $this->
error = 
"no_path_datadir";
 
 1563                if (strpos($datadir_path,$webspace_dir) !== 
false)
 
 1565                        $this->
error = 
"datadir_webspacedir_match";
 
 1570                if ($a_formdata[
"chk_datadir_path"] == 1)
 
 1572                        $dir_to_create = substr(strrchr($datadir_path, 
"/"), 1);
 
 1573                        $dir_to_check = substr($datadir_path,0,- strlen($dir_to_create)-1);
 
 1575                        if (is_writable($datadir_path))
 
 1577                                $this->
error = 
"dir_exists_create";
 
 1581                        if (!is_writable($dir_to_check))
 
 1583                                $this->
error = 
"cannot_create_datadir_no_write_access";
 
 1589                        if (!is_writable($datadir_path))
 
 1591                                $this->
error = 
"cannot_create_datadir_no_write_access";
 
 1606                if (!$a_formdata[
"setup_pass"])
 
 1608                        $this->
error = 
"no_setup_pass_given";
 
 1612                if ($a_formdata[
"setup_pass"] != $a_formdata[
"setup_pass2"])
 
 1614                        $this->
error = 
"pass_does_not_match";
 
 1629                if (!$a_formdata[
"chk_log_status"])
 
 1634                        if (empty($log_path))
 
 1636                                $this->
error = 
"no_path_log";
 
 1640                        if (!@touch($log_path))
 
 1642                                $this->
error = 
"could_not_create_logfile";
 
 1656                if (empty($this->
error))
 
 1689                if (trim($a_convert_path) == 
"")
 
 1691                        return "no_path_convert";
 
 1693                if (!is_file($a_convert_path))
 
 1695                        return "check_failed_convert";
 
 1711                if (trim($a_ghostscript_path) == 
"")
 
 1715                if (!is_file($a_ghostscript_path))
 
 1717                        return "check_failed_ghostscript";
 
 1732                if (trim($a_java_path) == 
"")
 
 1737                if (!is_file($a_java_path))
 
 1739                        return "check_failed_java";
 
 1761                if (trim($a_latex_url) == 
"")
 
 1767                include_once 
"./setup/classes/class.ilHttpRequest.php";
 
 1769                $result = @$http->downloadToString();
 
 1770                if ((strpos((substr(
$result, 0, 5)), 
"PNG") !== FALSE) || (strpos((substr(
$result, 0, 5)), 
"GIF") !== FALSE))
 
 1776                        return "check_failed_latex";;
 
 1788                if (trim($a_zip_path) == 
"")
 
 1790                        return "no_path_zip";
 
 1792                if (!is_file($a_zip_path))
 
 1794                        return "check_failed_zip";
 
 1841                if (trim($a_unzip_path) == 
"")
 
 1843                        return "no_path_unzip";
 
 1845                if (!is_file($a_unzip_path))
 
 1847                        return "check_failed_unzip";
 
 1887                if (trim($a_htmldoc_path) == 
"")
 
 1892                if (!is_file($a_htmldoc_path))
 
 1894                        return "check_failed_htmldoc";
 
 1904                $html = 
"<html><head><title></title></head><body><p>test</p></body></html>";
 
 1906                $html_file = 
"htmldoc_test_file.html";
 
 1908        $fp = fopen( $html_file ,
"wb");
 
 1912        $htmldoc = $a_htmldoc_path.
" ";
 
 1913        $htmldoc .= 
"--no-toc ";
 
 1914        $htmldoc .= 
"--no-jpeg ";
 
 1915        $htmldoc .= 
"--webpage ";
 
 1916        $htmldoc .= 
"--outfile htmldoc_test_file.pdf ";
 
 1917        $htmldoc .= 
"--bodyfont Arial ";
 
 1918        $htmldoc .= 
"--charset iso-8859-15 ";
 
 1919        $htmldoc .= 
"--color ";
 
 1920        $htmldoc .= 
"--size A4  ";      
 
 1921        $htmldoc .= 
"--format pdf ";
 
 1922        $htmldoc .= 
"--footer ... ";
 
 1923        $htmldoc .= 
"--header ... ";
 
 1924        $htmldoc .= 
"--left 60 ";
 
 1926        $htmldoc .= $html_file;
 
 1951        function unzip($a_file, $overwrite = 
false)
 
 1955                $pathinfo = pathinfo($a_file);
 
 1956                $dir = $pathinfo[
"dirname"];
 
 1957                $file = $pathinfo[
"basename"];
 
 1962                $unzip = $this->ini->readVariable(
"tools",
"unzip");
 
 1964                exec($unzipcmd, $arr);
 
 1967                foreach($arr as $line)
 
 1969                        if(is_int(strpos($line, 
"/")))
 
 1971                                $zdir = substr($line, 0, strrpos($line, 
"/"));
 
 1972                                $nr = substr_count($zdir, 
"/");
 
 1976                                        $nr = substr_count($zdir, 
"/");
 
 1977                                        $zdirs[$zdir] = $nr;                            
 
 1979                                        $zdir = substr($zdir, 0, strrpos($zdir, 
"/"));
 
 1986                foreach($zdirs as $zdir => $nr)                         
 
 2012                require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
 
 2014                $db = $this->client->getDB();
 
 2019                foreach($setting_fields as $field)
 
 2021                        if( isset($session_settings[$field]) )
 
 2023                                $query = 
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
 
 2025                                                array(
'text', 
'text'), array(
'common', $field));
 
 2030                                if( count(
$row) > 0 )
 
 2035                                                        'value' => array(
'text', $session_settings[$field])
 
 2038                                                        'module' => array(
'text', 
'common'),
 
 2039                                                        'keyword' => array(
'text', $field)
 
 2048                                                        'module' => array(
'text', 
'common'),
 
 2049                                                        'keyword' => array(
'text', $field),
 
 2050                                                        'value' => array(
'text', $session_settings[$field])
 
 2059                if($i < 4) $message = $this->lng->txt(
"session_settings_not_saved");
 
 2060                else $message = $this->lng->txt(
"settings_saved");
 
 2072                require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
 
 2074                $db = $this->client->getDB();
 
 2078                $query = 
"SELECT * FROM settings WHERE module = %s " .
 
 2079                                "AND ".$db->in(
'keyword', $setting_fields, 
false, 
'text');
 
 2083                $session_settings = array();
 
 2086                        $session_settings[
$row[
'keyword']] = 
$row[
'value'];
 
 2089                foreach( $setting_fields as $field )
 
 2091                        if( !isset($session_settings[$field]) )
 
 2097                                        case 'session_max_count':
 
 2102                                        case 'session_min_idle':
 
 2107                                        case 'session_max_idle':
 
 2112                                        case 'session_max_idle_after_first_request':
 
 2117                                        case 'session_allow_client_maintenance':
 
 2123                                $session_settings[$field] = $value;
 
 2127                return $session_settings;
 
 2138                $source = 
new ilClient($source_id, $this->db_connections);
 
 2147                        $this->
error = 
"Could not delete data dir $target->getDataDir()";
 
 2154                        $this->
error = 
"could_not_create_base_data_dir :".$target->getDataDir();
 
 2159                if (! 
ilUtil::rCopy($source->getDataDir(),$target->getDataDir())) {
 
 2160                        $this->
error = 
"clone_datadircopyfail";
 
 2161                        $target->ini->write();
 
 2167                        $this->
error = 
"Could not delete webspace dir $target->getWebspaceDir()";
 
 2174                        $this->
error = 
"could_not_create_base_webspace_dir :".$target->getWebspaceDir();
 
 2179                if (! 
ilUtil::rCopy($source->getWebspaceDir(),$target->getWebspaceDir())) {
 
 2180                        $this->
error = 
"clone_websipacedircopyfail";
 
 2181                        $target->ini->write();
 
 2186                $target->ini->write();
 
 2194            $this->
error = 
"Source database connection failed.";
 
 2201            $this->
error = 
"Target database connection failed.";
 
 2206                $srcTables = $source->db->query(
"SHOW TABLES");
 
 2210                $tarTables = $target->db->query(
"SHOW TABLES");
 
 2211                foreach($tarTables->fetchAll() as $cTable)
 
 2213                        $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
 
 2216                foreach($srcTables->fetchAll() as $cTable){
 
 2217                        $drop   = $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
 
 2218                        $create = $target->db->query(
"CREATE TABLE " . $cTable[0] . 
" LIKE " . $source->getDbName() . 
"." . $cTable[0]);
 
 2222            $insert = $target->db->query(
"INSERT INTO " . $cTable[0] . 
" SELECT * FROM ".$source->getDbName().
".".$cTable[0]);
 
 2225                $target->db->query(
"UPDATE settings SET VALUE = ".$target->db->quote(0, 
"integer").
" WHERE keyword = ".$target->db->quote(
"inst_id", 
"text"));
 
 2226                $target->db->query(
"UPDATE settings SET VALUE = ".$target->db->quote(0, 
"integer").
" WHERE keyword = ".$target->db->quote(
"nic_enabled", 
"text"));
 
 2238                require_once 
'./Services/Http/exceptions/class.ilProxyException.php';
 
 2239                $settings = 
$client->getAllSettings();
 
 2241                if((
bool)$settings[
'proxy_status'] == 
true)
 
 2250                                require_once 
'Services/PEAR/lib/Net/Socket.php';
 
 2254                                $response = $socket->connect($settings[
'proxy_host'], $settings[
'proxy_port']);
 
 2255                                if(!is_bool($response))
 
 2258                                        throw new ilProxyException(strlen($response) ? $response : 
$lng->txt(
'proxy_not_connectable'));
 
 2266                                ilUtil::sendFailure($this->lng->txt(
'proxy_pear_net_socket_error').
': '.$e->getMessage());
 
 2274                $db = $this->client->getDB();
 
 2275                $proxy_fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
 
 2277                foreach($proxy_fields as $field)
 
 2279                        if( isset($proxy_settings[$field]) )
 
 2281                                $query = 
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
 
 2283                                        array(
'text', 
'text'), array(
'common', $field));
 
 2288                                if( count(
$row) > 0 )
 
 2293                                                        'value' => array(
'text', $proxy_settings[$field])
 
 2296                                                        'module' => array(
'text', 
'common'),
 
 2297                                                        'keyword' => array(
'text', $field)
 
 2306                                                        'module' => array(
'text', 
'common'),
 
 2307                                                        'keyword' => array(
'text', $field),
 
 2308                                                        'value' => array(
'text', $proxy_settings[$field])
 
 2320                $ini_get = ini_get(
'opcache.enable');
 
 2322                return ($ini_get === 1 OR $ini_get === 
'1' OR strtolower($ini_get) === 
'on');
 
 2330                return parent::getFileName();
 
 2335                if(!parent::valid())
 
 2339                if($this->isFile() and substr(parent::getFileName(),-4) == 
'.xml')
 
 2343                if($this->isFile() and substr(parent::getFileName(),-8) != 
'_inserts')
 
 2348                return $this->
valid();
 
const PEAR_ERROR_RETURN
#+ ERROR constants
const PEAR_ERROR_CALLBACK
isError($data, $code=null)
Tell whether a value is a MDB2 error.
Generalized Socket class.
PEAR($error_class=null)
Constructor.
setErrorHandling($mode=null, $options=null)
Sets how errors generated by this object should be handled.
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
error($a_errmsg)
set error message @access public
Administrates DB connections in setup.
Error Handling & global info handling uses PEAR error class.
deleteTrailingSlash($a_path)
delete trailing slash of path variables
Class ilObjSetupUser A class derived from ilObjUser for authentication purposes in the ILIAS setup.
Class for proxy related exception handling in ILIAS.
SaxParserException thrown by ilSaxParser if property throwException is set.
static getSettingFields()
returns the array of setting fields
const DEFAULT_MAX_IDLE_AFTER_FIRST_REQUEST
const DEFAULT_ALLOW_CLIENT_MAINTENANCE
const DEFAULT_MAX_COUNT
default value for settings that have not been defined in setup or administration yet
checkToolsSetup($a_formdata)
check pathes to 3rd party software
checkClientContact(&$client)
check client contact data status
installDatabase()
set the database data
checkWritable()
check for writable directory
checkAccess(&$client)
check client access status
getStatus($client=0)
coumpute client status
ilSetup($a_auth, $a_auth_type)
constructor
testLatex($a_latex_url)
Check latex cgi script.
loginAsClient($a_auth_data)
process client login
saveMasterSetup($a_formdata)
saves intial settings
checkPHPVersion()
check for PHP version
testZip($a_zip_path)
Check zip program.
cloneFromSource($source_id)
Clone source client into current client.
checkPasswordSetup($a_formdata)
check setup password
isAuthenticated()
check if current user is authenticated
checkAuth()
check authentication status
checkCreatable($a_dir=".")
check for permission to create new folders in specified directory
isInstalled()
check if client's db is installed
testUnzip($a_unzip_path)
Check unzip program.
loginAsAdmin($a_password)
process setup admin login
setPassword($a_password)
set setup master password
checkDataDirSetup($a_formdata)
check datadir path
checkClientDatabase(&$client)
check client db status
readDump($db, $file)
execute a query
queryPreliminaries()
preliminaries
saveProxySettings($proxy_settings)
checkClientIni(&$client)
check client ini status
unzip($a_file, $overwrite=false)
unzip file
checkClientNIC(&$client)
check client nic status
testGhostscript($a_ghostscript_path)
Check ghostscript program.
updateMasterSettings($a_formdata)
updates settings
testConvert($a_convert_path)
Check convert program.
newClient($a_client_id=0)
creates a client object in $this->client
printProxyStatus($client)
Print proxy settings.
checkCookiesEnabled()
check cookies enabled
isAdmin()
check if current user is admin
checkClientLanguages(&$client)
check client installed languages status
checkClientSessionSettings(&$client, $a_as_bool=false)
check client session config status
createDatabase($a_collation="")
create client database
testHtmldoc($a_htmldoc_path)
Check htmldoc program.
init()
init setup load settings from ilias.ini if exists and sets some constants
checkClientProxySettings(&$client)
check client session config status
checkLogSetup($a_formdata)
check log path
checkMemoryLimit()
Check Memory Limit.
saveNewClient()
saves client.ini & updates client list in ilias.ini
getSessionSettings()
reads session settings from db
setSessionSettings($session_settings)
saves session settings to db
getPassword()
get setup master password
updateNewClient($a_old_client_id)
update client.ini & move data dirs does not work correctly at this time - DISABLED
checkPreliminaries()
check all prliminaries
checkFinish(&$client)
check if client setup was finished
checkIniFileExists()
check if inifile exists
testJava($a_java_path)
Check JVM.
getError()
get Error message
static getInstance()
Single method to reduce footprint (included files, created instances)
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static escapeShellArg($a_arg)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static createDirectory($a_dir, $a_mod=0755)
create directory
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
const ILIAS_ABSOLUTE_PATH