Added mail function support

This commit is contained in:
RainLoop Team 2014-11-13 02:09:14 +04:00
parent 2545ce3cd9
commit 6266b50c03
29 changed files with 311 additions and 204 deletions

View file

@ -211,7 +211,7 @@
RemoteAdminStorage.prototype.createOrUpdateDomain = function (fCallback, RemoteAdminStorage.prototype.createOrUpdateDomain = function (fCallback,
bCreate, sName, sIncHost, iIncPort, sIncSecure, bIncShortLogin, bCreate, sName, sIncHost, iIncPort, sIncSecure, bIncShortLogin,
sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutAuth, sWhiteList) sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutAuth, bOutPhpMail, sWhiteList)
{ {
this.defaultRequest(fCallback, 'AdminDomainSave', { this.defaultRequest(fCallback, 'AdminDomainSave', {
'Create': bCreate ? '1' : '0', 'Create': bCreate ? '1' : '0',
@ -225,12 +225,13 @@
'OutSecure': sOutSecure, 'OutSecure': sOutSecure,
'OutShortLogin': bOutShortLogin ? '1' : '0', 'OutShortLogin': bOutShortLogin ? '1' : '0',
'OutAuth': bOutAuth ? '1' : '0', 'OutAuth': bOutAuth ? '1' : '0',
'OutUsePhpMail': bOutPhpMail ? '1' : '0',
'WhiteList': sWhiteList 'WhiteList': sWhiteList
}); });
}; };
RemoteAdminStorage.prototype.testConnectionForDomain = function (fCallback, sName, RemoteAdminStorage.prototype.testConnectionForDomain = function (fCallback, sName,
sIncHost, iIncPort, sIncSecure, sOutHost, iOutPort, sOutSecure, bOutAuth) sIncHost, iIncPort, sIncSecure, sOutHost, iOutPort, sOutSecure, bOutAuth, bOutPhpMail)
{ {
this.defaultRequest(fCallback, 'AdminDomainTest', { this.defaultRequest(fCallback, 'AdminDomainTest', {
'Name': sName, 'Name': sName,
@ -240,7 +241,8 @@
'OutHost': sOutHost, 'OutHost': sOutHost,
'OutPort': iOutPort, 'OutPort': iOutPort,
'OutSecure': sOutSecure, 'OutSecure': sOutSecure,
'OutAuth': bOutAuth ? '1' : '0' 'OutAuth': bOutAuth ? '1' : '0',
'OutUsePhpMail': bOutPhpMail ? '1' : '0'
}); });
}; };

View file

@ -84,11 +84,6 @@
.checkbox-box-sizes(); .checkbox-box-sizes();
} }
&.disabled .sub-checkbox {
cursor: default;
color: #aaa;
}
.sub-checkbox.checked { .sub-checkbox.checked {
border-top: none; border-top: none;
border-left: none; border-left: none;
@ -121,6 +116,18 @@
animation: checkmark-shrink 140ms ease-out forwards; animation: checkmark-shrink 140ms ease-out forwards;
} }
} }
&.disabled {
.sub-checkbox {
border-color: #aaa;
cursor: not-allowed;
color: #aaa;
}
.sub-label {
cursor: not-allowed;
color: #aaa;
}
}
} }
} }

View file

@ -69,6 +69,7 @@
this.smtpSecure = ko.observable(Enums.ServerSecure.None); this.smtpSecure = ko.observable(Enums.ServerSecure.None);
this.smtpShortLogin = ko.observable(false); this.smtpShortLogin = ko.observable(false);
this.smtpAuth = ko.observable(true); this.smtpAuth = ko.observable(true);
this.smtpPhpMail = ko.observable(false);
this.whiteList = ko.observable(''); this.whiteList = ko.observable('');
this.enableSmartPorts = ko.observable(false); this.enableSmartPorts = ko.observable(false);
@ -110,6 +111,7 @@
this.smtpSecure(), this.smtpSecure(),
this.smtpShortLogin(), this.smtpShortLogin(),
this.smtpAuth(), this.smtpAuth(),
this.smtpPhpMail(),
this.whiteList() this.whiteList()
); );
}, this.canBeSaved); }, this.canBeSaved);
@ -129,7 +131,8 @@
this.smtpServer(), this.smtpServer(),
Utils.pInt(this.smtpPort()), Utils.pInt(this.smtpPort()),
this.smtpSecure(), this.smtpSecure(),
this.smtpAuth() this.smtpAuth(),
this.smtpPhpMail()
); );
}, this.canBeTested); }, this.canBeTested);
@ -289,6 +292,7 @@
this.smtpSecure(Utils.trim(oDomain.OutSecure)); this.smtpSecure(Utils.trim(oDomain.OutSecure));
this.smtpShortLogin(!!oDomain.OutShortLogin); this.smtpShortLogin(!!oDomain.OutShortLogin);
this.smtpAuth(!!oDomain.OutAuth); this.smtpAuth(!!oDomain.OutAuth);
this.smtpPhpMail(!!oDomain.OutUsePhpMail);
this.whiteList(Utils.trim(oDomain.WhiteList)); this.whiteList(Utils.trim(oDomain.WhiteList));
this.enableSmartPorts(true); this.enableSmartPorts(true);
@ -323,6 +327,7 @@
this.smtpSecure(Enums.ServerSecure.None); this.smtpSecure(Enums.ServerSecure.None);
this.smtpShortLogin(false); this.smtpShortLogin(false);
this.smtpAuth(true); this.smtpAuth(true);
this.smtpPhpMail(false);
this.whiteList(''); this.whiteList('');
this.enableSmartPorts(true); this.enableSmartPorts(true);

View file

@ -6,6 +6,12 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
\define('RAINLOOP_APP_LIBRARIES_PATH', RAINLOOP_APP_PATH.'libraries/'); \define('RAINLOOP_APP_LIBRARIES_PATH', RAINLOOP_APP_PATH.'libraries/');
\define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper')); \define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper'));
if (!defined('RL_BACKWARD_CAPABILITY'))
{
\define('RL_BACKWARD_CAPABILITY', true);
include_once RAINLOOP_APP_PATH.'src/RainLoop/Common/BackwardCapability/Account.php';
}
/** /**
* @param string $sClassName * @param string $sClassName
* *
@ -30,7 +36,7 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH'))
if (!RAINLOOP_MB_SUPPORTED && !defined('RL_MB_FIXED')) if (!RAINLOOP_MB_SUPPORTED && !defined('RL_MB_FIXED'))
{ {
\define('RL_MB_FIXED', true); \define('RL_MB_FIXED', true);
include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/MbStringFix.php'; include_once RAINLOOP_APP_PATH.'src/RainLoop/Common/MbStringFix.php';
} }
return include RAINLOOP_APP_LIBRARIES_PATH.'Sabre/'.\str_replace('\\', '/', \substr($sClassName, 6)).'.php'; return include RAINLOOP_APP_LIBRARIES_PATH.'Sabre/'.\str_replace('\\', '/', \substr($sClassName, 6)).'.php';

View file

@ -123,6 +123,15 @@ class Message
return $this->oAttachmentCollection; return $this->oAttachmentCollection;
} }
/**
* @return string
*/
public function GetSubject()
{
return isset($this->aHeadersValue[\MailSo\Mime\Enumerations\Header::SUBJECT]) ?
$this->aHeadersValue[\MailSo\Mime\Enumerations\Header::SUBJECT] : '';
}
/** /**
* @return \MailSo\Mime\Email|null * @return \MailSo\Mime\Email|null
*/ */

