4include_once(
"./setup/classes/class.ilDBConnections.php");
 
   79        define(
"ILIAS_MODULE", 
"setup");
 
   81        $this->auth = ($this->
checkAuth()) ? 
true : 
false;
 
   82        $this->access_mode = $a_auth_type;
 
   85        if ($this->safe_mode = ini_get(
"safe_mode")) {
 
   90        $this->ini_file_path = ILIAS_ABSOLUTE_PATH . 
"/ilias.ini.php";
 
   91        $this->setup_defaults = ILIAS_ABSOLUTE_PATH . 
"/setup/ilias.master.ini.php";
 
   94        $this->ini_ilias_exists = $this->
init();
 
  129        $this->client = $a_cl;
 
  149        $this->ini = 
new ilIniFile($this->ini_file_path);
 
  151        if (!$this->ini->read()) {
 
  152            $this->ini->GROUPS = parse_ini_file($this->setup_defaults, 
true);
 
  153            $this->
error = get_class($this) . 
": " . $this->ini->getError();
 
  157        $this->setup_password = $this->ini->readVariable(
"setup", 
"pass");
 
  158        $this->default_client = $this->ini->readVariable(
"clients", 
"default");
 
  160        define(
"ILIAS_DATA_DIR", $this->ini->readVariable(
"clients", 
"datadir"));
 
  161        define(
"ILIAS_WEB_DIR", $this->ini->readVariable(
"clients", 
"path"));
 
  173        $_SESSION[
"ClientId"] = $this->client->getId();
 
  176        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()) {
 
  200            ilUtil::delDir(ILIAS_ABSOLUTE_PATH . 
"/" . ILIAS_WEB_DIR . 
"/" . $a_old_client_id);
 
  205        $this->ini_client_exists = 
true;
 
  216        if ($this->client->getDBSetup()->isDatabaseInstalled()) {
 
  217            $this->
error = $this->lng->txt(
"database_exists");
 
  222        $db_setup = $this->client->getDBSetup();
 
  223        return $db_setup->createDatabase($a_collation);
 
  233        if (!$this->client->getDBSetup()->isDatabaseConnectable()) {
 
  237        if ($this->client->getDBSetup()->installDatabase()) {
 
  238            $this->client->db_installed = 
true;
 
  253        $a = @file_exists($this->INI_FILE);
 
  265        if (is_writable(
".")) {
 
  266            $arr[
"status"] = 
true;
 
  269            $arr[
"comment"] = getcwd();
 
  272            $arr[
"status"] = 
false;
 
  273            $arr[
"comment"] = $this->lng->txt(
"pre_folder_write_error");
 
  276            $arr[
"comment"] = getcwd() . 
": " . $arr[
"comment"];
 
  291        if (@mkdir($a_dir . 
"/crst879dldsk9d", 0774)) {
 
  292            $arr[
"status"] = 
true;
 
  293            $arr[
"comment"] = 
"";
 
  295            @rmdir($a_dir . 
"/crst879dldsk9d");
 
  297            $arr[
"status"] = 
false;
 
  300            $arr[
"comment"] = getcwd() . 
": " . $this->lng->txt(
"pre_folder_create_error");
 
  315        if (
$sess->usesCookies) {
 
  316            $arr[
"status"] = 
true;
 
  317            $arr[
"comment"] = 
"";
 
  319            $arr[
"status"] = 
false;
 
  320            $arr[
"comment"] = $this->lng->txt(
"pre_cookies_disabled");
 
  334        $arr[
"status"] = 
true;
 
  335        $arr[
"comment"] = 
"PHP " . 
$version;
 
  336        if (version_compare(
$version, 
'5.3.0', 
'<')) {
 
  337            $arr[
"status"] = 
false;
 
  338            $arr[
"comment"] = 
"PHP " . 
$version . 
". " . $this->lng->txt(
"pre_php_version_too_low");
 
  352        if (function_exists(
"mysql_query")) {
 
  353            $arr[
"status"] = 
true;
 
  354            $arr[
"comment"] = $this->lng->txt(
"pre_mysql_4_1_or_higher");
 
  356            $arr[
"status"] = 
false;
 
  357            $arr[
"comment"] = $this->lng->txt(
"pre_mysql_missing");
 
  385        if (class_exists(
"DOMDocument")) {
 
  386            $arr[
"status"] = 
true;
 
  388            $arr[
"status"] = 
false;
 
  389            $arr[
"comment"] = $this->lng->txt(
"pre_dom_missing");
 
  403        if (class_exists(
"XSLTProcessor")) {
 
  404            $arr[
"status"] = 
true;
 
  406            $arr[
"status"] = 
false;
 
  408                $this->lng->txt(
"pre_xsl_missing"),
 
  409                "http://php.net/manual/en/book.xsl.php" 
  424        if (function_exists(
"imagefill") && function_exists(
"imagecolorallocate")) {
 
  425            $arr[
"status"] = 
true;
 
  427            $arr[
"status"] = 
false;
 
  429                $this->lng->txt(
"pre_gd_missing"),
 
  430                "http://php.net/manual/en/book.image.php" 
  445        $limit = ini_get(
"memory_limit");
 
  448        if (is_int(strpos($limit, 
"M"))) {
 
  449            $limit_n = (int) $limit;
 
  456            $arr[
"status"] = 
true;
 
  457            $arr[
"comment"] = $limit . 
". " . $this->lng->txt(
"pre_memory_limit_recommend");
 
  459            $arr[
"status"] = 
false;
 
  460            $arr[
"comment"] = $limit . 
". " . $this->lng->txt(
"pre_memory_limit_too_low");
 
  474        if (version_compare(PHP_VERSION, 
'7.0.0', 
'>=')) {
 
  475            $arr[
"status"] = 
true;
 
  481        $load_comments = ini_get(
"opcache.load_comments");
 
  482        if ($load_comments == 1) {
 
  483            $arr[
"status"] = 
true;
 
  485            $arr[
"status"] = 
false;
 
  486            $arr[
"comment"] = $this->lng->txt(
"pre_opcache_comments");
 
  527        foreach ($this->preliminaries_result as $val) {
 
  528            if ($val[
"status"] === 
false) {
 
  529                $this->preliminaries = 
false;
 
  543        return $this->ini->readVariable(
"setup", 
"pass");
 
  553        $this->ini->setVariable(
"setup", 
"pass", md5($a_password));
 
  555        if ($this->ini->write() == 
false) {
 
  556            $this->
error = $this->ini->getError();
 
  572        if (empty($a_auth_data[
"client_id"])) {
 
  573            $this->
error = 
"no_client_id";
 
  577        if (empty($a_auth_data[
"username"])) {
 
  578            $this->
error = 
"no_username";
 
  582        if (empty($a_auth_data[
"password"])) {
 
  583            $this->
error = 
"no_password";
 
  587        if (!$this->
newClient($a_auth_data[
"client_id"])) { 
 
  588            $this->
error = 
"unknown_client_id";
 
  589            unset($this->client);
 
  593        if (!$this->client->db_exists) {
 
  594            $this->
error = 
"no_db_connect_consult_admin";
 
  595            unset($this->client);
 
  599        $s1 = $this->client->db->query(
"SELECT value from settings WHERE keyword = " .
 
  600            $this->client->db->quote(
'system_role_id', 
'text'));
 
  601        $r1 = $this->client->db->fetchAssoc($s1);
 
  602        $system_role_id = $r1[
"value"];
 
  605        if ($this->client->db->tableColumnExists(
'usr_data', 
'passwd_enc_type')) {
 
  606            $add_usrfields .= 
' , usr_data.passwd_enc_type, usr_data.passwd_salt ';
 
  608        $q = 
"SELECT usr_data.usr_id, usr_data.passwd $add_usrfields " .
 
  610            "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id " .
 
  611            "WHERE rbac_ua.rol_id = " . $this->client->db->quote((
int) $system_role_id, 
'integer') . 
" " .
 
  612            "AND usr_data.login=" . $this->client->db->quote($a_auth_data[
"username"], 
'text');
 
  613        $r = $this->client->db->query($q);
 
  614        if (!$this->client->db->numRows(
$r)) {
 
  615            $this->
error = 
'login_invalid';
 
  619        $data = $this->client->db->fetchAssoc(
$r);
 
  621        global $ilClientIniFile;
 
  623        $ilClientIniFile = $this->client->ini;
 
  625        require_once 
'Services/User/classes/class.ilUserPasswordManager.php';
 
  628            require_once 
'setup/classes/class.ilObjSetupUser.php';
 
  631            $user->setPasswordEncodingType(
$data[
'passwd_enc_type']);
 
  632            $user->setPasswordSalt(
$data[
'passwd_salt']);
 
  636            $password_valid =  
$data[
'passwd'] == md5($a_auth_data[
'password']);
 
  639        if ($password_valid) {
 
  642            $_SESSION[
'auth_path']   = ILIAS_HTTP_PATH;
 
  644            $_SESSION[
'ClientId']    = $this->client->getId();
 
  647            $this->
error = 
'login_invalid';
 
  659        $a_password = md5($a_password);
 
  661        if ($this->ini->readVariable(
"setup", 
"pass") == $a_password) {
 
  663            $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
 
  682        $this->client = 
new ilClient($a_client_id, $this->db_connections);
 
  684        if (!$this->client->init()) {
 
  686            $this->
error = get_class($this) . 
": " . $this->client->getError();
 
  704            if ($this->ini_client_exists) {
 
  714        if ($status[
"db"][
"status"] === 
false and $status[
"db"][
"update"] !== 
true) {
 
  717            $status[
"lang"][
"status"] = 
false;
 
  718            $status[
"lang"][
"comment"] = $status[
"db"][
"comment"];
 
  719            $status[
"contact"][
"status"] = 
false;
 
  720            $status[
"contact"][
"comment"] = $status[
"db"][
"comment"];
 
  722            $status[
"proxy"][
"status"] = 
false;
 
  723            $status[
"proxy"][
"comment"] = $status[
"db"][
"comment"];
 
  725            $status[
"nic"][
"status"] = 
false;
 
  726            $status[
"nic"][
"comment"] = $status[
"db"][
"comment"];
 
  748        if (
$client->getSetting(
"setup_ok")) {
 
  749            $arr[
"status"] = 
true;
 
  752            $arr[
"status"] = 
false;
 
  753            $arr[
"comment"] = $this->lng->txt(
"setup_not_finished");
 
  766        if (
$client->ini->readVariable(
"client", 
"access") == 
"1") {
 
  767            $arr[
"status"] = 
true;
 
  768            $arr[
"comment"] = $this->lng->txt(
"online");
 
  770            $arr[
"status"] = 
false;
 
  771            $arr[
"comment"] = $this->lng->txt(
"disabled");
 
  784        if (!$arr[
"status"] = 
$client->init()) {
 
  785            $arr[
"comment"] = 
$client->getError();
 
  802        if (!$arr[
"status"] = 
$client->db_exists) {
 
  803            $arr[
"comment"] = $this->lng->txt(
"no_database");
 
  808        if (!$arr[
"status"] = 
$client->db_installed) {
 
  809            $arr[
"comment"] = $this->lng->txt(
"db_not_installed");
 
  816        include_once 
"./Services/Database/classes/class.ilDBUpdate.php";
 
  817        $this->lng->setDbHandler(
$client->db);
 
  820        if (!$arr[
"status"] = $dbupdate->getDBVersionStatus()) {
 
  821            $arr[
"comment"] = $this->lng->txt(
"db_needs_update");
 
  822            $arr[
"update"] = 
true;
 
  826            if ($dbupdate->hotfixAvailable()) {
 
  827                $arr[
"status"] = 
false;
 
  828                $arr[
"comment"] = $this->lng->txt(
"hotfix_available");
 
  829                $arr[
"update"] = 
true;
 
  833                if ($dbupdate->customUpdatesAvailable()) {
 
  834                    $arr[
"status"] = 
false;
 
  835                    $arr[
"comment"] = $this->lng->txt(
"custom_updates_available");
 
  836                    $arr[
"update"] = 
true;
 
  845        $cset = 
$ilDB->query(
"SELECT count(*) as cnt FROM ctrl_calls");
 
  846        $crec = 
$ilDB->fetchAssoc($cset);
 
  848        if ($crec[
"cnt"] == 0) {
 
  849            $arr[
"status"] = 
false;
 
  850            $arr[
"comment"] = $this->lng->txt(
"db_control_structure_missing");
 
  851            $arr[
"update"] = 
true;
 
  866        require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
 
  873        $query = 
"SELECT keyword, value FROM settings WHERE " . 
$db->in(
'keyword', $fields, 
false, 
'text');
 
  878            if (
$row[
'value'] != 
'') {
 
  885        if (count(
$rows) != count($fields)) {
 
  889            $arr[
"status"] = 
false;
 
  890            $arr[
"comment"] = $this->lng->txt(
"session_management_not_configured");
 
  895            $arr[
"status"] = 
true;
 
  896            $arr[
"comment"] = $this->lng->txt(
"session_management_configured");
 
  912        $fields = array( 
'proxy_status', 
'proxy_host', 
'proxy_port' );
 
  914        $query = 
"SELECT keyword, value FROM settings WHERE " . 
$ilDB->in(
'keyword', $fields, 
false, 
'text');
 
  917        $proxy_settings = array();
 
  918        $already_saved = 
false;
 
  920            $already_saved = 
true;
 
  921            $proxy_settings[
$row[
'keyword']] = 
$row[
'value'];
 
  924        if (!$already_saved) {
 
  925            $arr[
"status"] = 
false;
 
  926            $arr[
"comment"] = $this->lng->txt(
"proxy");
 
  927            $arr[
"text"] = $this->lng->txt(
"proxy");
 
  929            if ((
bool) $proxy_settings[
"proxy_status"] == 
false) {
 
  930                $arr[
"status"] = 
true;
 
  931                $arr[
"comment"] = $this->lng->txt(
"proxy_disabled");
 
  932                $arr[
"text"] = $this->lng->txt(
"proxy_disabled");
 
  934                $arr[
"status"] = 
true;
 
  935                $arr[
"comment"] = $this->lng->txt(
"proxy_activated_configurated");
 
  936                $arr[
"text"] = $this->lng->txt(
"proxy_activated_configurated");
 
  951        $installed_langs = $this->lng->getInstalledLanguages();
 
  953        $count = count($installed_langs);
 
  956            $arr[
"status"] = 
false;
 
  957            $arr[
"comment"] = $this->lng->txt(
"lang_none_installed");
 
  959            $arr[
"status"] = 
true;
 
  973        $arr[
"status"] = 
true;
 
  976        $settings = 
$client->getAllSettings();
 
  977        $client_name = 
$client->getName();
 
  980        if (empty($settings[
"admin_firstname"]) or empty($settings[
"admin_lastname"]) or
 
  981            empty($settings[
"admin_email"]) or empty($client_name)) {
 
  982            $arr[
"status"] = 
false;
 
  983            $arr[
"comment"] = $this->lng->txt(
"missing_data");
 
  987        if (!
ilUtil::is_email($settings[
"admin_email"]) and $arr[
"status"] != 
false) {
 
  988            $arr[
"status"] = 
false;
 
  989            $arr[
"comment"] = $this->lng->txt(
"email_not_valid");
 
 1002        $settings = 
$client->getAllSettings();
 
 1004        if (!isset($settings[
"nic_enabled"])) {
 
 1005            $arr[
"status"] = 
false;
 
 1006            $arr[
"comment"] = $this->lng->txt(
"nic_not_disabled");
 
 1010        $arr[
"status"] = 
true;
 
 1012        if ($settings[
"nic_enabled"] == 
"-1") {
 
 1013            $arr[
"comment"] = $this->lng->txt(
"nic_reg_failed");
 
 1017        if (!$settings[
"nic_enabled"]) {
 
 1018            $arr[
"comment"] = $this->lng->txt(
"nic_reg_disabled");
 
 1020            $arr[
"comment"] = $this->lng->txt(
"nic_reg_enabled");
 
 1021            if ($settings[
"inst_id"] <= 0) {
 
 1022                $arr[
"status"] = 
false;
 
 1053        return ($this->access_mode == 
"admin") ? true : 
false;
 
 1065        if ($a_formdata[
"chk_datadir_path"] == 1) {     
 
 1067                $this->
error = 
"create_datadir_failed";
 
 1073        if (!@file_exists(ILIAS_ABSOLUTE_PATH . 
"/" . $this->ini->readVariable(
"clients", 
"path")) and !@is_dir(ILIAS_ABSOLUTE_PATH . 
"/" . $this->ini->readVariable(
"clients", 
"path"))) {
 
 1074            if (!
ilUtil::makeDir(ILIAS_ABSOLUTE_PATH . 
"/" . $this->ini->readVariable(
"clients", 
"path"))) {
 
 1075                $this->
error = 
"create_webdir_failed";
 
 1081        $log_path = substr($form_log_path, 0, strrpos($form_log_path, 
"/"));
 
 1082        $log_file = substr($form_log_path, strlen($log_path)+1);
 
 1085        $this->ini->setVariable(
"server", 
"http_path", ILIAS_HTTP_PATH);
 
 1086        $this->ini->setVariable(
"server", 
"absolute_path", ILIAS_ABSOLUTE_PATH);
 
 1087        $this->ini->setVariable(
"server", 
"timezone", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
 
 1088        $this->ini->setVariable(
"clients", 
"datadir", $datadir_path);
 
 1089        $this->ini->setVariable(
"tools", 
"convert", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"convert_path"])));
 
 1090        $this->ini->setVariable(
"tools", 
"zip", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"zip_path"])));
 
 1091        $this->ini->setVariable(
"tools", 
"unzip", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"unzip_path"])));
 
 1092        $this->ini->setVariable(
"tools", 
"ghostscript", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"])));
 
 1093        $this->ini->setVariable(
"tools", 
"java", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"java_path"])));
 
 1095        $this->ini->setVariable(
"tools", 
"ffmpeg", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"ffmpeg_path"])));
 
 1097        $this->ini->setVariable(
"tools", 
"vscantype", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"vscanner_type"])));
 
 1098        $this->ini->setVariable(
"tools", 
"scancommand", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"scan_command"])));
 
 1099        $this->ini->setVariable(
"tools", 
"cleancommand", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"clean_command"])));
 
 1100        $this->ini->setVariable(
"tools", 
"enable_system_styles_management", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"enable_system_styles_management"])));
 
 1101        $this->ini->setVariable(
"tools", 
"lessc", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"lessc_path"])));
 
 1102        $this->ini->setVariable(
"tools", 
"phantomjs", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"phantomjs_path"])));
 
 1104        $this->ini->setVariable(
"setup", 
"pass", md5($a_formdata[
"setup_pass"]));
 
 1105        $this->ini->setVariable(
"log", 
"path", $log_path);
 
 1106        $this->ini->setVariable(
"log", 
"file", $log_file);
 
 1107        $this->ini->setVariable(
"log", 
"enabled", ($a_formdata[
"chk_log_status"]) ? 
"0" : 1);
 
 1108        $this->ini->setVariable(
"log", 
"error_path", $error_log_path);
 
 1110        $this->ini->setVariable(
"https", 
"auto_https_detect_enabled", ($a_formdata[
"auto_https_detect_enabled"]) ? 1 : 0);
 
 1111        $this->ini->setVariable(
"https", 
"auto_https_detect_header_name", $a_formdata[
"auto_https_detect_header_name"]);
 
 1112        $this->ini->setVariable(
"https", 
"auto_https_detect_header_value", $a_formdata[
"auto_https_detect_header_value"]);
 
 1114        if (!$this->ini->write()) {
 
 1115            $this->
error = get_class($this) . 
": " . $this->ini->getError();
 
 1121        $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
 
 1134        $convert_path = preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"convert_path"]));
 
 1137        $ghostscript_path = preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
 
 1144        $scan_command = preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"scan_command"]));
 
 1145        $clean_command = preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"clean_command"]));
 
 1146        $enable_system_styles_management = preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"enable_system_styles_management"]));
 
 1148        $phantomjs_path = preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"phantomjs_path"]));
 
 1150        $this->ini->setVariable(
"tools", 
"convert", $convert_path);
 
 1151        $this->ini->setVariable(
"tools", 
"zip", $zip_path);
 
 1152        $this->ini->setVariable(
"tools", 
"unzip", $unzip_path);
 
 1153        $this->ini->setVariable(
"tools", 
"ghostscript", $ghostscript_path);
 
 1154        $this->ini->setVariable(
"tools", 
"java", $java_path);
 
 1156        $this->ini->setVariable(
"tools", 
"ffmpeg", $ffmpeg_path);
 
 1157        $this->ini->setVariable(
"tools", 
"latex", $latex_url);
 
 1158        $this->ini->setVariable(
"tools", 
"fop", $fop_path);
 
 1159        $this->ini->setVariable(
"tools", 
"vscantype", $scan_type);
 
 1160        $this->ini->setVariable(
"tools", 
"scancommand", $scan_command);
 
 1161        $this->ini->setVariable(
"tools", 
"cleancommand", $clean_command);
 
 1162        $this->ini->setVariable(
"tools", 
"lessc", $lessc_path);
 
 1163        $this->ini->setVariable(
"tools", 
"enable_system_styles_management", $enable_system_styles_management);
 
 1164        $this->ini->setVariable(
"tools", 
"phantomjs", $phantomjs_path);
 
 1167        $log_path = substr($form_log_path, 0, strrpos($form_log_path, 
"/"));
 
 1168        $log_file = substr($form_log_path, strlen($log_path)+1);
 
 1172        $this->ini->setVariable(
"log", 
"path", $log_path);
 
 1173        $this->ini->setVariable(
"log", 
"file", $log_file);
 
 1174        $this->ini->setVariable(
"log", 
"enabled", ($a_formdata[
"chk_log_status"]) ? 
"0" : 1);
 
 1175        $this->ini->setVariable(
"log", 
"error_path", $error_log_path);
 
 1176        $this->ini->setVariable(
"server", 
"timezone", preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
 
 1178        $this->ini->setVariable(
"https", 
"auto_https_detect_enabled", ($a_formdata[
"auto_https_detect_enabled"]) ? 1 : 0);
 
 1179        $this->ini->setVariable(
"https", 
"auto_https_detect_header_name", $a_formdata[
"auto_https_detect_header_name"]);
 
 1180        $this->ini->setVariable(
"https", 
"auto_https_detect_header_value", $a_formdata[
"auto_https_detect_header_value"]);
 
 1182        if (!$this->ini->write()) {
 
 1183            $this->
error = get_class($this) . 
": " . $this->ini->getError();
 
 1198        if (!isset($a_formdata[
"chk_convert_path"])) {
 
 1200            $convert_path = preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"convert_path"]));
 
 1202            if (($err = $this->
testConvert($convert_path)) != 
"") {
 
 1203                $this->
error = $err;
 
 1209        if (!isset($a_formdata[
"chk_zip_path"])) {
 
 1213            if (empty($zip_path)) {
 
 1214                $this->
error = 
"no_path_zip";
 
 1218            if (!$this->
testZip($zip_path)) {
 
 1219                $this->
error = 
"check_failed_zip";
 
 1225        if (!isset($a_formdata[
"chk_unzip_path"])) {
 
 1229            if (empty($unzip_path)) {
 
 1230                $this->
error = 
"no_path_unzip";
 
 1235                $this->
error = 
"check_failed_unzip";
 
 1241        if (!isset($a_formdata[
"chk_ghostscript_path"])) {
 
 1243            $ghostscript_path = preg_replace(
"/\\\\/", 
"/", 
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
 
 1246                $this->
error = $err;
 
 1252        if (!isset($a_formdata[
"chk_java_path"])) {
 
 1256            if (empty($java_path)) {
 
 1257                $this->
error = 
"no_path_java";
 
 1261            if (!$this->
testJava($java_path)) {
 
 1262                $this->
error = 
"check_failed_java";
 
 1279        if (!isset($a_formdata[
"chk_ffmpeg_path"])) {
 
 1283            if (empty($ffmpeg_path)) {
 
 1284                $this->
error = 
"no_path_ffmpeg";
 
 1288            if (!$this->testFFMpeg($ffmpeg_path)) {
 
 1289                $this->
error = 
"check_failed_ffmpeg";
 
 1295        if (!isset($a_formdata[
"chk_latex_url"])) {
 
 1297            if (empty($latex_url)) {
 
 1298                $this->
error = 
"no_latex_url";
 
 1303                $this->
error = 
"check_failed_latex";
 
 1321        if (empty($datadir_path)) {
 
 1322            $this->
error = 
"no_path_datadir";
 
 1326        $webspace_dir = ILIAS_ABSOLUTE_PATH . 
"/data";
 
 1329        if (strpos($datadir_path, $webspace_dir) !== 
false) {
 
 1330            $this->
error = 
"datadir_webspacedir_match";
 
 1335        if ($a_formdata[
"chk_datadir_path"] == 1) {
 
 1336            $dir_to_create = substr(strrchr($datadir_path, 
"/"), 1);
 
 1337            $dir_to_check = substr($datadir_path, 0, -strlen($dir_to_create)-1);
 
 1340                $this->
error = 
"cannot_create_datadir_inside_webdir";
 
 1344            if (is_writable($datadir_path)) {
 
 1345                $this->
error = 
"dir_exists_create";
 
 1349            if (!is_writable($dir_to_check)) {
 
 1350                $this->
error = 
"cannot_create_datadir_no_write_access";
 
 1355                $this->
error = 
"cannot_create_datadir_inside_webdir";
 
 1359            if (!is_writable($datadir_path)) {
 
 1360                $this->
error = 
"cannot_create_datadir_no_write_access";
 
 1375        if (!$a_formdata[
"setup_pass"]) {
 
 1376            $this->
error = 
"no_setup_pass_given";
 
 1380        if ($a_formdata[
"setup_pass"] != $a_formdata[
"setup_pass2"]) {
 
 1381            $this->
error = 
"pass_does_not_match";
 
 1396        if (!$a_formdata[
"chk_log_status"]) {
 
 1400            if (empty($log_path)) {
 
 1401                $this->
error = 
"no_path_log";
 
 1405            if (is_dir($log_path)) {
 
 1406                $this->
error = 
'could_not_create_logfile';
 
 1411                $this->
error = 
"cannot_create_logdir_inside_webdir";
 
 1415            if (!@touch($log_path)) {
 
 1416                $this->
error = 
"could_not_create_logfile";
 
 1436        if (!empty($clean_error_log_path)) {
 
 1438                $this->
error = 
"could_not_create_error_directory";
 
 1452        if (empty($this->
error)) {
 
 1484        if (trim($a_convert_path) == 
"") {
 
 1485            return "no_path_convert";
 
 1487        if (!is_file($a_convert_path)) {
 
 1488            return "check_failed_convert";
 
 1503        if (trim($a_ghostscript_path) == 
"") {
 
 1506        if (!is_file($a_ghostscript_path)) {
 
 1507            return "check_failed_ghostscript";
 
 1522        if (trim($a_java_path) == 
"") {
 
 1526        if (!is_file($a_java_path)) {
 
 1527            return "check_failed_java";
 
 1549        if (trim($a_latex_url) == 
"") {
 
 1554        include_once 
"./setup/classes/class.ilHttpRequest.php";
 
 1557        if ((strpos((substr(
$result, 0, 5)), 
"PNG") !== 
false) || (strpos((substr(
$result, 0, 5)), 
"GIF") !== 
false)) {
 
 1560            return "check_failed_latex";
 
 1573        if (trim($a_zip_path) == 
"") {
 
 1574            return "no_path_zip";
 
 1576        if (!is_file($a_zip_path)) {
 
 1577            return "check_failed_zip";
 
 1624        if (trim($a_unzip_path) == 
"") {
 
 1625            return "no_path_unzip";
 
 1627        if (!is_file($a_unzip_path)) {
 
 1628            return "check_failed_unzip";
 
 1665    public function unzip($a_file, $overwrite = 
false)
 
 1669        $pathinfo = pathinfo($a_file);
 
 1670        $dir = $pathinfo[
"dirname"];
 
 1671        $file = $pathinfo[
"basename"];
 
 1676        $unzip = $this->ini->readVariable(
"tools", 
"unzip");
 
 1678        exec($unzipcmd, $arr);
 
 1681        foreach ($arr as $line) {
 
 1682            if (is_int(strpos($line, 
"/"))) {
 
 1683                $zdir = substr($line, 0, strrpos($line, 
"/"));
 
 1684                $nr = substr_count($zdir, 
"/");
 
 1686                while ($zdir != 
"") {
 
 1687                    $nr = substr_count($zdir, 
"/");
 
 1688                    $zdirs[$zdir] = $nr;                                
 
 1690                    $zdir = substr($zdir, 0, strrpos($zdir, 
"/"));
 
 1697        foreach ($zdirs as $zdir => $nr) {                              
 
 1719        require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
 
 1721        $db = $this->client->getDB();
 
 1726        foreach ($setting_fields as $field) {
 
 1727            if (isset($session_settings[$field])) {
 
 1728                $query = 
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
 
 1731                    array(
'text', 
'text'),
 
 1732                    array(
'common', $field)
 
 1740                if (count(
$row) > 0) {
 
 1744                            'value' => array(
'text', $session_settings[$field])
 
 1747                            'module' => array(
'text', 
'common'),
 
 1748                            'keyword' => array(
'text', $field)
 
 1755                            'module' => array(
'text', 
'common'),
 
 1756                            'keyword' => array(
'text', $field),
 
 1757                            'value' => array(
'text', $session_settings[$field])
 
 1767            $message = $this->lng->txt(
"session_settings_not_saved");
 
 1769            $message = $this->lng->txt(
"settings_saved");
 
 1782        require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
 
 1784        $db = $this->client->getDB();
 
 1788        $query = 
"SELECT * FROM settings WHERE module = %s " .
 
 1789                "AND " . 
$db->in(
'keyword', $setting_fields, 
false, 
'text');
 
 1793        $session_settings = array();
 
 1795            $session_settings[
$row[
'keyword']] = 
$row[
'value'];
 
 1798        foreach ($setting_fields as $field) {
 
 1799            if (!isset($session_settings[$field])) {
 
 1803                    case 'session_max_count':
 
 1808                    case 'session_min_idle':
 
 1813                    case 'session_max_idle':
 
 1818                    case 'session_max_idle_after_first_request':
 
 1823                    case 'session_allow_client_maintenance':
 
 1829                $session_settings[$field] = $value;
 
 1833        return $session_settings;
 
 1853            $this->
error = 
"Could not delete data dir $target->getDataDir()";
 
 1859            $this->
error = 
"could_not_create_base_data_dir :" . 
$target->getDataDir();
 
 1865            $this->
error = 
"clone_datadircopyfail";
 
 1872            $this->
error = 
"Could not delete webspace dir $target->getWebspaceDir()";
 
 1878            $this->
error = 
"could_not_create_base_webspace_dir :" . 
$target->getWebspaceDir();
 
 1884            $this->
error = 
"clone_websipacedircopyfail";
 
 1897            $this->
error = 
"Source database connection failed.";
 
 1903            $this->
error = 
"Target database connection failed.";
 
 1908        $srcTables = 
$source->db->query(
"SHOW TABLES");
 
 1912        $tarTables = 
$target->db->query(
"SHOW TABLES");
 
 1913        foreach ($tarTables->fetchAll() as $cTable) {
 
 1914            $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
 
 1917        foreach ($srcTables->fetchAll() as $cTable) {
 
 1918            $drop   = 
$target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
 
 1919            $create = 
$target->db->query(
"CREATE TABLE " . $cTable[0] . 
" LIKE " . 
$source->getDbName() . 
"." . $cTable[0]);
 
 1923            $insert = 
$target->db->query(
"INSERT INTO " . $cTable[0] . 
" SELECT * FROM " . 
$source->getDbName() . 
"." . $cTable[0]);
 
 1926        $target->db->query(
"UPDATE settings SET VALUE = " . 
$target->db->quote(0, 
"integer") . 
" WHERE keyword = " . 
$target->db->quote(
"inst_id", 
"text"));
 
 1927        $target->db->query(
"UPDATE settings SET VALUE = " . 
$target->db->quote(0, 
"integer") . 
" WHERE keyword = " . 
$target->db->quote(
"nic_enabled", 
"text"));
 
 1939        require_once 
'./Services/Http/exceptions/class.ilProxyException.php';
 
 1940        $settings = 
$client->getAllSettings();
 
 1942        if ((
bool) $settings[
'proxy_status'] == 
true) {
 
 1945                $wait_timeout = 100;
 
 1947                $fp = @fsockopen($settings[
'proxy_host'], $settings[
'proxy_port'], $err_code, $err_str, $wait_timeout);
 
 1956            } 
catch (Exception $e) {
 
 1964        $db = $this->client->getDB();
 
 1965        $proxy_fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
 
 1967        foreach ($proxy_fields as $field) {
 
 1968            if (isset($proxy_settings[$field])) {
 
 1969                $query = 
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
 
 1972                    array(
'text', 
'text'),
 
 1973                    array(
'common', $field)
 
 1981                if (is_array(
$row) && count(
$row) > 0) {
 
 1985                            'value' => array(
'text', $proxy_settings[$field])
 
 1988                            'module' => array(
'text', 
'common'),
 
 1989                            'keyword' => array(
'text', $field)
 
 1996                            'module' => array(
'text', 
'common'),
 
 1997                            'keyword' => array(
'text', $field),
 
 1998                            'value' => array(
'text', $proxy_settings[$field])
 
 2011        $ini_get = ini_get(
'opcache.enable');
 
 2013        return ($ini_get === 1 or $ini_get === 
'1' or strtolower($ini_get) === 
'on');
 
 2024        if (!preg_match(
"/^[A-Za-z0-9]+$/", $a_client_id)) {
 
 2039        $other_directory = $other_directory . 
"/";
 
 2041        return !(strpos($directory, $other_directory) !== 0);
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
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.
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
testLatex($a_latex_url)
Check latex cgi script.
loginAsClient($a_auth_data)
process client login
checkErrorLogSetup($error_log_path)
check error log path
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
checkClientProxySettings(ilClient $client)
testUnzip($a_unzip_path)
Check unzip program.
isValidClientId($a_client_id)
Is valid client id.
checkClientDatabase(ilClient $client)
loginAsAdmin($a_password)
process setup admin login
setPassword($a_password)
set setup master password
checkDataDirSetup($a_formdata)
check datadir path
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
checkClientLanguages(ilClient $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.
checkClientSessionSettings(&$client, $a_as_bool=false)
check client session config status
createDatabase($a_collation="")
create client database
init()
init setup load settings from ilias.ini if exists and sets some constants
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
__construct($a_auth, $a_auth_type)
constructor
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 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 is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDirParents($a_dir)
Create a new directory and all parent directories.
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 ...
catch(Exception $e) $message
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
foreach($_POST as $key=> $value) $res