From b01f298b7b80b90e466fb8bbc73d130f8da0bd0a Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Sun, 15 Feb 2015 04:30:21 +0400 Subject: [PATCH] Release commit --- build/owncloud/rainloop-app/appinfo/app.php | 3 +- .../rainloop-app/lib/RainLoopHelper.php | 18 ++++++- dev/Common/Globals.js | 4 ++ dev/External/ko.js | 14 +++++- dev/Styles/Animations.less | 6 ++- dev/View/Popup/Compose.js | 8 ++++ package.json | 2 +- .../0.0.0/app/libraries/MailSo/Base/Utils.php | 2 +- .../0.0.0/app/libraries/RainLoop/Actions.php | 42 +++++++++++----- .../app/libraries/RainLoop/KeyPathHelper.php | 10 ++++ .../app/libraries/RainLoop/Model/Domain.php | 4 +- .../Suggestions/OwnCloudSuggestions.php | 48 ++++++++++--------- .../app/libraries/RainLoop/ServiceActions.php | 2 +- 13 files changed, 121 insertions(+), 42 deletions(-) diff --git a/build/owncloud/rainloop-app/appinfo/app.php b/build/owncloud/rainloop-app/appinfo/app.php index 48dc5ab3d..99ea4de8a 100644 --- a/build/owncloud/rainloop-app/appinfo/app.php +++ b/build/owncloud/rainloop-app/appinfo/app.php @@ -17,10 +17,11 @@ OCP\App::registerPersonal('rainloop', 'personal'); if (OCP\Config::getAppValue('rainloop', 'rainloop-autologin', false)) { OCP\Util::connectHook('OC_User', 'post_login', 'OC_RainLoop_Helper', 'login'); - OCP\Util::connectHook('OC_User', 'logout', 'OC_RainLoop_Helper', 'logout'); OCP\Util::connectHook('OC_User', 'post_setPassword', 'OC_RainLoop_Helper', 'changePassword'); } +OCP\Util::connectHook('OC_User', 'logout', 'OC_RainLoop_Helper', 'logout'); + OCP\Util::addScript('rainloop', 'rainloop'); OCP\App::addNavigationEntry(array( diff --git a/build/owncloud/rainloop-app/lib/RainLoopHelper.php b/build/owncloud/rainloop-app/lib/RainLoopHelper.php index 78bdee728..729caf397 100644 --- a/build/owncloud/rainloop-app/lib/RainLoopHelper.php +++ b/build/owncloud/rainloop-app/lib/RainLoopHelper.php @@ -110,8 +110,24 @@ class OC_RainLoop_Helper public static function logout() { - return OCP\Config::setUserValue( + OCP\Config::setUserValue( OCP\User::getUser(), 'rainloop', 'rainloop-autologin-password', ''); + + $sApiPath = __DIR__.'/../app/index.php'; + if (file_exists($sApiPath)) + { + self::regRainLoopDataFunction(); + + $_ENV['RAINLOOP_INCLUDE_AS_API'] = true; + include $sApiPath; + + if (class_exists('\\RainLoop\\Api')) + { + \RainLoop\Api::LogoutCurrentLogginedUser(); + } + } + + return true; } public static function changePassword($aParams) diff --git a/dev/Common/Globals.js b/dev/Common/Globals.js index 71ada0360..76bf8559f 100644 --- a/dev/Common/Globals.js +++ b/dev/Common/Globals.js @@ -203,6 +203,10 @@ return 0 < Globals.popupVisibilityNames().length; }, this); + Globals.popupVisibility.subscribe(function (bValue) { + Globals.$html.toggleClass('rl-modal', bValue); + }); + // keys Globals.keyScopeReal = ko.observable(Enums.KeyState.All); Globals.keyScopeFake = ko.observable(Enums.KeyState.All); diff --git a/dev/External/ko.js b/dev/External/ko.js index 84a9783f8..637963178 100644 --- a/dev/External/ko.js +++ b/dev/External/ko.js @@ -287,7 +287,19 @@ }); }, 'update': function (oElement, fValueAccessor) { - $(oElement).modal(ko.unwrap(fValueAccessor()) ? 'show' : 'hide'); + + var Globals = require('Common/Globals'); + + $(oElement).modal(!!ko.unwrap(fValueAccessor()) ? 'show' : 'hide'); + + if (Globals.$html.hasClass('rl-anim')) + { + Globals.$html.addClass('rl-modal-animation'); + _.delay(function () { + Globals.$html.removeClass('rl-modal-animation'); + }, 400); + } + } }; diff --git a/dev/Styles/Animations.less b/dev/Styles/Animations.less index ba3272bb5..353a5fa68 100644 --- a/dev/Styles/Animations.less +++ b/dev/Styles/Animations.less @@ -101,10 +101,14 @@ html.rl-started-trigger.no-mobile .b-login-content .loginFormWrapper { } } + &.csstransitions.rl-modal.rl-modal-animation .popups { + overflow: hidden; + } + &.csstransitions .modal.fade { .transition(all 200ms ease-out); - transform: scale(1.1); + transform: scale(0.95); &.in { transform: none; diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index aa824b90d..72662ef45 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -1308,6 +1308,7 @@ }); Events.sub('window.resize.real', this.resizerTrigger); + Events.sub('window.resize.real', _.debounce(this.resizerTrigger, 50)); if (this.dropboxEnabled()) { @@ -1328,6 +1329,13 @@ } }); } + + window.setInterval(function () { + if (self.modalVisibility() && self.oEditor) + { + self.oEditor.resize(); + } + }, 5000); }; ComposePopupView.prototype.driveCallback = function (sAccessToken, oData) diff --git a/package.json b/package.json index 90e8cb481..613447947 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "RainLoop", "title": "RainLoop Webmail", "version": "1.8.1", - "release": "255", + "release": "258", "description": "Simple, modern & fast web-based email client", "homepage": "http://rainloop.net", "main": "gulpfile.js", diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Base/Utils.php b/rainloop/v/0.0.0/app/libraries/MailSo/Base/Utils.php index 7e13d15bf..edf5cd91d 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Base/Utils.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Base/Utils.php @@ -831,7 +831,7 @@ class Utils public static function GetFileExtension($sFileName) { $iLast = \strrpos($sFileName, '.'); - return false === $iLast ? '' : \substr($sFileName, $iLast + 1); + return false === $iLast ? '' : \strtolower(\substr($sFileName, $iLast + 1)); } /** diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 94db128de..8367cd599 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -617,6 +617,15 @@ class Actions */ public function ClearAdminAuthToken() { + $aAdminHash = \RainLoop\Utils::DecodeKeyValues($this->getAdminAuthToken()); + if ( + !empty($aAdminHash[0]) && !empty($aAdminHash[1]) && !empty($aAdminHash[2]) && + 'token' === $aAdminHash[0] && \md5(APP_SALT) === $aAdminHash[1] + ) + { + $this->Cacher()->Delete(\RainLoop\KeyPathHelper::SessionAdminKey($aAdminHash[2])); + } + \RainLoop\Utils::ClearCookie(self::AUTH_ADMIN_TOKEN_KEY); } @@ -997,11 +1006,17 @@ class Actions } /** - * @return array + * @return string */ private function getAdminToken() { - return \RainLoop\Utils::EncodeKeyValues(array('token', \md5(APP_SALT))); + $sRand = \MailSo\Base\Utils::Md5Rand(); + if (!$this->Cacher()->Set(\RainLoop\KeyPathHelper::SessionAdminKey($sRand), \time())) + { + $sRand = ''; + } + + return '' === $sRand ? '' : \RainLoop\Utils::EncodeKeyValues(array('token', \md5(APP_SALT), $sRand)); } /** @@ -1015,8 +1030,10 @@ class Actions if ($this->Config()->Get('security', 'allow_admin_panel', true)) { $aAdminHash = \RainLoop\Utils::DecodeKeyValues($this->getAdminAuthToken()); - if ((!empty($aAdminHash[0]) && !empty($aAdminHash[1]) && - 'token' === $aAdminHash[0] && \md5(APP_SALT) === $aAdminHash[1])) + if (!empty($aAdminHash[0]) && !empty($aAdminHash[1]) && !empty($aAdminHash[2]) && + 'token' === $aAdminHash[0] && \md5(APP_SALT) === $aAdminHash[1] && + '' !== $this->Cacher()->Get(\RainLoop\KeyPathHelper::SessionAdminKey($aAdminHash[2]), '') + ) { $bResult = true; } @@ -1119,7 +1136,7 @@ class Actions if (!empty($aAccountHash[8]) && !empty($aAccountHash[9])) // init proxy user/password { $oAccount->SetProxyAuthUser($aAccountHash[8]); - $oAccount->SetProxyAuthUser($aAccountHash[89]); + $oAccount->SetProxyAuthPassword($aAccountHash[9]); } $this->Logger()->AddSecret($oAccount->Password()); @@ -2895,14 +2912,17 @@ class Actions public function DoLogout() { $oAccount = $this->getAccountFromToken(false); - if ($oAccount && $oAccount->SignMe()) + if ($oAccount) { - $this->ClearSignMeData($oAccount); - } + if ($oAccount->SignMe()) + { + $this->ClearSignMeData($oAccount); + } - if ($oAccount && '' === $oAccount->ParentEmail()) - { - \RainLoop\Utils::ClearCookie(\RainLoop\Actions::AUTH_SPEC_TOKEN_KEY); + if (!$oAccount->IsAdditionalAccount()) + { + \RainLoop\Utils::ClearCookie(\RainLoop\Actions::AUTH_SPEC_TOKEN_KEY); + } } return $this->TrueResponse(__FUNCTION__); diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/KeyPathHelper.php b/rainloop/v/0.0.0/app/libraries/RainLoop/KeyPathHelper.php index f292d4dba..f3e7529f4 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/KeyPathHelper.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/KeyPathHelper.php @@ -130,4 +130,14 @@ class KeyPathHelper { return '/CssCache/'.$sHash.'/'.$sTheme.'/'.APP_VERSION.'/'; } + + /** + * @param string $sRand + * + * @return string + */ + static public function SessionAdminKey($sRand) + { + return '/Session/AdminKey/'.\md5($sRand).'/'; + } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Model/Domain.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Model/Domain.php index 56cf7b4b1..5ba397ce9 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Model/Domain.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Model/Domain.php @@ -522,13 +522,13 @@ class Domain if (0 < strlen($sW)) { $sEmail = \MailSo\Base\Utils::IdnToUtf8($sEmail, true); - $sLogin = \MailSo\Base\Utils::IdnToUtf8($sLogin); + $sLogin = \MailSo\Base\Utils::IdnToUtf8($sLogin, true); $sW = \preg_replace('/([^\s]+)@[^\s]*/', '$1', $sW); $sW = ' '.\trim(\preg_replace('/[\s;,\r\n\t]+/', ' ', $sW)).' '; $sUserPart = \MailSo\Base\Utils::GetAccountNameFromEmail(0 < \strlen($sLogin) ? $sLogin : $sEmail); - return false !== \strpos($sW, ' '.$sUserPart.' '); + return false !== \stripos($sW, ' '.$sUserPart.' '); } return true; diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/OwnCloudSuggestions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/OwnCloudSuggestions.php index c9e8d7ff4..a716058b1 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/OwnCloudSuggestions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/OwnCloudSuggestions.php @@ -23,46 +23,50 @@ class OwnCloudSuggestions implements \RainLoop\Providers\Suggestions\ISuggestion try { if (!$oAccount || !\RainLoop\Utils::IsOwnCloud() || - !\class_exists('\\OCP\\Contacts') || !\OCP\Contacts::isEnabled()) + !\class_exists('\\OCP\\Contacts') || !\OCP\Contacts::isEnabled() || + !\class_exists('\\OCP\\User') || !\OCP\User::isLoggedIn() + ) { return $aResult; } $aSearchResult = \OCP\Contacts::search($sQuery, array('FN', 'EMAIL')); - - foreach ($aSearchResult as $aContact) + if (\is_array($aSearchResult) && 0 < \count($aSearchResult)) { - if (0 >= $iLimit) + foreach ($aSearchResult as $aContact) { - break; - } - - $sUid = empty($aContact['UID']) ? '' : $aContact['UID']; - if (!empty($sUid)) - { - $sFullName = isset($aContact['FN']) ? \trim($aContact['FN']) : ''; - $mEmails = isset($aContact['EMAIL']) ? $aContact['EMAIL'] : ''; - - if (!\is_array($mEmails)) + if (0 >= $iLimit) { - $mEmails = array($mEmails); + break; } - foreach ($mEmails as $sEmail) + $sUid = empty($aContact['UID']) ? '' : $aContact['UID']; + if (!empty($sUid)) { - $sEmail = \trim($sEmail); - if (!empty($sEmail)) + $sFullName = isset($aContact['FN']) ? \trim($aContact['FN']) : ''; + $mEmails = isset($aContact['EMAIL']) ? $aContact['EMAIL'] : ''; + + if (!\is_array($mEmails)) { - $iLimit--; - $aResult[$sUid] = array($sEmail, $sFullName); + $mEmails = array($mEmails); + } + + foreach ($mEmails as $sEmail) + { + $sEmail = \trim($sEmail); + if (!empty($sEmail)) + { + $iLimit--; + $aResult[$sUid] = array($sEmail, $sFullName); + } } } } + + $aResult = \array_values($aResult); } unset($aSearchResult); - - $aResult = \array_values($aResult); } catch (\Exception $oException) { diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php index a894b507a..f99c2be79 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -1121,7 +1121,7 @@ class ServiceActions private function localError($sTitle, $sDesc) { @header('Content-Type: text/html; charset=utf-8'); - return $this->oActions->ErrorTemplates($sTitle, \nl2br($sDesc)); + return $this->ErrorTemplates($sTitle, \nl2br($sDesc)); } /**