Check local ip

This commit is contained in:
RainLoop Team 2013-12-10 15:09:58 +04:00
parent fd22806e51
commit 54a522f7e4
2 changed files with 13 additions and 4 deletions

View file

@ -14,10 +14,12 @@ class AddXOriginatingIpHeaderPlugin extends \RainLoop\Plugins\AbstractPlugin
{
if ($oMessage instanceof \MailSo\Mime\Message)
{
$sIP = $this->Manager()->Actions()->Http()->GetClientIp(
!!$this->Config()->Get('plugin', 'check_proxy', false));
$oMessage->SetCustomHeader(
\MailSo\Mime\Enumerations\Header::X_ORIGINATING_IP,
$this->Manager()->Actions()->Http()->GetClientIp(
!!$this->Config()->Get('plugin', 'check_proxy', false))
$this->Manager()->Actions()->Http()->IsLocalhost($sIP) ? '127.0.0.1' : $sIP
);
}
}

View file

@ -219,11 +219,18 @@ class Http
}
/**
* @param string $sValueToCheck = ''
*
* @return bool
*/
public function IsLocalhost()
public function IsLocalhost($sValueToCheck = '')
{
return $this->CheckLocalhost($this->GetServer('REMOTE_ADDR', ''));
if (empty($sValueToCheck))
{
$sValueToCheck = $this->GetServer('REMOTE_ADDR', '');
}
return $this->CheckLocalhost($sValueToCheck);
}
/**