mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
IDNA support (beta)
This commit is contained in:
parent
0ca00dec40
commit
e82108ac85
31 changed files with 3839 additions and 308 deletions
|
|
@ -46,12 +46,12 @@ class Account
|
|||
*/
|
||||
protected function __construct($sEmail, $sLogin, $sPassword, \RainLoop\Domain $oDomain, $sSignMeToken = '', $sParentEmail = '')
|
||||
{
|
||||
$this->sEmail = \strtolower($sEmail);
|
||||
$this->sLogin = $sLogin;
|
||||
$this->sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true);
|
||||
$this->sLogin = \MailSo\Base\Utils::IdnToAscii($sLogin);
|
||||
$this->sPassword = $sPassword;
|
||||
$this->oDomain = $oDomain;
|
||||
$this->sSignMeToken = $sSignMeToken;
|
||||
$this->sParentEmail = \strtolower($sParentEmail);
|
||||
$this->sParentEmail = \MailSo\Base\Utils::IdnToAscii($sParentEmail, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -166,7 +166,6 @@ class Account
|
|||
*/
|
||||
public function Hash()
|
||||
{
|
||||
|
||||
return md5(APP_SALT.$this->Email().APP_SALT.$this->oDomain->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($this->Email())).
|
||||
APP_SALT.$this->oDomain->IncPort().APP_SALT.$this->Password().APP_SALT.'0'.APP_SALT.$this->ParentEmail().APP_SALT);
|
||||
}
|
||||
|
|
@ -188,7 +187,7 @@ class Account
|
|||
*/
|
||||
public function SetParentEmail($sParentEmail)
|
||||
{
|
||||
$this->sParentEmail = \strtolower($sParentEmail);
|
||||
$this->sParentEmail = \MailSo\Base\Utils::IdnToAscii($sParentEmail, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ class Actions
|
|||
$oAccount = $this->getAccountFromToken(false);
|
||||
if ($oAccount)
|
||||
{
|
||||
$sEmail = \strtolower($oAccount->Email());
|
||||
$sEmail = $oAccount->Email();
|
||||
$sFileName = \str_replace('{user:email}', $sEmail, $sFileName);
|
||||
$sFileName = \str_replace('{user:login}', \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail), $sFileName);
|
||||
$sFileName = \str_replace('{user:domain}', \MailSo\Base\Utils::GetDomainFromEmail($sEmail), $sFileName);
|
||||
|
|
@ -972,6 +972,9 @@ class Actions
|
|||
'AuthAccountHash' => '',
|
||||
'MailToEmail' => '',
|
||||
'Email' => '',
|
||||
'DevEmail' => '',
|
||||
'DevLogin' => '',
|
||||
'DevPassword' => '',
|
||||
'Title' => $oConfig->Get('webmail', 'title', ''),
|
||||
'LoadingDescription' => $oConfig->Get('webmail', 'loading_description', ''),
|
||||
'LoginLogo' => $oConfig->Get('branding', 'login_logo', ''),
|
||||
|
|
@ -1067,7 +1070,7 @@ class Actions
|
|||
$aResult['DevLogin'] = $oConfig->Get('labs', 'dev_login', '');
|
||||
$aResult['DevPassword'] = $oConfig->Get('labs', 'dev_password', '');
|
||||
}
|
||||
|
||||
|
||||
$aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false);
|
||||
if ($aResult['AllowGoogleSocial'] && (
|
||||
'' === \trim($oConfig->Get('social', 'google_client_id', '')) || '' === \trim($oConfig->Get('social', 'google_client_secret', ''))))
|
||||
|
|
@ -1267,6 +1270,12 @@ class Actions
|
|||
$aResult['PluginsLink'] = $sPluginsLink;
|
||||
$aResult['EditorDefaultType'] = 'Html' === $aResult['EditorDefaultType'] ? 'Html' : 'Plain';
|
||||
|
||||
$aResult['Email'] = \MailSo\Base\Utils::IdnToUtf8($aResult['Email']);
|
||||
$aResult['ParentEmail'] = \MailSo\Base\Utils::IdnToUtf8($aResult['ParentEmail']);
|
||||
$aResult['MailToEmail'] = \MailSo\Base\Utils::IdnToUtf8($aResult['MailToEmail']);
|
||||
$aResult['DevEmail'] = \MailSo\Base\Utils::IdnToUtf8($aResult['DevEmail']);
|
||||
$aResult['DevLogin'] = \MailSo\Base\Utils::IdnToUtf8($aResult['DevLogin']);
|
||||
|
||||
$this->Plugins()->InitAppData($bAdmin, $aResult);
|
||||
|
||||
return $aResult;
|
||||
|
|
@ -1538,7 +1547,7 @@ class Actions
|
|||
{
|
||||
$aAccounts[$oAccount->Email()] = $oAccount->GetAuthToken();
|
||||
}
|
||||
|
||||
|
||||
return $aAccounts;
|
||||
}
|
||||
|
||||
|
|
@ -1619,7 +1628,7 @@ class Actions
|
|||
$aResult = array();
|
||||
foreach ($aIdentities as $oItem)
|
||||
{
|
||||
$aResult[] = $oItem->ToSimpleJSON();
|
||||
$aResult[] = $oItem->ToSimpleJSON(false);
|
||||
}
|
||||
|
||||
$oSettings->SetConf('Identities', @\json_encode($aResult));
|
||||
|
|
@ -1651,7 +1660,7 @@ class Actions
|
|||
|
||||
$sParentEmail = 0 < \strlen($oAccount->ParentEmail()) ? $oAccount->ParentEmail() : $oAccount->Email();
|
||||
|
||||
$sEmail = \strtolower($sEmail);
|
||||
$sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true);
|
||||
if ($oAccount->Email() === $sEmail || $sParentEmail === $sEmail)
|
||||
{
|
||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AccountAlreadyExists);
|
||||
|
|
@ -1701,7 +1710,8 @@ class Actions
|
|||
$oAccount = $this->getAccountFromToken();
|
||||
|
||||
$sParentEmail = $oAccount->ParentEmailHelper();
|
||||
$sEmailToDelete = \strtolower(\trim($this->GetActionParam('EmailToDelete', '')));
|
||||
$sEmailToDelete = \trim($this->GetActionParam('EmailToDelete', ''));
|
||||
$sEmailToDelete = \MailSo\Base\Utils::IdnToAscii($sEmailToDelete, true);
|
||||
|
||||
$aAccounts = $this->GetAccounts($oAccount);
|
||||
|
||||
|
|
@ -1833,6 +1843,11 @@ class Actions
|
|||
{
|
||||
$mAccounts = $this->GetAccounts($oAccount);
|
||||
$mAccounts = \array_keys($mAccounts);
|
||||
|
||||
foreach ($mAccounts as $iIndex => $sName)
|
||||
{
|
||||
$mAccounts[$iIndex] = \MailSo\Base\Utils::IdnToUtf8($sName);
|
||||
}
|
||||
}
|
||||
|
||||
$mIdentities = false;
|
||||
|
|
@ -2366,7 +2381,7 @@ class Actions
|
|||
$this->IsAdminLoggined();
|
||||
|
||||
return $this->DefaultResponse(__FUNCTION__,
|
||||
$this->DomainProvider()->Load($this->GetActionParam('Name', '')));
|
||||
$this->DomainProvider()->Load($this->GetActionParam('Name', ''), false, false));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4213,7 +4228,7 @@ class Actions
|
|||
{
|
||||
$sMessageId = $oMessage->MessageId();
|
||||
|
||||
rewind($rMessageStream);
|
||||
\rewind($rMessageStream);
|
||||
|
||||
$iNewUid = 0;
|
||||
$this->MailClient()->MessageAppendStream(
|
||||
|
|
@ -4407,7 +4422,7 @@ class Actions
|
|||
|
||||
try
|
||||
{
|
||||
switch (strtolower($sDraftInfoType))
|
||||
switch (\strtolower($sDraftInfoType))
|
||||
{
|
||||
case 'reply':
|
||||
case 'reply-all':
|
||||
|
|
@ -4430,7 +4445,7 @@ class Actions
|
|||
}
|
||||
}
|
||||
|
||||
if (0 < strlen($sSentFolder))
|
||||
if (0 < \strlen($sSentFolder))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -4514,7 +4529,7 @@ class Actions
|
|||
$aTo =& $oToCollection->GetAsArray();
|
||||
foreach ($aTo as /* @var $oEmail \MailSo\Mime\Email */ $oEmail)
|
||||
{
|
||||
$aArrayToFrec[$oEmail->GetEmail()] = $oEmail->ToString();
|
||||
$aArrayToFrec[$oEmail->GetEmail(true)] = $oEmail->ToString(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6784,7 +6799,7 @@ class Actions
|
|||
|
||||
if ($bHasSimpleJsonFunc)
|
||||
{
|
||||
$mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), $mResponse->ToSimpleJSON());
|
||||
$mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), $mResponse->ToSimpleJSON(true));
|
||||
}
|
||||
else if ('MailSo\Mail\Message' === $sClassName)
|
||||
{
|
||||
|
|
@ -6934,7 +6949,7 @@ class Actions
|
|||
try
|
||||
{
|
||||
$oReadReceipt = \MailSo\Mime\Email::Parse($mResult['ReadReceipt']);
|
||||
if (!$oReadReceipt || ($oReadReceipt && \strtolower($oAccount->Email()) === \strtolower($oReadReceipt->GetEmail())))
|
||||
if (!$oReadReceipt || ($oReadReceipt && $oAccount->Email() === $oReadReceipt->GetEmail()))
|
||||
{
|
||||
$mResult['ReadReceipt'] = '';
|
||||
}
|
||||
|
|
@ -6954,7 +6969,7 @@ class Actions
|
|||
{
|
||||
$mResult = \array_merge($this->objectData($mResponse, $sParent, $aParameters), array(
|
||||
'Name' => \MailSo\Base\Utils::Utf8Clear($mResponse->GetDisplayName()),
|
||||
'Email' => \MailSo\Base\Utils::Utf8Clear($mResponse->GetEmail())
|
||||
'Email' => \MailSo\Base\Utils::Utf8Clear($mResponse->GetEmail(true))
|
||||
));
|
||||
}
|
||||
else if ('RainLoop\Providers\AddressBook\Classes\Contact' === $sClassName)
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ abstract class PdoAbstract
|
|||
return $aCache[$sEmail];
|
||||
}
|
||||
|
||||
$sEmail = \strtolower(\trim($sEmail));
|
||||
$sEmail = \MailSo\Base\Utils::IdnToAscii(\trim($sEmail), true);
|
||||
if (empty($sEmail))
|
||||
{
|
||||
throw new \InvalidArgumentException('Empty Email argument');
|
||||
|
|
|
|||
|
|
@ -263,11 +263,11 @@ class Domain
|
|||
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth,
|
||||
$sWhiteList = '')
|
||||
{
|
||||
$this->sIncHost = $sIncHost;
|
||||
$this->sIncHost = \MailSo\Base\Utils::IdnToAscii($sIncHost);
|
||||
$this->iIncPort = $iIncPort;
|
||||
$this->iIncSecure = $iIncSecure;
|
||||
$this->bIncShortLogin = $bIncShortLogin;
|
||||
$this->sOutHost = $sOutHost;
|
||||
$this->sOutHost = \MailSo\Base\Utils::IdnToAscii($sOutHost);
|
||||
$this->iOutPort = $iOutPort;
|
||||
$this->iOutSecure = $iOutSecure;
|
||||
$this->bOutShortLogin = $bOutShortLogin;
|
||||
|
|
@ -379,10 +379,13 @@ class Domain
|
|||
$sW = \trim($this->sWhiteList);
|
||||
if (0 < strlen($sW))
|
||||
{
|
||||
$sW = \preg_replace('/([^\s]+)@[^\s]*/', '$1', $sW);
|
||||
$sW = ' '.\strtolower(\trim(\preg_replace('/[\s;,\r\n\t]+/', ' ', $sW))).' ';
|
||||
$sEmail = \MailSo\Base\Utils::IdnToUtf8($sEmail, true);
|
||||
$sLogin = \MailSo\Base\Utils::IdnToUtf8($sLogin);
|
||||
|
||||
$sUserPart = \strtolower(\MailSo\Base\Utils::GetAccountNameFromEmail(0 < \strlen($sLogin) ? $sLogin : $sEmail));
|
||||
$sW = \preg_replace('/([^\s]+)@[^\s]*/', '$1', $sW);
|
||||
$sW = ' '.\trim(\preg_replace('/[\s;,\r\n\t]+/', ' ', $sW)).' ';
|
||||
|
||||
$sUserPart = \MailSo\Base\Utils::GetAccountNameFromEmail(0 < \strlen($sLogin) ? $sLogin : $sEmail);
|
||||
return false !== \strpos($sW, ' '.$sUserPart.' ');
|
||||
}
|
||||
|
||||
|
|
@ -390,17 +393,19 @@ class Domain
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $bAjax = false
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function ToSimpleJSON()
|
||||
public function ToSimpleJSON($bAjax = false)
|
||||
{
|
||||
return array(
|
||||
'Name' => $this->Name(),
|
||||
'IncHost' => $this->IncHost(),
|
||||
'Name' => $bAjax ? \MailSo\Base\Utils::IdnToUtf8($this->Name()) : $this->Name(),
|
||||
'IncHost' => $bAjax ? \MailSo\Base\Utils::IdnToUtf8($this->IncHost()) : $this->IncHost(),
|
||||
'IncPort' => $this->IncPort(),
|
||||
'IncSecure' => $this->IncSecure(),
|
||||
'IncShortLogin' => $this->IncShortLogin(),
|
||||
'OutHost' => $this->OutHost(),
|
||||
'OutHost' => $bAjax ? \MailSo\Base\Utils::IdnToUtf8($this->OutHost()) : $this->OutHost(),
|
||||
'OutPort' => $this->OutPort(),
|
||||
'OutSecure' => $this->OutSecure(),
|
||||
'OutShortLogin' => $this->OutShortLogin(),
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Identity
|
|||
protected function __construct($sId, $sEmail, $sName, $sReplyTo, $sBcc)
|
||||
{
|
||||
$this->sId = $sId;
|
||||
$this->sEmail = \strtolower($sEmail);
|
||||
$this->sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true);
|
||||
$this->sName = \trim($sName);
|
||||
$this->sReplyTo = \trim($sReplyTo);
|
||||
$this->sBcc = \trim($sBcc);
|
||||
|
|
@ -96,7 +96,7 @@ class Identity
|
|||
*/
|
||||
public function SetEmail($sEmail)
|
||||
{
|
||||
$this->sEmail = $sEmail;
|
||||
$this->sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -162,13 +162,15 @@ class Identity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $bAjax = false
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function ToSimpleJSON()
|
||||
public function ToSimpleJSON($bAjax = false)
|
||||
{
|
||||
return array(
|
||||
'Id' => $this->Id(),
|
||||
'Email' => $this->Email(),
|
||||
'Email' => $bAjax ? \MailSo\Base\Utils::IdnToUtf8($this->Email()) : $this->Email(),
|
||||
'Name' => $this->Name(),
|
||||
'ReplyTo' => $this->ReplyTo(),
|
||||
'Bcc' => $this->Bcc()
|
||||
|
|
|
|||
|
|
@ -190,10 +190,10 @@ class Manager
|
|||
*/
|
||||
private function convertPluginFolderNameToClassName($sFolderName)
|
||||
{
|
||||
$aParts = array_map('ucfirst', array_map('strtolower',
|
||||
explode(' ', preg_replace('/[^a-z0-9]+/', ' ', $sFolderName))));
|
||||
$aParts = \array_map('ucfirst', \array_map('strtolower',
|
||||
\explode(' ', \preg_replace('/[^a-z0-9]+/', ' ', $sFolderName))));
|
||||
|
||||
return implode($aParts).'Plugin';
|
||||
return \implode($aParts).'Plugin';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -425,9 +425,9 @@ class Manager
|
|||
*/
|
||||
public function AddAdditionalPartAction($sActionName, $mCallbak)
|
||||
{
|
||||
if ($this->bIsEnabled && is_callable($mCallbak))
|
||||
if ($this->bIsEnabled && \is_callable($mCallbak))
|
||||
{
|
||||
$sActionName = strtolower($sActionName);
|
||||
$sActionName = \strtolower($sActionName);
|
||||
if (!isset($this->aAdditionalParts[$sActionName]))
|
||||
{
|
||||
$this->aAdditionalParts[$sActionName] = array();
|
||||
|
|
@ -450,12 +450,12 @@ class Manager
|
|||
$bResult = false;
|
||||
if ($this->bIsEnabled)
|
||||
{
|
||||
$sActionName = strtolower($sActionName);
|
||||
$sActionName = \strtolower($sActionName);
|
||||
if (isset($this->aAdditionalParts[$sActionName]))
|
||||
{
|
||||
foreach ($this->aAdditionalParts[$sActionName] as $mCallbak)
|
||||
{
|
||||
$bCallResult = call_user_func_array($mCallbak, $aParts);
|
||||
$bCallResult = \call_user_func_array($mCallbak, $aParts);
|
||||
if ($bCallResult && !$bResult)
|
||||
{
|
||||
$bResult = true;
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class Property
|
|||
// lower
|
||||
if ($this->IsEmail())
|
||||
{
|
||||
$this->Value = \strtolower($this->Value);
|
||||
$this->Value = \MailSo\Base\Utils::StrToLowerIfAscii($this->Value);
|
||||
}
|
||||
|
||||
// phones clear value for searching
|
||||
|
|
|
|||
|
|
@ -620,7 +620,7 @@ class PdoAddressBook
|
|||
)
|
||||
);
|
||||
|
||||
$sLast = $this->lastInsertId('rainloop_ab_contacts', 'id_contact');
|
||||
$sLast = $this->lastInsertId('rainloop_ab_tags', 'id_tag');
|
||||
if (\is_numeric($sLast) && 0 < (int) $sLast)
|
||||
{
|
||||
$mResult = (int) $sLast;
|
||||
|
|
@ -1382,7 +1382,7 @@ class PdoAddressBook
|
|||
{
|
||||
if ($aItem && !empty($aItem['prop_value']))
|
||||
{
|
||||
$aExists[] = \strtolower(\trim($aItem['prop_value']));
|
||||
$aExists[] = \MailSo\Base\Utils::StrToLowerIfAscii(\trim($aItem['prop_value']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1391,7 +1391,7 @@ class PdoAddressBook
|
|||
$aEmailsToCreate = \array_filter($aEmailsObjects, function ($oItem) use ($aExists, &$aEmailsToUpdate) {
|
||||
if ($oItem)
|
||||
{
|
||||
$sEmail = \strtolower(\trim($oItem->GetEmail()));
|
||||
$sEmail = \trim($oItem->GetEmail(true));
|
||||
if (0 < \strlen($sEmail))
|
||||
{
|
||||
$aEmailsToUpdate[] = $sEmail;
|
||||
|
|
@ -1408,7 +1408,7 @@ class PdoAddressBook
|
|||
{
|
||||
if ($oItem)
|
||||
{
|
||||
$sEmailUpdate = \strtolower(\trim($oItem->GetEmail()));
|
||||
$sEmailUpdate = \trim($oItem->GetEmail(true));
|
||||
if (0 < \strlen($sEmailUpdate))
|
||||
{
|
||||
$aEmailsToUpdate[] = $sEmailUpdate;
|
||||
|
|
@ -1428,7 +1428,7 @@ class PdoAddressBook
|
|||
{
|
||||
$oPropEmail = new \RainLoop\Providers\AddressBook\Classes\Property();
|
||||
$oPropEmail->Type = \RainLoop\Providers\AddressBook\Enumerations\PropertyType::EMAIl;
|
||||
$oPropEmail->Value = \strtolower(\trim($oEmail->GetEmail()));
|
||||
$oPropEmail->Value = \trim($oEmail->GetEmail(true));
|
||||
|
||||
$oContact->Properties[] = $oPropEmail;
|
||||
}
|
||||
|
|
@ -1439,7 +1439,7 @@ class PdoAddressBook
|
|||
$sFullName = $oEmail->GetDisplayName();
|
||||
if (false !== \strpos($sFullName, ' '))
|
||||
{
|
||||
$aNames = explode(' ', $sFullName, 2);
|
||||
$aNames = \explode(' ', $sFullName, 2);
|
||||
$sFirst = isset($aNames[0]) ? $aNames[0] : '';
|
||||
$sLast = isset($aNames[1]) ? $aNames[1] : '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,12 +36,13 @@ class Domain extends \RainLoop\Providers\AbstractProvider
|
|||
/**
|
||||
* @param string $sName
|
||||
* @param bool $bFindWithWildCard = false
|
||||
* @param bool $bCheckDisabled = true
|
||||
*
|
||||
* @return \RainLoop\Domain|null
|
||||
*/
|
||||
public function Load($sName, $bFindWithWildCard = false)
|
||||
public function Load($sName, $bFindWithWildCard = false, $bCheckDisabled = true)
|
||||
{
|
||||
return $this->oDriver->Load($sName, $bFindWithWildCard);
|
||||
return $this->oDriver->Load($sName, $bFindWithWildCard, $bCheckDisabled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -43,7 +43,15 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
|
|||
return 'default';
|
||||
}
|
||||
|
||||
$sName = \strtolower($sName);
|
||||
if ($bBack)
|
||||
{
|
||||
$sName = \MailSo\Base\Utils::IdnToUtf8($sName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sName = \MailSo\Base\Utils::IdnToAscii($sName, true);
|
||||
}
|
||||
|
||||
return $bBack ? \str_replace('_wildcard_', '*', $sName) : \str_replace('*', '_wildcard_', $sName);
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +63,8 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
|
|||
*/
|
||||
public function Disable($sName, $bDisable)
|
||||
{
|
||||
$sName = \MailSo\Base\Utils::IdnToAscii($sName, true);
|
||||
|
||||
$sFile = '';
|
||||
if (\file_exists($this->sDomainPath.'/disabled'))
|
||||
{
|
||||
|
|
@ -111,8 +121,8 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
|
|||
$aList = \glob($this->sDomainPath.'/*.ini');
|
||||
foreach ($aList as $sFile)
|
||||
{
|
||||
$sName = \strtolower(\substr(\basename($sFile), 0, -4));
|
||||
if ('default' === $sName || false !== strpos($sName, '_wildcard_'))
|
||||
$sName = \substr(\basename($sFile), 0, -4);
|
||||
if ('default' === $sName || false !== \strpos($sName, '_wildcard_'))
|
||||
{
|
||||
$aNames[] = $this->codeFileName($sName, true);
|
||||
}
|
||||
|
|
@ -135,16 +145,16 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
|
|||
/**
|
||||
* @param string $sName
|
||||
* @param bool $bFindWithWildCard = false
|
||||
* @param bool $bCheckDisabled = true
|
||||
*
|
||||
* @return \RainLoop\Domain | null
|
||||
* @return \RainLoop\Domain|null
|
||||
*/
|
||||
public function Load($sName, $bFindWithWildCard = false)
|
||||
public function Load($sName, $bFindWithWildCard = false, $bCheckDisabled = true)
|
||||
{
|
||||
$mResult = null;
|
||||
|
||||
$sDisabled = '';
|
||||
$sFoundedValue = '';
|
||||
$sName = \strtolower($sName);
|
||||
|
||||
$sRealFileName = $this->codeFileName($sName);
|
||||
|
||||
|
|
@ -154,7 +164,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
|
|||
}
|
||||
|
||||
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini') &&
|
||||
(0 === \strlen($sDisabled) || false === \strpos(\strtolower(','.$sDisabled.','), \strtolower(','.$sName.','))))
|
||||
(!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(','.$sDisabled.',', ','.\MailSo\Base\Utils::IdnToAscii($sName, true).',')))
|
||||
{
|
||||
$aDomain = @\parse_ini_file($this->sDomainPath.'/'.$sRealFileName.'.ini');
|
||||
// fix misspellings (#119)
|
||||
|
|
@ -189,9 +199,10 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
|
|||
$sNames = $this->getWildcardDomainsLine();
|
||||
if (0 < \strlen($sNames))
|
||||
{
|
||||
if (\RainLoop\Plugins\Helper::ValidateWildcardValues($sName, $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue))
|
||||
if (\RainLoop\Plugins\Helper::ValidateWildcardValues(
|
||||
\MailSo\Base\Utils::IdnToUtf8($sName, true), $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue))
|
||||
{
|
||||
if (0 === \strlen($sDisabled) || false === \strpos(\strtolower(','.$sDisabled.','), \strtolower(','.$sFoundedValue.',')))
|
||||
if (!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(','.$sDisabled.',', ','.$sFoundedValue.','))
|
||||
{
|
||||
$mResult = $this->Load($sFoundedValue, false);
|
||||
}
|
||||
|
|
@ -209,8 +220,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
|
|||
*/
|
||||
public function Save(\RainLoop\Domain $oDomain)
|
||||
{
|
||||
$sName = \strtolower($oDomain->Name());
|
||||
$sRealFileName = $this->codeFileName($sName);
|
||||
$sRealFileName = $this->codeFileName($oDomain->Name());
|
||||
|
||||
if ($this->oCacher)
|
||||
{
|
||||
|
|
@ -229,7 +239,6 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
|
|||
public function Delete($sName)
|
||||
{
|
||||
$bResult = true;
|
||||
$sName = \strtolower($sName);
|
||||
$sRealFileName = $this->codeFileName($sName);
|
||||
|
||||
if (0 < \strlen($sName) && \file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini'))
|
||||
|
|
@ -264,8 +273,9 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
|
|||
|
||||
foreach ($aList as $sFile)
|
||||
{
|
||||
$sName = \strtolower(\substr(\basename($sFile), 0, -4));
|
||||
$sName = \substr(\basename($sFile), 0, -4);
|
||||
$sName = $this->codeFileName($sName, true);
|
||||
|
||||
if (false === \strpos($sName, '*'))
|
||||
{
|
||||
$aResult[] = $sName;
|
||||
|
|
@ -292,15 +302,19 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface
|
|||
$sDisabled = @\file_get_contents($this->sDomainPath.'/disabled');
|
||||
if (false !== $sDisabled && 0 < strlen($sDisabled))
|
||||
{
|
||||
$aDisabledNames = \explode(',', strtolower($sDisabled));
|
||||
$aDisabledNames = \explode(',', $sDisabled);
|
||||
$aDisabledNames = \array_unique($aDisabledNames);
|
||||
foreach ($aDisabledNames as $iIndex => $sValue)
|
||||
{
|
||||
$aDisabledNames[$iIndex] = \MailSo\Base\Utils::IdnToUtf8($sValue, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$aReturn = array();
|
||||
foreach ($aResult as $sName)
|
||||
{
|
||||
$aReturn[$sName] = !\in_array(\strtolower($sName), $aDisabledNames);
|
||||
$aReturn[$sName] = !\in_array($sName, $aDisabledNames);
|
||||
}
|
||||
|
||||
return $aReturn;
|
||||
|
|
|
|||
|
|
@ -16,10 +16,11 @@ interface DomainAdminInterface extends DomainInterface
|
|||
/**
|
||||
* @param string $sName
|
||||
* @param bool $bFindWithWildCard = false
|
||||
* @param bool $bCheckDisabled = true
|
||||
*
|
||||
* @return \RainLoop\Domain | null
|
||||
* @return \RainLoop\Domain|null
|
||||
*/
|
||||
public function Load($sName, $bFindWithWildCard = false);
|
||||
public function Load($sName, $bFindWithWildCard = false, $bCheckDisabled = true);
|
||||
|
||||
/**
|
||||
* @param \RainLoop\Domain $oDomain
|
||||
|
|
|
|||
|
|
@ -126,7 +126,8 @@ class Service
|
|||
{
|
||||
$bAdmin = !empty($aPaths[0]) && \in_array(\strtolower($aPaths[0]), array('admin', 'cp'));
|
||||
}
|
||||
else if (empty($aPaths[0]) && \strtolower($sAdminPanelHost) === \strtolower($this->oHttp->GetHost()))
|
||||
else if (empty($aPaths[0]) &&
|
||||
\MailSo\Base\Utils::StrToLowerIfAscii($sAdminPanelHost) === \MailSo\Base\Utils::StrToLowerIfAscii($this->oHttp->GetHost()))
|
||||
{
|
||||
$bAdmin = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -751,7 +751,7 @@ class ServiceActions
|
|||
|
||||
if (\is_array($mData) && !empty($mData['Email']) && isset($mData['Password']))
|
||||
{
|
||||
$sEmail = \strtolower(\trim($mData['Email']));
|
||||
$sEmail = \trim($mData['Email']);
|
||||
$sPassword = $mData['Password'];
|
||||
$sLogin = isset($mData['Login']) ? $mData['Login'] : '';
|
||||
|
||||
|
|
@ -866,7 +866,7 @@ class ServiceActions
|
|||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -875,9 +875,11 @@ class ServiceActions
|
|||
if ($this->Config()->Get('webmail', 'allow_additional_accounts', true))
|
||||
{
|
||||
$oAccountToLogin = null;
|
||||
$sEmail = empty($this->aPaths[2]) ? '' : \strtolower(\urldecode(\trim($this->aPaths[2])));
|
||||
$sEmail = empty($this->aPaths[2]) ? '' : \urldecode(\trim($this->aPaths[2]));
|
||||
if (!empty($sEmail))
|
||||
{
|
||||
$sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
|
||||
|
||||
$oAccount = $this->oActions->GetAccount();
|
||||
if ($oAccount)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,21 +36,21 @@ class Social
|
|||
$mResult = null;
|
||||
if (!empty($oItem['gd$email'][0]['address']))
|
||||
{
|
||||
$mEmail = \strtolower($oItem['gd$email'][0]['address']);
|
||||
if (\is_array($oItem['gd$email']) && 1 <\count($oItem['gd$email']))
|
||||
$mEmail = \MailSo\Base\Utils::IdnToAscii($oItem['gd$email'][0]['address'], true);
|
||||
if (\is_array($oItem['gd$email']) && 1 < \count($oItem['gd$email']))
|
||||
{
|
||||
$mEmail = array();
|
||||
foreach ($oItem['gd$email'] as $oEmail)
|
||||
{
|
||||
if (!empty($oEmail['address']))
|
||||
{
|
||||
$mEmail[] = \strtolower($oEmail['address']);
|
||||
$mEmail[] = \MailSo\Base\Utils::IdnToAscii($oEmail['address'], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sImg = '';
|
||||
if (!empty($oItem['link']) && is_array($oItem['link']))
|
||||
if (!empty($oItem['link']) && \is_array($oItem['link']))
|
||||
{
|
||||
foreach ($oItem['link'] as $oLink)
|
||||
{
|
||||
|
|
@ -79,29 +79,29 @@ class Social
|
|||
if (isset($aPics[$sHash]))
|
||||
{
|
||||
$mData = $aPics[$sHash];
|
||||
if (!is_array($mData))
|
||||
if (!\is_array($mData))
|
||||
{
|
||||
$mData = array($mData);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($mEmail))
|
||||
if (\is_array($mEmail))
|
||||
{
|
||||
$mData = array_merge($mData, $mEmail);
|
||||
$mData = array_unique($mData);
|
||||
$mData = \array_merge($mData, $mEmail);
|
||||
$mData = \array_unique($mData);
|
||||
}
|
||||
else if (0 < strlen($mEmail))
|
||||
else if (0 < \strlen($mEmail))
|
||||
{
|
||||
$mData[] = $mEmail;
|
||||
}
|
||||
|
||||
if (is_array($mData))
|
||||
if (\is_array($mData))
|
||||
{
|
||||
if (1 === count($mData) && !empty($mData[0]))
|
||||
if (1 === \count($mData) && !empty($mData[0]))
|
||||
{
|
||||
$aPics[$sHash] = $mData[0];
|
||||
}
|
||||
else if (1 < count($mData))
|
||||
else if (1 < \count($mData))
|
||||
{
|
||||
$aPics[$sHash] = $mData;
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ class Social
|
|||
'alt' => 'json'
|
||||
));
|
||||
|
||||
if (!empty($aResponse['result']['feed']['entry']) && is_array($aResponse['result']['feed']['entry']))
|
||||
if (!empty($aResponse['result']['feed']['entry']) && \is_array($aResponse['result']['feed']['entry']))
|
||||
{
|
||||
$mResult = array();
|
||||
foreach ($aResponse['result']['feed']['entry'] as $oItem)
|
||||
|
|
@ -140,7 +140,7 @@ class Social
|
|||
$aItem = $this->convertGoogleJsonContactToResponseContact($oItem, $aPics);
|
||||
if ($aItem)
|
||||
{
|
||||
if (is_array($aItem['email']))
|
||||
if (\is_array($aItem['email']))
|
||||
{
|
||||
$aNewItem = $aItem;
|
||||
unset($aNewItem['email']);
|
||||
|
|
@ -185,7 +185,7 @@ class Social
|
|||
if (!empty($sEncodedeData))
|
||||
{
|
||||
$aData = \RainLoop\Utils::DecodeKeyValues($sEncodedeData);
|
||||
if (is_array($aData) && isset($aData['access_token'], $aData['id']))
|
||||
if (\is_array($aData) && isset($aData['access_token'], $aData['id']))
|
||||
{
|
||||
$this->oActions->StorageProvider()->Clear(null,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue