Also use system_message template for site lock

This commit is contained in:
Kijin Sung 2016-02-09 10:55:26 +09:00
parent bc33e8f478
commit 95f8bf9a43
4 changed files with 41 additions and 12 deletions

View file

@ -242,12 +242,6 @@ class Context
// Load system configuration.
$this->loadDBInfo();
// If the site is locked, display the locked page.
if(config('lock.locked'))
{
self::enforceSiteLock();
}
// If Rhymix is installed, get virtual site information.
if(self::isInstalled())
{
@ -390,6 +384,12 @@ class Context
}
self::set('current_url', $current_url);
self::set('request_uri', $request_uri);
// If the site is locked, display the locked page.
if(config('lock.locked'))
{
self::enforceSiteLock();
}
}
/**
@ -1429,6 +1429,18 @@ class Context
*/
private static function enforceSiteLock()
{
// Allow if the current user is logged in as administrator, or trying to log in.
$logged_info = self::get('logged_info');
if ($logged_info && $logged_info->is_admin === 'Y')
{
return;
}
elseif (self::get('act') === 'procMemberLogin')
{
return;
}
// Allow if the current user is in the list of allowed IPs.
$allowed_list = config('lock.allow');
foreach ($allowed_list as $allowed_ip)
{
@ -1438,18 +1450,26 @@ class Context
}
}
// Set headers and constants for backward compatibility.
header('HTTP/1.1 503 Service Unavailable');
define('_XE_SITELOCK_', TRUE);
define('_XE_SITELOCK_TITLE_', config('lock.title'));
define('_XE_SITELOCK_MESSAGE_', config('lock.message'));
header('HTTP/1.1 503 Service Unavailable');
// Load the sitelock template.
if(FileHandler::exists(RX_BASEDIR . 'common/tpl/sitelock.user.html'))
{
include RX_BASEDIR . 'common/tpl/sitelock.user.html';
}
else
{
include RX_BASEDIR . 'common/tpl/sitelock.html';
$oMessageObject = getView('message');
$oMessageObject->setHttpStatusCode(503);
$oMessageObject->setError(-1);
$oMessageObject->setMessage(config('lock.title'));
$oMessageObject->dispMessage();
$oModuleHandler = new ModuleHandler;
$oModuleHandler->displayContent($oMessageObject);
}
exit;
}

View file

@ -1,3 +1,4 @@
<?php
$lang->message = '오류 표시';
$lang->about_skin = '오류 메시지용 스킨을 지정할 수 있습니다.';
$lang->msg_administrator_login = '관리자 로그인';

View file

@ -18,6 +18,7 @@
#access .login-header { margin: 30px; padding: 0; }
#access .login-header h1 { margin: 0; padding: 0; font-size: 16px; line-height: 20px; color:#f44336; font-weight:normal; }
#access .login-header .message { border: 0; border-radius: 0; padding: 0; margin: 20px 0 0 0; }
#access .login-body { margin: 30px; padding: 0; }
#access .login-body p { margin: 0; padding: 0; }

View file

@ -5,6 +5,7 @@
<div id="access">
<div class="login-header">
<h1>{$system_message}</h1>
<div class="message" cond="defined('_XE_SITELOCK_MESSAGE_')">{constant('_XE_SITELOCK_MESSAGE_')}</div>
</div>
<div cond="!$is_logged">
<div class="login-body">
@ -20,15 +21,21 @@
<input type="text" name="user_id" id="uid" title="{$lang->user_id}" placeholder="{$lang->user_id}" required autofocus cond="$member_config->identifier != 'email_address'" />
<input type="email" name="user_id" id="uid" title="{$lang->email_address}" placeholder="{$lang->email_address}" required autofocus cond="$member_config->identifier == 'email_address'" />
<input type="password" name="password" id="upw" title="{$lang->password}" placeholder="{$lang->password}" required />
<label for="keepid">
<label for="keepid" cond="!defined('_XE_SITELOCK_MESSAGE_')">
<input type="checkbox" name="keep_signed" id="keepid" class="inputCheck" value="Y" onclick="jQuery('#warning')[(jQuery('#keepid:checked').size()&gt;0?'addClass':'removeClass')]('open');" />
{$lang->keep_signed}
</label>
</div>
<p><button type="submit" class="button" href="#" onclick="$('#message_login_form').submit()">{$lang->cmd_login}</button></p>
<p><button type="submit" class="button" href="#" onclick="$('#message_login_form').submit()">
<!--@if(defined('_XE_SITELOCK_MESSAGE_'))-->
{$lang->msg_administrator_login}
<!--@else-->
{$lang->cmd_login}
<!--@end-->
</button></p>
</form>
</div>
<div class="login-footer">
<div class="login-footer" cond="!defined('_XE_SITELOCK_MESSAGE_')">
<a href="{getUrl('', 'act', 'dispMemberFindAccount')}">{$lang->cmd_find_member_account}</a>
<span class="bar">|</span>
<a href="{getUrl('', 'act', 'dispMemberSignUpForm')}">{$lang->cmd_signup}</a>