diff --git a/modules/install/install.controller.php b/modules/install/install.controller.php index 3db8d17bd..e9f9627ae 100644 --- a/modules/install/install.controller.php +++ b/modules/install/install.controller.php @@ -100,7 +100,7 @@ class installController extends install // Save rewrite and time zone settings if(!Context::get('install_config')) { - $config_info = Context::gets('use_rewrite','time_zone'); + $config_info = Context::gets('use_rewrite','time_zone', 'use_ssl'); if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; if(!$this->makeEtcConfigFile($config_info)) { @@ -452,52 +452,6 @@ class installController extends install } } - /** - * check this server can use rewrite module - * make a file to files/config and check url approach by ".htaccess" rules - * - * @return bool - */ - function checkRewriteUsable() { - $checkString = "isApproached"; - $checkFilePath = 'files/config/tmpRewriteCheck.txt'; - - FileHandler::writeFile(_XE_PATH_.$checkFilePath, trim($checkString)); - - $scheme = ($_SERVER['HTTPS'] === 'on') ? 'https' : 'http'; - $hostname = $_SERVER['SERVER_NAME']; - $port = $_SERVER['SERVER_PORT']; - $str_port = ''; - if($port) - { - $str_port = ':' . $port; - } - - $tmpPath = $_SERVER['DOCUMENT_ROOT']; - - //if DIRECTORY_SEPARATOR is not /(IIS) - if(DIRECTORY_SEPARATOR !== '/') - { - //change to slash for compare - $tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']); - } - - $query = "/JUST/CHECK/REWRITE/" . $checkFilePath; - $currentPath = str_replace($tmpPath, "", _XE_PATH_); - if($currentPath != "") - { - $query = $currentPath . $query; - } - $requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query); - $requestConfig = array(); - $requestConfig['ssl_verify_peer'] = false; - $buff = FileHandler::getRemoteResource($requestUrl, null, 3, 'GET', null, array(), array(), array(), $requestConfig); - - FileHandler::removeFile(_XE_PATH_.$checkFilePath); - - return (trim($buff) == $checkString); - } - /** * @brief Create files and subdirectories * Local evironment setting before installation by using DB information diff --git a/modules/install/install.view.php b/modules/install/install.view.php index dbee3109c..eb92f91e7 100644 --- a/modules/install/install.view.php +++ b/modules/install/install.view.php @@ -7,7 +7,10 @@ */ class installView extends install { - var $install_enable = false; + public $install_enable = false; + + public static $rewriteCheckFilePath = 'files/cache/tmpRewriteCheck.txt'; + public static $rewriteCheckString = ''; /** * @brief Initialization @@ -97,12 +100,11 @@ class installView extends install function dispInstallCheckEnv() { $oInstallController = getController('install'); - $useRewrite = $oInstallController->checkRewriteUsable() ? 'Y' : 'N'; - $_SESSION['use_rewrite'] = $useRewrite; - Context::set('use_rewrite', $useRewrite); - - // nginx 체크, rewrite 사용법 안내 - if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); + + self::$rewriteCheckString = Password::createSecureSalt(32); + FileHandler::writeFile(_XE_PATH_ . self::$rewriteCheckFilePath, self::$rewriteCheckString);; + Context::set('use_rewrite', $_SESSION['use_rewrite'] = 'N'); + Context::set('use_nginx', stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false); $this->setTemplateFile('check_env'); } @@ -114,6 +116,16 @@ class installView extends install { // Display check_env if it is not installable if(!$this->install_enable) return $this->dispInstallCheckEnv(); + + // Delete mod_rewrite check file + FileHandler::removeFile(_XE_PATH_ . self::$rewriteCheckFilePath); + + // Save mod_rewrite check status + if(Context::get('rewrite') === 'Y') + { + Context::set('use_rewrite', $_SESSION['use_rewrite'] = 'Y'); + } + // Enter ftp information if(ini_get('safe_mode') && !Context::isFTPRegisted()) { @@ -169,7 +181,8 @@ class installView extends install include _XE_PATH_.'files/config/tmpDB.config.php'; - Context::set('use_rewrite', $_SESSION['use_rewrite']); + Context::set('use_rewrite', $_SESSION['use_rewrite']); + Context::set('use_ssl', $_SERVER['HTTPS'] === 'on' ? 'always' : 'none'); Context::set('time_zone', $GLOBALS['time_zone']); Context::set('db_type', $db_info->db_type); $this->setTemplateFile('admin_form'); diff --git a/modules/install/lang/lang.xml b/modules/install/lang/lang.xml index 13d144267..6a1e0a1c0 100644 --- a/modules/install/lang/lang.xml +++ b/modules/install/lang/lang.xml @@ -722,6 +722,11 @@ http://blah/?document_srl=123 sẽ được rút ngắn thành http://blah/123]]> + + + + + @@ -761,27 +766,50 @@ - - - - - - - - - - + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 데이터 파일은 777퍼미션 설정된 곳으로 지정해주세요.]]> diff --git a/modules/install/tpl/admin_form.html b/modules/install/tpl/admin_form.html index 33f01a43e..0694b43bd 100644 --- a/modules/install/tpl/admin_form.html +++ b/modules/install/tpl/admin_form.html @@ -48,6 +48,16 @@

{$lang->about_time_zone}

+
+ +
+ +
+
diff --git a/modules/install/tpl/check_env.html b/modules/install/tpl/check_env.html index 9973f2311..aadff1a61 100644 --- a/modules/install/tpl/check_env.html +++ b/modules/install/tpl/check_env.html @@ -29,12 +29,17 @@ mod_rewrite - - OK - + + + - + + + {$lang->checking_rewrite} + + + {$lang->disable_rewrite}
{$lang->about_nginx_rewrite}
diff --git a/modules/install/tpl/js/install.js b/modules/install/tpl/js/install.js index 33f37f18e..15bcc7389 100644 --- a/modules/install/tpl/js/install.js +++ b/modules/install/tpl/js/install.js @@ -6,6 +6,28 @@ jQuery(function($){ $("p.db_type_" + $(this).val()).show(); }).triggerHandler("click"); } + if($("#mod_rewrite_checking").size()) { + var checking = $("#mod_rewrite_checking"); + $.ajax({ + url: checking.data("url"), + cache : false, + dataType: "text", + success: function(data) { + if($.trim(data) === checking.data("verify")) { + $("#mod_write_status span.ok").show(); + $("#mod_write_status span.no").hide(); + $("#task-checklist-confirm").attr("href", $("#task-checklist-confirm").attr("href") + "&rewrite=Y"); + } else { + $("#mod_rewrite_no_support").show(); + } + checking.hide(); + }, + error: function() { + $("#mod_rewrite_no_support").show(); + checking.hide(); + } + }); + } if($("input[name='user_id']").size() && $("input[name='email_address']").size()) { var user_id_input = $("input[name='user_id']"); var email_input = $("input[name='email_address']");