mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
Merge branch 'feature/ipfilter' into develop
This commit is contained in:
commit
8a7e5a8794
11 changed files with 165 additions and 53 deletions
|
|
@ -490,11 +490,31 @@ class adminAdminController extends admin
|
|||
$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 = $vars->sitelock_whitelist;
|
||||
if(!$db_info->sitelock_whitelist) $db_info->sitelock_whitelist = '127.0.0.1';
|
||||
|
||||
$whitelist = $vars->sitelock_whitelist;
|
||||
$whitelist = preg_replace("/[\r|\n|\r\n]+/",",",$whitelist);
|
||||
$whitelist = preg_replace("/\s+/","",$whitelist);
|
||||
if(preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist))
|
||||
{
|
||||
$whitelist = '';
|
||||
}
|
||||
$whitelist .= ',127.0.0.1';
|
||||
$whitelist = explode(',',trim($whitelist, ','));
|
||||
$whitelist = array_unique($whitelist);
|
||||
|
||||
FileHandler::writeFile(Context::getConfigFile(), $oInstallController->_getDBConfigFileContents($db_info));
|
||||
if(!IpFilter::validate($whitelist)) {
|
||||
return new Object(-1, 'msg_invalid_ip');
|
||||
}
|
||||
|
||||
$db_info->sitelock_whitelist = $whitelist;
|
||||
|
||||
$oInstallController = &getController('install');
|
||||
if(!$oInstallController->makeConfigFile())
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
|
||||
if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
|
||||
{
|
||||
$returnUrl = Context::get('success_return_url');
|
||||
|
|
@ -502,6 +522,12 @@ class adminAdminController extends admin
|
|||
header('location:' . $returnUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue