mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
Allow sitelock immediately after install (#160)
This commit is contained in:
parent
9e9b09464f
commit
605fdec1a2
10 changed files with 84 additions and 10 deletions
|
|
@ -234,6 +234,16 @@ class installController extends install
|
|||
}
|
||||
}
|
||||
|
||||
// Apply site lock.
|
||||
|
||||
if (Context::get('use_sitelock') === 'Y')
|
||||
{
|
||||
$user_ip_range = getView('install')->detectUserIPRange();
|
||||
Rhymix\Framework\Config::set('lock.locked', true);
|
||||
Rhymix\Framework\Config::set('lock.message', 'This site is locked.');
|
||||
Rhymix\Framework\Config::set('lock.allow', array('127.0.0.1', $user_ip_range));
|
||||
}
|
||||
|
||||
// Save the new configuration.
|
||||
Rhymix\Framework\Config::save();
|
||||
|
||||
|
|
|
|||
|
|
@ -153,9 +153,31 @@ class installView extends install
|
|||
|
||||
// Always use SSL if installing via SSL.
|
||||
Context::set('use_ssl', RX_SSL ? 'always' : 'none');
|
||||
Context::set('sitelock_ip_range', $this->detectUserIPRange());
|
||||
$this->setTemplateFile('other_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect the IP range of the user.
|
||||
*/
|
||||
function detectUserIPRange()
|
||||
{
|
||||
if (RX_CLIENT_IP_VERSION === 4)
|
||||
{
|
||||
return preg_replace('/\.\d+$/', '.*', RX_CLIENT_IP);
|
||||
}
|
||||
elseif (function_exists('inet_pton'))
|
||||
{
|
||||
$binary = inet_pton(RX_CLIENT_IP);
|
||||
$binary = substr($binary, 0, 8) . str_repeat(chr(0), 8);
|
||||
return inet_ntop($binary) . '/64';
|
||||
}
|
||||
else
|
||||
{
|
||||
return RX_CLIENT_IP;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect best time zone for the user.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -77,9 +77,13 @@ $lang->about_nginx_rewrite = 'To use this feature at nginx, you need to configur
|
|||
$lang->time_zone = 'Time Zone';
|
||||
$lang->about_time_zone = 'If the server time is different from your time zone, you can use this option to display times in your time zone.';
|
||||
$lang->use_ssl = 'SSL';
|
||||
$lang->ssl_options['none'] = 'Never';
|
||||
$lang->ssl_options['none'] = 'None';
|
||||
$lang->ssl_options['optional'] = 'Optional';
|
||||
$lang->ssl_options['always'] = 'Always';
|
||||
$lang->use_sitelock = 'Site Lock';
|
||||
$lang->sitelock_options['none'] = 'None';
|
||||
$lang->sitelock_options['lock'] = 'Lock after Install';
|
||||
$lang->about_sitelock_after_install = 'If you lock your site, only your current IP range (%s) will be able to access your site.';
|
||||
$lang->about_database_file = 'Sqlite saves data in a file. Location of the database file should be unreachable by web<br/><span style="color:red">Data file should be inside the permission of 777.</span>';
|
||||
$lang->success_installed = 'Installation has been completed.';
|
||||
$lang->msg_installing = 'Installing...';
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@ $lang->use_ssl = 'SSLを使用';
|
|||
$lang->ssl_options['none'] = '使わない';
|
||||
$lang->ssl_options['optional'] = '部分的に使う';
|
||||
$lang->ssl_options['always'] = '常に使う';
|
||||
$lang->use_sitelock = 'サイトロック';
|
||||
$lang->sitelock_options['none'] = '使わない';
|
||||
$lang->sitelock_options['lock'] = 'ロック';
|
||||
$lang->about_sitelock_after_install = 'サイトをロックすると、インストールに使用したIP帯域(%s)以外接続できなくなるので注意してください。';
|
||||
$lang->about_database_file = 'Sqliteはファイルにデータを保存します。そのため、データベースファイルにはウェブからアクセスできない場所にしなければなりません。<br/><span style="color:red">データファイルのパーミッションは「777」に設定してください。</span>';
|
||||
$lang->success_installed = '正常にインストールされました。';
|
||||
$lang->msg_cannot_proc = 'インストールできる環境が整っていないため、リクエストを実行できませんでした。';
|
||||
|
|
|
|||
|
|
@ -80,6 +80,10 @@ $lang->use_ssl = 'SSL 사용';
|
|||
$lang->ssl_options['none'] = '사용 안함';
|
||||
$lang->ssl_options['optional'] = '선택적으로';
|
||||
$lang->ssl_options['always'] = '항상 사용';
|
||||
$lang->use_sitelock = '사이트 잠금';
|
||||
$lang->sitelock_options['none'] = '사용 안함';
|
||||
$lang->sitelock_options['lock'] = '잠금 상태로 설치';
|
||||
$lang->about_sitelock_after_install = '사이트를 잠그면 설치에 사용하신 IP 대역 (%s) 외에는 접속할 수 없게 되니 주의하십시오.';
|
||||
$lang->about_database_file = 'Sqlite는 파일에 데이터를 저장합니다. 데이터베이스 파일의 위치를 웹에서 접근할 수 없는 곳으로 해야 합니다.<br/><span style="color:red">데이터 파일은 777퍼미션 설정된 곳으로 지정해주세요.</span>';
|
||||
$lang->success_installed = '설치가 되었습니다.';
|
||||
$lang->msg_cannot_proc = '설치 환경이 갖춰지지 않아 요청을 실행할 수가 없습니다.';
|
||||
|
|
|
|||
|
|
@ -176,7 +176,10 @@ button.grey:hover, a.button.grey:hover {
|
|||
.x #content ul li {
|
||||
line-height: 160%;
|
||||
}
|
||||
.x #content label input[type=checkbox] {
|
||||
.x #content label.x_inline {
|
||||
display: inline-block; margin-right: 12px;
|
||||
}
|
||||
.x #content label input[type=checkbox], .x #content label input[type=radio] {
|
||||
position: relative;
|
||||
top: 2px;
|
||||
}
|
||||
|
|
@ -207,6 +210,9 @@ button.grey:hover, a.button.grey:hover {
|
|||
line-height: 17px; padding: 3px 5px;
|
||||
width: 260px; box-sizing: border-box;
|
||||
}
|
||||
.x .x_control-group .x_controls input[type=checkbox], .x .x_control-group .x_controls input[type=radio] {
|
||||
padding: 0; width: auto;
|
||||
}
|
||||
.x .x_control-group .x_controls select {
|
||||
line-height: 17px; padding: 3px 7px 3px 3px;
|
||||
width: 260px; box-sizing: border-box;
|
||||
|
|
|
|||
|
|
@ -50,13 +50,19 @@
|
|||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->use_ssl}</label>
|
||||
<div class="x_controls">
|
||||
<select name="use_ssl">
|
||||
<!--@foreach($lang->ssl_options as $key => $val)-->
|
||||
<option value="{$key}" selected="selected"|cond="$use_ssl==$key" />{$val}</option>
|
||||
<label for="ssl_{$key}" class="x_inline"><input type="radio" name="use_ssl" id="ssl_{$key}" value="{$key}" checked="checked"|cond="$use_ssl==$key" /> {$val}</label>
|
||||
<!--@endforeach-->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->use_sitelock}</label>
|
||||
<div class="x_controls">
|
||||
<label for="sitelock_n" class="x_inline"><input type="radio" name="use_sitelock" id="sitelock_n" value="N" checked="checked" /> {$lang->sitelock_options['none']}</label>
|
||||
<label for="sitelock_y" class="x_inline"><input type="radio" name="use_sitelock" id="sitelock_y" value="Y" /> {$lang->sitelock_options['lock']}</label>
|
||||
</div>
|
||||
</div>
|
||||
<p class="install_help">{$lang->about_sitelock_after_install($sitelock_ip_range)}</p>
|
||||
</div>
|
||||
<div id="buttons">
|
||||
<div class="align-left">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue