mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-04 09:32:15 +09:00
Apply admin ip check
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9111 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
af4c27f832
commit
f00e0618ec
3 changed files with 36 additions and 1 deletions
|
|
@ -197,6 +197,11 @@
|
||||||
if(!$kind && $this->module == 'admin') $kind = 'admin';
|
if(!$kind && $this->module == 'admin') $kind = 'admin';
|
||||||
if($this->module_info->use_mobile != "Y") Mobile::setMobile(false);
|
if($this->module_info->use_mobile != "Y") Mobile::setMobile(false);
|
||||||
|
|
||||||
|
if($kind == 'admin'){
|
||||||
|
$oModuleAdminModel = &getAdminModel('module');
|
||||||
|
if(!$oModuleAdminModel->getModuleAdminIPCheck()) return false;
|
||||||
|
}
|
||||||
|
|
||||||
// if(type == view, and case for using mobilephone)
|
// if(type == view, and case for using mobilephone)
|
||||||
if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
|
if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
|
||||||
{
|
{
|
||||||
|
|
@ -377,7 +382,8 @@
|
||||||
if ($message != 'success') $_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
|
if ($message != 'success') $_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
|
||||||
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
|
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
|
||||||
$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
|
$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $oModule;
|
return $oModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,10 @@
|
||||||
<action name="getModuleAdminLangCode" type="model" standalone="true" />
|
<action name="getModuleAdminLangCode" type="model" standalone="true" />
|
||||||
<action name="getModuleAdminLangListByName" type="model" standalone="true" />
|
<action name="getModuleAdminLangListByName" type="model" standalone="true" />
|
||||||
<action name="getModuleAdminLangListByValue" type="model" standalone="true" />
|
<action name="getModuleAdminLangListByValue" type="model" standalone="true" />
|
||||||
|
<action name="getModuleAdminIPCheck" type="model" standalone="true" />
|
||||||
<action name="getLangListByLangcodeForAutoComplete" type="model" standalone="true" />
|
<action name="getLangListByLangcodeForAutoComplete" type="model" standalone="true" />
|
||||||
<action name="getFileBoxListHtml" type="model" />
|
<action name="getFileBoxListHtml" type="model" />
|
||||||
|
|
||||||
|
|
||||||
<action name="procModuleAdminInsertCategory" type="controller" standalone="true" ruleset="insertCategory" />
|
<action name="procModuleAdminInsertCategory" type="controller" standalone="true" ruleset="insertCategory" />
|
||||||
<action name="procModuleAdminUpdateCategory" type="controller" standalone="true" ruleset="updateCategory" />
|
<action name="procModuleAdminUpdateCategory" type="controller" standalone="true" ruleset="updateCategory" />
|
||||||
|
|
|
||||||
|
|
@ -261,5 +261,32 @@
|
||||||
|
|
||||||
return $this->getLangListByLangcode($args);
|
return $this->getLangListByLangcode($args);
|
||||||
}
|
}
|
||||||
|
function getModuleAdminIPCheck() {
|
||||||
|
|
||||||
|
$db_info = Context::getDBInfo();
|
||||||
|
$admin_ip = $db_info->admin_ip;
|
||||||
|
|
||||||
|
if(preg_match('/^(\d{1,3}(?:.(\d{1,3}|\*)){3})$/', $admin_ip, $matches)) {
|
||||||
|
if(!empty($_SERVER['HTTP_CLIENT_IP']) && getenv('HTTP_CLIENT_IP')){
|
||||||
|
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||||
|
}
|
||||||
|
else if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && getenv('HTTP_X_FORWARDED_FOR')){
|
||||||
|
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
|
}
|
||||||
|
else if(!empty($_SERVER['REMOTE_HOST']) && getenv('REMOTE_HOST')){
|
||||||
|
$ip = $_SERVER['REMOTE_HOST'];
|
||||||
|
}
|
||||||
|
else if(!empty($_SERVER['REMOTE_ADDR']) && getenv('REMOTE_ADDR')){
|
||||||
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
}
|
||||||
|
if($ip) {
|
||||||
|
$admin_ip = str_replace('*','',$admin_ip);
|
||||||
|
$admin_ip_patterns[] = preg_quote($admin_ip);
|
||||||
|
$admin_ip_pattern = '/^('.implode($admin_ip_patterns,'|').')/';
|
||||||
|
if(!preg_match($admin_ip_pattern, $ip, $matches)) return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue