IDNA support (beta)

This commit is contained in:
RainLoop Team 2014-05-13 20:13:55 +04:00
parent 0ca00dec40
commit e82108ac85
31 changed files with 3839 additions and 308 deletions

View file

@ -1883,4 +1883,62 @@ class Utils
'.aero .asia .biz .cat .com .coop .edu .gov .info .int .jobs .mil .mobi .museum .name .net .org .pro .tel .travel .xxx .ac .ad .ae .af .ag .ai .al .am .an .ao .aq .ar .as .at .au .aw .ax .az .ba .bb .bd .be .bf .bg .bh .bi .bj .bm .bn .bo .br .bs .bt .bv .bw .by .bz .ca .cc .cd .cf .cg .ch .ci .ck .cl .cm .cn .co .cr .cs .cu .cv .cx .cy .cz .dd .de .dj .dk .dm .do .dz .ec .ee .eg .er .es .et .eu .fi .fj .fk .fm .fo .fr .ga .gb .gd .ge .gf .gg .gh .gi .gl .gm .gn .gp .gq .gr .gs .gt .gu .gw .gy .hk .hm .hn .hr .ht .hu .id .ie .il .im .in .io .iq .ir .is .it .je .jm .jo .jp .ke .kg .kh .ki .km .kn .kp .kr .kw .ky .kz .la .lb .lc .li .lk .lr .ls .lt .lu .lv .ly .ma .mc .md .me .mg .mh .mk .ml .mm .mn .mo .mp .mq .mr .ms .mt .mu .mv .mw .mx .my .mz .na .nc .ne .nf .ng .ni .nl .no .np .nr .nu .nz .om .pa .pe .pf .pg .ph .pk .pl .pm .pn .pr .ps .pt .pw .py .qa .re .ro .rs .ru . .rw .sa .sb .sc .sd .se .sg .sh .si .sj .sk .sl .sm .sn .so .sr .st .su .sv .sy .sz .tc .td .tf .tg .th .tj .tk .tl .tm .tn .to .tp .tr .tt .tv .tw .tz .ua .ug .uk .us .uy .uz .va .vc .ve .vg .vi .vn .vu .wf .ws .ye .yt .za .zm .zw'
));
}
/**
* @return \Net_IDNA2
*/
private static function idn()
{
static $oIdn = null;
if (null === $oIdn)
{
include_once MAILSO_LIBRARY_ROOT_PATH.'Vendors/NET/IDNA2.php';
$oIdn = new \Net_IDNA2();
}
return $oIdn;
}
/**
* @param string $sDomain
* @param bool $bLowerIfAscii = false
*
* @return string
*/
public static function IdnToUtf8($sDomain, $bLowerIfAscii = false)
{
if ($sDomain && \preg_match('/(^|\.)xn--/i', $sDomain))
{
try
{
$sDomain = self::idn()->decode($sDomain);
}
catch (\Exception $oException) {}
}
$sDomain = $bLowerIfAscii ? \MailSo\Base\Utils::StrToLowerIfAscii($sDomain) : $sDomain;
return $sDomain;
}
/**
* @param string $sDomain
* @param bool $bLowerIfAscii = false
*
* @return string
*/
public static function IdnToAscii($sDomain, $bLowerIfAscii = false)
{
$sDomain = $bLowerIfAscii ? \MailSo\Base\Utils::StrToLowerIfAscii($sDomain) : $sDomain;
if ($sDomain && \preg_match('/[^\x20-\x7E]/', $sDomain))
{
try
{
$sDomain = self::idn()->encode($sDomain);
}
catch (\Exception $oException) {}
}
return $sDomain;
}
}

View file

@ -188,6 +188,7 @@ class ImapClient extends \MailSo\Net\NetClient
}
$sLogin = \trim($sLogin);
$sLogin = \MailSo\Base\Utils::IdnToAscii($sLogin);
$sPassword = $sPassword;
$this->sLogginedUser = $sLogin;

View file