View file

@ -1,6 +0,0 @@
<?php
namespace RainLoop;
// for backward compatibility
class Account extends \RainLoop\Model\Account {}

View file

@ -206,7 +206,7 @@ class Actions
/** /**
* @param string $sName * @param string $sName
* @param \RainLoop\Account $oAccount = null * @param \RainLoop\Model\Account $oAccount = null
* *
* @return mixed * @return mixed
*/ */
@ -308,7 +308,7 @@ class Actions
$this->MailClient()->LogoutAndDisconnect(); $this->MailClient()->LogoutAndDisconnect();
} }
} }
catch (\Exception $oException) {} catch (\Exception $oException) { unset($oException); }
} }
/** /**
@ -421,7 +421,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return void * @return void
*/ */
@ -512,7 +512,7 @@ class Actions
/** /**
* @param bool $bThrowExceptionOnFalse = false * @param bool $bThrowExceptionOnFalse = false
* *
* @return \RainLoop\Account|bool * @return \RainLoop\Model\Account|bool
* @throws \RainLoop\Exceptions\ClientException * @throws \RainLoop\Exceptions\ClientException
*/ */
public function GetAccount($bThrowExceptionOnFalse = false) public function GetAccount($bThrowExceptionOnFalse = false)
@ -660,7 +660,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount = null * @param \RainLoop\Model\Account $oAccount = null
* @param bool $bForceEnable = false * @param bool $bForceEnable = false
* *
* @return \RainLoop\Providers\AddressBook * @return \RainLoop\Providers\AddressBook
@ -861,7 +861,7 @@ class Actions
* @param string $sSignMeToken = '' * @param string $sSignMeToken = ''
* @param bool $bThrowProvideException = false * @param bool $bThrowProvideException = false
* *
* @return \RainLoop\Account|null * @return \RainLoop\Model\Account|null
*/ */
public function LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken = '', $bThrowProvideException = false) public function LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken = '', $bThrowProvideException = false)
{ {
@ -873,10 +873,10 @@ class Actions
{ {
if ($oDomain->ValidateWhiteList($sEmail, $sLogin)) if ($oDomain->ValidateWhiteList($sEmail, $sLogin))
{ {
$oAccount = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken); $oAccount = \RainLoop\Model\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken);
$this->Plugins()->RunHook('filter.acount', array(&$oAccount)); $this->Plugins()->RunHook('filter.acount', array(&$oAccount));
if ($bThrowProvideException && !($oAccount instanceof \RainLoop\Account)) if ($bThrowProvideException && !($oAccount instanceof \RainLoop\Model\Account))
{ {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError); throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
} }
@ -900,7 +900,7 @@ class Actions
* @param bool $bThrowExceptionOnFalse = true * @param bool $bThrowExceptionOnFalse = true
* @param bool $bValidateShortToken = true * @param bool $bValidateShortToken = true
* *
* @return \RainLoop\Account|bool * @return \RainLoop\Model\Account|bool
* @throws \RainLoop\Exceptions\ClientException * @throws \RainLoop\Exceptions\ClientException
*/ */
public function GetAccountFromCustomToken($sToken, $bThrowExceptionOnFalse = true, $bValidateShortToken = true) public function GetAccountFromCustomToken($sToken, $bThrowExceptionOnFalse = true, $bValidateShortToken = true)
@ -919,7 +919,7 @@ class Actions
$oAccount = $this->LoginProvide($aAccountHash[1], $aAccountHash[2], $aAccountHash[3], $oAccount = $this->LoginProvide($aAccountHash[1], $aAccountHash[2], $aAccountHash[3],
empty($aAccountHash[5]) ? '' : $aAccountHash[5], $bThrowExceptionOnFalse); empty($aAccountHash[5]) ? '' : $aAccountHash[5], $bThrowExceptionOnFalse);
if ($oAccount instanceof \RainLoop\Account) if ($oAccount instanceof \RainLoop\Model\Account)
{ {
if (!empty($aAccountHash[8]) && !empty($aAccountHash[9])) // init proxy user/password if (!empty($aAccountHash[8]) && !empty($aAccountHash[9])) // init proxy user/password
{ {
@ -940,7 +940,7 @@ class Actions
} }
} }
if ($bThrowExceptionOnFalse && !($oResult instanceof \RainLoop\Account)) if ($bThrowExceptionOnFalse && !($oResult instanceof \RainLoop\Model\Account))
{ {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError); throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
} }
@ -949,7 +949,7 @@ class Actions
} }
/** /**
* @return \RainLoop\Account|bool * @return \RainLoop\Model\Account|bool
*/ */
public function GetAccountFromSignMeToken() public function GetAccountFromSignMeToken()
{ {
@ -970,7 +970,7 @@ class Actions
/** /**
* @param bool $bThrowExceptionOnFalse = true * @param bool $bThrowExceptionOnFalse = true
* *
* @return \RainLoop\Account|bool * @return \RainLoop\Model\Account|bool
* @throws \RainLoop\Exceptions\ClientException * @throws \RainLoop\Exceptions\ClientException
*/ */
private function getAccountFromToken($bThrowExceptionOnFalse = true) private function getAccountFromToken($bThrowExceptionOnFalse = true)
@ -1090,7 +1090,7 @@ class Actions
if (!$bAdmin) if (!$bAdmin)
{ {
$oAccount = $this->getAccountFromToken(false); $oAccount = $this->getAccountFromToken(false);
if ($oAccount instanceof \RainLoop\Account) if ($oAccount instanceof \RainLoop\Model\Account)
{ {
$oAddressBookProvider = $this->AddressBookProvider($oAccount); $oAddressBookProvider = $this->AddressBookProvider($oAccount);
@ -1450,11 +1450,11 @@ class Actions
} }
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
*/ */
public function AuthToken($oAccount) public function AuthToken($oAccount)
{ {
if ($oAccount instanceof \RainLoop\Account) if ($oAccount instanceof \RainLoop\Model\Account)
{ {
$this->SetAuthToken($oAccount); $this->SetAuthToken($oAccount);
@ -1468,7 +1468,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @throws \RainLoop\Exceptions\ClientException * @throws \RainLoop\Exceptions\ClientException
*/ */
@ -1499,7 +1499,7 @@ class Actions
* @param string $sAdditionalCode = '' * @param string $sAdditionalCode = ''
* @param string $bAdditionalCodeSignMe = false * @param string $bAdditionalCodeSignMe = false
* *
* @return \RainLoop\Account * @return \RainLoop\Model\Account
* @throws \RainLoop\Exceptions\ClientException * @throws \RainLoop\Exceptions\ClientException
*/ */
public function LoginProcess(&$sEmail, &$sPassword, $sSignMeToken = '', public function LoginProcess(&$sEmail, &$sPassword, $sSignMeToken = '',
@ -1585,14 +1585,14 @@ class Actions
{ {
$oAccount = $this->LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken, true); $oAccount = $this->LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken, true);
if (!($oAccount instanceof \RainLoop\Account)) if (!($oAccount instanceof \RainLoop\Model\Account))
{ {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError); throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
} }
$this->Plugins()->RunHook('event.login-post-login-provide', array(&$oAccount)); $this->Plugins()->RunHook('event.login-post-login-provide', array(&$oAccount));
if (!($oAccount instanceof \RainLoop\Account)) if (!($oAccount instanceof \RainLoop\Model\Account))
{ {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError); throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
} }
@ -1813,7 +1813,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return array * @return array
*/ */
@ -1851,7 +1851,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return array * @return array
*/ */
@ -1892,7 +1892,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return array * @return array
*/ */
@ -1950,7 +1950,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param array $aAccounts = array() * @param array $aAccounts = array()
* *
* @return array * @return array
@ -1972,7 +1972,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param array $aIdentities = array() * @param array $aIdentities = array()
* *
* @return array * @return array
@ -2238,7 +2238,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
*/ */
public function ClearSignMeData($oAccount) public function ClearSignMeData($oAccount)
{ {
@ -3998,7 +3998,7 @@ class Actions
/** /**
* @staticvar array $aCache * @staticvar array $aCache
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return array * @return array
*/ */
@ -4055,7 +4055,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param \MailSo\Mail\FolderCollection $oFolders * @param \MailSo\Mail\FolderCollection $oFolders
* @param array $aResult * @param array $aResult
* @param bool $bListFolderTypes = true * @param bool $bListFolderTypes = true
@ -4596,7 +4596,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param bool $bWithDraftInfo = true * @param bool $bWithDraftInfo = true
* *
* @return \MailSo\Mime\Message * @return \MailSo\Mime\Message
@ -4763,7 +4763,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return \MailSo\Mime\Message * @return \MailSo\Mime\Message
*/ */
@ -4886,10 +4886,11 @@ class Actions
/** /**
* *
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param type $oMessage * @param \MailSo\Mime\Message $oMessage
* @param type $rMessageStream * @param resource $rMessageStream
* @param type $bAddHiddenRcpt * @param bool $bAddHiddenRcpt = true
*
* @throws \RainLoop\Exceptions\ClientException * @throws \RainLoop\Exceptions\ClientException
* @throws \MailSo\Net\Exceptions\ConnectionException * @throws \MailSo\Net\Exceptions\ConnectionException
*/ */
@ -4902,8 +4903,6 @@ class Actions
try try
{ {
$oSmtpClient = \MailSo\Smtp\SmtpClient::NewInstance()->SetLogger($this->Logger());
$oFrom = $oMessage->GetFrom(); $oFrom = $oMessage->GetFrom();
$sFrom = $oFrom instanceof \MailSo\Mime\Email ? $oFrom->GetEmail() : ''; $sFrom = $oFrom instanceof \MailSo\Mime\Email ? $oFrom->GetEmail() : '';
$sFrom = empty($sFrom) ? $oAccount->Email() : $sFrom; $sFrom = empty($sFrom) ? $oAccount->Email() : $sFrom;
@ -4916,9 +4915,48 @@ class Actions
$this->Plugins()->RunHook('filter.smtp-hidden-rcpt', array($oAccount, $oMessage, &$aHiddenRcpt)); $this->Plugins()->RunHook('filter.smtp-hidden-rcpt', array($oAccount, $oMessage, &$aHiddenRcpt));
} }
$bLoggined = $oAccount->OutConnectAndLoginHelper($this->Plugins(), $oSmtpClient, $this->Config()); $bUsePhpMail = $oAccount->Domain()->OutUsePhpMail();
if ($oSmtpClient->IsConnected()) $oSmtpClient = \MailSo\Smtp\SmtpClient::NewInstance()->SetLogger($this->Logger());
$bLoggined = $oAccount->OutConnectAndLoginHelper($this->Plugins(), $oSmtpClient, $this->Config(), $bUsePhpMail);
if ($bUsePhpMail)
{
if (\MailSo\Base\Utils::FunctionExistsAndEnabled('mail'))
{
$aToCollection = $oMessage->GetTo();
if ($aToCollection && $oFrom)
{
$sRawBody = @\stream_get_contents($rMessageStream);
if (!empty($sRawBody))
{
$sMailTo = \trim($aToCollection->ToString(true));
$sMailSubject = \trim($oMessage->GetSubject());
$sMailSubject = 0 === \strlen($sMailSubject) ? '' : \MailSo\Base\Utils::EncodeUnencodedValue(
\MailSo\Base\Enumerations\Encoding::BASE64_SHORT, $sMailSubject);
$sMailHeaders = $sMailBody = '';
list($sMailHeaders, $sMailBody) = \explode("\r\n\r\n", $sRawBody, 2);
unset($sRawBody);
$this->Logger()->WriteDump(array(
$sMailTo, $sMailSubject, $sMailBody, $sMailHeaders
));
if (!\mail($sMailTo, $sMailSubject, $sMailBody, $sMailHeaders/*, '-f'.$oFrom->GetEmail()*/))
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CantSendMessage);
}
}
}
}
else
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CantSendMessage);
}
}
else if ($oSmtpClient->IsConnected())
{ {
if (!empty($sFrom)) if (!empty($sFrom))
{ {
@ -6503,7 +6541,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param resource $rFile * @param resource $rFile
* @param string $sFileStart * @param string $sFileStart
* *
@ -6563,7 +6601,7 @@ class Actions
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param resource $rFile * @param resource $rFile
* @param string $sFileStart * @param string $sFileStart
* *
@ -6677,7 +6715,7 @@ class Actions
$sFolderFullNameRaw = $this->GetActionParam('Folder', ''); $sFolderFullNameRaw = $this->GetActionParam('Folder', '');
$_FILES = isset($_FILES) ? $_FILES : null; $_FILES = isset($_FILES) ? $_FILES : null;
if ($oAccount instanceof \RainLoop\Account && if ($oAccount instanceof \RainLoop\Model\Account &&
$this->Config()->Get('labs', 'allow_message_append', false) && $this->Config()->Get('labs', 'allow_message_append', false) &&
isset($_FILES, $_FILES['AppendFile'], $_FILES['AppendFile']['name'], isset($_FILES, $_FILES['AppendFile'], $_FILES['AppendFile']['name'],
$_FILES['AppendFile']['tmp_name'], $_FILES['AppendFile']['size'])) $_FILES['AppendFile']['tmp_name'], $_FILES['AppendFile']['size']))
@ -6705,7 +6743,7 @@ class Actions
/** /**
* @param bool $bAdmin * @param bool $bAdmin
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return array * @return array
*/ */
@ -7031,7 +7069,7 @@ class Actions
} }
/** /**
* @return \RainLoop\Account|bool * @return \RainLoop\Model\Account|bool
*/ */
private function initMailClientConnection() private function initMailClientConnection()
{ {
@ -7614,7 +7652,7 @@ class Actions
public function GetLanguageAndTheme() public function GetLanguageAndTheme()
{ {
$oAccount = $this->GetAccount(); $oAccount = $this->GetAccount();
$oSettings = $oAccount instanceof \RainLoop\Account ? $this->SettingsProvider()->Load($oAccount) : null; $oSettings = $oAccount instanceof \RainLoop\Model\Account ? $this->SettingsProvider()->Load($oAccount) : null;
$sLanguage = $this->Config()->Get('webmail', 'language', 'en'); $sLanguage = $this->Config()->Get('webmail', 'language', 'en');
$sTheme = $this->Config()->Get('webmail', 'theme', 'Default'); $sTheme = $this->Config()->Get('webmail', 'theme', 'Default');
@ -7912,7 +7950,7 @@ class Actions
$mResult['ReadReceipt'] = ''; $mResult['ReadReceipt'] = '';
} }
} }
catch (\Exception $oException) {} catch (\Exception $oException) { unset($oException); }
} }
if (0 < \strlen($mResult['ReadReceipt']) && '1' === $this->Cacher()->Get( if (0 < \strlen($mResult['ReadReceipt']) && '1' === $this->Cacher()->Get(

View file

@ -0,0 +1,5 @@
<?php
namespace RainLoop;
class Account {}

View file

@ -2,7 +2,7 @@
namespace RainLoop\Model; namespace RainLoop\Model;
class Account class Account extends \RainLoop\Account // for backward compatibility
{ {
/** /**
* @var string * @var string
@ -388,18 +388,20 @@ class Account
/** /**
* @param \RainLoop\Plugins\Manager $oPlugins * @param \RainLoop\Plugins\Manager $oPlugins
* @param \MailSo\Smtp\SmtpClient $oSmtpClient * @param \MailSo\Smtp\SmtpClient|null $oSmtpClient
* @param \RainLoop\Application $oConfig * @param \RainLoop\Application $oConfig
* @param bool $bUsePhpMail = false
* *
* @return bool * @return bool
*/ */
public function OutConnectAndLoginHelper($oPlugins, $oSmtpClient, $oConfig) public function OutConnectAndLoginHelper($oPlugins, $oSmtpClient, $oConfig, &$bUsePhpMail = false)
{ {
$bLogin = false; $bLogin = false;
$aSmtpCredentials = array( $aSmtpCredentials = array(
'UseConnect' => true, 'UseConnect' => true,
'UseAuth' => $this->DomainOutAuth(), 'UseAuth' => $this->DomainOutAuth(),
'UsePhpMail' => $bUsePhpMail,
'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(), 'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(),
'Host' => $this->DomainOutHost(), 'Host' => $this->DomainOutHost(),
'Port' => $this->DomainOutPort(), 'Port' => $this->DomainOutPort(),
@ -413,9 +415,11 @@ class Account
$oPlugins->RunHook('filter.smtp-credentials', array($this, &$aSmtpCredentials)); $oPlugins->RunHook('filter.smtp-credentials', array($this, &$aSmtpCredentials));
$bUsePhpMail = $aSmtpCredentials['UsePhpMail'];
$oPlugins->RunHook('event.smtp-pre-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials)); $oPlugins->RunHook('event.smtp-pre-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials));
if ($aSmtpCredentials['UseConnect']) if ($aSmtpCredentials['UseConnect'] && !$aSmtpCredentials['UsePhpMail'] && $oSmtpClient)
{ {
$oSmtpClient->Connect($aSmtpCredentials['Host'], $aSmtpCredentials['Port'], $oSmtpClient->Connect($aSmtpCredentials['Host'], $aSmtpCredentials['Port'],
$aSmtpCredentials['Ehlo'], $aSmtpCredentials['Secure'], $aSmtpCredentials['VerifySsl']); $aSmtpCredentials['Ehlo'], $aSmtpCredentials['Secure'], $aSmtpCredentials['VerifySsl']);
@ -424,7 +428,7 @@ class Account
$oPlugins->RunHook('event.smtp-post-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials)); $oPlugins->RunHook('event.smtp-post-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials));
$oPlugins->RunHook('event.smtp-pre-login', array($this, $aSmtpCredentials['UseAuth'], $aSmtpCredentials)); $oPlugins->RunHook('event.smtp-pre-login', array($this, $aSmtpCredentials['UseAuth'], $aSmtpCredentials));
if ($aSmtpCredentials['UseAuth']) if ($aSmtpCredentials['UseAuth'] && !$aSmtpCredentials['UsePhpMail'] && $oSmtpClient)
{ {
$oSmtpClient->Login($aSmtpCredentials['Login'], $aSmtpCredentials['Password']); $oSmtpClient->Login($aSmtpCredentials['Login'], $aSmtpCredentials['Password']);

View file

@ -58,6 +58,11 @@ class Domain
*/ */
private $bOutAuth; private $bOutAuth;
/**
* @var bool
*/
private $bOutUsePhpMail;
/** /**
* @var string * @var string
*/ */
@ -74,10 +79,11 @@ class Domain
* @param int $iOutSecure * @param int $iOutSecure
* @param bool $bOutShortLogin * @param bool $bOutShortLogin
* @param bool $bOutAuth * @param bool $bOutAuth
* @param bool $bOutUsePhpMail = false
* @param string $sWhiteList = '' * @param string $sWhiteList = ''
*/ */
private function __construct($sName, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, private function __construct($sName, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList = '') $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail = false, $sWhiteList = '')
{ {
$this->sName = $sName; $this->sName = $sName;
$this->sIncHost = $sIncHost; $this->sIncHost = $sIncHost;
@ -89,6 +95,7 @@ class Domain
$this->iOutSecure = $iOutSecure; $this->iOutSecure = $iOutSecure;
$this->bOutShortLogin = $bOutShortLogin; $this->bOutShortLogin = $bOutShortLogin;
$this->bOutAuth = $bOutAuth; $this->bOutAuth = $bOutAuth;
$this->bOutUsePhpMail = $bOutUsePhpMail;
$this->sWhiteList = \trim($sWhiteList); $this->sWhiteList = \trim($sWhiteList);
} }
@ -103,18 +110,19 @@ class Domain
* @param int $iOutSecure * @param int $iOutSecure
* @param bool $bOutShortLogin * @param bool $bOutShortLogin
* @param bool $bOutAuth * @param bool $bOutAuth
* @param bool $bOutUsePhpMail = false
* @param string $sWhiteList = '' * @param string $sWhiteList = ''
* *
* @return \RainLoop\Model\Domain * @return \RainLoop\Model\Domain
*/ */
public static function NewInstance($sName, public static function NewInstance($sName,
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
$sWhiteList = '') $sWhiteList = '')
{ {
return new self($sName, return new self($sName,
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
$sWhiteList); $sWhiteList);
} }
@ -142,6 +150,7 @@ class Domain
!empty($aDomain['smtp_secure']) ? $aDomain['smtp_secure'] : ''); !empty($aDomain['smtp_secure']) ? $aDomain['smtp_secure'] : '');
$bOutAuth = isset($aDomain['smtp_auth']) ? (bool) $aDomain['smtp_auth'] : true; $bOutAuth = isset($aDomain['smtp_auth']) ? (bool) $aDomain['smtp_auth'] : true;
$bOutUsePhpMail = isset($aDomain['smtp_php_mail']) ? (bool) $aDomain['smtp_php_mail'] : false;
$sWhiteList = (string) (isset($aDomain['white_list']) ? $aDomain['white_list'] : ''); $sWhiteList = (string) (isset($aDomain['white_list']) ? $aDomain['white_list'] : '');
$bIncShortLogin = isset($aDomain['imap_short_login']) ? (bool) $aDomain['imap_short_login'] : false; $bIncShortLogin = isset($aDomain['imap_short_login']) ? (bool) $aDomain['imap_short_login'] : false;
@ -149,7 +158,7 @@ class Domain
$oDomain = self::NewInstance($sName, $oDomain = self::NewInstance($sName,
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
$sWhiteList); $sWhiteList);
} }
@ -199,6 +208,7 @@ class Domain
'smtp_secure = "'.self::ConstConnectionSecurityTypeToStr($this->iOutSecure).'"', 'smtp_secure = "'.self::ConstConnectionSecurityTypeToStr($this->iOutSecure).'"',
'smtp_short_login = '.($this->bOutShortLogin ? 'On' : 'Off'), 'smtp_short_login = '.($this->bOutShortLogin ? 'On' : 'Off'),
'smtp_auth = '.($this->bOutAuth ? 'On' : 'Off'), 'smtp_auth = '.($this->bOutAuth ? 'On' : 'Off'),
'smtp_php_mail = '.($this->bOutUsePhpMail ? 'On' : 'Off'),
'white_list = "'.$this->encodeIniString($this->sWhiteList).'"' 'white_list = "'.$this->encodeIniString($this->sWhiteList).'"'
)); ));
} }
@ -254,13 +264,14 @@ class Domain
* @param int $iOutSecure * @param int $iOutSecure
* @param bool $bOutShortLogin * @param bool $bOutShortLogin
* @param bool $bOutAuth * @param bool $bOutAuth
* @param bool $bOutUsePhpMail = false
* @param string $sWhiteList = '' * @param string $sWhiteList = ''
* *
* @return \RainLoop\Model\Domain * @return \RainLoop\Model\Domain
*/ */
public function UpdateInstance( public function UpdateInstance(
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
$sWhiteList = '') $sWhiteList = '')
{ {
$this->sIncHost = \MailSo\Base\Utils::IdnToAscii($sIncHost); $this->sIncHost = \MailSo\Base\Utils::IdnToAscii($sIncHost);
@ -272,6 +283,7 @@ class Domain
$this->iOutSecure = $iOutSecure; $this->iOutSecure = $iOutSecure;
$this->bOutShortLogin = $bOutShortLogin; $this->bOutShortLogin = $bOutShortLogin;
$this->bOutAuth = $bOutAuth; $this->bOutAuth = $bOutAuth;
$this->bOutUsePhpMail = $bOutUsePhpMail;
$this->sWhiteList = \trim($sWhiteList); $this->sWhiteList = \trim($sWhiteList);
return $this; return $this;
@ -341,16 +353,6 @@ class Domain
return $this->iOutSecure; return $this->iOutSecure;
} }
/**
* @param bool|null $bGlobalVerify = null
*
* @return bool
*/
public function OutVerifySsl($bGlobalVerify = null)
{
return null === $bGlobalVerify ? $this->bOutVerifySsl : !!$bGlobalVerify;
}
/** /**
* @return bool * @return bool
*/ */
@ -367,6 +369,14 @@ class Domain
return $this->bOutAuth; return $this->bOutAuth;
} }
/**
* @return bool
*/
public function OutUsePhpMail()
{
return $this->bOutUsePhpMail;
}
/** /**
* @return string * @return string
*/ */
@ -417,6 +427,7 @@ class Domain
'OutSecure' => $this->OutSecure(), 'OutSecure' => $this->OutSecure(),
'OutShortLogin' => $this->OutShortLogin(), 'OutShortLogin' => $this->OutShortLogin(),
'OutAuth' => $this->OutAuth(), 'OutAuth' => $this->OutAuth(),
'OutUsePhpMail' => $this->OutUsePhpMail(),
'WhiteList' => $this->WhiteList() 'WhiteList' => $this->WhiteList()
); );
} }

View file

@ -282,7 +282,7 @@ class Manager
/** /**
* @param bool $bAdmin * @param bool $bAdmin
* @param array $aAppData * @param array $aAppData
* @param \RainLoop\Account|null $oAccount = null * @param \RainLoop\Model\Account|null $oAccount = null
* *
* @return \RainLoop\PluginsNext\Manager * @return \RainLoop\PluginsNext\Manager
*/ */
@ -399,7 +399,7 @@ class Manager
/** /**
* @param string $sHookName * @param string $sHookName
* @param array $aArg = array() * @param array $aArg = array()
* @param \RainLoop\Account|null $oAccount = null * @param \RainLoop\Model\Account|null $oAccount = null
* @param bool $bLogHook = true * @param bool $bLogHook = true
* *
* @return \RainLoop\PluginsNext\Manager * @return \RainLoop\PluginsNext\Manager

View file

@ -5,7 +5,7 @@ namespace RainLoop\Providers;
abstract class AbstractProvider abstract class AbstractProvider
{ {
/** /**
* @var \RainLoop\Account * @var \RainLoop\Model\Account
*/ */
protected $oAccount; protected $oAccount;
@ -23,7 +23,7 @@ abstract class AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
*/ */
public function SetAccount($oAccount) public function SetAccount($oAccount)
{ {

View file

@ -34,24 +34,24 @@ class ChangePassword extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return bool * @return bool
*/ */
public function PasswordChangePossibility($oAccount) public function PasswordChangePossibility($oAccount)
{ {
return $this->IsActive() && return $this->IsActive() &&
$oAccount instanceof \RainLoop\Account && $oAccount instanceof \RainLoop\Model\Account &&
$this->oDriver && $this->oDriver->PasswordChangePossibility($oAccount) $this->oDriver && $this->oDriver->PasswordChangePossibility($oAccount)
; ;
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sPrevPassword * @param string $sPrevPassword
* @param string $sNewPassword * @param string $sNewPassword
*/ */
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) public function ChangePassword(\RainLoop\Model\Account $oAccount, $sPrevPassword, $sNewPassword)
{ {
if ($this->oDriver instanceof \RainLoop\Providers\ChangePassword\ChangePasswordInterface && if ($this->oDriver instanceof \RainLoop\Providers\ChangePassword\ChangePasswordInterface &&
$this->PasswordChangePossibility($oAccount)) $this->PasswordChangePossibility($oAccount))

View file

@ -5,18 +5,18 @@ namespace RainLoop\Providers\ChangePassword;
interface ChangePasswordInterface interface ChangePasswordInterface
{ {
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return bool * @return bool
*/ */
public function PasswordChangePossibility($oAccount); public function PasswordChangePossibility($oAccount);
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sPrevPassword * @param string $sPrevPassword
* @param string $sNewPassword * @param string $sNewPassword
* *
* @return bool * @return bool
*/ */
public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword); public function ChangePassword(\RainLoop\Model\Account $oAccount, $sPrevPassword, $sNewPassword);
} }

View file

@ -134,6 +134,7 @@ class Domain extends \RainLoop\Providers\AbstractProvider
$iOutSecure = (int) $oActions->GetActionParam('OutSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); $iOutSecure = (int) $oActions->GetActionParam('OutSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE);
$bOutShortLogin = '1' === (string) $oActions->GetActionParam('OutShortLogin', '0'); $bOutShortLogin = '1' === (string) $oActions->GetActionParam('OutShortLogin', '0');
$bOutAuth = '1' === (string) $oActions->GetActionParam('OutAuth', '1'); $bOutAuth = '1' === (string) $oActions->GetActionParam('OutAuth', '1');
$bOutUsePhpMail = '1' === (string) $oActions->GetActionParam('OutUsePhpMail', '0');
$sWhiteList = (string) $oActions->GetActionParam('WhiteList', ''); $sWhiteList = (string) $oActions->GetActionParam('WhiteList', '');
if (0 < \strlen($sName) && 0 < strlen($sNameForTest) && false === \strpos($sName, '*')) if (0 < \strlen($sName) && 0 < strlen($sNameForTest) && false === \strpos($sName, '*'))
@ -154,7 +155,7 @@ class Domain extends \RainLoop\Providers\AbstractProvider
{ {
$oDomain->UpdateInstance( $oDomain->UpdateInstance(
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
$sWhiteList); $sWhiteList);
} }
} }
@ -162,7 +163,7 @@ class Domain extends \RainLoop\Providers\AbstractProvider
{ {
$oDomain = \RainLoop\Model\Domain::NewInstance(0 < strlen($sNameForTest) ? $sNameForTest : $sName, $oDomain = \RainLoop\Model\Domain::NewInstance(0 < strlen($sNameForTest) ? $sNameForTest : $sName,
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutUsePhpMail,
$sWhiteList); $sWhiteList);
} }
} }

View file

@ -18,7 +18,7 @@ class Files extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* @param resource $rSource * @param resource $rSource
* *
@ -30,7 +30,7 @@ class Files extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* @param string $sSource * @param string $sSource
* *
@ -42,7 +42,7 @@ class Files extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* @param string $sOpenMode = 'rb' * @param string $sOpenMode = 'rb'
* *
@ -54,7 +54,7 @@ class Files extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return string | bool * @return string | bool
@ -65,7 +65,7 @@ class Files extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return bool * @return bool
@ -76,7 +76,7 @@ class Files extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return int|bool * @return int|bool
@ -87,7 +87,7 @@ class Files extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return bool * @return bool

View file

@ -20,7 +20,7 @@ class DefaultStorage implements \RainLoop\Providers\Files\FilesInterface
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* @param resource $rSource * @param resource $rSource
* *
@ -42,7 +42,7 @@ class DefaultStorage implements \RainLoop\Providers\Files\FilesInterface
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* @param string $sSource * @param string $sSource
* *
@ -55,7 +55,7 @@ class DefaultStorage implements \RainLoop\Providers\Files\FilesInterface
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* @param string $sOpenMode = 'rb' * @param string $sOpenMode = 'rb'
* *
@ -76,7 +76,7 @@ class DefaultStorage implements \RainLoop\Providers\Files\FilesInterface
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return string|bool * @return string|bool
@ -94,7 +94,7 @@ class DefaultStorage implements \RainLoop\Providers\Files\FilesInterface
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return bool * @return bool
@ -112,7 +112,7 @@ class DefaultStorage implements \RainLoop\Providers\Files\FilesInterface
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return int|bool * @return int|bool
@ -130,7 +130,7 @@ class DefaultStorage implements \RainLoop\Providers\Files\FilesInterface
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return bool * @return bool
@ -157,7 +157,7 @@ class DefaultStorage implements \RainLoop\Providers\Files\FilesInterface
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* @param bool $bMkDir = false * @param bool $bMkDir = false
* *

View file

@ -5,7 +5,7 @@ namespace RainLoop\Providers\Files;
interface FilesInterface interface FilesInterface
{ {
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* @param resource $rSource * @param resource $rSource
* *
@ -23,7 +23,7 @@ interface FilesInterface
public function MoveUploadedFile($oAccount, $sKey, $sSource); public function MoveUploadedFile($oAccount, $sKey, $sSource);
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* @param string $sOpenMode = 'rb' * @param string $sOpenMode = 'rb'
* *
@ -32,7 +32,7 @@ interface FilesInterface
public function GetFile($oAccount, $sKey, $sOpenMode = 'rb'); public function GetFile($oAccount, $sKey, $sOpenMode = 'rb');
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return string|bool * @return string|bool
@ -40,7 +40,7 @@ interface FilesInterface
public function GetFileName($oAccount, $sKey); public function GetFileName($oAccount, $sKey);
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return bool * @return bool
@ -48,7 +48,7 @@ interface FilesInterface
public function Clear($oAccount, $sKey); public function Clear($oAccount, $sKey);
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return int | bool * @return int | bool
@ -56,7 +56,7 @@ interface FilesInterface
public function FileSize($oAccount, $sKey); public function FileSize($oAccount, $sKey);
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sKey * @param string $sKey
* *
* @return bool * @return bool

View file

@ -20,11 +20,11 @@ class Settings extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return \RainLoop\Settings * @return \RainLoop\Settings
*/ */
public function Load(\RainLoop\Account $oAccount) public function Load(\RainLoop\Model\Account $oAccount)
{ {
$oSettings = new \RainLoop\Settings(); $oSettings = new \RainLoop\Settings();
$oSettings->InitData($this->oDriver->Load($oAccount)); $oSettings->InitData($this->oDriver->Load($oAccount));
@ -32,12 +32,12 @@ class Settings extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param \RainLoop\Settings $oSettings * @param \RainLoop\Settings $oSettings
* *
* @return bool * @return bool
*/ */
public function Save(\RainLoop\Account $oAccount, \RainLoop\Settings $oSettings) public function Save(\RainLoop\Model\Account $oAccount, \RainLoop\Settings $oSettings)
{ {
return $this->oDriver->Save($oAccount, $oSettings->DataAsArray()); return $this->oDriver->Save($oAccount, $oSettings->DataAsArray());
} }

View file

@ -20,11 +20,11 @@ class DefaultSettings implements \RainLoop\Providers\Settings\SettingsInterface
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return array * @return array
*/ */
public function Load(\RainLoop\Account $oAccount) public function Load(\RainLoop\Model\Account $oAccount)
{ {
$sValue = $this->oStorageProvider->Get($oAccount, $sValue = $this->oStorageProvider->Get($oAccount,
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG, \RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
@ -44,12 +44,12 @@ class DefaultSettings implements \RainLoop\Providers\Settings\SettingsInterface
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param array $aSettings * @param array $aSettings
* *
* @return bool * @return bool
*/ */
public function Save(\RainLoop\Account $oAccount, array $aSettings) public function Save(\RainLoop\Model\Account $oAccount, array $aSettings)
{ {
return $this->oStorageProvider->Put($oAccount, return $this->oStorageProvider->Put($oAccount,
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG, \RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,

View file

@ -5,19 +5,19 @@ namespace RainLoop\Providers\Settings;
interface SettingsInterface interface SettingsInterface
{ {
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* *
* @return array * @return array
*/ */
public function Load(\RainLoop\Account $oAccount); public function Load(\RainLoop\Model\Account $oAccount);
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param array $aSettings * @param array $aSettings
* *
* @return bool * @return bool
*/ */
public function Save(\RainLoop\Account $oAccount, array $aSettings); public function Save(\RainLoop\Model\Account $oAccount, array $aSettings);
/** /**
* @param string $sEmail * @param string $sEmail

View file

@ -18,7 +18,7 @@ class Storage extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account|string|null $oAccount * @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType * @param int $iStorageType
* *
* @return bool * @return bool
@ -26,7 +26,7 @@ class Storage extends \RainLoop\Providers\AbstractProvider
public function verifyAccount($oAccount, $iStorageType) public function verifyAccount($oAccount, $iStorageType)
{ {
if (\RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY !== $iStorageType && if (\RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY !== $iStorageType &&
!($oAccount instanceof \RainLoop\Account || \is_string($oAccount))) !($oAccount instanceof \RainLoop\Model\Account || \is_string($oAccount)))
{ {
return false; return false;
} }
@ -35,7 +35,7 @@ class Storage extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account|string|null $oAccount * @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType * @param int $iStorageType
* @param string $sKey * @param string $sKey
* @param string $sValue * @param string $sValue
@ -53,7 +53,7 @@ class Storage extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account|string|null $oAccount * @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType * @param int $iStorageType
* @param string $sKey * @param string $sKey
* @param mixed $mDefault = false * @param mixed $mDefault = false
@ -71,7 +71,7 @@ class Storage extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account|string|null $oAccount * @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType * @param int $iStorageType
* @param string $sKey * @param string $sKey
* *

View file

@ -20,7 +20,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
} }
/** /**
* @param \RainLoop\Account|string|null $oAccount * @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType * @param int $iStorageType
* @param string $sKey * @param string $sKey
* @param string $sValue * @param string $sValue
@ -34,7 +34,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
} }
/** /**
* @param \RainLoop\Account|string|null $oAccount * @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType * @param int $iStorageType
* @param string $sKey * @param string $sKey
* @param mixed $mDefault = false * @param mixed $mDefault = false
@ -54,7 +54,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
} }
/** /**
* @param \RainLoop\Account|string|null $oAccount * @param \RainLoop\Model\Account|string|null $oAccount
* @param int $iStorageType * @param int $iStorageType
* @param string $sKey * @param string $sKey
* *
@ -73,7 +73,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
} }
/** /**
* @param \RainLoop\Account|string|null $mAccount * @param \RainLoop\Model\Account|string|null $mAccount
* @param int $iStorageType * @param int $iStorageType
* @param string $sKey * @param string $sKey
* @param bool $bMkDir = false * @param bool $bMkDir = false
@ -87,7 +87,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
$iStorageType = \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY; $iStorageType = \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY;
} }
$sEmail = $mAccount instanceof \RainLoop\Account ? \preg_replace('/[^a-z0-9\-\.@]+/', '_', $sEmail = $mAccount instanceof \RainLoop\Model\Account ? \preg_replace('/[^a-z0-9\-\.@]+/', '_',
('' === $mAccount->ParentEmail() ? '' : $mAccount->ParentEmail().'/').$mAccount->Email()) : ''; ('' === $mAccount->ParentEmail() ? '' : $mAccount->ParentEmail().'/').$mAccount->Email()) : '';
if (\is_string($mAccount) && empty($sEmail)) if (\is_string($mAccount) && empty($sEmail))

View file

@ -5,7 +5,7 @@ namespace RainLoop\Providers\Storage;
interface StorageInterface interface StorageInterface
{ {
/** /**
* @param \RainLoop\Account|null $oAccount * @param \RainLoop\Model\Account|null $oAccount
* @param int $iStorageType * @param int $iStorageType
* @param string $sKey * @param string $sKey
* @param string $sValue * @param string $sValue
@ -15,7 +15,7 @@ interface StorageInterface
public function Put($oAccount, $iStorageType, $sKey, $sValue); public function Put($oAccount, $iStorageType, $sKey, $sValue);
/** /**
* @param \RainLoop\Account|null $oAccount * @param \RainLoop\Model\Account|null $oAccount
* @param int $iStorageType * @param int $iStorageType
* @param string $sKey * @param string $sKey
* @param mixed $mDefault = false * @param mixed $mDefault = false
@ -25,7 +25,7 @@ interface StorageInterface
public function Get($oAccount, $iStorageType, $sKey, $mDefault = false); public function Get($oAccount, $iStorageType, $sKey, $mDefault = false);
/** /**
* @param \RainLoop\Account|null $oAccount * @param \RainLoop\Model\Account|null $oAccount
* @param int $iStorageType * @param int $iStorageType
* @param string $sKey * @param string $sKey
* *

View file

@ -20,12 +20,12 @@ class Suggestions extends \RainLoop\Providers\AbstractProvider
} }
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sQuery * @param string $sQuery
* *
* @return array * @return array
*/ */
public function Process(\RainLoop\Account $oAccount, $sQuery) public function Process(\RainLoop\Model\Account $oAccount, $sQuery)
{ {
return $this->oDriver && $this->IsActive() && 0 < \strlen($sQuery) ? $this->oDriver->Process($oAccount, $sQuery) : array(); return $this->oDriver && $this->IsActive() && 0 < \strlen($sQuery) ? $this->oDriver->Process($oAccount, $sQuery) : array();
} }

View file

@ -5,10 +5,10 @@ namespace RainLoop\Providers\Suggestions;
interface SuggestionsInterface interface SuggestionsInterface
{ {
/** /**
* @param \RainLoop\Account $oAccount * @param \RainLoop\Model\Account $oAccount
* @param string $sQuery * @param string $sQuery
* *
* @return array * @return array
*/ */
public function Process(\RainLoop\Account $oAccount, $sQuery); public function Process(\RainLoop\Model\Account $oAccount, $sQuery);
} }

View file

@ -868,7 +868,7 @@ class ServiceActions
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword); $oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
$this->oActions->AuthToken($oAccount); $this->oActions->AuthToken($oAccount);
$bLogout = !($oAccount instanceof \RainLoop\Account); $bLogout = !($oAccount instanceof \RainLoop\Model\Account);
} }
catch (\Exception $oException) catch (\Exception $oException)
{ {
@ -905,7 +905,7 @@ class ServiceActions
{ {
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword); $oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
$this->oActions->AuthToken($oAccount); $this->oActions->AuthToken($oAccount);
$bLogout = !($oAccount instanceof \RainLoop\Account); $bLogout = !($oAccount instanceof \RainLoop\Model\Account);
} }
catch (\Exception $oException) catch (\Exception $oException)
{ {
@ -940,7 +940,7 @@ class ServiceActions
{ {
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword); $oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
$this->oActions->AuthToken($oAccount); $this->oActions->AuthToken($oAccount);
$bLogout = !($oAccount instanceof \RainLoop\Account); $bLogout = !($oAccount instanceof \RainLoop\Model\Account);
} }
catch (\Exception $oException) catch (\Exception $oException)
{ {
@ -961,7 +961,7 @@ class ServiceActions
$aResult = array( $aResult = array(
'Action' => 'ExternalLogin', 'Action' => 'ExternalLogin',
'Result' => $oAccount instanceof \RainLoop\Account ? true : false, 'Result' => $oAccount instanceof \RainLoop\Model\Account ? true : false,
'ErrorCode' => 0 'ErrorCode' => 0
); );

View file

@ -346,7 +346,7 @@ class Social
!empty($aUserData['Email']) && isset($aUserData['Password'])) !empty($aUserData['Email']) && isset($aUserData['Password']))
{ {
$oAccount = $this->oActions->LoginProcess($aUserData['Email'], $aUserData['Password']); $oAccount = $this->oActions->LoginProcess($aUserData['Email'], $aUserData['Password']);
if ($oAccount instanceof \RainLoop\Account) if ($oAccount instanceof \RainLoop\Model\Account)
{ {
$this->oActions->AuthToken($oAccount); $this->oActions->AuthToken($oAccount);
@ -493,7 +493,7 @@ class Social
!empty($aUserData['Email']) && isset($aUserData['Password'])) !empty($aUserData['Email']) && isset($aUserData['Password']))
{ {
$oAccount = $this->oActions->LoginProcess($aUserData['Email'], $aUserData['Password']); $oAccount = $this->oActions->LoginProcess($aUserData['Email'], $aUserData['Password']);
if ($oAccount instanceof \RainLoop\Account) if ($oAccount instanceof \RainLoop\Model\Account)
{ {
$this->oActions->AuthToken($oAccount); $this->oActions->AuthToken($oAccount);
@ -669,7 +669,7 @@ class Social
isset($aUserData['Password'])) isset($aUserData['Password']))
{ {
$oAccount = $this->oActions->LoginProcess($aUserData['Email'], $aUserData['Password']); $oAccount = $this->oActions->LoginProcess($aUserData['Email'], $aUserData['Password']);
if ($oAccount instanceof \RainLoop\Account) if ($oAccount instanceof \RainLoop\Model\Account)
{ {
$this->oActions->AuthToken($oAccount); $this->oActions->AuthToken($oAccount);
@ -800,7 +800,7 @@ class Social
} }
/** /**
* @param \RainLoop\Account|null $oAccount = null * @param \RainLoop\Model\Account|null $oAccount = null
* *
* @return \RainLoop\Common\RainLoopFacebookRedirectLoginHelper|null * @return \RainLoop\Common\RainLoopFacebookRedirectLoginHelper|null
*/ */

View file

@ -50,16 +50,20 @@
</div> </div>
</div> </div>
<br /> <br />
<div data-bind="component: { <div class="row">
name: 'Checkbox', <div class="span5">
params: { <div data-bind="component: {
label: 'Use short login', name: 'Checkbox',
value: imapShortLogin, params: {
inline: true label: 'Use short login',
} value: imapShortLogin,
}"></div> inline: true
&nbsp; }
<span style="color: #aaa">(user@domain.com &rarr; user)</span> }"></div>
&nbsp;&nbsp;
<span style="color: #aaa">(user@domain.com &rarr; user)</span>
</div>
</div>
</div> </div>
<div class="span5" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingSmtpError }"> <div class="span5" data-bind="css: { 'testing-done': testingDone, 'testing-error': testingSmtpError }">
<div class="legend smtp-header"> <div class="legend smtp-header">
@ -67,51 +71,72 @@
SMTP SMTP
</span> </span>
</div> </div>
<div class="row"> <div data-bind="visible: !smtpPhpMail()">
<div class="span3"> <div class="row">
Server <div class="span3">
<br /> Server
<input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" <br />
data-bind="textInput: smtpServer, hasfocus: smtpServerFocus" /> <input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: smtpServer, hasfocus: smtpServerFocus" />
</div>
<div class="span1">
Port
<br />
<input type="text" class="span1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: smtpPort" />
</div>
</div> </div>
<div class="span1"> <br />
Port <div class="row">
<br /> <div class="span4">
<input type="text" class="span1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" Secure
data-bind="textInput: smtpPort" /> <br />
<select class="span2" data-bind="value: smtpSecure">
<option value="0">None</option>
<option value="1">SSL/TLS</option>
<option value="2">STARTTLS</option>
</select>
</div>
</div>
<br />
<div class="row">
<div class="span5">
<div data-bind="component: {
name: 'Checkbox',
params: {
label: 'Use short login',
value: smtpShortLogin,
inline: true
}
}"></div>
&nbsp;&nbsp;
<span style="color: #aaa">(user@domain.com &rarr; user)</span>
<br />
<div data-bind="component: {
name: 'Checkbox',
params: {
label: 'Use authentication',
value: smtpAuth
}
}"></div>
</div>
</div>
<br />
</div>
<div class="row">
<div class="span5">
<div data-bind="component: {
name: 'Checkbox',
params: {
label: 'Use php mail() function',
value: smtpPhpMail,
inline: true
}
}"></div>
&nbsp;&nbsp;
<span style="color: red">(beta)</span>
</div> </div>
</div> </div>
<br />
<div class="row">
<div class="span4">
Secure
<br />
<select class="span2" data-bind="value: smtpSecure">
<option value="0">None</option>
<option value="1">SSL/TLS</option>
<option value="2">STARTTLS</option>
</select>
</div>
</div>
<br />
<div data-bind="component: {
name: 'Checkbox',
params: {
label: 'Use short login',
value: smtpShortLogin,
inline: true
}
}"></div>
&nbsp;
<span style="color: #aaa">(user@domain.com &rarr; user)</span>
<br />
<div data-bind="component: {
name: 'Checkbox',
params: {
label: 'Use authentication',
value: smtpAuth
}
}"></div>
</div> </div>
<div class="span10"> <div class="span10">
<div class="legend white-list-header"> <div class="legend white-list-header">