mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-05 10:02:16 +09:00
#43 사이트 잠금기능 추가.
This commit is contained in:
parent
a00f2d1033
commit
6ebf867277
9 changed files with 203 additions and 0 deletions
|
|
@ -418,6 +418,8 @@ body,table,input,textarea,select,button{font-family:나눔고딕,NanumGothic,NG,
|
|||
<li id="UMAN_config_general_sso">SSO 사용: 사용자가 한 번만 로그인하면 기본 사이트와 가상 사이트에 동시에 로그인이 됩니다. 가상 사이트를 사용할 때만 필요합니다.</li>
|
||||
<li id="UMAN_config_general_db_session">인증 세션 DB 사용: 인증 시 사용되는 PHP 세션을 DB로 사용하는 기능입니다. 웹서버의 사용률이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다. 단, 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.</li>
|
||||
<li id="UMAN_config_general_qmail">Qmail 호환: Qmail등 CRLF를 줄 구분자로 인식하지 못하는 MTA에서 메일이 발송되도록 합니다.</li>
|
||||
<li id="UMAN_config_general_sitelock">사이트 잠금: 지정한 IP 외 접근을 차단할 수 있습니다.</li>
|
||||
<li id="UMAN_config_general_sitelock_whitelist">접근 허용 IP: 이곳에 관리자의 IP가 반드시 포함되어야 합니다. 만약 접근이 차단된 경우 './files/config/db.config.php' 파일에서 `$db_info->use_sitelock`를 'N'으로 변경하여 차단을 해제할 수 있습니다.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt id="UMAN_config_ftp">FTP 설정</dt>
|
||||
|
|
|
|||
|
|
@ -214,6 +214,28 @@ class Context
|
|||
|
||||
$this->loadDBInfo();
|
||||
|
||||
$context = Context::getInstance();
|
||||
|
||||
if($context->db_info->use_sitelock == 'Y') {
|
||||
$whitelist = array('127.0.0.1', '::1', 'fe80::1');
|
||||
if(is_array($context->db_info->sitelock_whitelist)) $whitelist = array_merge($whitelist, $context->db_info->sitelock_whitelist);
|
||||
|
||||
if(in_array($_SERVER['REMOTE_ADDR'], $whitelist)) {
|
||||
$title = ($context->db_info->sitelock_title) ? $context->db_info->sitelock_title : 'Maintenance in progress...';
|
||||
$message = $context->db_info->sitelock_message;
|
||||
$image = './modules/admin/tpl/img/xe.h1.png';
|
||||
|
||||
define('_XE_SITELOCK_', TRUE);
|
||||
define('_XE_SITELOCK_TITLE_', $title);
|
||||
define('_XE_SITELOCK_MESSAGE_', nl2br($message));
|
||||
define('_XE_SITELOCK_IMAGE_', $image);
|
||||
|
||||
header('403 Forbidden');
|
||||
include _XE_PATH_ . 'common/tpl/sitelock.html';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// If XE is installed, get virtual site information
|
||||
if(Context::isInstalled())
|
||||
{
|
||||
|
|
@ -474,6 +496,14 @@ class Context
|
|||
if($db_info->https_port)
|
||||
$self->set('_https_port', $db_info->https_port);
|
||||
|
||||
if(!$db_info->sitelock_whitelist) {
|
||||
$db_info->sitelock_whitelist = '127.0.0.1,::1,fe80::1';
|
||||
}
|
||||
|
||||
if(is_string($db_info->sitelock_whitelist)) {
|
||||
$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
|
||||
}
|
||||
|
||||
$self->setDBInfo($db_info);
|
||||
}
|
||||
|
||||
|
|
|
|||
56
common/tpl/sitelock.html
Normal file
56
common/tpl/sitelock.html
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo _XE_SITELOCK_TITLE_?></title>
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
min-height: 100%;
|
||||
}
|
||||
body {
|
||||
font-size: 12px;
|
||||
}
|
||||
h1 {
|
||||
margin: 0;
|
||||
font: bold 24px Arial, Helvetica, sans-serif;
|
||||
color: #666;
|
||||
}
|
||||
section {
|
||||
position: relative;
|
||||
max-width: 500px;
|
||||
margin: 100px auto 0 auto;
|
||||
padding: 0 0 0 70px;
|
||||
overflow: hidden;
|
||||
}
|
||||
div {
|
||||
height: 100%;
|
||||
border-left: 1px dotted #CCC;
|
||||
padding: 0 0 0 15px;
|
||||
}
|
||||
p {
|
||||
line-height: 1.5;
|
||||
color: #666;
|
||||
}
|
||||
div img {
|
||||
float:left;
|
||||
margin-left: -65px;
|
||||
}
|
||||
@media only all and (max-width: 480px) {
|
||||
section {
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<section>
|
||||
<div>
|
||||
<img src="<?php echo _XE_SITELOCK_IMAGE_?>" alt="" />
|
||||
<h1><?php echo _XE_SITELOCK_TITLE_?></h1>
|
||||
<p><?php echo _XE_SITELOCK_MESSAGE_?> </p>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -480,6 +480,31 @@ class adminAdminController extends admin
|
|||
$this->setMessage('success_deleted');
|
||||
}
|
||||
|
||||
function procAdminUpdateSitelock()
|
||||
{
|
||||
$vars = Context::getRequestVars();
|
||||
$oInstallController = &getController('install');
|
||||
|
||||
$config_file = Context::getConfigFile();
|
||||
$db_info = Context::getDbInfo();
|
||||
|
||||
$db_info->use_sitelock = ($vars->use_sitelock) ? $vars->use_sitelock : 'N';
|
||||
$db_info->sitelock_title = $vars->sitelock_title;
|
||||
$db_info->sitelock_message = $vars->sitelock_message;
|
||||
|
||||
$db_info->sitelock_whitelist = preg_replace("/[\r\n|\r|\n]+/", ",", $vars->sitelock_whitelist);
|
||||
|
||||
$buff = $oInstallController->_getDBConfigFileContents($db_info);
|
||||
FileHandler::writeFile($config_file, $buff);
|
||||
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||
{
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file admin.admin.controller.php */
|
||||
/* Location: ./modules/admin/admin.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -412,6 +412,15 @@ class adminAdminView extends admin
|
|||
Context::set('default_url', $db_info->default_url);
|
||||
Context::set('langs', Context::loadLangSupported());
|
||||
|
||||
// site lock
|
||||
if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...';
|
||||
if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR'];
|
||||
Context::set('remote_addr', $_SERVER['REMOTE_ADDR']);
|
||||
Context::set('use_sitelock', $db_info->use_sitelock);
|
||||
Context::set('sitelock_title', $db_info->sitelock_title);
|
||||
Context::set('sitelock_message', $db_info->sitelock_message);
|
||||
Context::set('sitelock_whitelist', implode(PHP_EOL, $db_info->sitelock_whitelist));
|
||||
|
||||
Context::set('lang_selected', Context::loadLangSelected());
|
||||
|
||||
$admin_ip_list = preg_replace("/[,]+/", "\r\n", $db_info->admin_ip_list);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<action name="procAdminUpdateConfig" type="controller" />
|
||||
<action name="procAdminDeleteLogo" type="controller" />
|
||||
<action name="procAdminMenuReset" type="controller" />
|
||||
<action name="procAdminUpdateSitelock" type="controller" />
|
||||
|
||||
<action name="getAdminFTPList" type="model" />
|
||||
<action name="getAdminFTPPath" type="model" />
|
||||
|
|
|
|||
|
|
@ -1503,4 +1503,23 @@
|
|||
<value xml:lang="ko"><![CDATA[일]]></value>
|
||||
<value xml:lang="en"><![CDATA[Sun]]></value>
|
||||
</item>
|
||||
<!-- site lock -->
|
||||
<item name="use_sitelock">
|
||||
<value xml:lang="ko"><![CDATA[사이트 잠금 사용]]></value>
|
||||
</item>
|
||||
<item name="sitelock_whitelist">
|
||||
<value xml:lang="ko"><![CDATA[접근 허용 IP]]></value>
|
||||
</item>
|
||||
<item name="sitelock_title">
|
||||
<value xml:lang="ko"><![CDATA[안내문 제목]]></value>
|
||||
</item>
|
||||
<item name="sitelock_message">
|
||||
<value xml:lang="ko"><![CDATA[안내문 내용]]></value>
|
||||
</item>
|
||||
<item name="sitelock_warning_whitelist">
|
||||
<value xml:lang="ko"><![CDATA[이곳에 관리자의 IP가 반드시 포함되어야 합니다.<br>만약 접근이 차단된 경우 './files/config/db.config.php' 파일에서 `$db_info->use_sitelock`를 'N'으로 변경하여 차단을 해제할 수 있습니다.]]></value>
|
||||
</item>
|
||||
<item name="your_ip">
|
||||
<value xml:lang="ko"><![CDATA[접속하신 IP]]></value>
|
||||
</item>
|
||||
</lang>
|
||||
|
|
|
|||
15
modules/admin/ruleset/sitelock.xml
Normal file
15
modules/admin/ruleset/sitelock.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ruleset version="1.5.0">
|
||||
<fields>
|
||||
<field name="use_sitelock" required="true" />
|
||||
<field name="sitelock_whitelist">
|
||||
<if test="$use_sitelock == 'Y'" attr="required" value="true" />
|
||||
</field>
|
||||
<field name="sitelock_title">
|
||||
<if test="$use_sitelock == 'Y'" attr="required" value="true" />
|
||||
</field>
|
||||
<field name="sitelock_message">
|
||||
<if test="$use_sitelock == 'Y'" attr="required" value="true" />
|
||||
</field>
|
||||
</fields>
|
||||
</ruleset>
|
||||
|
|
@ -199,6 +199,52 @@
|
|||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
|
||||
<section class="section !collapsed">
|
||||
<h1>사이트 잠금</h1>
|
||||
<form action="./" method="post" enctype="multipart/form-data" class="x_form-horizontal" ruleset="sitelock">
|
||||
<input type="hidden" name="module" value="admin" />
|
||||
<input type="hidden" name="act" value="procAdminUpdateSitelock" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/admin/tpl/config_general/1" />
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->use_sitelock} <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_config_general_sitelock" target="_blank">{$lang->help}</a></label>
|
||||
<div class="x_controls">
|
||||
<label for="use_sitelock_y" class="x_inline"><input type="radio" name="use_sitelock" id="use_sitelock_y" value="Y" checked="checked"|cond="$use_sitelock=='Y'" /> {$lang->cmd_yes}</label>
|
||||
<label for="use_sitelock_n" class="x_inline"><input type="radio" name="use_sitelock" id="use_sitelock_n" value="N" checked="checked"|cond="$use_sitelock!='Y'" /> {$lang->cmd_no}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="sitelock_whitelist">{$lang->sitelock_whitelist} <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_config_general_sitelock_whitelist" target="_blank">{$lang->help}</a></label>
|
||||
<div class="x_controls">
|
||||
<textarea name="sitelock_whitelist" id="sitelock_whitelist" rows="4" cols="42" placeholder="{$IP}({$lang->local_ip_address})" style="margin-right:10px">{$sitelock_whitelist}</textarea>
|
||||
<span class="x_help-block">{$lang->sitelock_warning_whitelist}</span>
|
||||
<span class="x_help-block">{$lang->your_ip} : {$remote_addr}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="sitelock_title">{$lang->sitelock_title}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" name="sitelock_title" id="sitelock_title" value="{$sitelock_title}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="sitelock_message">{$lang->sitelock_message}</label>
|
||||
<div class="x_controls" style="margin-right:14px">
|
||||
<textarea name="sitelock_message" id="sitelock_message" rows="4" cols="42" style="width:100%;">{$sitelock_message}</textarea>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<iframe name="hiddenIframe" src="about:blank" hidden></iframe>
|
||||
<script>
|
||||
function afterUploadConfigImage(name, fileName, tmpFileName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue