diff --git a/modules/admin/admin.admin.controller.php b/modules/admin/admin.admin.controller.php
index 01cbfd337..cdff0d549 100644
--- a/modules/admin/admin.admin.controller.php
+++ b/modules/admin/admin.admin.controller.php
@@ -987,6 +987,145 @@ class adminAdminController extends admin
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSitelock'));
}
+ /**
+ * Insert or update domain info
+ * @return void
+ */
+ function procAdminInsertDomain()
+ {
+ $vars = Context::getRequestVars();
+ $domain_srl = strval($vars->domain_srl);
+ $domain_info = null;
+ if ($domain_srl !== '')
+ {
+ $output = executeQuery('module.getDomainInfo', (object)array('domain_srl' => $domain_srl));
+ if ($output->toBool() && $output->data)
+ {
+ $domain_info = $output->data;
+ }
+ }
+
+ // Validate the domain.
+ if (!preg_match('@^https?://@', $vars->domain))
+ {
+ $vars->domain = 'http://' . $vars->domain;
+ }
+ try
+ {
+ $vars->domain = Rhymix\Framework\URL::getDomainFromUrl(strtolower($vars->domain));
+ }
+ catch (Exception $e)
+ {
+ $vars->domain = '';
+ }
+ if (!$vars->domain)
+ {
+ return new Object(-1, 'msg_invalid_domain');
+ }
+ $existing_domain = getModel('module')->getSiteInfoByDomain($vars->domain);
+ if ($existing_domain && $existing_domain->domain == $vars->domain && (!$domain_info || $existing_domain->domain_srl != $domain_info->domain_srl))
+ {
+ return new Object(-1, 'msg_domain_already_exists');
+ }
+
+ // Validate the ports.
+ if ($vars->http_port == 80 || !$vars->http_port)
+ {
+ $vars->http_port = 0;
+ }
+ if ($vars->https_port == 443 || !$vars->https_port)
+ {
+ $vars->https_port = 0;
+ }
+ if ($vars->http_port !== 0 && ($vars->http_port < 1 || $vars->http_port > 65535 || $vars->http_port == 443))
+ {
+ return new Object(-1, 'msg_invalid_http_port');
+ }
+ if ($vars->https_port !== 0 && ($vars->https_port < 1 || $vars->https_port > 65535 || $vars->https_port == 80))
+ {
+ return new Object(-1, 'msg_invalid_http_port');
+ }
+
+ // Validate the security setting.
+ $valid_security_options = array('none', 'optional', 'always');
+ if (!in_array($vars->domain_security, $valid_security_options))
+ {
+ $vars->domain_security = 'none';
+ }
+
+ // Validate the index module setting.
+ $module_info = getModel('module')->getModuleInfoByModuleSrl(intval($vars->index_module_srl));
+ if (!$module_info || $module_info->module_srl != $vars->index_module_srl)
+ {
+ return new Object(-1, 'msg_invalid_index_module_srl');
+ }
+
+ // Validate the index document setting.
+ if ($vars->index_document_srl)
+ {
+ $oDocument = getModel('document')->getDocument($vars->index_document_srl);
+ if (!$oDocument || !$oDocument->isExists())
+ {
+ return new Object(-1, 'msg_invalid_index_document_srl');
+ }
+ }
+ else
+ {
+ $vars->index_document_srl = 0;
+ }
+
+ // Validate the default language.
+ $enabled_lang = Rhymix\Framework\Config::get('locale.enabled_lang');
+ if (!in_array($vars->default_lang, $enabled_lang))
+ {
+ return new Object(-1, 'msg_lang_is_not_enabled');
+ }
+
+ // Insert or update the domain.
+ if (!$domain_info)
+ {
+ $args = new stdClass();
+ $args->domain_srl = getNextSequence();
+ $args->domain = $vars->domain;
+ $args->index_module_srl = $vars->index_module_srl;
+ $args->index_document_srl = $vars->index_document_srl;
+ $args->http_port = $vars->http_port;
+ $args->https_port = $vars->https_port;
+ $args->security = $vars->domain_security;
+ $args->description = '';
+ $args->settings = json_encode(array('language' => $vars->default_lang, 'timezone' => null));
+ $output = executeQuery('module.insertDomain', $args);
+ if (!$output->toBool())
+ {
+ return $output;
+ }
+ }
+ else
+ {
+ $args = new stdClass();
+ $args->domain_srl = $domain_info->domain_srl;
+ $args->domain = $vars->domain;
+ $args->index_module_srl = $vars->index_module_srl;
+ $args->index_document_srl = $vars->index_document_srl;
+ $args->http_port = $vars->http_port;
+ $args->https_port = $vars->https_port;
+ $args->security = $vars->domain_security;
+ $args->settings = json_encode(array_merge($domain_info->settings, array('language' => $vars->default_lang)));
+ $output = executeQuery('module.updateDomain', $args);
+ if (!$output->toBool())
+ {
+ return $output;
+ }
+
+ }
+
+ // Clear cache.
+ Rhymix\Framework\Cache::clearGroup('site_and_module');
+
+ // Redirect to the domain list.
+ $this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigDomains'));
+ }
+
/**
* Update FTP configuration.
*/
diff --git a/modules/admin/admin.admin.view.php b/modules/admin/admin.admin.view.php
index addf8cb4d..4b2144323 100644
--- a/modules/admin/admin.admin.view.php
+++ b/modules/admin/admin.admin.view.php
@@ -691,6 +691,54 @@ class adminAdminView extends admin
$this->setTemplateFile('config_sitelock');
}
+ /**
+ * Display domain edit screen
+ * @return void
+ */
+ function dispAdminInsertDomain()
+ {
+ // Get selected domain.
+ $domain_srl = strval(Context::get('domain_srl'));
+ $domain_info = null;
+ if ($domain_srl !== '')
+ {
+ $output = executeQuery('module.getDomainInfo', (object)array('domain_srl' => $domain_srl));
+ if ($output->toBool() && $output->data)
+ {
+ $domain_info = $output->data;
+ }
+ }
+ Context::set('domain_info', $domain_info);
+
+ // Get modules.
+ $module_list = getModel('module')->getMidList();
+ if ($domain_info && $domain_info->index_module_srl)
+ {
+ $index_module_srl = $domain_info->index_module_srl;
+ }
+ else
+ {
+ $index_module_srl = 0;
+ }
+ Context::set('module_list', $module_list);
+ Context::set('index_module_srl', $index_module_srl);
+
+ // Get language list.
+ Context::set('supported_lang', Rhymix\Framework\Lang::getSupportedList());
+ Context::set('enabled_lang', Rhymix\Framework\Config::get('locale.enabled_lang'));
+ if ($domain_info && $domain_info->settings->language)
+ {
+ $domain_lang = $domain_info->settings->language;
+ }
+ else
+ {
+ $domain_lang = Rhymix\Framework\Config::get('locale.default_lang');
+ }
+ Context::set('domain_lang', $domain_lang);
+
+ $this->setTemplateFile('config_domains_edit');
+ }
+
/**
* Display FTP Configuration(settings) page
* @return void
diff --git a/modules/admin/conf/module.xml b/modules/admin/conf/module.xml
index 16709df91..b24cfd36e 100644
--- a/modules/admin/conf/module.xml
+++ b/modules/admin/conf/module.xml
@@ -12,6 +12,7 @@
\'선택적으로\'는 회원가입, 정보수정 등의 일부 동작에서만 선택적으로 보안접속(SSL)을 사용합니다.
\'항상 사용\'은 모든 서비스에 SSL을 사용 합니다.
SSL 환경이 갖춰지지 않은 상태에서 SSL을 사용할 경우, 접속이 되지 않을 수 있습니다. SSL 인증서가 정상적으로 설치되었는지 반드시 확인하고 설정하시기 바랍니다.
'; -$lang->server_ports = '서버 포트 지정'; +$lang->cmd_edit_domain = '도메인 정보 수정'; +$lang->about_use_ssl = '\'선택적으로 사용\'은 회원가입, 정보수정 등의 지정된 동작(action)에서만 보안접속(HTTPS)을 사용합니다.