4 include_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");
124 $this->client = $a_cl;
145 $this->ini =
new ilIniFile($this->ini_file_path);
147 if (!$this->ini->read())
149 $this->ini->GROUPS = parse_ini_file($this->setup_defaults,
true);
150 $this->error = get_class($this).
": ".$this->ini->getError();
154 $this->setup_password = $this->ini->readVariable(
"setup",
"pass");
155 $this->default_client = $this->ini->readVariable(
"clients",
"default");
157 define(
"ILIAS_DATA_DIR",$this->ini->readVariable(
"clients",
"datadir"));
158 define(
"ILIAS_WEB_DIR",$this->ini->readVariable(
"clients",
"path"));
170 $_SESSION[
"ClientId"] = $this->client->getId();
173 if (!$this->client->create())
175 $this->error = $this->client->getError();
180 $this->ini_client_exists =
true;
195 if ($a_old_client_id != $this->client->getId())
200 $this->
raiseError($this->lng->txt(
"client_id_already_exists"),$this->error_obj->MESSAGE);
205 $this->
raiseError($this->lng->txt(
"save_error"),$this->error_obj->MESSAGE);
213 $this->ini_client_exists =
true;
224 if ($this->client->checkDatabaseExists())
226 $this->error = $this->lng->txt(
"database_exists");
230 $this->client->getDB()->connectHost(
true);
233 $db = $this->client->getDB();
236 $this->error =
"connection_failed";
240 $r =
$db->createDatabase($this->client->getdbName(),
241 "utf8", $a_collation);
245 $this->error =
"create_database_failed";
252 $this->client->db_exists =
true;
268 if (!$this->client->connect())
274 if ($this->
readDump($this->client->db, $this->SQL_FILE))
276 $this->client->db_installed =
true;
288 while( !feof( $fp ) )
307 if (
$db->getDBType() ==
"mysql")
309 $fp = fopen(
$file,
'r');
314 $line = trim($this->
getline($fp,
"\n"));
316 if ($line !=
"" && substr($line,0,1)!=
"#"
317 && substr($line,0,1)!=
"-")
320 if (substr($line,-1)==
";")
323 $q .=
" ".substr($line,0,-1);
326 if (
$db->getErrorNo() > 0)
328 echo
"<br />ERROR: ".$db->getError().
345 #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage();
346 if (in_array(
$db->getDBType(), array(
"oracle",
"postgres",
"innodb")))
348 if(@is_dir(
'./setup/sql/ilDBTemplate'))
350 include_once
'./Services/Database/classes/class.ilArrayTableDataParser.php';
351 include_once
'./Services/Xml/exceptions/class.ilSaxParserException.php';
355 eval(file_get_contents(
'./setup/sql/ilDBTemplate/'.$file));
359 #$parser = new ilSimpleXMLTableDataParser('./setup/sql/ilDBTemplate/'.$file.'.xml');
360 $parser->startParsing();
361 #echo 'Table: '.$file.', memory: '.memory_get_peak_usage().' peak: '.memory_get_peak_usage().'<br />';flush();
372 include_once(
"./setup/sql/ilDBTemplate.php");
373 setupILIASDatabase();
376 #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage();
387 $a = @file_exists($this->INI_FILE);
399 if (is_writable(
"."))
401 $arr[
"status"] =
true;
404 $arr[
"comment"] = getcwd();
409 $arr[
"status"] =
false;
410 $arr[
"comment"] = $this->lng->txt(
"pre_folder_write_error");
413 $arr[
"comment"] = getcwd().
": ".$arr[
"comment"];
428 if (@mkdir($a_dir.
"/crst879dldsk9d", 0774))
430 $arr[
"status"] =
true;
431 $arr[
"comment"] =
"";
433 @rmdir($a_dir.
"/crst879dldsk9d");
437 $arr[
"status"] =
false;
440 $arr[
"comment"] = getcwd().
": ".$this->lng->txt(
"pre_folder_create_error");
455 if ($sess->usesCookies)
457 $arr[
"status"] =
true;
458 $arr[
"comment"] =
"";
462 $arr[
"status"] =
false;
463 $arr[
"comment"] = $this->lng->txt(
"pre_cookies_disabled");
475 $version = PHP_VERSION;
477 $arr[
"status"] =
true;
478 $arr[
"comment"] =
"PHP ".$version;
479 if (version_compare($version,
'5.3.0',
'<'))
481 $arr[
"status"] =
false;
482 $arr[
"comment"] =
"PHP ".$version.
". ".$this->lng->txt(
"pre_php_version_too_low");
496 if (function_exists(
"mysql_query"))
498 $arr[
"status"] =
true;
499 $arr[
"comment"] = $this->lng->txt(
"pre_mysql_4_1_or_higher");
503 $arr[
"status"] =
false;
504 $arr[
"comment"] = $this->lng->txt(
"pre_mysql_missing");
533 if (class_exists(
"DOMDocument"))
535 $arr[
"status"] =
true;
539 $arr[
"status"] =
false;
540 $arr[
"comment"] = $this->lng->txt(
"pre_dom_missing");
554 if (class_exists(
"XSLTProcessor"))
556 $arr[
"status"] =
true;
560 $arr[
"status"] =
false;
561 $arr[
"comment"] = sprintf($this->lng->txt(
"pre_xsl_missing"),
562 "http://php.net/manual/en/book.xsl.php");
576 if (function_exists(
"imagefill") && function_exists(
"imagecolorallocate"))
578 $arr[
"status"] =
true;
582 $arr[
"status"] =
false;
583 $arr[
"comment"] = sprintf($this->lng->txt(
"pre_gd_missing"),
584 "http://php.net/manual/en/book.image.php");
598 $limit = ini_get(
"memory_limit");
601 if (is_int(strpos($limit,
"M")))
603 $limit_n = (int) $limit;
612 $arr[
"status"] =
true;
613 $arr[
"comment"] = $limit.
". ".$this->lng->txt(
"pre_memory_limit_recommend");
617 $arr[
"status"] =
false;
618 $arr[
"comment"] = $limit.
". ".$this->lng->txt(
"pre_memory_limit_too_low");
655 foreach ($this->preliminaries_result as $val)
657 if ($val[
"status"] ===
false)
659 $this->preliminaries =
false;
673 return $this->ini->readVariable(
"setup",
"pass");
683 $this->ini->setVariable(
"setup",
"pass",md5($a_password));
685 if ($this->ini->write() ==
false)
687 $this->error = $this->ini->getError();
703 if (empty($a_auth_data[
"client_id"]))
705 $this->error =
"no_client_id";
709 if (empty($a_auth_data[
"username"]))
711 $this->error =
"no_username";
715 if (empty($a_auth_data[
"password"]))
717 $this->error =
"no_password";
721 if (!$this->
newClient($a_auth_data[
"client_id"]))
723 $this->error =
"unknown_client_id";
724 unset($this->client);
728 if (!$this->client->db_exists)
730 $this->error =
"no_db_connect_consult_admin";
731 unset($this->client);
735 $s1 = $this->client->db->query(
"SELECT value from settings WHERE keyword = ".
736 $this->client->db->quote(
'system_role_id',
'text'));
737 $r1 = $this->client->db->fetchAssoc($s1);
738 $system_role_id = $r1[
"value"];
739 $q =
"SELECT usr_data.usr_id FROM usr_data ".
740 "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id ".
741 "WHERE rbac_ua.rol_id = ".$this->client->db->quote((
int) $system_role_id,
'integer').
" ".
742 "AND usr_data.login=".$this->client->db->quote($a_auth_data[
"username"],
'text').
" ".
743 "AND usr_data.passwd=".$this->client->db->quote(md5($a_auth_data[
"password"]),
'text');
745 $r = $this->client->db->query($q);
749 $this->error =
"login_invalid";
755 $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
757 $_SESSION[
"ClientId"] = $this->client->getId();
768 $a_password = md5($a_password);
770 if ($this->ini->readVariable(
"setup",
"pass") == $a_password)
773 $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
793 $this->client =
new ilClient($a_client_id, $this->db_connections);
795 if (!$this->client->init())
798 $this->error = get_class($this).
": ".$this->client->getError();
817 if ($this->ini_client_exists)
830 if ($status[
"db"][
"status"] ===
false and $status[
"db"][
"update"] !==
true)
834 $status[
"lang"][
"status"] =
false;
835 $status[
"lang"][
"comment"] = $status[
"db"][
"comment"];
836 $status[
"contact"][
"status"] =
false;
837 $status[
"contact"][
"comment"] = $status[
"db"][
"comment"];
839 $status[
"proxy"][
"status"] =
false;
840 $status[
"proxy"][
"comment"] = $status[
"db"][
"comment"];
842 $status[
"nic"][
"status"] =
false;
843 $status[
"nic"][
"comment"] = $status[
"db"][
"comment"];
867 if (
$client->getSetting(
"setup_ok"))
869 $arr[
"status"] =
true;
874 $arr[
"status"] =
false;
875 $arr[
"comment"] = $this->lng->txt(
"setup_not_finished");
888 if (
$client->ini->readVariable(
"client",
"access") ==
"1")
890 $arr[
"status"] =
true;
891 $arr[
"comment"] = $this->lng->txt(
"online");
895 $arr[
"status"] =
false;
896 $arr[
"comment"] = $this->lng->txt(
"disabled");
909 if (!$arr[
"status"] =
$client->init())
911 $arr[
"comment"] =
$client->getError();
928 if (!$arr[
"status"] =
$client->db_exists)
930 $arr[
"comment"] = $this->lng->txt(
"no_database");
934 if (!$arr[
"status"] =
$client->db_installed)
936 $arr[
"comment"] = $this->lng->txt(
"db_not_installed");
944 include_once
"./Services/Database/classes/class.ilDBUpdate.php";
946 $this->lng->setDbHandler(
$client->db);
949 if (!$arr[
"status"] = $dbupdate->getDBVersionStatus())
951 $arr[
"comment"] = $this->lng->txt(
"db_needs_update");
952 $arr[
"update"] =
true;
955 else if ($dbupdate->hotfixAvailable())
957 $arr[
"status"] =
false;
958 $arr[
"comment"] = $this->lng->txt(
"hotfix_available");
959 $arr[
"update"] =
true;
962 else if ($dbupdate->customUpdatesAvailable())
964 $arr[
"status"] =
false;
965 $arr[
"comment"] = $this->lng->txt(
"custom_updates_available");
966 $arr[
"update"] =
true;
972 $cset = $ilDB->query(
"SELECT count(*) as cnt FROM ctrl_calls");
973 $crec = $ilDB->fetchAssoc($cset);
974 if ($crec[
"cnt"] == 0)
976 $arr[
"status"] =
false;
977 $arr[
"comment"] = $this->lng->txt(
"db_control_structure_missing");
978 $arr[
"update"] =
true;
993 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
1000 $query =
"SELECT keyword, value FROM settings WHERE ".$db->in(
'keyword', $fields,
false,
'text');
1006 if(
$row[
'value'] !=
'' )
1011 if (count($rows) != count($fields))
1013 if($a_as_bool)
return false;
1014 $arr[
"status"] =
false;
1015 $arr[
"comment"] = $this->lng->txt(
"session_management_not_configured");
1019 if($a_as_bool)
return true;
1020 $arr[
"status"] =
true;
1021 $arr[
"comment"] = $this->lng->txt(
"session_management_configured");
1036 $fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
1038 $query =
"SELECT keyword, value FROM settings WHERE ".$db->in(
'keyword', $fields,
false,
'text');
1041 $proxy_settings = array();
1042 $already_saved =
false;
1045 $already_saved =
true;
1046 $proxy_settings[
$row[
'keyword']] = $row[
'value'];
1051 $arr[
"status"] =
false;
1052 $arr[
"comment"] = $this->lng->txt(
"proxy");
1053 $arr[
"text"] = $this->lng->txt(
"proxy");
1055 else if((
bool)$proxy_settings[
"proxy_status"] ==
false)
1057 $arr[
"status"] =
true;
1058 $arr[
"comment"] = $this->lng->txt(
"proxy_disabled");
1059 $arr[
"text"] = $this->lng->txt(
"proxy_disabled");
1063 $arr[
"status"] =
true;
1064 $arr[
"comment"] = $this->lng->txt(
"proxy_activated_configurated");
1065 $arr[
"text"] = $this->lng->txt(
"proxy_activated_configurated");
1078 $installed_langs = $this->lng->getInstalledLanguages();
1080 $count = count($installed_langs);
1084 $arr[
"status"] =
false;
1085 $arr[
"comment"] = $this->lng->txt(
"lang_none_installed");
1089 $arr[
"status"] =
true;
1103 $arr[
"status"] =
true;
1106 $settings =
$client->getAllSettings();
1107 $client_name =
$client->getName();
1110 if (empty($settings[
"admin_firstname"]) or empty($settings[
"admin_lastname"]) or
1111 empty($settings[
"admin_email"]) or empty($client_name))
1113 $arr[
"status"] =
false;
1114 $arr[
"comment"] = $this->lng->txt(
"missing_data");
1118 if (!
ilUtil::is_email($settings[
"admin_email"]) and $arr[
"status"] !=
false)
1120 $arr[
"status"] =
false;
1121 $arr[
"comment"] = $this->lng->txt(
"email_not_valid");
1134 $settings =
$client->getAllSettings();
1136 if (!isset($settings[
"nic_enabled"]))
1138 $arr[
"status"] =
false;
1139 $arr[
"comment"] = $this->lng->txt(
"nic_not_disabled");
1143 $arr[
"status"] =
true;
1145 if ($settings[
"nic_enabled"] ==
"-1")
1147 $arr[
"comment"] = $this->lng->txt(
"nic_reg_failed");
1151 if (!$settings[
"nic_enabled"])
1153 $arr[
"comment"] = $this->lng->txt(
"nic_reg_disabled");
1157 $arr[
"comment"] = $this->lng->txt(
"nic_reg_enabled");
1158 if ($settings[
"inst_id"] <= 0)
1160 $arr[
"status"] =
false;
1191 return ($this->access_mode ==
"admin") ?
true :
false;
1203 if ($a_formdata[
"chk_datadir_path"] == 1)
1207 $this->error =
"create_datadir_failed";
1217 $this->error =
"create_webdir_failed";
1223 $log_path = substr($form_log_path,0,strrpos($form_log_path,
"/"));
1224 $log_file = substr($form_log_path,strlen($log_path)+1);
1226 $this->ini->setVariable(
"server",
"http_path",ILIAS_HTTP_PATH);
1228 $this->ini->setVariable(
"server",
"timezone",preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
1229 $this->ini->setVariable(
"clients",
"datadir", $datadir_path);
1230 $this->ini->setVariable(
"tools",
"convert", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"convert_path"])));
1231 $this->ini->setVariable(
"tools",
"zip", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"zip_path"])));
1232 $this->ini->setVariable(
"tools",
"unzip", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"unzip_path"])));
1233 $this->ini->setVariable(
"tools",
"ghostscript", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"])));
1234 $this->ini->setVariable(
"tools",
"java", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"java_path"])));
1235 $this->ini->setVariable(
"tools",
"htmldoc", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"htmldoc_path"])));
1237 $this->ini->setVariable(
"tools",
"ffmpeg", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ffmpeg_path"])));
1239 $this->ini->setVariable(
"tools",
"vscantype", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"vscanner_type"])));
1240 $this->ini->setVariable(
"tools",
"scancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"scan_command"])));
1241 $this->ini->setVariable(
"tools",
"cleancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"])));
1242 $this->ini->setVariable(
"setup",
"pass", md5($a_formdata[
"setup_pass"]));
1243 $this->ini->setVariable(
"log",
"path", $log_path);
1244 $this->ini->setVariable(
"log",
"file", $log_file);
1245 $this->ini->setVariable(
"log",
"enabled", ($a_formdata[
"chk_log_status"]) ?
"0" : 1);
1247 if (!$this->ini->write())
1249 $this->error = get_class($this).
": ".$this->ini->getError();
1255 $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
1271 $ghostscript_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
1280 $clean_command = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"]));
1282 $this->ini->setVariable(
"tools",
"convert", $convert_path);
1283 $this->ini->setVariable(
"tools",
"zip", $zip_path);
1284 $this->ini->setVariable(
"tools",
"unzip", $unzip_path);
1285 $this->ini->setVariable(
"tools",
"ghostscript", $ghostscript_path);
1286 $this->ini->setVariable(
"tools",
"java", $java_path);
1287 $this->ini->setVariable(
"tools",
"htmldoc", $htmldoc_path);
1289 $this->ini->setVariable(
"tools",
"ffmpeg", $ffmpeg_path);
1290 $this->ini->setVariable(
"tools",
"latex", $latex_url);
1291 $this->ini->setVariable(
"tools",
"fop", $fop_path);
1292 $this->ini->setVariable(
"tools",
"vscantype", $scan_type);
1293 $this->ini->setVariable(
"tools",
"scancommand", $scan_command);
1294 $this->ini->setVariable(
"tools",
"cleancommand", $clean_command);
1297 $log_path = substr($form_log_path,0,strrpos($form_log_path,
"/"));
1298 $log_file = substr($form_log_path,strlen($log_path)+1);
1300 $this->ini->setVariable(
"log",
"path", $log_path);
1301 $this->ini->setVariable(
"log",
"file", $log_file);
1302 $this->ini->setVariable(
"log",
"enabled", ($a_formdata[
"chk_log_status"]) ?
"0" : 1);
1303 $this->ini->setVariable(
"server",
"timezone",preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
1305 if (!$this->ini->write())
1307 $this->error = get_class($this).
": ".$this->ini->getError();
1322 if (!isset($a_formdata[
"chk_convert_path"]))
1327 if (($err = $this->
testConvert($convert_path)) !=
"")
1329 $this->error = $err;
1335 if (!isset($a_formdata[
"chk_zip_path"]))
1340 if (empty($zip_path))
1342 $this->error =
"no_path_zip";
1346 if (!$this->
testZip($zip_path))
1348 $this->error =
"check_failed_zip";
1354 if (!isset($a_formdata[
"chk_unzip_path"]))
1359 if (empty($unzip_path))
1361 $this->error =
"no_path_unzip";
1367 $this->error =
"check_failed_unzip";
1373 if (!isset($a_formdata[
"chk_ghostscript_path"]))
1376 $ghostscript_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
1380 $this->error = $err;
1386 if (!isset($a_formdata[
"chk_java_path"]))
1391 if (empty($java_path))
1393 $this->error =
"no_path_java";
1399 $this->error =
"check_failed_java";
1405 if (!isset($a_formdata[
"chk_htmldoc_path"]))
1410 if (empty($htmldoc_path))
1412 $this->error =
"no_path_htmldoc";
1418 $this->error =
"check_failed_htmldoc";
1440 if (!isset($a_formdata[
"chk_ffmpeg_path"]))
1445 if (empty($ffmpeg_path))
1447 $this->error =
"no_path_ffmpeg";
1451 if (!$this->testFFMpeg($ffmpeg_path))
1453 $this->error =
"check_failed_ffmpeg";
1459 if (!isset($a_formdata[
"chk_latex_url"]))
1462 if (empty($latex_url))
1464 $this->error =
"no_latex_url";
1470 $this->error =
"check_failed_latex";
1488 if (empty($datadir_path))
1490 $this->error =
"no_path_datadir";
1497 if (strpos($datadir_path,$webspace_dir) !==
false)
1499 $this->error =
"datadir_webspacedir_match";
1504 if ($a_formdata[
"chk_datadir_path"] == 1)
1506 $dir_to_create = substr(strrchr($datadir_path,
"/"), 1);
1507 $dir_to_check = substr($datadir_path,0,- strlen($dir_to_create)-1);
1509 if (is_writable($datadir_path))
1511 $this->error =
"dir_exists_create";
1515 if (!is_writable($dir_to_check))
1517 $this->error =
"cannot_create_datadir_no_write_access";
1523 if (!is_writable($datadir_path))
1525 $this->error =
"cannot_create_datadir_no_write_access";
1540 if (!$a_formdata[
"setup_pass"])
1542 $this->error =
"no_setup_pass_given";
1546 if ($a_formdata[
"setup_pass"] != $a_formdata[
"setup_pass2"])
1548 $this->error =
"pass_does_not_match";
1563 if (!$a_formdata[
"chk_log_status"])
1568 if (empty($log_path))
1570 $this->error =
"no_path_log";
1574 if (!@touch($log_path))
1576 $this->error =
"could_not_create_logfile";
1590 if (empty($this->error))
1623 if (trim($a_convert_path) ==
"")
1625 return "no_path_convert";
1627 if (!is_file($a_convert_path))
1629 return "check_failed_convert";
1665 if (trim($a_ghostscript_path) ==
"")
1669 if (!is_file($a_ghostscript_path))
1671 return "check_failed_ghostscript";
1686 if (trim($a_java_path) ==
"")
1691 if (!is_file($a_java_path))
1693 return "check_failed_java";
1715 if (trim($a_latex_url) ==
"")
1721 include_once
"./setup/classes/class.ilHttpRequest.php";
1723 $result = @$http->downloadToString();
1724 if ((strpos((substr(
$result, 0, 5)),
"PNG") !== FALSE) || (strpos((substr(
$result, 0, 5)),
"GIF") !== FALSE))
1730 return "check_failed_latex";;
1742 if (trim($a_zip_path) ==
"")
1744 return "no_path_zip";
1746 if (!is_file($a_zip_path))
1748 return "check_failed_zip";
1795 if (trim($a_unzip_path) ==
"")
1797 return "no_path_unzip";
1799 if (!is_file($a_unzip_path))
1801 return "check_failed_unzip";
1841 if (trim($a_htmldoc_path) ==
"")
1846 if (!is_file($a_htmldoc_path))
1848 return "check_failed_htmldoc";
1858 $html =
"<html><head><title></title></head><body><p>test</p></body></html>";
1860 $html_file =
"htmldoc_test_file.html";
1862 $fp = fopen( $html_file ,
"wb");
1866 $htmldoc = $a_htmldoc_path.
" ";
1867 $htmldoc .=
"--no-toc ";
1868 $htmldoc .=
"--no-jpeg ";
1869 $htmldoc .=
"--webpage ";
1870 $htmldoc .=
"--outfile htmldoc_test_file.pdf ";
1871 $htmldoc .=
"--bodyfont Arial ";
1872 $htmldoc .=
"--charset iso-8859-15 ";
1873 $htmldoc .=
"--color ";
1874 $htmldoc .=
"--size A4 ";
1875 $htmldoc .=
"--format pdf ";
1876 $htmldoc .=
"--footer ... ";
1877 $htmldoc .=
"--header ... ";
1878 $htmldoc .=
"--left 60 ";
1880 $htmldoc .= $html_file;
1905 function unzip($a_file, $overwrite =
false)
1909 $pathinfo = pathinfo($a_file);
1910 $dir = $pathinfo[
"dirname"];
1911 $file = $pathinfo[
"basename"];
1916 $unzip = $this->ini->readVariable(
"tools",
"unzip");
1918 exec($unzipcmd, $arr);
1921 foreach($arr as $line)
1923 if(is_int(strpos($line,
"/")))
1925 $zdir = substr($line, 0, strrpos($line,
"/"));
1926 $nr = substr_count($zdir,
"/");
1930 $nr = substr_count($zdir,
"/");
1931 $zdirs[$zdir] = $nr;
1933 $zdir = substr($zdir, 0, strrpos($zdir,
"/"));
1940 foreach($zdirs as $zdir => $nr)
1966 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
1968 $db = $this->client->getDB();
1973 foreach($setting_fields as $field)
1975 if( isset($session_settings[$field]) )
1977 $query =
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
1979 array(
'text',
'text'), array(
'common', $field));
1984 if( count(
$row) > 0 )
1989 'value' => array(
'text', $session_settings[$field])
1992 'module' => array(
'text',
'common'),
1993 'keyword' => array(
'text', $field)
2002 'module' => array(
'text',
'common'),
2003 'keyword' => array(
'text', $field),
2004 'value' => array(
'text', $session_settings[$field])
2013 if($i < 4) $message = $this->lng->txt(
"session_settings_not_saved");
2014 else $message = $this->lng->txt(
"settings_saved");
2026 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
2028 $db = $this->client->getDB();
2032 $query =
"SELECT * FROM settings WHERE module = %s " .
2033 "AND ".$db->in(
'keyword', $setting_fields,
false,
'text');
2037 $session_settings = array();
2040 $session_settings[
$row[
'keyword']] = $row[
'value'];
2043 foreach( $setting_fields as $field )
2045 if( !isset($session_settings[$field]) )
2051 case 'session_max_count':
2056 case 'session_min_idle':
2061 case 'session_max_idle':
2066 case 'session_max_idle_after_first_request':
2071 case 'session_allow_client_maintenance':
2077 $session_settings[$field] = $value;
2081 return $session_settings;
2092 $source =
new ilClient($source_id, $this->db_connections);
2101 $this->error =
"Could not delete data dir $target->getDataDir()";
2108 $this->error =
"could_not_create_base_data_dir :".$target->getDataDir();
2113 if (!
ilUtil::rCopy($source->getDataDir(),$target->getDataDir())) {
2114 $this->error =
"clone_datadircopyfail";
2115 $target->ini->write();
2121 $this->error =
"Could not delete webspace dir $target->getWebspaceDir()";
2128 $this->error =
"could_not_create_base_webspace_dir :".$target->getWebspaceDir();
2133 if (!
ilUtil::rCopy($source->getWebspaceDir(),$target->getWebspaceDir())) {
2134 $this->error =
"clone_websipacedircopyfail";
2135 $target->ini->write();
2140 $target->ini->write();
2148 $this->error =
"Source database connection failed.";
2155 $this->error =
"Target database connection failed.";
2160 $srcTables = $source->db->query(
"SHOW TABLES");
2164 $tarTables = $target->db->query(
"SHOW TABLES");
2165 foreach($tarTables->fetchAll() as $cTable)
2167 $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
2170 foreach($srcTables->fetchAll() as $cTable){
2171 $drop = $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
2172 $create = $target->db->query(
"CREATE TABLE " . $cTable[0] .
" LIKE " . $source->getDbName() .
"." . $cTable[0]);
2176 $insert = $target->db->query(
"INSERT INTO " . $cTable[0] .
" SELECT * FROM ".$source->getDbName().
".".$cTable[0]);
2189 require_once
'./Services/Http/exceptions/class.ilProxyException.php';
2190 $settings =
$client->getAllSettings();
2192 if((
bool)$settings[
'proxy_status'] ==
true)
2201 require_once
'Services/PEAR/lib/Net/Socket.php';
2205 $response = $socket->connect($settings[
'proxy_host'], $settings[
'proxy_port']);
2206 if(!is_bool($response))
2209 throw new ilProxyException(strlen($response) ? $response : $lng->txt(
'proxy_not_connectable'));
2217 ilUtil::sendFailure($this->lng->txt(
'proxy_pear_net_socket_error').
': '.$e->getMessage());
2225 $db = $this->client->getDB();
2226 $proxy_fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
2228 foreach($proxy_fields as $field)
2230 if( isset($proxy_settings[$field]) )
2232 $query =
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
2234 array(
'text',
'text'), array(
'common', $field));
2239 if( count(
$row) > 0 )
2244 'value' => array(
'text', $proxy_settings[$field])
2247 'module' => array(
'text',
'common'),
2248 'keyword' => array(
'text', $field)
2257 'module' => array(
'text',
'common'),
2258 'keyword' => array(
'text', $field),
2259 'value' => array(
'text', $proxy_settings[$field])
2274 return parent::getFileName();
2279 if(!parent::valid())
2283 if($this->isFile() and substr(parent::getFileName(),-4) ==
'.xml')
2287 if($this->isFile() and substr(parent::getFileName(),-8) !=
'_inserts')
2292 return $this->
valid();