From 2545ce3cd9c59fe4c1c8d8d2af7be6f6d8abd328 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Wed, 12 Nov 2014 20:46:05 +0400 Subject: [PATCH] Code refactoring --- dev/Model/Email.js | 2 +- dev/Storage/Admin/Remote.js | 11 +- dev/View/Popup/Domain.js | 10 - dev/View/User/Login.js | 8 +- gulpfile.js | 5 +- package.json | 1 + rainloop/v/0.0.0/app/src/RainLoop/Account.php | 456 +--------- rainloop/v/0.0.0/app/src/RainLoop/Actions.php | 24 +- .../0.0.0/app/src/RainLoop/Model/Account.php | 438 +++++++++ .../app/src/RainLoop/{ => Model}/Domain.php | 77 +- .../app/src/RainLoop/{ => Model}/Identity.php | 18 +- .../app/src/RainLoop/Providers/Domain.php | 24 +- .../Providers/Domain/DefaultDomain.php | 12 +- .../Providers/Domain/DomainAdminInterface.php | 6 +- .../templates/Views/Admin/PopupsDomain.html | 28 +- vendors/jua/_/jua.js | 858 +++++++++--------- vendors/jua/jua.min.js | 2 +- 17 files changed, 946 insertions(+), 1034 deletions(-) create mode 100644 rainloop/v/0.0.0/app/src/RainLoop/Model/Account.php rename rainloop/v/0.0.0/app/src/RainLoop/{ => Model}/Domain.php (77%) rename rainloop/v/0.0.0/app/src/RainLoop/{ => Model}/Identity.php (90%) diff --git a/dev/Model/Email.js b/dev/Model/Email.js index 07858b8ba..c47738b2c 100644 --- a/dev/Model/Email.js +++ b/dev/Model/Email.js @@ -92,7 +92,7 @@ sString = Utils.trim(sString); var - mRegex = /(?:"([^"]+)")? ?,]+)>?,? ?/g, + mRegex = /(?:"([^"]+)")? ?[<]?(.*?@[^>,]+)>?,? ?/g, mMatch = mRegex.exec(sString) ; diff --git a/dev/Storage/Admin/Remote.js b/dev/Storage/Admin/Remote.js index afdff1d12..7630dfdcd 100644 --- a/dev/Storage/Admin/Remote.js +++ b/dev/Storage/Admin/Remote.js @@ -210,8 +210,8 @@ }; RemoteAdminStorage.prototype.createOrUpdateDomain = function (fCallback, - bCreate, sName, sIncHost, iIncPort, sIncSecure, bIncVerifySsl, bIncShortLogin, - sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutVerifySsl, bOutAuth, sWhiteList) + bCreate, sName, sIncHost, iIncPort, sIncSecure, bIncShortLogin, + sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutAuth, sWhiteList) { this.defaultRequest(fCallback, 'AdminDomainSave', { 'Create': bCreate ? '1' : '0', @@ -219,12 +219,10 @@ 'IncHost': sIncHost, 'IncPort': iIncPort, 'IncSecure': sIncSecure, - 'IncVerifySsl': bIncVerifySsl ? '1' : '0', 'IncShortLogin': bIncShortLogin ? '1' : '0', 'OutHost': sOutHost, 'OutPort': iOutPort, 'OutSecure': sOutSecure, - 'OutVerifySsl': bOutVerifySsl ? '1' : '0', 'OutShortLogin': bOutShortLogin ? '1' : '0', 'OutAuth': bOutAuth ? '1' : '0', 'WhiteList': sWhiteList @@ -232,19 +230,16 @@ }; RemoteAdminStorage.prototype.testConnectionForDomain = function (fCallback, sName, - sIncHost, iIncPort, sIncSecure, bIncVerifySsl, - sOutHost, iOutPort, sOutSecure, bOutVerifySsl, bOutAuth) + sIncHost, iIncPort, sIncSecure, sOutHost, iOutPort, sOutSecure, bOutAuth) { this.defaultRequest(fCallback, 'AdminDomainTest', { 'Name': sName, 'IncHost': sIncHost, 'IncPort': iIncPort, 'IncSecure': sIncSecure, - 'IncVerifySsl': bIncVerifySsl ? '1' : '0', 'OutHost': sOutHost, 'OutPort': iOutPort, 'OutSecure': sOutSecure, - 'OutVerifySsl': bOutVerifySsl ? '1' : '0', 'OutAuth': bOutAuth ? '1' : '0' }); }; diff --git a/dev/View/Popup/Domain.js b/dev/View/Popup/Domain.js index f14c992e3..f18b31787 100644 --- a/dev/View/Popup/Domain.js +++ b/dev/View/Popup/Domain.js @@ -63,12 +63,10 @@ this.imapServer = ko.observable(''); this.imapPort = ko.observable('' + Consts.Values.ImapDefaulPort); this.imapSecure = ko.observable(Enums.ServerSecure.None); - this.imapVerifySsl = ko.observable(false); this.imapShortLogin = ko.observable(false); this.smtpServer = ko.observable(''); this.smtpPort = ko.observable('' + Consts.Values.SmtpDefaulPort); this.smtpSecure = ko.observable(Enums.ServerSecure.None); - this.smtpVerifySsl = ko.observable(false); this.smtpShortLogin = ko.observable(false); this.smtpAuth = ko.observable(true); this.whiteList = ko.observable(''); @@ -106,12 +104,10 @@ this.imapServer(), Utils.pInt(this.imapPort()), this.imapSecure(), - this.imapVerifySsl(), this.imapShortLogin(), this.smtpServer(), Utils.pInt(this.smtpPort()), this.smtpSecure(), - this.smtpVerifySsl(), this.smtpShortLogin(), this.smtpAuth(), this.whiteList() @@ -130,11 +126,9 @@ this.imapServer(), Utils.pInt(this.imapPort()), this.imapSecure(), - this.imapVerifySsl(), this.smtpServer(), Utils.pInt(this.smtpPort()), this.smtpSecure(), - this.smtpVerifySsl(), this.smtpAuth() ); }, this.canBeTested); @@ -289,12 +283,10 @@ this.imapServer(Utils.trim(oDomain.IncHost)); this.imapPort('' + Utils.pInt(oDomain.IncPort)); this.imapSecure(Utils.trim(oDomain.IncSecure)); - this.imapVerifySsl(!!oDomain.IncVerifySsl); this.imapShortLogin(!!oDomain.IncShortLogin); this.smtpServer(Utils.trim(oDomain.OutHost)); this.smtpPort('' + Utils.pInt(oDomain.OutPort)); this.smtpSecure(Utils.trim(oDomain.OutSecure)); - this.smtpVerifySsl(!!oDomain.OutVerifySsl); this.smtpShortLogin(!!oDomain.OutShortLogin); this.smtpAuth(!!oDomain.OutAuth); this.whiteList(Utils.trim(oDomain.WhiteList)); @@ -325,12 +317,10 @@ this.imapServer(''); this.imapPort('' + Consts.Values.ImapDefaulPort); this.imapSecure(Enums.ServerSecure.None); - this.imapVerifySsl(false); this.imapShortLogin(false); this.smtpServer(''); this.smtpPort('' + Consts.Values.SmtpDefaulPort); this.smtpSecure(Enums.ServerSecure.None); - this.smtpVerifySsl(false); this.smtpShortLogin(false); this.smtpAuth(true); this.whiteList(''); diff --git a/dev/View/User/Login.js b/dev/View/User/Login.js index 3323fc77a..77f81eafc 100644 --- a/dev/View/User/Login.js +++ b/dev/View/User/Login.js @@ -189,7 +189,8 @@ this.facebookCommand = Utils.createCommand(this, function () { window.open(Links.socialFacebook(), 'Facebook', - 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes'); + 'left=200,top=100,width=650,height=450,menubar=no,status=no,resizable=yes,scrollbars=yes'); + return true; }, function () { @@ -201,7 +202,8 @@ this.googleCommand = Utils.createCommand(this, function () { window.open(Links.socialGoogle(), 'Google', - 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes'); + 'left=200,top=100,width=650,height=450,menubar=no,status=no,resizable=yes,scrollbars=yes'); + return true; }, function () { @@ -213,7 +215,7 @@ this.twitterCommand = Utils.createCommand(this, function () { window.open(Links.socialTwitter(), 'Twitter', - 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes'); + 'left=200,top=100,width=650,height=450,menubar=no,status=no,resizable=yes,scrollbars=yes'); return true; diff --git a/gulpfile.js b/gulpfile.js index 821005db3..a09f8c757 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -33,6 +33,7 @@ var rename = require('gulp-rename'), replace = require('gulp-replace'), uglify = require('gulp-uglify'), + plumber = require('gulp-plumber'), gutil = require('gulp-util') ; @@ -191,11 +192,12 @@ gulp.task('css:main', ['less:main'], function() { var // csslint = require('gulp-csslint'), - csscomb = require('gulp-csscomb'), +// csscomb = require('gulp-csscomb'), autoprefixer = require('gulp-autoprefixer') ; return gulp.src(cfg.paths.css.main.src) + .pipe(plumber()) .pipe(concat(cfg.paths.css.main.name)) .pipe(autoprefixer('last 3 versions', '> 1%', 'ie 9', 'Firefox ESR', 'Opera 12.1')) // .pipe(csscomb()) @@ -209,6 +211,7 @@ gulp.task('css:main', ['less:main'], function() { gulp.task('css:main:min', ['css:main'], function() { var minifyCss = require('gulp-minify-css'); return gulp.src(cfg.paths.staticCSS + cfg.paths.css.main.name) + .pipe(plumber()) .pipe(minifyCss({ 'keepSpecialComments': 0 })) diff --git a/package.json b/package.json index 7352b24bc..180563857 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "gulp-closure-compiler": "*", "gulp-csslint": "*", "gulp-beautify": "*", + "gulp-plumber": "*", "gulp-concat-util": "*" } } diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Account.php b/rainloop/v/0.0.0/app/src/RainLoop/Account.php index 57a351c5c..ba3e898af 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Account.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Account.php @@ -2,457 +2,5 @@ namespace RainLoop; -class Account -{ - /** - * @var string - */ - private $sEmail; - - /** - * @var string - */ - private $sLogin; - - /** - * @var int - */ - private $sPassword; - - /** - * @var string - */ - private $sProxyAuthUser; - - /** - * @var string - */ - private $sProxyAuthPassword; - - /** - * @var string - */ - private $sSignMeToken; - - /** - * @var \RainLoop\Domain - */ - private $oDomain; - - /** - * @var string - */ - private $sParentEmail; - - /** - * @param string $sEmail - * @param string $sLogin - * @param string $sPassword - * @param \RainLoop\Domain $oDomain - * @param string $sSignMeToken = '' - * @param string $sProxyAuthUser = '' - * @param string $sProxyAuthPassword = '' - * - * @return void - */ - protected function __construct($sEmail, $sLogin, $sPassword, \RainLoop\Domain $oDomain, - $sSignMeToken = '', $sProxyAuthUser = '', $sProxyAuthPassword = '') - { - $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->sProxyAuthUser = $sProxyAuthUser; - $this->sProxyAuthPassword = $sProxyAuthPassword; - } - - /** - * @param string $sEmail - * @param string $sLogin - * @param string $sPassword - * @param \RainLoop\Domain $oDomain - * @param string $sSignMeToken = '' - * @param string $sProxyAuthUser = '' - * @param string $sProxyAuthPassword = '' - * - * @return \RainLoop\Account - */ - public static function NewInstance($sEmail, $sLogin, $sPassword, \RainLoop\Domain $oDomain, - $sSignMeToken = '', $sProxyAuthUser = '', $sProxyAuthPassword = '') - { - return new self($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken, $sProxyAuthUser, $sProxyAuthPassword); - } - - /** - * @return string - */ - public function Email() - { - return $this->sEmail; - } - - /** - * @return string - */ - public function ParentEmail() - { - return $this->sParentEmail; - } - - /** - * @return string - */ - public function ProxyAuthUser() - { - return $this->sProxyAuthUser; - } - - /** - * @return string - */ - public function ProxyAuthPassword() - { - return $this->sProxyAuthPassword; - } - - /** - * @return string - */ - public function ParentEmailHelper() - { - return 0 < \strlen($this->sParentEmail) ? $this->sParentEmail : $this->sEmail; - } - - /** - * @return string - */ - public function IncLogin() - { - $sLogin = $this->sLogin; - if ($this->oDomain->IncShortLogin()) - { - $sLogin = \MailSo\Base\Utils::GetAccountNameFromEmail($this->sLogin); - } - - return $sLogin; - } - - /** - * @return string - */ - public function IncPassword() - { - return $this->sPassword; - } - - /** - * @return string - */ - public function OutLogin() - { - $sLogin = $this->sLogin; - if ($this->oDomain->OutShortLogin()) - { - $sLogin = \MailSo\Base\Utils::GetAccountNameFromEmail($this->sLogin); - } - - return $sLogin; - } - - /** - * @return string - */ - public function Login() - { - return $this->IncLogin(); - } - - /** - * @return string - */ - public function Password() - { - return $this->IncPassword(); - } - - /** - * @return bool - */ - public function SignMe() - { - return 0 < \strlen($this->sSignMeToken); - } - - /** - * @return string - */ - public function SignMeToken() - { - return $this->sSignMeToken; - } - - /** - * @return \RainLoop\Domain - */ - public function Domain() - { - return $this->oDomain; - } - - /** - * @return \RainLoop\Domain - */ - public function Hash() - { - return md5(APP_SALT.$this->Email().APP_SALT.$this->DomainIncHost(). - APP_SALT.$this->DomainIncPort().APP_SALT.$this->Password().APP_SALT.'0'.APP_SALT.$this->ParentEmail().APP_SALT); - } - - /** - * @param string $sPassword - * - * @return void - */ - public function SetPassword($sPassword) - { - $this->sPassword = $sPassword; - } - - /** - * @param string $sParentEmail - * - * @return void - */ - public function SetParentEmail($sParentEmail) - { - $this->sParentEmail = \MailSo\Base\Utils::IdnToAscii($sParentEmail, true); - } - - /** - * @param string $sProxyAuthUser - * - * @return void - */ - public function SetProxyAuthUser($sProxyAuthUser) - { - return $this->sProxyAuthUser = $sProxyAuthUser; - } - - /** - * @param string $sProxyAuthPassword - * - * @return void - */ - public function SetProxyAuthPassword($sProxyAuthPassword) - { - return $this->sProxyAuthPassword = $sProxyAuthPassword; - } - - /** - * @return string - */ - public function DomainIncHost() - { - return $this->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($this->Email())); - } - - /** - * @return int - */ - public function DomainIncPort() - { - return $this->Domain()->IncPort(); - } - - /** - * @return int - */ - public function DomainIncSecure() - { - return $this->Domain()->IncSecure(); - } - - /** - * @param bool|null $bGlobalVerify = null - * - * @return bool - */ - public function DomainIncVerifySsl($bGlobalVerify = null) - { - return $this->Domain()->IncVerifySsl($bGlobalVerify); - } - - /** - * @return string - */ - public function DomainOutHost() - { - return $this->Domain()->OutHost(\MailSo\Base\Utils::GetDomainFromEmail($this->Email())); - } - - /** - * @return int - */ - public function DomainOutPort() - { - return $this->Domain()->OutPort(); - } - - /** - * @return int - */ - public function DomainOutSecure() - { - return $this->Domain()->OutSecure(); - } - - /** - * @return bool - */ - public function DomainOutAuth() - { - return $this->Domain()->OutAuth(); - } - - /** - * @param bool|null $bGlobalVerify = null - * - * @return bool - */ - public function DomainOutVerifySsl($bGlobalVerify = null) - { - return $this->Domain()->OutVerifySsl($bGlobalVerify); - } - - /** - * @return string - */ - public function GetAuthToken() - { - return \RainLoop\Utils::EncodeKeyValues(array( - 'token', // 0 - $this->sEmail, // 1 - $this->sLogin, // 2 - $this->sPassword, // 3 - \RainLoop\Utils::Fingerprint(), // 4 - $this->sSignMeToken, // 5 - $this->sParentEmail, // 6 - \RainLoop\Utils::GetShortToken(), // 7 - $this->sProxyAuthUser, // 8 - $this->sProxyAuthPassword, // 9 - 0 // 10 - )); - } - - /** - * @param \RainLoop\Plugins\Manager $oPlugins - * @param \MailSo\Mail\MailClient $oMailClient - * @param \RainLoop\Application $oConfig - * - * @return bool - */ - public function IncConnectAndLoginHelper($oPlugins, $oMailClient, $oConfig) - { - $bLogin = false; - - $aImapCredentials = array( - 'UseConnect' => true, - 'UseAuth' => true, - 'Host' => $this->DomainIncHost(), - 'Port' => $this->DomainIncPort(), - 'Secure' => $this->DomainIncSecure(), - 'Login' => $this->IncLogin(), - 'Password' => $this->Password(), - 'ProxyAuthUser' => $this->ProxyAuthUser(), - 'ProxyAuthPassword' => $this->ProxyAuthPassword(), - 'VerifySsl' => $this->DomainIncVerifySsl(!!$oConfig->Get('ssl', 'verify_certificate')), - 'UseAuthPlainIfSupported' => !!$oConfig->Get('labs', 'use_imap_auth_plain') - ); - - $oPlugins->RunHook('filter.imap-credentials', array($this, &$aImapCredentials)); - - $oPlugins->RunHook('event.imap-pre-connect', array($this, $aImapCredentials['UseConnect'], $aImapCredentials)); - - if ($aImapCredentials['UseConnect']) - { - $oMailClient - ->Connect($aImapCredentials['Host'], $aImapCredentials['Port'], - $aImapCredentials['Secure'], $aImapCredentials['VerifySsl']); - } - - $oPlugins->RunHook('event.imap-pre-login', array($this, $aImapCredentials['UseAuth'], $aImapCredentials)); - - if ($aImapCredentials['UseAuth']) - { - if (0 < \strlen($aImapCredentials['ProxyAuthUser']) && - 0 < \strlen($aImapCredentials['ProxyAuthPassword'])) - { - $oMailClient - ->Login($aImapCredentials['ProxyAuthUser'], $aImapCredentials['ProxyAuthPassword'], - $aImapCredentials['Login'], $aImapCredentials['UseAuthPlainIfSupported']); - } - else - { - $oMailClient->Login($aImapCredentials['Login'], $aImapCredentials['Password'], '', - $aImapCredentials['UseAuthPlainIfSupported']); - } - - $bLogin = true; - } - - $oPlugins->RunHook('event.imap-post-login', array($this, $aImapCredentials['UseAuth'], $bLogin, $aImapCredentials)); - - return $bLogin; - } - - /** - * @param \RainLoop\Plugins\Manager $oPlugins - * @param \MailSo\Smtp\SmtpClient $oSmtpClient - * @param \RainLoop\Application $oConfig - * - * @return bool - */ - public function OutConnectAndLoginHelper($oPlugins, $oSmtpClient, $oConfig) - { - $bLogin = false; - - $aSmtpCredentials = array( - 'UseConnect' => true, - 'UseAuth' => $this->DomainOutAuth(), - 'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(), - 'Host' => $this->DomainOutHost(), - 'Port' => $this->DomainOutPort(), - 'Secure' => $this->DomainOutSecure(), - 'Login' => $this->OutLogin(), - 'Password' => $this->Password(), - 'ProxyAuthUser' => $this->ProxyAuthUser(), - 'ProxyAuthPassword' => $this->ProxyAuthPassword(), - 'VerifySsl' => $this->DomainOutVerifySsl(!!$oConfig->Get('ssl', 'verify_certificate')) - ); - - $oPlugins->RunHook('filter.smtp-credentials', array($this, &$aSmtpCredentials)); - - $oPlugins->RunHook('event.smtp-pre-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials)); - - if ($aSmtpCredentials['UseConnect']) - { - $oSmtpClient->Connect($aSmtpCredentials['Host'], $aSmtpCredentials['Port'], - $aSmtpCredentials['Ehlo'], $aSmtpCredentials['Secure'], $aSmtpCredentials['VerifySsl']); - } - - $oPlugins->RunHook('event.smtp-post-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials)); - $oPlugins->RunHook('event.smtp-pre-login', array($this, $aSmtpCredentials['UseAuth'], $aSmtpCredentials)); - - if ($aSmtpCredentials['UseAuth']) - { - $oSmtpClient->Login($aSmtpCredentials['Login'], $aSmtpCredentials['Password']); - - $bLogin = true; - } - - $oPlugins->RunHook('event.smtp-post-login', array($this, $aSmtpCredentials['UseAuth'], $bLogin, $aSmtpCredentials)); - - return $bLogin; - } -} +// for backward compatibility +class Account extends \RainLoop\Model\Account {} diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Actions.php b/rainloop/v/0.0.0/app/src/RainLoop/Actions.php index 7964ba260..b9d12af64 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Actions.php @@ -869,7 +869,7 @@ class Actions if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword)) { $oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true); - if ($oDomain instanceof \RainLoop\Domain) + if ($oDomain instanceof \RainLoop\Model\Domain) { if ($oDomain->ValidateWhiteList($sEmail, $sLogin)) { @@ -1529,7 +1529,7 @@ class Actions $sLine = \trim(\implode('.', $aDomainParts), '. '); $oDomain = $oDomainProvider->Load($sLine); - if ($oDomain && $oDomain instanceof \RainLoop\Domain) + if ($oDomain && $oDomain instanceof \RainLoop\Model\Domain) { $bAdded = true; $this->Logger()->Write('Check "'.$sLine.'": OK ('.$sEmail.' > '.$sEmail.'@'.$sLine.')', @@ -2950,7 +2950,7 @@ class Actions $oDomain = $this->DomainProvider()->LoadOrCreateNewFromAction($this); return $this->DefaultResponse(__FUNCTION__, - $oDomain instanceof \RainLoop\Domain ? $this->DomainProvider()->Save($oDomain) : false); + $oDomain instanceof \RainLoop\Model\Domain ? $this->DomainProvider()->Save($oDomain) : false); } /** @@ -2977,8 +2977,8 @@ class Actions $oImapClient->SetTimeOuts(5); $iTime = \microtime(true); - $oImapClient->Connect($oDomain->IncHost($oDomain->Name()), $oDomain->IncPort(), - $oDomain->IncSecure(), $oDomain->IncVerifySsl(!!$this->Config()->Get('ssl', 'verify_certificate'))); + $oImapClient->Connect($oDomain->IncHost(), $oDomain->IncPort(), + $oDomain->IncSecure(), !!$this->Config()->Get('ssl', 'verify_certificate')); $iImapTime = \microtime(true) - $iTime; $oImapClient->Disconnect(); @@ -3005,8 +3005,8 @@ class Actions $oSmtpClient->SetTimeOuts(5); $iTime = \microtime(true); - $oSmtpClient->Connect($oDomain->OutHost($oDomain->Name()), $oDomain->OutPort(), '127.0.0.1', - $oDomain->OutSecure(), $oDomain->OutVerifySsl(!!$this->Config()->Get('ssl', 'verify_certificate'))); + $oSmtpClient->Connect($oDomain->OutHost(), $oDomain->OutPort(), '127.0.0.1', + $oDomain->OutSecure(), !!$this->Config()->Get('ssl', 'verify_certificate')); $iSmtpTime = \microtime(true) - $iTime; $oSmtpClient->Disconnect(); @@ -3422,11 +3422,10 @@ class Actions { $this->Logger()->Write('Versions GC: Begin'); - $iLimitToDelete = 3; - $sVPath = APP_INDEX_ROOT_PATH.'rainloop/v/'; $aDirs = @\array_map('basename', @\array_filter(@\glob($sVPath.'*'), 'is_dir')); + $this->Logger()->Write('Versions GC: Count:'.(\is_array($aDirs) ? \count($aDirs) : 0)); if (\is_array($aDirs) && 5 < \count($aDirs)) { \uasort($aDirs, 'version_compare'); @@ -3439,12 +3438,7 @@ class Actions @\MailSo\Base\Utils::RecRmDir($sVPath.$sName); $this->Logger()->Write('Versions GC: End to remove "'.$sVPath.$sName.'" version'); - $iLimitToDelete--; - - if (0 > $iLimitToDelete) - { - break; - } + break; } } } diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Model/Account.php b/rainloop/v/0.0.0/app/src/RainLoop/Model/Account.php new file mode 100644 index 000000000..242ad1112 --- /dev/null +++ b/rainloop/v/0.0.0/app/src/RainLoop/Model/Account.php @@ -0,0 +1,438 @@ +sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true); + $this->sLogin = \MailSo\Base\Utils::IdnToAscii($sLogin); + $this->sPassword = $sPassword; + $this->oDomain = $oDomain; + $this->sSignMeToken = $sSignMeToken; + $this->sProxyAuthUser = $sProxyAuthUser; + $this->sProxyAuthPassword = $sProxyAuthPassword; + } + + /** + * @param string $sEmail + * @param string $sLogin + * @param string $sPassword + * @param \RainLoop\Model\Domain $oDomain + * @param string $sSignMeToken = '' + * @param string $sProxyAuthUser = '' + * @param string $sProxyAuthPassword = '' + * + * @return \RainLoop\Model\Account + */ + public static function NewInstance($sEmail, $sLogin, $sPassword, \RainLoop\Model\Domain $oDomain, + $sSignMeToken = '', $sProxyAuthUser = '', $sProxyAuthPassword = '') + { + return new self($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken, $sProxyAuthUser, $sProxyAuthPassword); + } + + /** + * @return string + */ + public function Email() + { + return $this->sEmail; + } + + /** + * @return string + */ + public function ParentEmail() + { + return $this->sParentEmail; + } + + /** + * @return string + */ + public function ProxyAuthUser() + { + return $this->sProxyAuthUser; + } + + /** + * @return string + */ + public function ProxyAuthPassword() + { + return $this->sProxyAuthPassword; + } + + /** + * @return string + */ + public function ParentEmailHelper() + { + return 0 < \strlen($this->sParentEmail) ? $this->sParentEmail : $this->sEmail; + } + + /** + * @return string + */ + public function IncLogin() + { + $sLogin = $this->sLogin; + if ($this->oDomain->IncShortLogin()) + { + $sLogin = \MailSo\Base\Utils::GetAccountNameFromEmail($this->sLogin); + } + + return $sLogin; + } + + /** + * @return string + */ + public function IncPassword() + { + return $this->sPassword; + } + + /** + * @return string + */ + public function OutLogin() + { + $sLogin = $this->sLogin; + if ($this->oDomain->OutShortLogin()) + { + $sLogin = \MailSo\Base\Utils::GetAccountNameFromEmail($this->sLogin); + } + + return $sLogin; + } + + /** + * @return string + */ + public function Login() + { + return $this->IncLogin(); + } + + /** + * @return string + */ + public function Password() + { + return $this->IncPassword(); + } + + /** + * @return bool + */ + public function SignMe() + { + return 0 < \strlen($this->sSignMeToken); + } + + /** + * @return string + */ + public function SignMeToken() + { + return $this->sSignMeToken; + } + + /** + * @return \RainLoop\Model\Domain + */ + public function Domain() + { + return $this->oDomain; + } + + /** + * @return string + */ + public function Hash() + { + return md5(APP_SALT.$this->Email().APP_SALT.$this->DomainIncHost(). + APP_SALT.$this->DomainIncPort().APP_SALT.$this->Password().APP_SALT.'0'.APP_SALT.$this->ParentEmail().APP_SALT); + } + + /** + * @param string $sPassword + * + * @return void + */ + public function SetPassword($sPassword) + { + $this->sPassword = $sPassword; + } + + /** + * @param string $sParentEmail + * + * @return void + */ + public function SetParentEmail($sParentEmail) + { + $this->sParentEmail = \MailSo\Base\Utils::IdnToAscii($sParentEmail, true); + } + + /** + * @param string $sProxyAuthUser + * + * @return void + */ + public function SetProxyAuthUser($sProxyAuthUser) + { + return $this->sProxyAuthUser = $sProxyAuthUser; + } + + /** + * @param string $sProxyAuthPassword + * + * @return void + */ + public function SetProxyAuthPassword($sProxyAuthPassword) + { + return $this->sProxyAuthPassword = $sProxyAuthPassword; + } + + /** + * @return string + */ + public function DomainIncHost() + { + return $this->Domain()->IncHost(); + } + + /** + * @return int + */ + public function DomainIncPort() + { + return $this->Domain()->IncPort(); + } + + /** + * @return int + */ + public function DomainIncSecure() + { + return $this->Domain()->IncSecure(); + } + + /** + * @return string + */ + public function DomainOutHost() + { + return $this->Domain()->OutHost(); + } + + /** + * @return int + */ + public function DomainOutPort() + { + return $this->Domain()->OutPort(); + } + + /** + * @return int + */ + public function DomainOutSecure() + { + return $this->Domain()->OutSecure(); + } + + /** + * @return bool + */ + public function DomainOutAuth() + { + return $this->Domain()->OutAuth(); + } + + /** + * @return string + */ + public function GetAuthToken() + { + return \RainLoop\Utils::EncodeKeyValues(array( + 'token', // 0 + $this->sEmail, // 1 + $this->sLogin, // 2 + $this->sPassword, // 3 + \RainLoop\Utils::Fingerprint(), // 4 + $this->sSignMeToken, // 5 + $this->sParentEmail, // 6 + \RainLoop\Utils::GetShortToken(), // 7 + $this->sProxyAuthUser, // 8 + $this->sProxyAuthPassword, // 9 + 0 // 10 + )); + } + + /** + * @param \RainLoop\Plugins\Manager $oPlugins + * @param \MailSo\Mail\MailClient $oMailClient + * @param \RainLoop\Application $oConfig + * + * @return bool + */ + public function IncConnectAndLoginHelper($oPlugins, $oMailClient, $oConfig) + { + $bLogin = false; + + $aImapCredentials = array( + 'UseConnect' => true, + 'UseAuth' => true, + 'Host' => $this->DomainIncHost(), + 'Port' => $this->DomainIncPort(), + 'Secure' => $this->DomainIncSecure(), + 'Login' => $this->IncLogin(), + 'Password' => $this->Password(), + 'ProxyAuthUser' => $this->ProxyAuthUser(), + 'ProxyAuthPassword' => $this->ProxyAuthPassword(), + 'VerifySsl' => !!$oConfig->Get('ssl', 'verify_certificate'), + 'UseAuthPlainIfSupported' => !!$oConfig->Get('labs', 'use_imap_auth_plain') + ); + + $oPlugins->RunHook('filter.imap-credentials', array($this, &$aImapCredentials)); + + $oPlugins->RunHook('event.imap-pre-connect', array($this, $aImapCredentials['UseConnect'], $aImapCredentials)); + + if ($aImapCredentials['UseConnect']) + { + $oMailClient + ->Connect($aImapCredentials['Host'], $aImapCredentials['Port'], + $aImapCredentials['Secure'], $aImapCredentials['VerifySsl']); + } + + $oPlugins->RunHook('event.imap-pre-login', array($this, $aImapCredentials['UseAuth'], $aImapCredentials)); + + if ($aImapCredentials['UseAuth']) + { + if (0 < \strlen($aImapCredentials['ProxyAuthUser']) && + 0 < \strlen($aImapCredentials['ProxyAuthPassword'])) + { + $oMailClient + ->Login($aImapCredentials['ProxyAuthUser'], $aImapCredentials['ProxyAuthPassword'], + $aImapCredentials['Login'], $aImapCredentials['UseAuthPlainIfSupported']); + } + else + { + $oMailClient->Login($aImapCredentials['Login'], $aImapCredentials['Password'], '', + $aImapCredentials['UseAuthPlainIfSupported']); + } + + $bLogin = true; + } + + $oPlugins->RunHook('event.imap-post-login', array($this, $aImapCredentials['UseAuth'], $bLogin, $aImapCredentials)); + + return $bLogin; + } + + /** + * @param \RainLoop\Plugins\Manager $oPlugins + * @param \MailSo\Smtp\SmtpClient $oSmtpClient + * @param \RainLoop\Application $oConfig + * + * @return bool + */ + public function OutConnectAndLoginHelper($oPlugins, $oSmtpClient, $oConfig) + { + $bLogin = false; + + $aSmtpCredentials = array( + 'UseConnect' => true, + 'UseAuth' => $this->DomainOutAuth(), + 'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(), + 'Host' => $this->DomainOutHost(), + 'Port' => $this->DomainOutPort(), + 'Secure' => $this->DomainOutSecure(), + 'Login' => $this->OutLogin(), + 'Password' => $this->Password(), + 'ProxyAuthUser' => $this->ProxyAuthUser(), + 'ProxyAuthPassword' => $this->ProxyAuthPassword(), + 'VerifySsl' => !!$oConfig->Get('ssl', 'verify_certificate') + ); + + $oPlugins->RunHook('filter.smtp-credentials', array($this, &$aSmtpCredentials)); + + $oPlugins->RunHook('event.smtp-pre-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials)); + + if ($aSmtpCredentials['UseConnect']) + { + $oSmtpClient->Connect($aSmtpCredentials['Host'], $aSmtpCredentials['Port'], + $aSmtpCredentials['Ehlo'], $aSmtpCredentials['Secure'], $aSmtpCredentials['VerifySsl']); + } + + $oPlugins->RunHook('event.smtp-post-connect', array($this, $aSmtpCredentials['UseConnect'], $aSmtpCredentials)); + $oPlugins->RunHook('event.smtp-pre-login', array($this, $aSmtpCredentials['UseAuth'], $aSmtpCredentials)); + + if ($aSmtpCredentials['UseAuth']) + { + $oSmtpClient->Login($aSmtpCredentials['Login'], $aSmtpCredentials['Password']); + + $bLogin = true; + } + + $oPlugins->RunHook('event.smtp-post-login', array($this, $aSmtpCredentials['UseAuth'], $bLogin, $aSmtpCredentials)); + + return $bLogin; + } +} diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Domain.php b/rainloop/v/0.0.0/app/src/RainLoop/Model/Domain.php similarity index 77% rename from rainloop/v/0.0.0/app/src/RainLoop/Domain.php rename to rainloop/v/0.0.0/app/src/RainLoop/Model/Domain.php index fe9ef7923..8bbc5ee6f 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Domain.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Model/Domain.php @@ -1,6 +1,6 @@ sName = $sName; $this->sIncHost = $sIncHost; $this->iIncPort = $iIncPort; $this->iIncSecure = $iIncSecure; - $this->bIncVerifySsl = !!$bIncVerifySsl; $this->bIncShortLogin = $bIncShortLogin; $this->sOutHost = $sOutHost; $this->iOutPort = $iOutPort; $this->iOutSecure = $iOutSecure; - $this->bOutVerifySsl = !!$bOutVerifySsl; $this->bOutShortLogin = $bOutShortLogin; $this->bOutAuth = $bOutAuth; $this->sWhiteList = \trim($sWhiteList); @@ -111,26 +97,24 @@ class Domain * @param string $sIncHost * @param int $iIncPort * @param int $iIncSecure - * @param bool $bIncVerifySsl * @param bool $bIncShortLogin * @param string $sOutHost * @param int $iOutPort * @param int $iOutSecure - * @param bool $bOutVerifySsl * @param bool $bOutShortLogin * @param bool $bOutAuth * @param string $sWhiteList = '' * - * @return \RainLoop\Domain + * @return \RainLoop\Model\Domain */ public static function NewInstance($sName, - $sIncHost, $iIncPort, $iIncSecure, $bIncVerifySsl, $bIncShortLogin, - $sOutHost, $iOutPort, $iOutSecure, $bOutVerifySsl, $bOutShortLogin, $bOutAuth, + $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList = '') { return new self($sName, - $sIncHost, $iIncPort, $iIncSecure, $bIncVerifySsl, $bIncShortLogin, - $sOutHost, $iOutPort, $iOutSecure, $bOutVerifySsl, $bOutShortLogin, $bOutAuth, + $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList); } @@ -138,7 +122,7 @@ class Domain * @param string $sName * @param array $aDomain * - * @return \RainLoop\Domain|null + * @return \RainLoop\Model\Domain|null */ public static function NewInstanceFromDomainConfigArray($sName, $aDomain) { @@ -152,15 +136,11 @@ class Domain $iIncSecure = self::StrConnectionSecurityTypeToCons( !empty($aDomain['imap_secure']) ? $aDomain['imap_secure'] : ''); - $bIncVerifySsl = isset($aDomain['imap_verify_ssl']) ? (bool) $aDomain['smtp_verify_ssl'] : false;; - $sOutHost = (string) $aDomain['smtp_host']; $iOutPort = (int) $aDomain['smtp_port']; $iOutSecure = self::StrConnectionSecurityTypeToCons( !empty($aDomain['smtp_secure']) ? $aDomain['smtp_secure'] : ''); - $bOutVerifySsl = isset($aDomain['smtp_verify_ssl']) ? (bool) $aDomain['smtp_verify_ssl'] : false; - $bOutAuth = isset($aDomain['smtp_auth']) ? (bool) $aDomain['smtp_auth'] : true; $sWhiteList = (string) (isset($aDomain['white_list']) ? $aDomain['white_list'] : ''); @@ -168,8 +148,8 @@ class Domain $bOutShortLogin = isset($aDomain['smtp_short_login']) ? (bool) $aDomain['smtp_short_login'] : false; $oDomain = self::NewInstance($sName, - $sIncHost, $iIncPort, $iIncSecure, $bIncVerifySsl, $bIncShortLogin, - $sOutHost, $iOutPort, $iOutSecure, $bOutVerifySsl, $bOutShortLogin, $bOutAuth, + $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList); } @@ -213,12 +193,10 @@ class Domain 'imap_host = "'.$this->encodeIniString($this->sIncHost).'"', 'imap_port = '.$this->iIncPort, 'imap_secure = "'.self::ConstConnectionSecurityTypeToStr($this->iIncSecure).'"', - 'imap_verify_ssl = '.($this->bIncVerifySsl ? 'On' : 'Off'), 'imap_short_login = '.($this->bIncShortLogin ? 'On' : 'Off'), 'smtp_host = "'.$this->encodeIniString($this->sOutHost).'"', 'smtp_port = '.$this->iOutPort, 'smtp_secure = "'.self::ConstConnectionSecurityTypeToStr($this->iOutSecure).'"', - 'smtp_verify_ssl = '.($this->bOutVerifySsl ? 'On' : 'Off'), 'smtp_short_login = '.($this->bOutShortLogin ? 'On' : 'Off'), 'smtp_auth = '.($this->bOutAuth ? 'On' : 'Off'), 'white_list = "'.$this->encodeIniString($this->sWhiteList).'"' @@ -270,32 +248,28 @@ class Domain * @param string $sIncHost * @param int $iIncPort * @param int $iIncSecure - * @param bool $bIncVerifySsl * @param bool $bIncShortLogin * @param string $sOutHost * @param int $iOutPort * @param int $iOutSecure - * @param bool $bOutVerifySsl * @param bool $bOutShortLogin * @param bool $bOutAuth * @param string $sWhiteList = '' * - * @return \RainLoop\Domain + * @return \RainLoop\Model\Domain */ public function UpdateInstance( - $sIncHost, $iIncPort, $iIncSecure, $bIncVerifySsl, $bIncShortLogin, - $sOutHost, $iOutPort, $iOutSecure, $bOutVerifySsl, $bOutShortLogin, $bOutAuth, + $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList = '') { $this->sIncHost = \MailSo\Base\Utils::IdnToAscii($sIncHost); $this->iIncPort = $iIncPort; $this->iIncSecure = $iIncSecure; - $this->bIncVerifySsl = !!$bIncVerifySsl; $this->bIncShortLogin = $bIncShortLogin; $this->sOutHost = \MailSo\Base\Utils::IdnToAscii($sOutHost); $this->iOutPort = $iOutPort; $this->iOutSecure = $iOutSecure; - $this->bOutVerifySsl = !!$bOutVerifySsl; $this->bOutShortLogin = $bOutShortLogin; $this->bOutAuth = $bOutAuth; $this->sWhiteList = \trim($sWhiteList); @@ -312,13 +286,11 @@ class Domain } /** - * @param string $sRealDomainName = '' - * * @return string */ - public function IncHost($sRealDomainName = '') + public function IncHost() { - return 0 < \strlen($sRealDomainName) ? \str_replace('{domain:name}', $sRealDomainName, $this->sIncHost) : $this->sIncHost; + return $this->sIncHost; } /** @@ -337,16 +309,6 @@ class Domain return $this->iIncSecure; } - /** - * @param bool|null $bGlobalVerify = null - * - * @return bool - */ - public function IncVerifySsl($bGlobalVerify = null) - { - return null === $bGlobalVerify ? $this->bIncVerifySsl : !!$bGlobalVerify; - } - /** * @return bool */ @@ -356,12 +318,11 @@ class Domain } /** - * @param string $sRealDomainName = '' * @return string */ - public function OutHost($sRealDomainName = '') + public function OutHost() { - return 0 < \strlen($sRealDomainName) ? \str_replace('{domain:name}', $sRealDomainName, $this->sOutHost) : $this->sOutHost; + return $this->sOutHost; } /** @@ -450,12 +411,10 @@ class Domain 'IncHost' => $bAjax ? \MailSo\Base\Utils::IdnToUtf8($this->IncHost()) : $this->IncHost(), 'IncPort' => $this->IncPort(), 'IncSecure' => $this->IncSecure(), - 'IncVerifySsl' => $this->IncVerifySsl(), 'IncShortLogin' => $this->IncShortLogin(), 'OutHost' => $bAjax ? \MailSo\Base\Utils::IdnToUtf8($this->OutHost()) : $this->OutHost(), 'OutPort' => $this->OutPort(), 'OutSecure' => $this->OutSecure(), - 'OutVerifySsl' => $this->OutVerifySsl(), 'OutShortLogin' => $this->OutShortLogin(), 'OutAuth' => $this->OutAuth(), 'WhiteList' => $this->WhiteList() diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Identity.php b/rainloop/v/0.0.0/app/src/RainLoop/Model/Identity.php similarity index 90% rename from rainloop/v/0.0.0/app/src/RainLoop/Identity.php rename to rainloop/v/0.0.0/app/src/RainLoop/Model/Identity.php index d591a1505..f658660c1 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Identity.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Model/Identity.php @@ -1,6 +1,6 @@ sId = $sId; - + return $this; } @@ -92,7 +92,7 @@ class Identity /** * @param string $sEmail * - * @return \RainLoop\Identity + * @return \RainLoop\Model\Identity */ public function SetEmail($sEmail) { @@ -112,7 +112,7 @@ class Identity /** * @param string $sName * - * @return \RainLoop\Identity + * @return \RainLoop\Model\Identity */ public function SetName($sName) { @@ -132,7 +132,7 @@ class Identity /** * @param string $sReplyTo * - * @return \RainLoop\Identity + * @return \RainLoop\Model\Identity */ public function SetReplyTo($sReplyTo) { @@ -152,7 +152,7 @@ class Identity /** * @param string $sBcc * - * @return \RainLoop\Identity + * @return \RainLoop\Model\Identity */ public function SetBcc($sBcc) { @@ -163,7 +163,7 @@ class Identity /** * @param bool $bAjax = false - * + * * @return array */ public function ToSimpleJSON($bAjax = false) diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain.php b/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain.php index 40ad0657e..79d4d4b95 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain.php @@ -45,12 +45,12 @@ class Domain extends \RainLoop\Providers\AbstractProvider * @param bool $bFindWithWildCard = false * @param bool $bCheckDisabled = true * - * @return \RainLoop\Domain|null + * @return \RainLoop\Model\Domain|null */ public function Load($sName, $bFindWithWildCard = false, $bCheckDisabled = true) { $oDomain = $this->oDriver->Load($sName, $bFindWithWildCard, $bCheckDisabled); - if ($oDomain instanceof \RainLoop\Domain) + if ($oDomain instanceof \RainLoop\Model\Domain) { $this->oPlugins->RunHook('filter.domain', array(&$oDomain)); } @@ -59,11 +59,11 @@ class Domain extends \RainLoop\Providers\AbstractProvider } /** - * @param \RainLoop\Domain $oDomain + * @param \RainLoop\Model\Domain $oDomain * * @return bool */ - public function Save(\RainLoop\Domain $oDomain) + public function Save(\RainLoop\Model\Domain $oDomain) { return $this->bAdmin ? $this->oDriver->Save($oDomain) : false; } @@ -115,7 +115,7 @@ class Domain extends \RainLoop\Providers\AbstractProvider * @param \RainLoop\Actions $oActions * @param string $sNameForTest = '' * - * @return \RainLoop\Domain | null + * @return \RainLoop\Model\Domain | null */ public function LoadOrCreateNewFromAction(\RainLoop\Actions $oActions, $sNameForTest = '') { @@ -128,12 +128,10 @@ class Domain extends \RainLoop\Providers\AbstractProvider $sIncHost = (string) $oActions->GetActionParam('IncHost', ''); $iIncPort = (int) $oActions->GetActionParam('IncPort', 143); $iIncSecure = (int) $oActions->GetActionParam('IncSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); - $bIncVerifySsl = '1' === (string) $oActions->GetActionParam('IncVerifySsl', '0'); $bIncShortLogin = '1' === (string) $oActions->GetActionParam('IncShortLogin', '0'); $sOutHost = (string) $oActions->GetActionParam('OutHost', ''); $iOutPort = (int) $oActions->GetActionParam('OutPort', 25); $iOutSecure = (int) $oActions->GetActionParam('OutSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE); - $bOutVerifySsl = '1' === (string) $oActions->GetActionParam('OutVerifySsl', '0'); $bOutShortLogin = '1' === (string) $oActions->GetActionParam('OutShortLogin', '0'); $bOutAuth = '1' === (string) $oActions->GetActionParam('OutAuth', '1'); $sWhiteList = (string) $oActions->GetActionParam('WhiteList', ''); @@ -146,7 +144,7 @@ class Domain extends \RainLoop\Providers\AbstractProvider if (0 < strlen($sName) || 0 < strlen($sNameForTest)) { $oDomain = 0 < strlen($sNameForTest) ? null : $this->Load($sName); - if ($oDomain instanceof \RainLoop\Domain) + if ($oDomain instanceof \RainLoop\Model\Domain) { if ($bCreate) { @@ -155,16 +153,16 @@ class Domain extends \RainLoop\Providers\AbstractProvider else { $oDomain->UpdateInstance( - $sIncHost, $iIncPort, $iIncSecure, $bIncVerifySsl, $bIncShortLogin, - $sOutHost, $iOutPort, $iOutSecure, $bOutVerifySsl, $bOutShortLogin, $bOutAuth, + $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList); } } else { - $oDomain = \RainLoop\Domain::NewInstance(0 < strlen($sNameForTest) ? $sNameForTest : $sName, - $sIncHost, $iIncPort, $iIncSecure, $bIncVerifySsl, $bIncShortLogin, - $sOutHost, $iOutPort, $iOutSecure, $bOutVerifySsl, $bOutShortLogin, $bOutAuth, + $oDomain = \RainLoop\Model\Domain::NewInstance(0 < strlen($sNameForTest) ? $sNameForTest : $sName, + $sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, + $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList); } } diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain/DefaultDomain.php b/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain/DefaultDomain.php index 57c69e3d5..e23a3eed1 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain/DefaultDomain.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain/DefaultDomain.php @@ -147,7 +147,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface * @param bool $bFindWithWildCard = false * @param bool $bCheckDisabled = true * - * @return \RainLoop\Domain|null + * @return \RainLoop\Model\Domain|null */ public function Load($sName, $bFindWithWildCard = false, $bCheckDisabled = true) { @@ -155,14 +155,14 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface $sDisabled = ''; $sFoundedValue = ''; - + $sRealFileName = $this->codeFileName($sName); if (\file_exists($this->sDomainPath.'/disabled')) { $sDisabled = @\file_get_contents($this->sDomainPath.'/disabled'); } - + if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini') && (!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(','.$sDisabled.',', ','.\MailSo\Base\Utils::IdnToAscii($sName, true).','))) { @@ -192,7 +192,7 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface } //--- - $mResult = \RainLoop\Domain::NewInstanceFromDomainConfigArray($sName, $aDomain); + $mResult = \RainLoop\Model\Domain::NewInstanceFromDomainConfigArray($sName, $aDomain); } else if ($bFindWithWildCard) { @@ -214,11 +214,11 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface } /** - * @param \RainLoop\Domain $oDomain + * @param \RainLoop\Model\Domain $oDomain * * @return bool */ - public function Save(\RainLoop\Domain $oDomain) + public function Save(\RainLoop\Model\Domain $oDomain) { $sRealFileName = $this->codeFileName($oDomain->Name()); diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain/DomainAdminInterface.php b/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain/DomainAdminInterface.php index d1ed98d48..c33ba664a 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain/DomainAdminInterface.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Providers/Domain/DomainAdminInterface.php @@ -18,16 +18,16 @@ interface DomainAdminInterface extends DomainInterface * @param bool $bFindWithWildCard = false * @param bool $bCheckDisabled = true * - * @return \RainLoop\Domain|null + * @return \RainLoop\Model\Domain|null */ public function Load($sName, $bFindWithWildCard = false, $bCheckDisabled = true); /** - * @param \RainLoop\Domain $oDomain + * @param \RainLoop\Model\Domain $oDomain * * @return bool */ - public function Save(\RainLoop\Domain $oDomain); + public function Save(\RainLoop\Model\Domain $oDomain); /** * @param string $sName diff --git a/rainloop/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html b/rainloop/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html index 140f2cb43..7bca9c6e5 100644 --- a/rainloop/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html +++ b/rainloop/v/0.0.0/app/templates/Views/Admin/PopupsDomain.html @@ -6,16 +6,16 @@