@ -39,7 +39,7 @@ class Email
throw new \MailSo\Base\Exceptions\InvalidArgumentException();
}
$this->sEmail = \trim($sEmail);
$this->sEmail = \MailSo\Base\Utils::IdnToAscii(\trim($sEmail), true);
$this->sDisplayName = \trim($sDisplayName);
$this->sRemark = \trim($sRemark);
}
@ -176,6 +176,7 @@ class Email
}
$sEmail = \trim(\trim($sEmail), '<>');
$sName = \trim(\trim($sName), '"');
$sName = \trim($sName, '\'');
$sComment = \trim(\trim($sComment), '()');
@ -188,11 +189,13 @@ class Email
}
/**
* @param bool $bIdn = false
*
* @return string
*/
public function GetEmail()
public function GetEmail($bIdn = false)
{
return $this->sEmail;
return $bIdn ? \MailSo\Base\Utils::IdnToUtf8($this->sEmail) : $this->sEmail;
}
/**
@ -216,31 +219,36 @@ class Email
*/
public function GetAccountName()
{
return \MailSo\Base\Utils::GetAccountNameFromEmail($this->sEmail);
return \MailSo\Base\Utils::GetAccountNameFromEmail($this->GetEmail(false));
}
/**
* @param bool $bIdn = false
*
* @return string
*/
public function GetDomain()
public function GetDomain($bIdn = false)
{
return \MailSo\Base\Utils::GetDomainFromEmail($this->sEmail);
return \MailSo\Base\Utils::GetDomainFromEmail($this->GetEmail($bIdn));
}
/**
* @param bool $bIdn = false
*
* @return array
*/
public function ToArray()
public function ToArray($bIdn = false)
{
return array($this->sDisplayName, $this->sEmail, $this->sRemark);
return array($this->sDisplayName, $this->GetEmail($bIdn), $this->sRemark);
}
/**
* @param bool $bConvertSpecialsName = false
* @param bool $bIdn = false
*
* @return string
*/
public function ToString($bConvertSpecialsName = false)
public function ToString($bConvertSpecialsName = false, $bIdn = false)
{
$sReturn = '';
@ -263,8 +271,7 @@ class Email
if (0 < \strlen($this->sEmail))
{
$sReturn = $this->sEmail;
$sReturn = $this->GetEmail($bIdn);
if (0 < \strlen($sDisplayName.$sRemark))
{
$sReturn = $sDisplayName.' <'.$sReturn.'> '.$sRemark;

View file

@ -100,16 +100,17 @@ class EmailCollection extends \MailSo\Base\Collection
/**
* @param bool $bConvertSpecialsName = false
* @param bool $bIdn = false
*
* @return string
*/
public function ToString($bConvertSpecialsName = false)
public function ToString($bConvertSpecialsName = false, $bIdn = false)
{
$aReturn = $aEmails = array();
$aEmails =& $this->GetAsArray();
foreach ($aEmails as /* @var $oEmail \MailSo\Mime\Email */ $oEmail)
{
$aReturn[] = $oEmail->ToString($bConvertSpecialsName);
$aReturn[] = $oEmail->ToString($bConvertSpecialsName, $bIdn);
}
return \implode(', ', $aReturn);

View file

@ -228,7 +228,7 @@ class Header
$oEmailCollection = \MailSo\Mime\EmailCollection::NewInstance($this->sFullValue);
if ($oEmailCollection && 0 < $oEmailCollection->Count())
{
$sResult = $oEmailCollection->ToString(true);
$sResult = $oEmailCollection->ToString(true, false);
}
}

View file

@ -191,7 +191,7 @@ class Message
}
/**
* @param string $sHeader
* @param string $sHeaderName
* @param string $sValue
*
* @return \MailSo\Mime\Message

View file

@ -173,6 +173,8 @@ class SmtpClient extends \MailSo\Net\NetClient
*/
public function Login($sLogin, $sPassword)
{
$sLogin = \MailSo\Base\Utils::IdnToAscii($sLogin);
if ($this->IsAuthSupported('LOGIN'))
{
try
@ -299,6 +301,7 @@ class SmtpClient extends \MailSo\Net\NetClient
*/
public function MailFrom($sFrom, $sSizeIfSupported = '')
{
$sFrom = \MailSo\Base\Utils::IdnToAscii($sFrom, true);
$sCmd = 'FROM:<'.$sFrom.'>';
$sSizeIfSupported = (string) $sSizeIfSupported;
@ -333,6 +336,7 @@ class SmtpClient extends \MailSo\Net\NetClient
\MailSo\Log\Enumerations\Type::ERROR, true);
}
$sTo = \MailSo\Base\Utils::IdnToAscii($sTo, true);
$this->sendRequestWithCheck('RCPT', array(250, 251), 'TO:<'.$sTo.'>');
$this->bRcpt = true;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
<?php
class Net_IDNA2_Exception extends Exception
{
}

View file

@ -0,0 +1,10 @@
<?php
//require_once 'Net/IDNA2/Exception.php';
defined('MAILSO_LIBRARY_ROOT_PATH') || die();
require_once MAILSO_LIBRARY_ROOT_PATH.'Vendors/Net/IDNA2/Exception.php';
class Net_IDNA2_Exception_Nameprep extends Net_IDNA2_Exception
{
}

View file

@ -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);
}
/**

View file

@ -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)

View file

@ -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');

View file

@ -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(),

View file

@ -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()

View file

@ -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;

View file

@ -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

View file

@ -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] : '';
}

View file

@ -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);
}
/**

View file

@ -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;

View file

@ -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

View file

@ -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;
}

View file

@ -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)
{

View file

@ -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,

View file

@ -225,7 +225,7 @@
<div data-bind="foreach: viewPropertiesEmails">
<div class="property-line">
<span class="contactValueStatic" data-bind="text: value" />
<input type="email" class="contactValueInput" placeholder=""
<input type="text" class="contactValueInput" placeholder=""
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
</div>

View file

@ -637,7 +637,7 @@
border-radius: 8px;
}
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
/* =============================================================================
@ -1142,7 +1142,7 @@ table {
border-collapse: collapse;
border-spacing: 0;
}
@charset "UTF-8";
@font-face {
@ -1510,7 +1510,7 @@ table {
.icon-help:before {
content: "\e06c";
}
/** initial setup **/
.nano {
/*
@ -1627,7 +1627,7 @@ table {
.nano > .pane2:hover > .slider2, .nano > .pane2.active > .slider2 {
background-color: rgba(0, 0, 0, 0.4);
}
/* Magnific Popup CSS */
.mfp-bg {
top: 0;
@ -1992,7 +1992,7 @@ img.mfp-img {
right: 0;
padding-top: 0; }
/* overlay at start */
.mfp-fade.mfp-bg {
@ -2038,7 +2038,7 @@ img.mfp-img {
-moz-transform: translateX(50px);
transform: translateX(50px);
}
.simple-pace {
-webkit-pointer-events: none;
pointer-events: none;
@ -2109,7 +2109,7 @@ img.mfp-img {
@keyframes simple-pace-stripe-animation {
0% { transform: none; transform: none; }
100% { transform: translate(-32px, 0); transform: translate(-32px, 0); }
}
}
.inputosaurus-container {
background-color:#fff;
border:1px solid #bcbec0;
@ -2177,7 +2177,7 @@ img.mfp-img {
box-shadow:none;
}
.inputosaurus-input-hidden { display:none; }
.flag-wrapper {
width: 24px;
height: 16px;
@ -2221,7 +2221,7 @@ img.mfp-img {
.flag.flag-pt-br {background-position: -192px -11px}
.flag.flag-cn, .flag.flag-zh-tw, .flag.flag-zh-cn, .flag.flag-zh-hk {background-position: -208px -22px}
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
.clearfix {
*zoom: 1;

View file

@ -1,5 +1,5 @@
/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, _) {
/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, _) {
'use strict';
@ -77,14 +77,14 @@ var
$document = $(window.document),
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
;
;
/*jshint onevar: false*/
/**
* @type {?AdminApp}
*/
var RL = null;
/*jshint onevar: true*/
/**
* @type {?}
*/
@ -233,7 +233,7 @@ if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
return oType && 'application/pdf' === oType.type;
});
}
Consts.Defaults = {};
Consts.Values = {};
Consts.DataImages = {};
@ -351,7 +351,7 @@ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA
* @type {string}
*/
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
/**
* @enum {string}
*/
@ -726,7 +726,7 @@ Enums.Notification = {
'UnknownNotification': 999,
'UnknownError': 999
};
Utils.trim = $.trim;
Utils.inArray = $.inArray;
Utils.isArray = _.isArray;
@ -2469,7 +2469,7 @@ Utils.detectDropdownVisibility = _.debounce(function () {
Globals.dropdownVisibility(!!_.find(BootstrapDropdowns, function (oItem) {
return oItem.hasClass('open');
}));
}, 50);
}, 50);
// Base64 encode / decode
// http://www.webtoolkit.info/
@ -2632,7 +2632,7 @@ Base64 = {
}
};
/*jslint bitwise: false*/
/*jslint bitwise: false*/
ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) {
if (!Globals.bMobileDevice)
@ -3460,7 +3460,7 @@ ko.observable.fn.validateFunc = function (fFunc)
return this;
};
/**
* @constructor
*/
@ -3772,7 +3772,7 @@ LinkBuilder.prototype.socialFacebook = function ()
{
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
};
/**
* @type {Object}
*/
@ -3866,7 +3866,7 @@ Plugins.settingsGet = function (sPluginSection, sName)
};
/**
* @constructor
*/
@ -3940,7 +3940,7 @@ CookieDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -4011,7 +4011,7 @@ LocalStorageDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -4054,7 +4054,7 @@ LocalStorage.prototype.get = function (iKey)
{
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
};
/**
* @constructor
*/
@ -4067,7 +4067,7 @@ KnoinAbstractBoot.prototype.bootstart = function ()
{
};
/**
* @param {string=} sPosition = ''
* @param {string=} sTemplate = ''
@ -4160,7 +4160,7 @@ KnoinAbstractViewModel.prototype.registerPopupKeyDown = function ()
return true;
});
};
/**
* @param {string} sScreenName
* @param {?=} aViewModels = []
@ -4236,7 +4236,7 @@ KnoinAbstractScreen.prototype.__start = function ()
this.oCross = oRoute;
}
};
/**
* @constructor
*/
@ -4636,7 +4636,7 @@ Knoin.prototype.bootstart = function ()
};
kn = new Knoin();
/**
* @param {string=} sEmail
* @param {string=} sName
@ -5000,7 +5000,7 @@ EmailModel.prototype.inputoTagLine = function ()
{
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
};
/**
* @constructor
*/
@ -5044,7 +5044,7 @@ ContactTagModel.prototype.toLine = function (bEncodeHtml)
return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
Utils.encodeHtml(this.name()) : this.name();
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5339,7 +5339,7 @@ PopupsDomainViewModel.prototype.clearForm = function ()
this.smtpAuth(true);
this.whiteList('');
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5476,7 +5476,7 @@ PopupsPluginViewModel.prototype.onBuild = function ()
}
}, this));
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5592,7 +5592,7 @@ PopupsActivateViewModel.prototype.validateSubscriptionKey = function ()
{
var sValue = this.key();
return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
};
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5652,7 +5652,7 @@ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
RL.data().mainLanguage(sLang);
this.cancelCommand();
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5758,7 +5758,7 @@ PopupsAskViewModel.prototype.onBuild = function ()
}, this));
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5845,7 +5845,7 @@ AdminLoginViewModel.prototype.onHide = function ()
{
this.loginFocus(false);
};
/**
* @param {?} oScreen
*
@ -5869,7 +5869,7 @@ AdminMenuViewModel.prototype.link = function (sRoute)
{
return '#/' + sRoute;
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5893,7 +5893,7 @@ AdminPaneViewModel.prototype.logoutClick = function ()
RL.remote().adminLogout(function () {
RL.loginAndLogoutReload();
});
};
};
/**
* @constructor
*/
@ -5993,7 +5993,7 @@ AdminGeneral.prototype.selectLanguage = function ()
{
kn.showScreenPopup(PopupsLanguagesViewModel);
};
/**
* @constructor
*/
@ -6045,7 +6045,7 @@ AdminLogin.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -6114,7 +6114,7 @@ AdminBranding.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -6334,7 +6334,7 @@ AdminContacts.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -6423,7 +6423,7 @@ AdminDomains.prototype.onDomainListChangeRequest = function ()
{
RL.reloadDomainList();
};
/**
* @constructor
*/
@ -6535,7 +6535,7 @@ AdminSecurity.prototype.phpInfoLink = function ()
{
return RL.link().phpInfo();
};
/**
* @constructor
*/
@ -6651,7 +6651,7 @@ AdminSocial.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -6748,7 +6748,7 @@ AdminPlugins.prototype.onPluginDisableRequest = function (sResult, oData)
RL.reloadPluginList();
};
/**
* @constructor
*/
@ -6846,7 +6846,7 @@ AdminPackages.prototype.installPackage = function (oPackage)
RL.remote().packageInstall(this.requestHelper(oPackage, true), oPackage);
}
};
/**
* @constructor
*/
@ -6897,7 +6897,7 @@ AdminLicensing.prototype.licenseExpiredMomentValue = function ()
{
var oDate = moment.unix(this.licenseExpired());
return oDate.format('LL') + ' (' + oDate.from(moment()) + ')';
};
};
/**
* @constructor
*/
@ -7027,7 +7027,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
};
/**
* @constructor
* @extends AbstractData
@ -7069,7 +7069,7 @@ _.extend(AdminDataStorage.prototype, AbstractData.prototype);
AdminDataStorage.prototype.populateDataOnStart = function()
{
AbstractData.prototype.populateDataOnStart.call(this);
};
};
/**
* @constructor
*/
@ -7343,7 +7343,7 @@ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
'Version': sVersion
});
};
/**
* @constructor
* @extends AbstractAjaxRemoteStorage
@ -7588,7 +7588,7 @@ AdminAjaxRemoteStorage.prototype.adminPing = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminPing');
};
/**
* @constructor
*/
@ -7671,7 +7671,7 @@ AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData)
{
this.oEmailsPicsHashes = oData;
};
/**
* @constructor
* @extends AbstractCacheStorage
@ -7682,7 +7682,7 @@ function AdminCacheStorage()
}
_.extend(AdminCacheStorage.prototype, AbstractCacheStorage.prototype);
/**
* @param {Array} aViewModels
* @constructor
@ -7860,7 +7860,7 @@ AbstractSettings.prototype.routes = function ()
['', oRules]
];
};
/**
* @constructor
* @extends KnoinAbstractScreen
@ -7875,7 +7875,7 @@ _.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
AdminLoginScreen.prototype.onShow = function ()
{
RL.setTitle('');
};
};
/**
* @constructor
* @extends AbstractSettings
@ -7895,7 +7895,7 @@ AdminSettingsScreen.prototype.onShow = function ()
// AbstractSettings.prototype.onShow.call(this);
RL.setTitle('');
};
};
/**
* @constructor
* @extends KnoinAbstractBoot
@ -8243,7 +8243,7 @@ AbstractApp.prototype.bootstart = function ()
ssm.ready();
};
/**
* @constructor
* @extends AbstractApp
@ -8482,7 +8482,7 @@ AdminApp.prototype.bootstart = function ()
* @type {AdminApp}
*/
RL = new AdminApp();
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
@ -8533,9 +8533,9 @@ window['__RLBOOT'] = function (fCall) {
window['__RLBOOT'] = null;
});
};
if (window.SimplePace) {
window.SimplePace.add(10);
}
}
}(window, jQuery, ko, crossroads, hasher, _));

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, moment, Jua, _, ifvisible, key) {
/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, moment, Jua, _, ifvisible, key) {
'use strict';
@ -77,7 +77,7 @@ var
$document = $(window.document),
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
;
;
/*jshint onevar: false*/
/**
* @type {?RainLoopApp}
@ -88,7 +88,7 @@ var
$proxyDiv = $('<div></div>')
;
/*jshint onevar: true*/
/**
* @type {?}
*/
@ -237,7 +237,7 @@ if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
return oType && 'application/pdf' === oType.type;
});
}
Consts.Defaults = {};
Consts.Values = {};
Consts.DataImages = {};
@ -355,7 +355,7 @@ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA
* @type {string}
*/
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
/**
* @enum {string}
*/
@ -730,7 +730,7 @@ Enums.Notification = {
'UnknownNotification': 999,
'UnknownError': 999
};
Utils.trim = $.trim;
Utils.inArray = $.inArray;
Utils.isArray = _.isArray;
@ -2473,7 +2473,7 @@ Utils.detectDropdownVisibility = _.debounce(function () {
Globals.dropdownVisibility(!!_.find(BootstrapDropdowns, function (oItem) {
return oItem.hasClass('open');
}));
}, 50);
}, 50);
// Base64 encode / decode
// http://www.webtoolkit.info/
@ -2636,7 +2636,7 @@ Base64 = {
}
};
/*jslint bitwise: false*/
/*jslint bitwise: false*/
ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) {
if (!Globals.bMobileDevice)
@ -3464,7 +3464,7 @@ ko.observable.fn.validateFunc = function (fFunc)
return this;
};
/**
* @constructor
*/
@ -3776,7 +3776,7 @@ LinkBuilder.prototype.socialFacebook = function ()
{
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
};
/**
* @type {Object}
*/
@ -3870,7 +3870,7 @@ Plugins.settingsGet = function (sPluginSection, sName)
};
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
{
var self = this;
@ -4090,7 +4090,7 @@ NewHtmlEditorWrapper.prototype.clear = function (bFocus)
this.setHtml('', bFocus);
};
/**
* @constructor
* @param {koProperty} oKoList
@ -4799,7 +4799,7 @@ Selector.prototype.on = function (sEventName, fCallback)
{
this.oCallbacks[sEventName] = fCallback;
};
/**
* @constructor
*/
@ -4873,7 +4873,7 @@ CookieDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -4944,7 +4944,7 @@ LocalStorageDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -4987,7 +4987,7 @@ LocalStorage.prototype.get = function (iKey)
{
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
};
/**
* @constructor
*/
@ -5000,7 +5000,7 @@ KnoinAbstractBoot.prototype.bootstart = function ()
{
};
/**
* @param {string=} sPosition = ''
* @param {string=} sTemplate = ''
@ -5093,7 +5093,7 @@ KnoinAbstractViewModel.prototype.registerPopupKeyDown = function ()
return true;
});
};
/**
* @param {string} sScreenName
* @param {?=} aViewModels = []
@ -5169,7 +5169,7 @@ KnoinAbstractScreen.prototype.__start = function ()
this.oCross = oRoute;
}
};
/**
* @constructor
*/
@ -5569,7 +5569,7 @@ Knoin.prototype.bootstart = function ()
};
kn = new Knoin();
/**
* @param {string=} sEmail
* @param {string=} sName
@ -5933,7 +5933,7 @@ EmailModel.prototype.inputoTagLine = function ()
{
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
};
/**
* @constructor
*/
@ -6057,7 +6057,7 @@ ContactModel.prototype.lineAsCcc = function ()
return aResult.join(' ');
};
/**
* @param {number=} iType = Enums.ContactPropertyType.Unknown
* @param {string=} sTypeStr = ''
@ -6086,7 +6086,7 @@ function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
}, this);
}
/**
* @constructor
*/
@ -6130,7 +6130,7 @@ ContactTagModel.prototype.toLine = function (bEncodeHtml)
return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
Utils.encodeHtml(this.name()) : this.name();
};
/**
* @constructor
*/
@ -6366,7 +6366,7 @@ AttachmentModel.prototype.iconClass = function ()
return sClass;
};
/**
* @constructor
* @param {string} sId
@ -6427,7 +6427,7 @@ ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
}
return bResult;
};
};
/**
* @constructor
*/
@ -7621,7 +7621,7 @@ MessageModel.prototype.flagHash = function ()
return [this.deleted(), this.unseen(), this.flagged(), this.answered(), this.forwarded(),
this.isReadReceipt()].join('');
};
/**
* @constructor
*/
@ -7953,7 +7953,7 @@ FolderModel.prototype.printableFullName = function ()
{
return this.fullName.split(this.delimiter).join(' / ');
};
/**
* @param {string} sEmail
* @param {boolean=} bCanBeDelete = true
@ -7974,7 +7974,7 @@ AccountModel.prototype.email = '';
AccountModel.prototype.changeAccountLink = function ()
{
return RL.link().change(this.email);
};
};
/**
* @param {string} sId
* @param {string} sEmail
@ -8010,7 +8010,7 @@ IdentityModel.prototype.formattedNameForEmail = function ()
var sName = this.name();
return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
};
/**
* @param {string} iIndex
* @param {string} sGuID
@ -8041,7 +8041,7 @@ OpenPgpKeyModel.prototype.user = '';
OpenPgpKeyModel.prototype.email = '';
OpenPgpKeyModel.prototype.armor = '';
OpenPgpKeyModel.prototype.isPrivate = false;
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -8137,7 +8137,7 @@ PopupsFolderClearViewModel.prototype.onShow = function (oFolder)
this.selectedFolder(oFolder);
}
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -8247,7 +8247,7 @@ PopupsFolderCreateViewModel.prototype.onFocus = function ()
{
this.folderName.focused(true);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -8360,7 +8360,7 @@ PopupsFolderSystemViewModel.prototype.onShow = function (iNotificationType)
this.notification(sNotification);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -9848,7 +9848,7 @@ PopupsComposeViewModel.prototype.triggerForResize = function ()
this.editorResizeThrottle();
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10589,7 +10589,7 @@ PopupsContactsViewModel.prototype.onHide = function ()
oItem.checked(false);
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10725,7 +10725,7 @@ PopupsAdvancedSearchViewModel.prototype.onFocus = function ()
{
this.fromFocus(true);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10837,7 +10837,7 @@ PopupsAddAccountViewModel.prototype.onFocus = function ()
{
this.emailFocus(true);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10923,7 +10923,7 @@ PopupsAddOpenPgpKeyViewModel.prototype.onFocus = function ()
{
this.key.focus(true);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10963,7 +10963,7 @@ PopupsViewOpenPgpKeyViewModel.prototype.onShow = function (oOpenPgpKey)
this.key(oOpenPgpKey.armor);
}
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11051,7 +11051,7 @@ PopupsGenerateNewOpenPgpKeyViewModel.prototype.onFocus = function ()
{
this.email.focus(true);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11291,7 +11291,7 @@ PopupsComposeOpenPgpViewModel.prototype.onShow = function (fCallback, sText, sFr
this.to(aRec);
this.text(sText);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11439,7 +11439,7 @@ PopupsIdentityViewModel.prototype.onFocus = function ()
this.email.focused(true);
}
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11499,7 +11499,7 @@ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
RL.data().mainLanguage(sLang);
this.cancelCommand();
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11553,7 +11553,7 @@ PopupsTwoFactorTestViewModel.prototype.onFocus = function ()
{
this.code.focused(true);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11659,7 +11659,7 @@ PopupsAskViewModel.prototype.onBuild = function ()
}, this));
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11704,7 +11704,7 @@ PopupsKeyboardShortcutsHelpViewModel.prototype.onBuild = function (oDom)
}
}, this));
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -12016,7 +12016,7 @@ LoginViewModel.prototype.selectLanguage = function ()
kn.showScreenPopup(PopupsLanguagesViewModel);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -12112,7 +12112,7 @@ AbstractSystemDropDownViewModel.prototype.onBuild = function ()
}
});
};
/**
* @constructor
* @extends AbstractSystemDropDownViewModel
@ -12124,7 +12124,7 @@ function MailBoxSystemDropDownViewModel()
}
Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel);
/**
* @constructor
* @extends AbstractSystemDropDownViewModel
@ -12136,7 +12136,7 @@ function SettingsSystemDropDownViewModel()
}
Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel);
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -12345,7 +12345,7 @@ MailBoxFolderListViewModel.prototype.contactsClick = function ()
kn.showScreenPopup(PopupsContactsViewModel);
}
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -13248,7 +13248,7 @@ MailBoxMessageListViewModel.prototype.initUploaderForAppend = function ()
;
return !!oJua;
};
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -13940,7 +13940,7 @@ MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
}
};
/**
* @param {?} oScreen
*
@ -13969,7 +13969,7 @@ SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
{
kn.setHash(RL.link().inbox());
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -14000,7 +14000,7 @@ SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
{
kn.setHash(RL.link().inbox());
};
/**
* @constructor
*/
@ -14160,7 +14160,7 @@ SettingsGeneral.prototype.selectLanguage = function ()
{
kn.showScreenPopup(PopupsLanguagesViewModel);
};
/**
* @constructor
*/
@ -14210,7 +14210,7 @@ SettingsContacts.prototype.onBuild = function ()
//{
//
//};
/**
* @constructor
*/
@ -14291,7 +14291,7 @@ SettingsAccounts.prototype.deleteAccount = function (oAccountToRemove)
}
}
};
/**
* @constructor
*/
@ -14379,7 +14379,7 @@ SettingsIdentity.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -14537,7 +14537,7 @@ SettingsIdentities.prototype.onBuild = function (oDom)
});
}, 50);
};
};
/**
* @constructor
*/
@ -14687,7 +14687,7 @@ SettingsSecurity.prototype.onBuild = function ()
this.processing(true);
RL.remote().getTwoFactor(this.onResult);
};
/**
* @constructor
*/
@ -14754,7 +14754,7 @@ function SettingsSocialScreen()
}
Utils.addSettingsViewModel(SettingsSocialScreen, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
/**
* @constructor
*/
@ -14859,7 +14859,7 @@ SettingsChangePasswordScreen.prototype.onChangePasswordResponse = function (sRes
Utils.getNotification(Enums.Notification.CouldNotSaveNewPassword));
}
};
/**
* @constructor
*/
@ -15054,7 +15054,7 @@ SettingsFolders.prototype.unSubscribeFolder = function (oFolder)
oFolder.subScribed(false);
};
/**
* @constructor
*/
@ -15168,7 +15168,7 @@ SettingsThemes.prototype.onBuild = function ()
};
}));
};
/**
* @constructor
*/
@ -15236,7 +15236,7 @@ SettingsOpenPGP.prototype.deleteOpenPgpKey = function (oOpenPgpKeyToRemove)
RL.reloadOpenPgpKeys();
}
}
};
};
/**
* @constructor
*/
@ -15366,7 +15366,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
};
/**
* @constructor
* @extends AbstractData
@ -16620,7 +16620,7 @@ WebMailDataStorage.prototype.findSelfPrivateKey = function (sPassword)
{
return this.findPrivateKeyByEmail(this.accountEmail(), sPassword);
};
/**
* @constructor
*/
@ -16894,7 +16894,7 @@ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
'Version': sVersion
});
};
/**
* @constructor
* @extends AbstractAjaxRemoteStorage
@ -17687,7 +17687,7 @@ WebMailAjaxRemoteStorage.prototype.socialUsers = function (fCallback)
this.defaultRequest(fCallback, 'SocialUsers');
};
/**
* @constructor
*/
@ -17770,7 +17770,7 @@ AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData)
{
this.oEmailsPicsHashes = oData;
};
/**
* @constructor
* @extends AbstractCacheStorage
@ -18088,7 +18088,7 @@ WebMailCacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function
this.setMessageFlagsToCache(sFolder, sUid, aFlags);
}
};
/**
* @param {Array} aViewModels
* @constructor
@ -18266,7 +18266,7 @@ AbstractSettings.prototype.routes = function ()
['', oRules]
];
};
/**
* @constructor
* @extends KnoinAbstractScreen
@ -18281,7 +18281,7 @@ _.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
LoginScreen.prototype.onShow = function ()
{
RL.setTitle('');
};
};
/**
* @constructor
* @extends KnoinAbstractScreen
@ -18452,7 +18452,7 @@ MailBoxScreen.prototype.routes = function ()
[/^([^\/]*)$/, {'normalize_': fNormS}]
];
};
/**
* @constructor
* @extends AbstractSettings
@ -18481,7 +18481,7 @@ SettingsScreen.prototype.onShow = function ()
RL.setTitle(this.sSettingsTitle);
RL.data().keyScope(Enums.KeyState.Settings);
};
/**
* @constructor
* @extends KnoinAbstractBoot
@ -18829,7 +18829,7 @@ AbstractApp.prototype.bootstart = function ()
ssm.ready();
};
/**
* @constructor
* @extends AbstractApp
@ -20131,7 +20131,7 @@ RainLoopApp.prototype.bootstart = function ()
* @type {RainLoopApp}
*/
RL = new RainLoopApp();
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
@ -20182,9 +20182,9 @@ window['__RLBOOT'] = function (fCall) {
window['__RLBOOT'] = null;
});
};
if (window.SimplePace) {
window.SimplePace.add(10);
}
}
}(window, jQuery, ko, crossroads, hasher, moment, Jua, _, ifvisible, key));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long