mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Move plugins to webmail repository.
This commit is contained in:
parent
17958b15cb
commit
cf0968b5a8
32 changed files with 4348 additions and 0 deletions
38
plugins/add-x-originating-ip-header/index.php
Normal file
38
plugins/add-x-originating-ip-header/index.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
class AddXOriginatingIpHeaderPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||
{
|
||||
public function Init()
|
||||
{
|
||||
$this->addHook('filter.build-message', 'FilterBuildMessage');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Mime\Message $oMessage
|
||||
*/
|
||||
public function FilterBuildMessage(&$oMessage)
|
||||
{
|
||||
if ($oMessage instanceof \MailSo\Mime\Message)
|
||||
{
|
||||
$oMessage->SetCustomHeader(
|
||||
\MailSo\Mime\Enumerations\Header::X_ORIGINATING_IP,
|
||||
$this->Manager()->Actions()->Http()->GetClientIp(
|
||||
!!$this->Config()->Get('plugin', 'check_proxy', false))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function configMapping()
|
||||
{
|
||||
return array(
|
||||
\RainLoop\Plugins\Property::NewInstance('check_proxy')
|
||||
->SetLabel('Сheck User Proxy')
|
||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
|
||||
->SetDescription('Enable, if you need to check proxy header')
|
||||
->SetDefaultValue(false)
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue