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();
 
  130                $this->client = $a_cl;
 
  149                $this->ini = 
new ilIniFile($this->ini_file_path);
 
  151                if (!$this->ini->read())
 
  153                        $this->ini->GROUPS = parse_ini_file($this->setup_defaults,
true);
 
  154                        $this->
error = get_class($this).
": ".$this->ini->getError();
 
  158                $this->setup_password = $this->ini->readVariable(
"setup",
"pass");
 
  159                $this->default_client = $this->ini->readVariable(
"clients",
"default");
 
  161                define(
"ILIAS_DATA_DIR",$this->ini->readVariable(
"clients",
"datadir"));
 
  162                define(
"ILIAS_WEB_DIR",$this->ini->readVariable(
"clients",
"path"));
 
  174                $_SESSION[
"ClientId"] = $this->client->getId();
 
  177                if (!$this->client->create())
 
  179                        $this->
error = $this->client->getError();
 
  184                $this->ini_client_exists = 
true;
 
  199                if ($a_old_client_id != $this->client->getId())
 
  204                                $this->
raiseError($this->lng->txt(
"client_id_already_exists"),$this->error_obj->MESSAGE);
 
  209                                $this->
raiseError($this->lng->txt(
"save_error"),$this->error_obj->MESSAGE);
 
  217                $this->ini_client_exists = 
true;
 
  228                if ($this->client->checkDatabaseExists())
 
  230                        $this->
error = $this->lng->txt(
"database_exists");
 
  234                $this->client->getDB()->connectHost(
true);
 
  237                $db = $this->client->getDB();
 
  240                        $this->
error = 
"connection_failed";
 
  244                $r = $db->createDatabase($this->client->getdbName(),
 
  245                        "utf8", $a_collation);
 
  249                        $this->
error = 
"create_database_failed";
 
  256                $this->client->db_exists = 
true;
 
  272                if (!$this->client->connect())
 
  278                if ($this->
readDump($this->client->db, $this->SQL_FILE))
 
  280                        $this->client->db_installed = 
true;
 
  292                while( !feof( $fp ) )
 
  311                if (
$db->getDBType() == 
"mysql")
 
  313                        $fp = fopen(
$file, 
'r');
 
  318                                $line = trim($this->
getline($fp, 
"\n"));
 
  320                                if ($line != 
"" && substr($line,0,1)!=
"#" 
  321                                        && substr($line,0,1)!=
"-")
 
  324                                        if (substr($line,-1)==
";")
 
  327                                                $q .= 
" ".substr($line,0,-1);
 
  330                                                if (
$db->getErrorNo() > 0)
 
  332                                                        echo 
"<br />ERROR: ".$db->getError().
 
  349                #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage(); 
  350                if (in_array(
$db->getDBType(), array(
"oracle", 
"postgres", 
"innodb")))
 
  352                        if(@is_dir(
'./setup/sql/ilDBTemplate'))
 
  354                                include_once 
'./Services/Database/classes/class.ilArrayTableDataParser.php';
 
  355                                include_once 
'./Services/Xml/exceptions/class.ilSaxParserException.php';
 
  359                                        eval(file_get_contents(
'./setup/sql/ilDBTemplate/'.
$file));
 
  363                                                #$parser = new ilSimpleXMLTableDataParser('./setup/sql/ilDBTemplate/'.$file.'.xml'); 
  364                                                $parser->startParsing();
 
  365                                                #echo 'Table: '.$file.', memory: '.memory_get_peak_usage().' peak: '.memory_get_peak_usage().'<br />';flush(); 
  376                                include_once(
"./setup/sql/ilDBTemplate.php");
 
  377                                setupILIASDatabase();
 
  380                #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage(); 
  391                $a = @file_exists($this->INI_FILE);
 
  403                if (is_writable(
"."))
 
  405                        $arr[
"status"] = 
true;
 
  408                        $arr[
"comment"] = getcwd();
 
  413                        $arr[
"status"] = 
false;
 
  414                        $arr[
"comment"] = $this->lng->txt(
"pre_folder_write_error");
 
  417                        $arr[
"comment"] = getcwd().
": ".$arr[
"comment"];
 
  432                if (@mkdir($a_dir.
"/crst879dldsk9d", 0774))
 
  434                        $arr[
"status"] = 
true;
 
  435                        $arr[
"comment"] = 
"";
 
  437                        @rmdir($a_dir.
"/crst879dldsk9d");
 
  441                        $arr[
"status"] = 
false;
 
  444                        $arr[
"comment"] = getcwd().
": ".$this->lng->txt(
"pre_folder_create_error");
 
  459                if (
$sess->usesCookies)
 
  461                        $arr[
"status"] = 
true;
 
  462                        $arr[
"comment"] = 
"";
 
  466                        $arr[
"status"] = 
false;
 
  467                        $arr[
"comment"] = $this->lng->txt(
"pre_cookies_disabled");
 
  479                $version =  PHP_VERSION;
 
  481                $arr[
"status"] = 
true;
 
  482                $arr[
"comment"] = 
"PHP ".$version;
 
  483                if (version_compare($version, 
'5.3.0', 
'<'))
 
  485                        $arr[
"status"] = 
false;
 
  486                        $arr[
"comment"] = 
"PHP ".$version.
". ".$this->lng->txt(
"pre_php_version_too_low");
 
  500                if (function_exists(
"mysql_query"))
 
  502                        $arr[
"status"] = 
true;
 
  503                        $arr[
"comment"] = $this->lng->txt(
"pre_mysql_4_1_or_higher");
 
  507                        $arr[
"status"] = 
false;
 
  508                        $arr[
"comment"] = $this->lng->txt(
"pre_mysql_missing");
 
  537                if (class_exists(
"DOMDocument"))
 
  539                        $arr[
"status"] = 
true;
 
  543                        $arr[
"status"] = 
false;
 
  544                        $arr[
"comment"] = $this->lng->txt(
"pre_dom_missing");
 
  558                if (class_exists(
"XSLTProcessor"))
 
  560                        $arr[
"status"] = 
true;
 
  564                        $arr[
"status"] = 
false;
 
  565                        $arr[
"comment"] = sprintf($this->lng->txt(
"pre_xsl_missing"),
 
  566                                "http://php.net/manual/en/book.xsl.php");
 
  580                if (function_exists(
"imagefill") && function_exists(
"imagecolorallocate"))
 
  582                        $arr[
"status"] = 
true;
 
  586                        $arr[
"status"] = 
false;
 
  587                        $arr[
"comment"] = sprintf($this->lng->txt(
"pre_gd_missing"),
 
  588                                "http://php.net/manual/en/book.image.php");
 
  602                $limit = ini_get(
"memory_limit");
 
  605                if (is_int(strpos($limit, 
"M")))
 
  607                        $limit_n = (int) $limit;
 
  616                        $arr[
"status"] = 
true;
 
  617                        $arr[
"comment"] = $limit.
". ".$this->lng->txt(
"pre_memory_limit_recommend");
 
  621                        $arr[
"status"] = 
false;
 
  622                        $arr[
"comment"] = $limit.
". ".$this->lng->txt(
"pre_memory_limit_too_low");
 
  634                $load_comments = ini_get(
"opcache.load_comments");
 
  635                if($load_comments == 1) {
 
  636                        $arr[
"status"] = 
true;
 
  638                        $arr[
"status"] = 
false;
 
  639                        $arr[
"comment"] = $this->lng->txt(
"pre_opcache_comments");
 
  680                foreach ($this->preliminaries_result as $val)
 
  682                        if ($val[
"status"] === 
false)
 
  684                                $this->preliminaries = 
false;
 
  698                return $this->ini->readVariable(
"setup",
"pass");
 
  708                $this->ini->setVariable(
"setup",
"pass",md5($a_password));
 
  710                if ($this->ini->write() == 
false)
 
  712                        $this->
error = $this->ini->getError();
 
  728                if (empty($a_auth_data[
"client_id"]))
 
  730                        $this->
error = 
"no_client_id";
 
  734                if (empty($a_auth_data[
"username"]))
 
  736                        $this->
error = 
"no_username";
 
  740                if (empty($a_auth_data[
"password"]))
 
  742                        $this->
error = 
"no_password";
 
  746                if (!$this->
newClient($a_auth_data[
"client_id"]))
 
  748                        $this->
error = 
"unknown_client_id";
 
  749                        unset($this->client);
 
  753                if (!$this->client->db_exists)
 
  755                        $this->
error = 
"no_db_connect_consult_admin";
 
  756                        unset($this->client);
 
  760                $s1 = $this->client->db->query(
"SELECT value from settings WHERE keyword = ".
 
  761                        $this->client->db->quote(
'system_role_id',
'text'));
 
  762                $r1 = $this->client->db->fetchAssoc($s1);
 
  763                $system_role_id = $r1[
"value"];
 
  766                if($this->client->db->tableColumnExists(
'usr_data', 
'passwd_enc_type'))
 
  768                        $add_usrfields .= 
' , usr_data.passwd_enc_type, usr_data.passwd_salt ';
 
  770                $q = 
"SELECT usr_data.usr_id, usr_data.passwd $add_usrfields " .
 
  772                        "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id " .
 
  773                        "WHERE rbac_ua.rol_id = " . $this->client->db->quote((
int)$system_role_id, 
'integer') . 
" " .
 
  774                        "AND usr_data.login=" . $this->client->db->quote($a_auth_data[
"username"], 
'text');
 
  775                $r = $this->client->db->query($q);
 
  776                if(!$this->client->db->numRows(
$r))
 
  778                        $this->
error = 
'login_invalid';
 
  782                $data = $this->client->db->fetchAssoc(
$r);
 
  784                global $ilClientIniFile;
 
  786                $ilClientIniFile = $this->client->ini;
 
  788                require_once 
'Services/User/classes/class.ilUserPasswordManager.php';
 
  792                        require_once 
'setup/classes/class.ilObjSetupUser.php';
 
  795                        $user->setPasswordEncodingType(
$data[
'passwd_enc_type']);
 
  796                        $user->setPasswordSalt(
$data[
'passwd_salt']);
 
  802                        $password_valid =  
$data[
'passwd'] == md5($a_auth_data[
'password']);
 
  809                        $_SESSION[
'auth_path']   = ILIAS_HTTP_PATH;
 
  811                        $_SESSION[
'ClientId']    = $this->client->getId();
 
  816                        $this->
error = 
'login_invalid';
 
  828                $a_password = md5($a_password);
 
  830                if ($this->ini->readVariable(
"setup",
"pass") == $a_password)
 
  833                        $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
 
  853                $this->client = 
new ilClient($a_client_id, $this->db_connections);
 
  855                if (!$this->client->init())
 
  858                        $this->
error = get_class($this).
": ".$this->client->getError();
 
  877                        if ($this->ini_client_exists)
 
  890                if ($status[
"db"][
"status"] === 
false and $status[
"db"][
"update"] !== 
true)
 
  894                        $status[
"lang"][
"status"] = 
false;
 
  895                        $status[
"lang"][
"comment"] = $status[
"db"][
"comment"];
 
  896                        $status[
"contact"][
"status"] = 
false;
 
  897                        $status[
"contact"][
"comment"] = $status[
"db"][
"comment"];
 
  899                        $status[
"proxy"][
"status"] = 
false;
 
  900                        $status[
"proxy"][
"comment"] = $status[
"db"][
"comment"];
 
  902                        $status[
"nic"][
"status"] = 
false;
 
  903                        $status[
"nic"][
"comment"] = $status[
"db"][
"comment"];
 
  927                if (
$client->getSetting(
"setup_ok"))
 
  929                        $arr[
"status"] = 
true;
 
  934                        $arr[
"status"] = 
false;
 
  935                        $arr[
"comment"] = $this->lng->txt(
"setup_not_finished");
 
  948                if (
$client->ini->readVariable(
"client",
"access") == 
"1")
 
  950                        $arr[
"status"] = 
true;
 
  951                        $arr[
"comment"] = $this->lng->txt(
"online");
 
  955                        $arr[
"status"] = 
false;
 
  956                        $arr[
"comment"] = $this->lng->txt(
"disabled");
 
  969                if (!$arr[
"status"] = 
$client->init())
 
  971                        $arr[
"comment"] = 
$client->getError();
 
  988                if (!$arr[
"status"] = 
$client->db_exists)
 
  990                        $arr[
"comment"] = $this->lng->txt(
"no_database");
 
  994                if (!$arr[
"status"] = 
$client->db_installed)
 
  996                        $arr[
"comment"] = $this->lng->txt(
"db_not_installed");
 
 1004                include_once 
"./Services/Database/classes/class.ilDBUpdate.php";
 
 1006                $this->lng->setDbHandler(
$client->db);
 
 1009                if (!$arr[
"status"] = $dbupdate->getDBVersionStatus())
 
 1011                        $arr[
"comment"] = $this->lng->txt(
"db_needs_update");
 
 1012                        $arr[
"update"] = 
true;
 
 1015                else if ($dbupdate->hotfixAvailable())
 
 1017                        $arr[
"status"] = 
false;
 
 1018                        $arr[
"comment"] = $this->lng->txt(
"hotfix_available");
 
 1019                        $arr[
"update"] = 
true;
 
 1022                else if ($dbupdate->customUpdatesAvailable())
 
 1024                        $arr[
"status"] = 
false;
 
 1025                        $arr[
"comment"] = $this->lng->txt(
"custom_updates_available");
 
 1026                        $arr[
"update"] = 
true;
 
 1032                $cset = 
$ilDB->query(
"SELECT count(*) as cnt FROM ctrl_calls");
 
 1033                $crec = 
$ilDB->fetchAssoc($cset);
 
 1034                if ($crec[
"cnt"] == 0)
 
 1036                        $arr[
"status"] = 
false;
 
 1037                        $arr[
"comment"] = $this->lng->txt(
"db_control_structure_missing");
 
 1038                        $arr[
"update"] = 
true;
 
 1053                require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
 
 1060                $query = 
"SELECT keyword, value FROM settings WHERE ".$db->in(
'keyword', $fields, 
false, 
'text');
 
 1066                        if( 
$row[
'value'] != 
'' )
 
 1071                if (count($rows) != count($fields))
 
 1073                        if($a_as_bool) 
return false;
 
 1074                        $arr[
"status"] = 
false;
 
 1075                        $arr[
"comment"] = $this->lng->txt(
"session_management_not_configured");
 
 1079                        if($a_as_bool) 
return true;
 
 1080                        $arr[
"status"] = 
true;
 
 1081                        $arr[
"comment"] = $this->lng->txt(
"session_management_configured");
 
 1096                $fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
 
 1098                $query = 
"SELECT keyword, value FROM settings WHERE ".$db->in(
'keyword', $fields, 
false, 
'text');
 
 1101                $proxy_settings = array();
 
 1102                $already_saved = 
false;
 
 1105                        $already_saved = 
true;
 
 1106                        $proxy_settings[
$row[
'keyword']] = 
$row[
'value'];
 
 1111                        $arr[
"status"] = 
false;
 
 1112                        $arr[
"comment"] = $this->lng->txt(
"proxy");
 
 1113                        $arr[
"text"] = $this->lng->txt(
"proxy");
 
 1115                else if((
bool)$proxy_settings[
"proxy_status"] == 
false)
 
 1117                        $arr[
"status"] = 
true;
 
 1118                        $arr[
"comment"] = $this->lng->txt(
"proxy_disabled");
 
 1119                        $arr[
"text"] = $this->lng->txt(
"proxy_disabled");
 
 1123                        $arr[
"status"] = 
true;
 
 1124                        $arr[
"comment"] = $this->lng->txt(
"proxy_activated_configurated");
 
 1125                        $arr[
"text"] = $this->lng->txt(
"proxy_activated_configurated");
 
 1138                $installed_langs = $this->lng->getInstalledLanguages();
 
 1140                $count = count($installed_langs);
 
 1144                        $arr[
"status"] = 
false;
 
 1145                        $arr[
"comment"] = $this->lng->txt(
"lang_none_installed");
 
 1149                        $arr[
"status"] = 
true;
 
 1163                $arr[
"status"] = 
true;
 
 1166                $settings = 
$client->getAllSettings();
 
 1167                $client_name = 
$client->getName();
 
 1170                if (empty($settings[
"admin_firstname"]) or empty($settings[
"admin_lastname"]) or
 
 1171                        empty($settings[
"admin_email"]) or empty($client_name))
 
 1173                        $arr[
"status"] = 
false;
 
 1174                        $arr[
"comment"] = $this->lng->txt(
"missing_data");
 
 1178                if (!
ilUtil::is_email($settings[
"admin_email"]) and $arr[
"status"] != 
false)
 
 1180                        $arr[
"status"] = 
false;
 
 1181                        $arr[
"comment"] = $this->lng->txt(
"email_not_valid");
 
 1194                $settings = 
$client->getAllSettings();
 
 1196                if (!isset($settings[
"nic_enabled"]))
 
 1198                        $arr[
"status"] = 
false;
 
 1199                        $arr[
"comment"] = $this->lng->txt(
"nic_not_disabled");
 
 1203                $arr[
"status"] = 
true;
 
 1205                if ($settings[
"nic_enabled"] == 
"-1")
 
 1207                        $arr[
"comment"] = $this->lng->txt(
"nic_reg_failed");
 
 1211                if (!$settings[
"nic_enabled"])
 
 1213                        $arr[
"comment"] = $this->lng->txt(
"nic_reg_disabled");
 
 1217                        $arr[
"comment"] = $this->lng->txt(
"nic_reg_enabled");
 
 1218                        if ($settings[
"inst_id"] <= 0)
 
 1220                                $arr[
"status"] = 
false;
 
 1251                return ($this->access_mode == 
"admin") ? true : 
false;
 
 1263                if ($a_formdata[
"chk_datadir_path"] == 1)       
 
 1267                                $this->
error = 
"create_datadir_failed";
 
 1277                                $this->
error = 
"create_webdir_failed";
 
 1283                $log_path = substr($form_log_path,0,strrpos($form_log_path,
"/"));
 
 1284                $log_file = substr($form_log_path,strlen($log_path)+1);
 
 1286                $this->ini->setVariable(
"server",
"http_path",ILIAS_HTTP_PATH);
 
 1288                $this->ini->setVariable(
"server",
"timezone",preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
 
 1289                $this->ini->setVariable(
"clients", 
"datadir", $datadir_path);
 
 1290                $this->ini->setVariable(
"tools", 
"convert", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"convert_path"])));
 
 1291                $this->ini->setVariable(
"tools", 
"zip", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"zip_path"])));
 
 1292                $this->ini->setVariable(
"tools", 
"unzip", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"unzip_path"])));
 
 1293                $this->ini->setVariable(
"tools", 
"ghostscript", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"])));
 
 1294                $this->ini->setVariable(
"tools", 
"java", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"java_path"])));
 
 1295                $this->ini->setVariable(
"tools", 
"htmldoc", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"htmldoc_path"])));
 
 1297                $this->ini->setVariable(
"tools", 
"ffmpeg", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ffmpeg_path"])));
 
 1299                $this->ini->setVariable(
"tools", 
"vscantype", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"vscanner_type"])));
 
 1300                $this->ini->setVariable(
"tools", 
"scancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"scan_command"])));
 
 1301                $this->ini->setVariable(
"tools", 
"cleancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"])));
 
 1302                $this->ini->setVariable(
"setup", 
"pass", md5($a_formdata[
"setup_pass"]));
 
 1303                $this->ini->setVariable(
"log", 
"path", $log_path);
 
 1304                $this->ini->setVariable(
"log", 
"file", $log_file);
 
 1305                $this->ini->setVariable(
"log", 
"enabled", ($a_formdata[
"chk_log_status"]) ? 
"0" : 1);
 
 1307                $this->ini->setVariable(
"https",
"auto_https_detect_enabled", ($a_formdata[
"auto_https_detect_enabled"]) ? 1 : 0);
 
 1308                $this->ini->setVariable(
"https",
"auto_https_detect_header_name", $a_formdata[
"auto_https_detect_header_name"]);
 
 1309                $this->ini->setVariable(
"https",
"auto_https_detect_header_value", $a_formdata[
"auto_https_detect_header_value"]);
 
 1311                if (!$this->ini->write())
 
 1313                        $this->
error = get_class($this).
": ".$this->ini->getError();
 
 1319                $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
 
 1335                $ghostscript_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
 
 1344                $clean_command = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"]));
 
 1346                $this->ini->setVariable(
"tools", 
"convert", $convert_path);
 
 1347                $this->ini->setVariable(
"tools", 
"zip", $zip_path);
 
 1348                $this->ini->setVariable(
"tools", 
"unzip", $unzip_path);
 
 1349                $this->ini->setVariable(
"tools", 
"ghostscript", $ghostscript_path);
 
 1350                $this->ini->setVariable(
"tools", 
"java", $java_path);
 
 1351                $this->ini->setVariable(
"tools", 
"htmldoc", $htmldoc_path);
 
 1353                $this->ini->setVariable(
"tools", 
"ffmpeg", $ffmpeg_path);
 
 1354                $this->ini->setVariable(
"tools", 
"latex", $latex_url);
 
 1355                $this->ini->setVariable(
"tools", 
"fop", $fop_path);
 
 1356                $this->ini->setVariable(
"tools", 
"vscantype", $scan_type);
 
 1357                $this->ini->setVariable(
"tools", 
"scancommand", $scan_command);
 
 1358                $this->ini->setVariable(
"tools", 
"cleancommand", $clean_command);
 
 1361                $log_path = substr($form_log_path,0,strrpos($form_log_path,
"/"));
 
 1362                $log_file = substr($form_log_path,strlen($log_path)+1);
 
 1364                $this->ini->setVariable(
"log", 
"path", $log_path);
 
 1365                $this->ini->setVariable(
"log", 
"file", $log_file);
 
 1366                $this->ini->setVariable(
"log", 
"enabled", ($a_formdata[
"chk_log_status"]) ? 
"0" : 1);
 
 1367                $this->ini->setVariable(
"server",
"timezone",preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
 
 1369                $this->ini->setVariable(
"https",
"auto_https_detect_enabled",($a_formdata[
"auto_https_detect_enabled"]) ? 1 : 0);
 
 1370                $this->ini->setVariable(
"https",
"auto_https_detect_header_name", $a_formdata[
"auto_https_detect_header_name"]);
 
 1371                $this->ini->setVariable(
"https",
"auto_https_detect_header_value", $a_formdata[
"auto_https_detect_header_value"]);
 
 1373                if (!$this->ini->write())
 
 1375                        $this->
error = get_class($this).
": ".$this->ini->getError();
 
 1390                if (!isset($a_formdata[
"chk_convert_path"]))
 
 1395                        if (($err = $this->
testConvert($convert_path)) != 
"")
 
 1397                                $this->
error = $err;
 
 1403                if (!isset($a_formdata[
"chk_zip_path"]))
 
 1408                        if (empty($zip_path))
 
 1410                                $this->
error = 
"no_path_zip";
 
 1414                        if (!$this->
testZip($zip_path))
 
 1416                                $this->
error = 
"check_failed_zip";
 
 1422                if (!isset($a_formdata[
"chk_unzip_path"]))
 
 1427                        if (empty($unzip_path))
 
 1429                                $this->
error = 
"no_path_unzip";
 
 1435                                $this->
error = 
"check_failed_unzip";
 
 1441                if (!isset($a_formdata[
"chk_ghostscript_path"]))
 
 1444                        $ghostscript_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
 
 1448                                $this->
error = $err;
 
 1454                if (!isset($a_formdata[
"chk_java_path"]))
 
 1459                        if (empty($java_path))
 
 1461                                $this->
error = 
"no_path_java";
 
 1467                                $this->
error = 
"check_failed_java";
 
 1473                if (!isset($a_formdata[
"chk_htmldoc_path"]))
 
 1478                        if (empty($htmldoc_path))
 
 1480                                $this->
error = 
"no_path_htmldoc";
 
 1486                                $this->
error = 
"check_failed_htmldoc";
 
 1508                if (!isset($a_formdata[
"chk_ffmpeg_path"]))
 
 1513                        if (empty($ffmpeg_path))
 
 1515                                $this->
error = 
"no_path_ffmpeg";
 
 1519                        if (!$this->testFFMpeg($ffmpeg_path))
 
 1521                                $this->
error = 
"check_failed_ffmpeg";
 
 1527                if (!isset($a_formdata[
"chk_latex_url"]))
 
 1530                        if (empty($latex_url))
 
 1532                                $this->
error = 
"no_latex_url";
 
 1538                                $this->
error = 
"check_failed_latex";
 
 1556                if (empty($datadir_path))
 
 1558                        $this->
error = 
"no_path_datadir";
 
 1565                if (strpos($datadir_path,$webspace_dir) !== 
false)
 
 1567                        $this->
error = 
"datadir_webspacedir_match";
 
 1572                if ($a_formdata[
"chk_datadir_path"] == 1)
 
 1574                        $dir_to_create = substr(strrchr($datadir_path, 
"/"), 1);
 
 1575                        $dir_to_check = substr($datadir_path,0,- strlen($dir_to_create)-1);
 
 1578                                $this->
error = 
"cannot_create_datadir_inside_webdir";
 
 1582                        if (is_writable($datadir_path))
 
 1584                                $this->
error = 
"dir_exists_create";
 
 1588                        if (!is_writable($dir_to_check))
 
 1590                                $this->
error = 
"cannot_create_datadir_no_write_access";
 
 1597                                $this->
error = 
"cannot_create_datadir_inside_webdir";
 
 1601                        if (!is_writable($datadir_path))
 
 1603                                $this->
error = 
"cannot_create_datadir_no_write_access";
 
 1618                if (!$a_formdata[
"setup_pass"])
 
 1620                        $this->
error = 
"no_setup_pass_given";
 
 1624                if ($a_formdata[
"setup_pass"] != $a_formdata[
"setup_pass2"])
 
 1626                        $this->
error = 
"pass_does_not_match";
 
 1641                if (!$a_formdata[
"chk_log_status"])
 
 1646                        if (empty($log_path))
 
 1648                                $this->
error = 
"no_path_log";
 
 1653                                $this->
error = 
"cannot_create_logdir_inside_webdir";
 
 1657                        if (!@touch($log_path))
 
 1659                                $this->
error = 
"could_not_create_logfile";
 
 1673                if (empty($this->
error))
 
 1706                if (trim($a_convert_path) == 
"")
 
 1708                        return "no_path_convert";
 
 1710                if (!is_file($a_convert_path))
 
 1712                        return "check_failed_convert";
 
 1728                if (trim($a_ghostscript_path) == 
"")
 
 1732                if (!is_file($a_ghostscript_path))
 
 1734                        return "check_failed_ghostscript";
 
 1749                if (trim($a_java_path) == 
"")
 
 1754                if (!is_file($a_java_path))
 
 1756                        return "check_failed_java";
 
 1778                if (trim($a_latex_url) == 
"")
 
 1784                include_once 
"./setup/classes/class.ilHttpRequest.php";
 
 1786                $result = @$http->downloadToString();
 
 1787                if ((strpos((substr(
$result, 0, 5)), 
"PNG") !== FALSE) || (strpos((substr(
$result, 0, 5)), 
"GIF") !== FALSE))
 
 1793                        return "check_failed_latex";;
 
 1805                if (trim($a_zip_path) == 
"")
 
 1807                        return "no_path_zip";
 
 1809                if (!is_file($a_zip_path))
 
 1811                        return "check_failed_zip";
 
 1858                if (trim($a_unzip_path) == 
"")
 
 1860                        return "no_path_unzip";
 
 1862                if (!is_file($a_unzip_path))
 
 1864                        return "check_failed_unzip";
 
 1904                if (trim($a_htmldoc_path) == 
"")
 
 1909                if (!is_file($a_htmldoc_path))
 
 1911                        return "check_failed_htmldoc";
 
 1921                $html = 
"<html><head><title></title></head><body><p>test</p></body></html>";
 
 1923                $html_file = 
"htmldoc_test_file.html";
 
 1925        $fp = fopen( $html_file ,
"wb");
 
 1929        $htmldoc = $a_htmldoc_path.
" ";
 
 1930        $htmldoc .= 
"--no-toc ";
 
 1931        $htmldoc .= 
"--no-jpeg ";
 
 1932        $htmldoc .= 
"--webpage ";
 
 1933        $htmldoc .= 
"--outfile htmldoc_test_file.pdf ";
 
 1934        $htmldoc .= 
"--bodyfont Arial ";
 
 1935        $htmldoc .= 
"--charset iso-8859-15 ";
 
 1936        $htmldoc .= 
"--color ";
 
 1937        $htmldoc .= 
"--size A4  ";      
 
 1938        $htmldoc .= 
"--format pdf ";
 
 1939        $htmldoc .= 
"--footer ... ";
 
 1940        $htmldoc .= 
"--header ... ";
 
 1941        $htmldoc .= 
"--left 60 ";
 
 1943        $htmldoc .= $html_file;
 
 1968        function unzip($a_file, $overwrite = 
false)
 
 1972                $pathinfo = pathinfo($a_file);
 
 1973                $dir = $pathinfo[
"dirname"];
 
 1974                $file = $pathinfo[
"basename"];
 
 1979                $unzip = $this->ini->readVariable(
"tools",
"unzip");
 
 1981                exec($unzipcmd, $arr);
 
 1984                foreach($arr as $line)
 
 1986                        if(is_int(strpos($line, 
"/")))
 
 1988                                $zdir = substr($line, 0, strrpos($line, 
"/"));
 
 1989                                $nr = substr_count($zdir, 
"/");
 
 1993                                        $nr = substr_count($zdir, 
"/");
 
 1994                                        $zdirs[$zdir] = $nr;                            
 
 1996                                        $zdir = substr($zdir, 0, strrpos($zdir, 
"/"));
 
 2003                foreach($zdirs as $zdir => $nr)                         
 
 2029                require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
 
 2031                $db = $this->client->getDB();
 
 2036                foreach($setting_fields as $field)
 
 2038                        if( isset($session_settings[$field]) )
 
 2040                                $query = 
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
 
 2042                                                array(
'text', 
'text'), array(
'common', $field));
 
 2047                                if( count(
$row) > 0 )
 
 2052                                                        'value' => array(
'text', $session_settings[$field])
 
 2055                                                        'module' => array(
'text', 
'common'),
 
 2056                                                        'keyword' => array(
'text', $field)
 
 2065                                                        'module' => array(
'text', 
'common'),
 
 2066                                                        'keyword' => array(
'text', $field),
 
 2067                                                        'value' => array(
'text', $session_settings[$field])
 
 2076                if($i < 4) $message = $this->lng->txt(
"session_settings_not_saved");
 
 2077                else $message = $this->lng->txt(
"settings_saved");
 
 2089                require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
 
 2091                $db = $this->client->getDB();
 
 2095                $query = 
