Implement multidomain settings

This commit is contained in:
Kijin Sung 2017-03-13 13:47:07 +09:00
parent 51d0aa5e5e
commit 79f29b3372
7 changed files with 63 additions and 13 deletions

View file

@ -44,6 +44,7 @@ return array(
),
'url' => array(
'default' => null,
'unregistered_domain_action' => 'redirect_301',
'http_port' => null,
'https_port' => null,
'ssl' => 'none',

View file

@ -507,6 +507,23 @@ class adminAdminController extends admin
{
$vars = Context::getRequestVars();
// Validate the unregistered domain action.
$valid_actions = array('redirect_301', 'redirect_302', 'display', 'block');
if (!in_array($vars->unregistered_domain_action, $valid_actions))
{
$vars->unregistered_domain_action = 'redirect_301';
}
// Save system config.
Rhymix\Framework\Config::set('url.unregistered_domain_action', $vars->unregistered_domain_action);
Rhymix\Framework\Config::set('use_sso', $vars->use_sso === 'Y');
if (!Rhymix\Framework\Config::save())
{
return new Object(-1, 'msg_failed_to_save_config');
}
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigGeneral'));
}
/**
@ -761,7 +778,6 @@ class adminAdminController extends admin
// Other settings
Rhymix\Framework\Config::set('use_rewrite', $vars->use_rewrite === 'Y');
Rhymix\Framework\Config::set('use_sso', $vars->use_sso === 'Y');
Rhymix\Framework\Config::set('session.delay', $vars->delay_session === 'Y');
Rhymix\Framework\Config::set('session.use_db', $vars->use_db_session === 'Y');
Rhymix\Framework\Config::set('session.use_keys', $vars->use_session_keys === 'Y');

View file

@ -556,7 +556,6 @@ class adminAdminView extends admin
Context::set('use_rewrite', Rhymix\Framework\Config::get('use_rewrite'));
Context::set('use_mobile_view', (config('mobile.enabled') !== null ? config('mobile.enabled') : config('use_mobile_view')) ? true : false);
Context::set('tablets_as_mobile', config('mobile.tablets') ? true : false);
Context::set('use_sso', Rhymix\Framework\Config::get('use_sso'));
Context::set('use_ssl', Rhymix\Framework\Config::get('url.ssl'));
Context::set('delay_session', Rhymix\Framework\Config::get('session.delay'));
Context::set('use_session_keys', Rhymix\Framework\Config::get('session.use_keys'));

View file

@ -119,6 +119,12 @@ $lang->cmd_default_language = 'Default Language';
$lang->cmd_new_domain = 'Add New Domain';
$lang->cmd_edit_domain = 'Edit Domain';
$lang->cmd_is_default_domain = 'Default Domain';
$lang->cmd_multidomain_configuration = 'Multidomain Configuration';
$lang->cmd_unregistered_domain_action = 'Unregistered Domains';
$lang->cmd_unregistered_domain_redirect_301 = '301 Redirect to Default Domain (Recommended)';
$lang->cmd_unregistered_domain_redirect_302 = '302 Redirect to Default Domain';
$lang->cmd_unregistered_domain_display = 'Display Main Screen as Usual';
$lang->cmd_unregistered_domain_block = '404 Not Found';
$lang->about_use_ssl = 'Selecting \'Optional\' is to use SSL for the specified actions such as signing up and changing information.<br />Selecting \'Always\' is to use SSL for the entire pages, generated by Rhymix.<br>Please be careful! You may not be able to access to the site, before installing SSL certificate.';
$lang->server_ports = 'Server Port';
$lang->about_server_ports = 'If your web server does not use 80 for HTTP or 443 for HTTPS port, you should specify server ports.';
@ -258,7 +264,7 @@ $lang->detail_use_mobile_icon = 'The mobile icon should be 57x57 or 114x114, onl
$lang->cmd_site_default_image = 'Default Image';
$lang->about_site_default_image = 'This image will be shown when your site is linked to in various social networks. It should be 200x200, either jpg or png format.';
$lang->use_sso = 'Use <abbr title="Single Sign On">SSO</abbr>?';
$lang->about_use_sso = 'If your site uses multiple domains, logging into one domain will automatically log the user into all domains.';
$lang->about_use_sso = 'Logging into one domain will automatically log the user into all domains.';
$lang->about_arrange_session = 'Do you want to clean up session?';
$lang->cmd_clear_session = 'Clean up session';
$lang->save = 'Save';

View file

@ -118,6 +118,12 @@ $lang->cmd_default_language = '기본 언어';
$lang->cmd_new_domain = '새 도메인 추가';
$lang->cmd_edit_domain = '도메인 정보 수정';
$lang->cmd_is_default_domain = '기본 도메인';
$lang->cmd_multidomain_configuration = '멀티도메인 기능 설정';
$lang->cmd_unregistered_domain_action = '등록되지 않은 도메인 처리';
$lang->cmd_unregistered_domain_redirect_301 = '기본 도메인으로 301 Redirect (권장)';
$lang->cmd_unregistered_domain_redirect_302 = '기본 도메인으로 302 Redirect';
$lang->cmd_unregistered_domain_display = '메인 화면 표시';
$lang->cmd_unregistered_domain_block = '404 Not Found 오류 표시';
$lang->about_use_ssl = '\'선택적으로 사용\'은 회원가입, 정보수정 등의 지정된 동작(action)에서만 보안접속(HTTPS)을 사용합니다.<br>\'항상 사용\'은 사이트 전체에 HTTPS를 사용합니다.<br>SSL 인증서가 설치되지 않은 상태에서 HTTPS 사용을 시도하면 접속이 되지 않을 수 있으니 주의하시기 바랍니다.';
$lang->server_ports = '포트';
$lang->about_server_ports = 'HTTP는 80, HTTPS는 443 이 아닌, 다른 포트를 사용할 경우에 포트를 지정해 주어야 합니다.';
@ -252,7 +258,7 @@ $lang->detail_use_mobile_icon = '57x57 또는 114x114 크기의 png 파일을
$lang->cmd_site_default_image = '사이트 대표 이미지';
$lang->about_site_default_image = 'SNS 등에 이 사이트가 링크되었을 때 표시되는 이미지입니다. 200x200 크기의 jpg 또는 png 파일을 권장합니다.';
$lang->use_sso = '<abbr title="Single Sign On">SSO</abbr> 사용';
$lang->about_use_sso = '여러 도메인을 사용하는 사이트에서 한 번만 로그인하면 모든 도메인에 로그인되도록 합니다.';
$lang->about_use_sso = '한 번만 로그인하면 모든 도메인에 로그인되도록 합니다.';
$lang->about_arrange_session = '세션을 정리하시겠습니까?';
$lang->cmd_clear_session = '세션 정리';
$lang->save = '저장';

View file

@ -116,15 +116,6 @@
<p class="x_help-block">{$lang->about_use_session_ssl}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->use_sso}</label>
<div class="x_controls">
<label for="use_sso_y" class="x_inline"><input type="radio" name="use_sso" id="use_sso_y" value="Y" checked="checked"|cond="$use_sso" /> {$lang->cmd_yes}</label>
<label for="use_sso_n" class="x_inline"><input type="radio" name="use_sso" id="use_sso_n" value="N" checked="checked"|cond="!$use_sso" /> {$lang->cmd_no}</label>
<br />
<p class="x_help-block">{$lang->about_use_sso}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->thumbnail_type}</label>
<div class="x_controls">

View file

@ -60,10 +60,41 @@
</section>
<section class="section">
<h2>{$lang->cmd_multidomain_configuration}</h2>
<form action="./" method="post" class="x_form-horizontal">
<input type="hidden" name="module" value="admin" />
<input type="hidden" name="act" value="procAdminUpdateDomains" />
<input type="hidden" name="xe_validator_id" value="modules/admin/tpl/config_domains/1" />
<div class="x_control-group">
<label class="x_control-label">{$lang->cmd_unregistered_domain_action}</label>
<div class="x_controls">
<label for="unregistered_domain_redirect_301">
<input type="radio" name="unregistered_domain_action" id="unregistered_domain_redirect_301" value="redirect_301" checked="checked"|cond="config('url.unregistered_domain_action') === 'redirect_301' || !config('url.unregistered_domain_action')" />
{$lang->cmd_unregistered_domain_redirect_301}
</label>
<label for="unregistered_domain_redirect_302">
<input type="radio" name="unregistered_domain_action" id="unregistered_domain_redirect_302" value="redirect_302" checked="checked"|cond="config('url.unregistered_domain_action') === 'redirect_302'" />
{$lang->cmd_unregistered_domain_redirect_302}
</label>
<label for="unregistered_domain_display">
<input type="radio" name="unregistered_domain_action" id="unregistered_domain_display" value="display" checked="checked"|cond="config('url.unregistered_domain_action') === 'display'" />
{$lang->cmd_unregistered_domain_display}
</label>
<label for="unregistered_domain_block">
<input type="radio" name="unregistered_domain_action" id="unregistered_domain_block" value="block" checked="checked"|cond="config('url.unregistered_domain_action') === 'block'" />
{$lang->cmd_unregistered_domain_block}
</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->use_sso}</label>
<div class="x_controls">
<label for="use_sso_y" class="x_inline"><input type="radio" name="use_sso" id="use_sso_y" value="Y" checked="checked"|cond="config('use_sso')" /> {$lang->cmd_yes}</label>
<label for="use_sso_n" class="x_inline"><input type="radio" name="use_sso" id="use_sso_n" value="N" checked="checked"|cond="!config('use_sso')" /> {$lang->cmd_no}</label>
<br />
<p class="x_help-block">{$lang->about_use_sso}</p>
</div>
</div>
<div class="x_clearfix btnArea">
<div class="x_pull-right">
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>