22 $this->
stop(
'msg_already_installed');
25 $this->db_tmp_config_file =
_XE_PATH_.
'files/config/tmpDB.config.php';
26 $this->etc_tmp_config_file =
_XE_PATH_.
'files/config/tmpEtc.config.php';
89 $con_string =
Context::gets(
'db_type',
'db_port',
'db_hostname',
'db_userid',
'db_password',
'db_database',
'db_table_prefix');
91 $db_info =
new stdClass();
92 $db_info->master_db = get_object_vars($con_string);
93 $db_info->slave_db = array($db_info->master_db);
96 $db_info->use_mobile_view =
'Y';
105 if(!$oDB->isConnected())
return $oDB->getError();
113 header(
'location:'.$returnUrl);
125 if($config_info->use_rewrite!=
'Y') $config_info->use_rewrite =
'N';
133 header(
'location:'.$returnUrl);
150 if(!$oMemberModel->checkPasswordStrength($vars->password,
'high'))
179 if(!$oDB->isConnected())
return $oDB->getError();
186 }
catch(Exception $e) {
196 if(count($scripts)>0)
199 foreach($scripts as $script)
202 $output = include($script_path . $script);
213 unset($_SESSION[
'use_rewrite']);
218 header(
'location:'.$returnUrl);
228 $db_info =
new stdClass();
229 $db_info->master_db = array(
238 $db_info->slave_db = array($db_info->master_db);
245 if($_SERVER[
'HTTPS'] ==
'on')
248 $https_port = (!$https_port != 443) ? $https_port : null;
253 $http_port = (!$http_port != 80) ? $http_port : null;
255 if($http_port) $db_info->http_port = $http_port;
256 if($https_port) $db_info->https_port = $https_port;
267 $ftp_info =
Context::gets(
'ftp_host',
'ftp_user',
'ftp_password',
'ftp_port',
'ftp_root_path');
268 $ftp_info->ftp_port = (int)$ftp_info->ftp_port;
269 if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
270 if(!$ftp_info->ftp_host) $ftp_info->ftp_host =
'127.0.0.1';
271 if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path =
'/';
273 $buff = array(
'<?php if(!defined("__XE__")) exit();');
274 $buff[] =
"\$ftp_info = new stdClass();";
275 foreach($ftp_info as $key => $val)
277 $buff[] = sprintf(
"\$ftp_info->%s='%s';", $key, str_replace(
"'",
"\\'",$val));
281 if(ini_get(
'safe_mode'))
283 if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
return new BaseObject(-1,
'msg_safe_mode_ftp_needed');
285 require_once(
_XE_PATH_.
'libs/ftp.class.php');
287 if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
return new BaseObject(-1, sprintf(
Context::getLang(
'msg_ftp_not_connected'),
'host'));
289 if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
292 return new BaseObject(-1,
'msg_ftp_invalid_auth_info');
295 if(!is_dir(
_XE_PATH_.
'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.
'files'))
298 return new BaseObject(-1,
'msg_ftp_mkdir_fail');
301 if(!$oFtp->ftp_site(
"CHMOD 777 ".$ftp_info->ftp_root_path.
'files'))
304 return new BaseObject(-1,
'msg_ftp_chmod_fail');
307 if(!is_dir(
_XE_PATH_.
'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.
'files/config'))
310 return new BaseObject(-1,
'msg_ftp_mkdir_fail');
313 if(!$oFtp->ftp_site(
"CHMOD 777 ".$ftp_info->ftp_root_path.
'files/config'))
316 return new BaseObject(-1,
'msg_ftp_chmod_fail');
327 $ftp_info =
Context::gets(
'ftp_user',
'ftp_password',
'ftp_port',
'sftp');
328 $ftp_info->ftp_port = (int)$ftp_info->ftp_port;
329 if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
330 if(!$ftp_info->sftp) $ftp_info->sftp =
'N';
332 if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
return new BaseObject(-1,
'msg_safe_mode_ftp_needed');
334 if($ftp_info->sftp ==
'Y')
336 $connection = ssh2_connect(
'localhost', $ftp_info->ftp_port);
337 if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
339 return new BaseObject(-1,
'msg_ftp_invalid_auth_info');
344 require_once(
_XE_PATH_.
'libs/ftp.class.php');
346 if(!$oFtp->ftp_connect(
'127.0.0.1', $ftp_info->ftp_port))
return new BaseObject(-1, sprintf(
Context::getLang(
'msg_ftp_not_connected'),
'localhost'));
348 if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
351 return new BaseObject(-1,
'msg_ftp_invalid_auth_info');
365 $checklist = array();
367 $checklist[
'php_version'] =
true;
370 $checklist[
'php_version'] =
false;
379 if(is_writable(
'./')||is_writable(
'./files')) $checklist[
'permission'] =
true;
380 else $checklist[
'permission'] =
false;
382 if(function_exists(
'xml_parser_create')) $checklist[
'xml'] =
true;
383 else $checklist[
'xml'] =
false;
385 if(ini_get(
'session.auto_start')!=1) $checklist[
'session'] =
true;
386 else $checklist[
'session'] =
false;
388 if(function_exists(
'iconv')) $checklist[
'iconv'] =
true;
389 else $checklist[
'iconv'] =
false;
391 if(function_exists(
'imagecreatefromgif')) $checklist[
'gd'] =
true;
392 else $checklist[
'gd'] =
false;
395 else $checklist[
'db'] =
false;
397 if(!$checklist[
'php_version'] || !$checklist[
'permission'] || !$checklist[
'xml'] || !$checklist[
'session'] || !$checklist[
'db']) $install_enable =
false;
398 else $install_enable =
true;
405 return $install_enable;
415 $license_agreement = ($vars->license_agreement ==
'Y') ?
true :
false;
417 if($license_agreement)
419 $currentTime = $_SERVER[
'REQUEST_TIME'];
425 return new BaseObject(-1,
'msg_must_accept_license_agreement');
442 $checkString =
"isApproached";
443 $checkFilePath =
'files/config/tmpRewriteCheck.txt';
447 $scheme = ($_SERVER[
'HTTPS'] ===
'on') ?
'https' :
'http';
448 $hostname = $_SERVER[
'SERVER_NAME'];
449 $port = $_SERVER[
'SERVER_PORT'];
453 $str_port =
':' . $port;
456 $tmpPath = $_SERVER[
'DOCUMENT_ROOT'];
459 if(DIRECTORY_SEPARATOR !==
'/')
462 $tmpPath = str_replace(DIRECTORY_SEPARATOR,
'/', $_SERVER[
'DOCUMENT_ROOT']);
465 $query =
"/JUST/CHECK/REWRITE/" . $checkFilePath;
466 $currentPath = str_replace($tmpPath,
"",
_XE_PATH_);
467 if($currentPath !=
"")
469 $query = $currentPath . $query;
471 $requestUrl = sprintf(
'%s://%s%s%s', $scheme, $hostname, $str_port, $query);
472 $requestConfig = array();
473 $requestConfig[
'ssl_verify_peer'] =
false;
478 return (trim($buff) == $checkString);
487 $directory_list = array(
489 './files/cache/queries',
490 './files/cache/js_filter_compiled',
491 './files/cache/template_compiled',
494 foreach($directory_list as $dir)
513 $tmp_arr = explode(
'/',$module_path);
514 $module = $tmp_arr[count($tmp_arr)-1];
523 if($oModule->checkUpdate()) $oModule->moduleUpdate();
525 $install_step = array(
'system',
'content',
'member');
527 foreach($install_step as $category)
529 if(count($modules[$category]))
531 foreach($modules[$category] as
$module)
533 if($module ==
'module')
continue;
534 $this->
installModule($module, sprintf(
'./modules/%s', $module));
537 if(is_object($oModule) && method_exists($oModule,
'checkUpdate'))
539 if($oModule->checkUpdate()) $oModule->moduleUpdate();
542 unset($modules[$category]);
548 foreach($modules as $category => $module_list)
550 if(count($module_list))
552 foreach($module_list as
$module)
554 if($module ==
'module')
continue;
555 $this->
installModule($module, sprintf(
'./modules/%s', $module));
558 if($oModule && method_exists($oModule,
'checkUpdate') && method_exists($oModule,
'moduleUpdate'))
560 if($oModule->checkUpdate()) $oModule->moduleUpdate();
581 $file_cnt = count($schema_files);
582 for($i=0;$i<$file_cnt;$i++)
584 $file = trim($schema_files[$i]);
585 if(!$file || substr($file,-4)!=
'.xml')
continue;
586 $output = $oDB->createTableByXmlFile($file);
588 throw new Exception(
'msg_create_table_failed');
593 if(method_exists($oModule,
'moduleInstall')) $oModule->moduleInstall();
599 if(substr($db_info->master_db[
'db_table_prefix'], -1) !=
'_')
601 $db_info->master_db[
'db_table_prefix'] .=
'_';
604 foreach($db_info->slave_db as &$slave)
606 if(substr($slave[
'db_table_prefix'], -1) !=
'_')
608 $slave[
'db_table_prefix'] .=
'_';
613 $buff[] =
'<?php if(!defined("__XE__")) exit();';
614 $buff[] =
'$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) .
';';
616 return implode(PHP_EOL, $buff);
628 if(!$db_info)
return;
646 $buff =
'<?php if(!defined("__XE__")) exit();'.
"\n";
647 foreach($config_info as $key => $val)
649 $buff .= sprintf(
"\$db_info->%s = '%s';\n", $key, str_replace(
"'",
"\\'",$val));
669 if(!$db_info)
return;
675 if(@file_exists($config_file))
682 }
catch (Exception $e) {
689 include $install_config_file;
690 if(!is_array($auto_config))
return false;
692 $auto_config[
'module'] =
'install';
693 $auto_config[
'act'] =
'procInstall';
695 $fstr =
"<%s><![CDATA[%s]]></%s>\r\n";
696 $fheader =
"POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n";
697 $body =
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";
698 foreach($auto_config as $k => $v)
700 if(!in_array($k,array(
'host',
'port',
'path'))) $body .= sprintf($fstr,$k,$v,$k);
702 $body .=
"</params>\r\n</methodCall>";
704 $header = sprintf($fheader,$auto_config[
'path'],$auto_config[
'host'],strlen($body),$body);
705 $fp = @fsockopen($auto_config[
'host'], $auto_config[
'port'], $errno, $errstr, 5);
712 $line = trim(fgets($fp, 4096));
713 if(strncmp(
'<error>', $line, 7) === 0)
setMessage($message= 'success', $type=NULL)
checkInstallEnv()
Result returned after checking the installation environment.
_makeDbInfoByInstallConfig()
Make DB Information by Install Config.
procPostgresqlDBSetting()
postgresql db setting wrapper, becase Server Side Validator... Server Side Validatro can use only one...
_procDBSetting()
division install step... DB Config temp file create
makeDefaultDirectory()
Create files and subdirectories Local evironment setting before installation by using DB information...
set($key, $val, $set_to_get_vars=0)
installModule($module, $module_path)
Install an each module.
writeFile($filename, $buff, $mode="w")
installByConfig($install_config_file)
const __XE_RECOMMEND_PHP_VERSION__
makeConfigFile()
Create config file Create the config file when all settings are completed.
procInstall()
Install with received information.
$xml_info
an object containing the module description extracted from XML file
$module_path
a path to directory where module source code resides
getRemoteResource($url, $body=null, $timeout=3, $method= 'GET', $content_type=null, $headers=array(), $cookies=array(), $post_data=array(), $request_config=array())
_getDBConfigFileContents($db_info)
setLangType($lang_type= 'ko')
procInstallLicenseAggrement()
License agreement.
installDownloadedModule()
Install all the modules.
procConfigSetting()
division install step... rewrite, time_zone Config temp file create
procCubridDBSetting()
cubrid db setting wrapper, becase Server Side Validator... Server Side Validatro can use only one pro...
setRedirectUrl($url= './', $output=NULL)
install module of the Controller class
install module of the high class
getInstance($db_type=NULL)
makeEtcConfigFile($config_info)
Create etc config file Create the config file when all settings are completed.
procSqliteDBSetting()
sqlite db setting wrapper, becase Server Side Validator... Server Side Validatro can use only one pro...
getRequestUri($ssl_mode=FOLLOW_REQUEST_SSL, $domain=null)
const __XE_MIN_PHP_VERSION__
makeDBConfigFile()
Create DB temp config file Create the config file when all settings are completed.
procFirebirdDBSetting()
firebird db setting wrapper, becase Server Side Validator... Server Side Validatro can use only one p...
procMssqlDBSetting()
mssql db setting wrapper, becase Server Side Validator... Server Side Validatro can use only one proc...
getAdminController($module_name)
readDir($path, $filter= '', $to_lower=FALSE, $concat_prefix=FALSE)
$module
Class name of Xe Module that is identified by mid.
procInstallFTP()
Set FTP Information.
procMysqlDBSetting()
mysql db setting wrapper, becase Server Side Validator... Server Side Validatro can use only one proc...