"SELECT * FROM settings WHERE module = %s " .
 
 2096                                "AND ".$db->in(
'keyword', $setting_fields, 
false, 
'text');
 
 2100                $session_settings = array();
 
 2103                        $session_settings[
$row[
'keyword']] = 
$row[
'value'];
 
 2106                foreach( $setting_fields as $field )
 
 2108                        if( !isset($session_settings[$field]) )
 
 2114                                        case 'session_max_count':
 
 2119                                        case 'session_min_idle':
 
 2124                                        case 'session_max_idle':
 
 2129                                        case 'session_max_idle_after_first_request':
 
 2134                                        case 'session_allow_client_maintenance':
 
 2140                                $session_settings[$field] = $value;
 
 2144                return $session_settings;
 
 2155                $source = 
new ilClient($source_id, $this->db_connections);
 
 2164                        $this->
error = 
"Could not delete data dir $target->getDataDir()";
 
 2171                        $this->
error = 
"could_not_create_base_data_dir :".$target->getDataDir();
 
 2176                if (! 
ilUtil::rCopy($source->getDataDir(),$target->getDataDir())) {
 
 2177                        $this->
error = 
"clone_datadircopyfail";
 
 2178                        $target->ini->write();
 
 2184                        $this->
error = 
"Could not delete webspace dir $target->getWebspaceDir()";
 
 2191                        $this->
error = 
"could_not_create_base_webspace_dir :".$target->getWebspaceDir();
 
 2196                if (! 
ilUtil::rCopy($source->getWebspaceDir(),$target->getWebspaceDir())) {
 
 2197                        $this->
error = 
"clone_websipacedircopyfail";
 
 2198                        $target->ini->write();
 
 2203                $target->ini->write();
 
 2211            $this->
error = 
"Source database connection failed.";
 
 2218            $this->
error = 
"Target database connection failed.";
 
 2223                $srcTables = $source->db->query(
"SHOW TABLES");
 
 2227                $tarTables = $target->db->query(
"SHOW TABLES");
 
 2228                foreach($tarTables->fetchAll() as $cTable)
 
 2230                        $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
 
 2233                foreach($srcTables->fetchAll() as $cTable){
 
 2234                        $drop   = $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
 
 2235                        $create = $target->db->query(
"CREATE TABLE " . $cTable[0] . 
" LIKE " . $source->getDbName() . 
"." . $cTable[0]);
 
 2239            $insert = $target->db->query(
"INSERT INTO " . $cTable[0] . 
" SELECT * FROM ".$source->getDbName().
".".$cTable[0]);
 
 2242                $target->db->query(
"UPDATE settings SET VALUE = ".$target->db->quote(0, 
"integer").
" WHERE keyword = ".$target->db->quote(
"inst_id", 
"text"));
 
 2243                $target->db->query(
"UPDATE settings SET VALUE = ".$target->db->quote(0, 
"integer").
" WHERE keyword = ".$target->db->quote(
"nic_enabled", 
"text"));
 
 2255                require_once 
'./Services/Http/exceptions/class.ilProxyException.php';
 
 2256                $settings = 
$client->getAllSettings();
 
 2258                if((
bool)$settings[
'proxy_status'] == 
true)
 
 2267                                require_once 
'Services/PEAR/lib/Net/Socket.php';
 
 2271                                $response = $socket->connect($settings[
'proxy_host'], $settings[
'proxy_port']);
 
 2272                                if(!is_bool($response))
 
 2275                                        throw new ilProxyException(strlen($response) ? $response : 
$lng->txt(
'proxy_not_connectable'));
 
 2283                                ilUtil::sendFailure($this->lng->txt(
'proxy_pear_net_socket_error').
': '.$e->getMessage());
 
 2291                $db = $this->client->getDB();
 
 2292                $proxy_fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
 
 2294                foreach($proxy_fields as $field)
 
 2296                        if( isset($proxy_settings[$field]) )
 
 2298                                $query = 
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
 
 2300                                        array(
'text', 
'text'), array(
'common', $field));
 
 2305                                if( count(
$row) > 0 )
 
 2310                                                        'value' => array(
'text', $proxy_settings[$field])
 
 2313                                                        'module' => array(
'text', 
'common'),
 
 2314                                                        'keyword' => array(
'text', $field)
 
 2323                                                        'module' => array(
'text', 
'common'),
 
 2324                                                        'keyword' => array(
'text', $field),
 
 2325                                                        'value' => array(
'text', $proxy_settings[$field])
 
 2337                $ini_get = ini_get(
'opcache.enable');
 
 2339                return ($ini_get === 1 OR $ini_get === 
'1' OR strtolower($ini_get) === 
'on');
 
 2350                $other_directory = $other_directory.
"/";
 
 2352                return !(strpos($directory, $other_directory) !== 0);
 
 2361                return parent::getFileName();
 
 2366                if(!parent::valid())
 
 2370                if($this->isFile() and substr(parent::getFileName(),-4) == 
'.xml')
 
 2374                if($this->isFile() and substr(parent::getFileName(),-8) != 
'_inserts')
 
 2379                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.
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
isDirectoryInOther($directory, $other_directory)
Checks if directory is subdirectory of other directory.
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