mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-04 12:14:11 +08:00
Check local ip
This commit is contained in:
parent
fd22806e51
commit
54a522f7e4
2 changed files with 13 additions and 4 deletions
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue