Add new configuration (#58)

[security]
admin_panel_host
This commit is contained in:
RainLoop Team 2014-01-23 17:41:19 +04:00 committed by RayMan
parent 1623f515ff
commit c7105186d9
2 changed files with 12 additions and 1 deletions

View file

@ -106,6 +106,7 @@ class Application extends \RainLoop\Config\AbstractConfig
'admin_login' => array('admin', 'Login and password for web admin panel'),
'admin_password' => array('12345'),
'allow_admin_panel' => array(true, 'Access settings'),
'admin_panel_host' => array(''),
'core_install_access_domains' => array('')
),

View file

@ -129,7 +129,17 @@ class Service
$aPaths = \explode('/', $sQuery);
$this->oActions->Plugins()->RunHook('filter.http-paths', array(&$aPaths));
$bAdmin = !empty($aPaths[0]) && \in_array(\strtolower($aPaths[0]), array('admin', 'cp'));
$bAdmin = false;
$sAdminPanelHost = $this->oActions->Config()->Get('security', 'admin_panel_host', '');
if (empty($sAdminPanelHost))
{
$bAdmin = !empty($aPaths[0]) && \in_array(\strtolower($aPaths[0]), array('admin', 'cp'));
}
else if (empty($aPaths[0]) && \strtolower($sAdminPanelHost) === \strtolower($this->oHttp->GetHost()))
{
$bAdmin = true;
}
if ($bAdmin && !$this->oActions->Config()->Get('security', 'allow_admin_panel', true))
{
echo $this->oActions->ErrorTemplates('Access Denied.',