From 844afadd6f40e4e0390f400a827bdcdcd17c6f9c Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Thu, 12 Feb 2015 21:54:12 +0400 Subject: [PATCH] ckeditor fixes demo-plugin TemproryApcStorage --- dev/Common/HtmlEditor.js | 63 +- dev/Stores/User/Notification.js | 14 +- dev/Styles/Admin.less | 4 + dev/Styles/Identity.less | 2 +- dev/Styles/Settings.less | 4 + dev/Styles/SettingsThemes.less | 71 +- plugins/demo-account/VERSION | 1 + plugins/demo-account/index.php | 126 +++ .../libraries/MailSo/Cache/Drivers/File.php | 13 +- .../0.0.0/app/libraries/RainLoop/Actions.php | 20 +- .../Providers/AddressBook/PdoAddressBook.php | 10 +- .../libraries/RainLoop/Providers/Files.php | 6 +- .../{DefaultStorage.php => FileStorage.php} | 2 +- .../Files/{FilesInterface.php => IFiles.php} | 2 +- .../libraries/RainLoop/Providers/Settings.php | 8 +- .../Providers/Settings/DefaultSettings.php | 2 +- .../{SettingsInterface.php => ISettings.php} | 2 +- .../libraries/RainLoop/Providers/Storage.php | 8 +- .../{DefaultStorage.php => FileStorage.php} | 18 +- .../{StorageInterface.php => IStorage.php} | 2 +- .../Providers/Storage/TemproryApcStorage.php | 78 ++ .../RainLoop/Providers/Suggestions.php | 6 +- ...gestionsInterface.php => ISuggestions.php} | 2 +- .../Suggestions/OwnCloudSuggestions.php | 4 +- .../Providers/Suggestions/TestSuggestions.php | 2 +- .../0.0.0/app/libraries/RainLoop/Service.php | 12 +- .../Views/Admin/AdminSettingsLicensing.html | 10 +- .../Views/Admin/AdminSettingsSocial.html | 2 +- .../Views/User/SettingsAccounts.html | 21 +- .../templates/Views/User/SystemDropDown.html | 8 +- rainloop/v/0.0.0/include.php | 2 +- rainloop/v/0.0.0/langs/en.ini | 3 +- rainloop/v/0.0.0/static/ckeditor/CUSTOMS | 10 + rainloop/v/0.0.0/static/ckeditor/ckeditor.js | 10 +- .../v/0.0.0/static/ckeditor/ckeditor.orig.js | 964 ++++++++++++++++++ .../ckeditor/plugins/signature/plugin.js | 36 +- vendors/ckeditor-plugins/signature/plugin.js | 36 +- vendors/ckeditor/CUSTOMS | 10 + vendors/ckeditor/ckeditor.js | 10 +- vendors/ckeditor/ckeditor.orig.js | 964 ++++++++++++++++++ 40 files changed, 2371 insertions(+), 197 deletions(-) create mode 100644 plugins/demo-account/VERSION create mode 100644 plugins/demo-account/index.php rename rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/{DefaultStorage.php => FileStorage.php} (98%) rename rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/{FilesInterface.php => IFiles.php} (98%) rename rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/{SettingsInterface.php => ISettings.php} (93%) rename rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/{DefaultStorage.php => FileStorage.php} (91%) rename rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/{StorageInterface.php => IStorage.php} (96%) create mode 100644 rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/TemproryApcStorage.php rename rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/{SuggestionsInterface.php => ISuggestions.php} (88%) create mode 100644 rainloop/v/0.0.0/static/ckeditor/CUSTOMS create mode 100644 rainloop/v/0.0.0/static/ckeditor/ckeditor.orig.js create mode 100644 vendors/ckeditor/CUSTOMS create mode 100644 vendors/ckeditor/ckeditor.orig.js diff --git a/dev/Common/HtmlEditor.js b/dev/Common/HtmlEditor.js index b039de237..8558ce6d3 100644 --- a/dev/Common/HtmlEditor.js +++ b/dev/Common/HtmlEditor.js @@ -101,16 +101,7 @@ */ HtmlEditor.prototype.clearSignatureSigns = function (sText) { - return sText - .replace("\u0002", '').replace("\u0002", '') - .replace("\u0002", '').replace("\u0002", '') - .replace("\u0003", '').replace("\u0003", '') - .replace("\u0003", '').replace("\u0003", '') - .replace("\u0004", '').replace("\u0004", '') - .replace("\u0004", '').replace("\u0004", '') - .replace("\u0005", '').replace("\u0005", '') - .replace("\u0005", '').replace("\u0005", '') - ; + return sText.replace(/(\u0002|\u0003|\u0004|\u0005)/g, ''); }; /** @@ -123,16 +114,20 @@ var sResult = ''; if (this.editor) { - if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain) + try { - sResult = this.editor.__plain.getRawData(); - } - else - { - sResult = bWrapIsHtml ? - '
' + - this.editor.getData() + '
' : this.editor.getData(); + if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain) + { + sResult = this.editor.__plain.getRawData(); + } + else + { + sResult = bWrapIsHtml ? + '
' + + this.editor.getData() + '
' : this.editor.getData(); + } } + catch (e) {} if (bClearSignatureSigns) { @@ -147,20 +142,22 @@ { if (this.editor) { - if (bPlain) - { - if ('plain' === this.editor.mode) + try { + if (bPlain) { - this.editor.setMode('wysiwyg'); + if ('plain' === this.editor.mode) + { + this.editor.setMode('wysiwyg'); + } } - } - else - { - if ('wysiwyg' === this.editor.mode) + else { - this.editor.setMode('plain'); + if ('wysiwyg' === this.editor.mode) + { + this.editor.setMode('plain'); + } } - } + } catch(e) {} this.resize(); } @@ -319,7 +316,9 @@ { if (this.editor) { - this.editor.focusManager.blur(true); + try { + this.editor.focusManager.blur(true); + } catch (e) {} } }; @@ -327,11 +326,9 @@ { if (this.editor && this.__resizable) { - try - { + try { this.editor.resize(this.$element.width(), this.$element.innerHeight()); - } - catch (e) {} + } catch (e) {} } }; diff --git a/dev/Stores/User/Notification.js b/dev/Stores/User/Notification.js index b16f1dbe7..4b10981d9 100644 --- a/dev/Stores/User/Notification.js +++ b/dev/Stores/User/Notification.js @@ -28,7 +28,7 @@ this.allowDesktopNotification = ko.observable(false); - this.desktopNotificationPermisions = ko.computed(function () { + this.desktopNotificationPermissions = ko.computed(function () { this.allowDesktopNotification(); @@ -65,14 +65,14 @@ 'owner': this, 'read': function () { return this.allowDesktopNotification() && - Enums.DesktopNotification.Allowed === this.desktopNotificationPermisions(); + Enums.DesktopNotification.Allowed === this.desktopNotificationPermissions(); }, 'write': function (bValue) { if (bValue) { var NotificationClass = this.notificationClass(), - iPermission = this.desktopNotificationPermisions() + iPermission = this.desktopNotificationPermissions() ; if (NotificationClass && Enums.DesktopNotification.Allowed === iPermission) @@ -83,7 +83,7 @@ { NotificationClass.requestPermission(function () { self.allowDesktopNotification.valueHasMutated(); - if (Enums.DesktopNotification.Allowed === self.desktopNotificationPermisions()) + if (Enums.DesktopNotification.Allowed === self.desktopNotificationPermissions()) { if (self.allowDesktopNotification()) { @@ -134,12 +134,12 @@ NotificationUserStore.prototype.computedProperies = function () { this.isDesktopNotificationSupported = ko.computed(function () { - return Enums.DesktopNotification.NotSupported !== this.desktopNotificationPermisions(); + return Enums.DesktopNotification.NotSupported !== this.desktopNotificationPermissions(); }, this); this.isDesktopNotificationDenied = ko.computed(function () { - return Enums.DesktopNotification.NotSupported === this.desktopNotificationPermisions() || - Enums.DesktopNotification.Denied === this.desktopNotificationPermisions(); + return Enums.DesktopNotification.NotSupported === this.desktopNotificationPermissions() || + Enums.DesktopNotification.Denied === this.desktopNotificationPermissions(); }, this); }; diff --git a/dev/Styles/Admin.less b/dev/Styles/Admin.less index b27699559..d2eb87986 100644 --- a/dev/Styles/Admin.less +++ b/dev/Styles/Admin.less @@ -99,5 +99,9 @@ .b-settings-content { padding: 20px; padding-left: 30px; + + .legend { + width: 670px; + } } } diff --git a/dev/Styles/Identity.less b/dev/Styles/Identity.less index 422f59fac..325f46864 100644 --- a/dev/Styles/Identity.less +++ b/dev/Styles/Identity.less @@ -22,7 +22,7 @@ } .e-signature-place { - height: 300px; + height: 200px; } .textEmail { diff --git a/dev/Styles/Settings.less b/dev/Styles/Settings.less index 574d65596..f819129f7 100644 --- a/dev/Styles/Settings.less +++ b/dev/Styles/Settings.less @@ -106,5 +106,9 @@ .b-settings-content { padding: 20px; padding-left: 30px; + + .legend { + width: 600px; + } } } diff --git a/dev/Styles/SettingsThemes.less b/dev/Styles/SettingsThemes.less index 415059ae6..33310d449 100644 --- a/dev/Styles/SettingsThemes.less +++ b/dev/Styles/SettingsThemes.less @@ -1,33 +1,38 @@ - -.b-settings-themes { -} - -.b-themes-list { - - .e-item { - - display: inline-block; - border: 2px solid transparent; - cursor: pointer; - - color: #000; - background-color: #fff; - padding: 16px; - margin: 5px; - - &:hover { - border: 2px solid grey; - } - - &.selected { - background-color: #eee; - border: 2px solid #000; - } - - .e-image { - width: 100px; - height: 100px; - border: 1px solid #ddd; - } - } -} + +.b-settings-content { + .b-settings-themes { + .legend { + width: 100%; + } + } +} + +.b-themes-list { + + .e-item { + + display: inline-block; + border: 2px solid transparent; + cursor: pointer; + + color: #000; + background-color: #fff; + padding: 16px; + margin: 5px; + + &:hover { + border: 2px solid grey; + } + + &.selected { + background-color: #eee; + border: 2px solid #000; + } + + .e-image { + width: 100px; + height: 100px; + border: 1px solid #ddd; + } + } +} diff --git a/plugins/demo-account/VERSION b/plugins/demo-account/VERSION new file mode 100644 index 000000000..9f8e9b69a --- /dev/null +++ b/plugins/demo-account/VERSION @@ -0,0 +1 @@ +1.0 \ No newline at end of file diff --git a/plugins/demo-account/index.php b/plugins/demo-account/index.php new file mode 100644 index 000000000..5da1f9c44 --- /dev/null +++ b/plugins/demo-account/index.php @@ -0,0 +1,126 @@ +addHook('filter.app-data', 'FilterAppData'); + $this->addHook('filter.action-params', 'FilterActionParams'); + $this->addHook('ajax.action-pre-call', 'AjaxActionPreCall'); + $this->addHook('filter.send-message', 'FilterSendMessage'); + $this->addHook('main.fabrica[2]', 'MainFabrica'); + } + + /** + * @return array + */ + protected function configMapping() + { + return array( + \RainLoop\Plugins\Property::NewInstance('email')->SetLabel('Demo Email') + ->SetDefaultValue('demo@domain.com'), + \RainLoop\Plugins\Property::NewInstance('password')->SetLabel('Demo Password') + ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD) + ); + } + + /** + * @return void + */ + public function FilterAppData($bAdmin, &$aResult) + { + if (!$bAdmin && \is_array($aResult) && isset($aResult['Auth']) && !$aResult['Auth']) + { + $aResult['DevEmail'] = $this->Config()->Get('plugin', 'email', $aResult['DevEmail']); + $aResult['DevPassword'] = APP_DUMMY; + } + } + + /** + * @return void + */ + public function FilterActionParams($sMethodName, &$aActionParams) + { + if ('DoLogin' === $sMethodName && isset($aActionParams['Email']) && isset($aActionParams['Password'])) + { + if ($this->Config()->Get('plugin', 'email') === $aActionParams['Email']) + { + $aActionParams['Password'] = $this->Config()->Get('plugin', 'password'); + } + } + } + + /** + * @param \RainLoop\Model\Account $oAccount + * + * @return bool + */ + public function isDemoAccount($oAccount) + { + return ($oAccount && $oAccount->Email() === $this->Config()->Get('plugin', 'email')); + } + + public function AjaxActionPreCall($sAction) + { + if ('AccountSetup' === $sAction && + $this->isDemoAccount($this->Manager()->Actions()->GetAccount())) + { + throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DemoAccountError); + } + } + + public function FilterSendMessage(&$oMessage) + { + if ($oMessage && $this->isDemoAccount($this->Manager()->Actions()->GetAccount())) + { + $bError = true; + $oRcpt = $oMessage->GetRcpt(); + if ($oRcpt && 0 < $oRcpt->Count()) + { + $aRcpt =& $oRcpt->GetAsArray(); + if (0 < \count($aRcpt)) + { + $bError = false; + $sCheck = \strtolower(\trim($this->Config()->Get('plugin', 'email'))); + foreach ($aRcpt as /* @var $oEmail \MailSo\Mime\Email */ $oEmail) + { + if ($sCheck !== \strtolower(\trim($oEmail->GetEmail()))) + { + $bError = true; + } + } + } + } + + if ($bError) + { + throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DemoSendMessageError); + } + } + } + + /** + * @param string $sName + * @param mixed $oDriver + */ + public function MainFabrica($sName, &$oDriver, $oAccount) + { + switch ($sName) + { + case 'settings': + case 'settings-local': + if ($oAccount && \class_exists('\\RainLoop\\Providers\\Storage\\TemproryApcStorage') && + \function_exists('apc_store') && + $this->isDemoAccount($oAccount)) + { + $oDriver = new \RainLoop\Providers\Storage\TemproryApcStorage(APP_PRIVATE_DATA.'storage', + $sName === 'settings-local'); + } + break; + } + } +} + diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Cache/Drivers/File.php b/rainloop/v/0.0.0/app/libraries/MailSo/Cache/Drivers/File.php index 1ffdc55b1..ec12a2e00 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Cache/Drivers/File.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Cache/Drivers/File.php @@ -56,7 +56,8 @@ class File implements \MailSo\Cache\DriverInterface */ public function Set($sKey, $sValue) { - return false !== \file_put_contents($sPath = $this->generateCachedFileName($sKey, true), $sValue); + $sPath = $this->generateCachedFileName($sKey, true); + return '' === $sPath ? false : false !== \file_put_contents($sPath, $sValue); } /** @@ -68,7 +69,7 @@ class File implements \MailSo\Cache\DriverInterface { $sValue = ''; $sPath = $this->generateCachedFileName($sKey); - if (\file_exists($sPath)) + if ('' !== $sPath && \file_exists($sPath)) { $sValue = \file_get_contents($sPath); } @@ -84,7 +85,7 @@ class File implements \MailSo\Cache\DriverInterface public function Delete($sKey) { $sPath = $this->generateCachedFileName($sKey); - if (\file_exists($sPath)) + if ('' !== $sPath && \file_exists($sPath)) { \unlink($sPath); } @@ -92,7 +93,7 @@ class File implements \MailSo\Cache\DriverInterface /** * @param int $iTimeToClearInHours = 24 - * + * * @return bool */ public function GC($iTimeToClearInHours = 24) @@ -102,7 +103,7 @@ class File implements \MailSo\Cache\DriverInterface \MailSo\Base\Utils::RecTimeDirRemove($this->sCacheFolder, 60 * 60 * $iTimeToClearInHours, \time()); return true; } - + return false; } @@ -120,7 +121,7 @@ class File implements \MailSo\Cache\DriverInterface $sKeyPath = \sha1($sKey); $sKeyPath = \substr($sKeyPath, 0, 2).'/'.\substr($sKeyPath, 2, 2).'/'.$sKeyPath; - $sFilePath = $this->sCacheFolder.'/'.$sKeyPath; + $sFilePath = $this->sCacheFolder.$sKeyPath; if ($bMkDir && !\is_dir(\dirname($sFilePath))) { if (!\mkdir(\dirname($sFilePath), 0755, true)) 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 95baba11a..e7f941431 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -246,23 +246,23 @@ class Actions switch ($sName) { case 'files': - // RainLoop\Providers\Files\FilesInterface - $oResult = new \RainLoop\Providers\Files\DefaultStorage(APP_PRIVATE_DATA.'storage/files'); + // RainLoop\Providers\Files\IFiles + $oResult = new \RainLoop\Providers\Files\FileStorage(APP_PRIVATE_DATA.'storage/files'); break; case 'storage': - // RainLoop\Providers\Storage\StorageInterface - $oResult = new \RainLoop\Providers\Storage\DefaultStorage(APP_PRIVATE_DATA.'storage'); + // RainLoop\Providers\Storage\IStorage + $oResult = new \RainLoop\Providers\Storage\FileStorage(APP_PRIVATE_DATA.'storage'); break; case 'storage-local': - // RainLoop\Providers\Storage\StorageInterface - $oResult = new \RainLoop\Providers\Storage\DefaultStorage(APP_PRIVATE_DATA.'storage', true); + // RainLoop\Providers\Storage\IStorage + $oResult = new \RainLoop\Providers\Storage\FileStorage(APP_PRIVATE_DATA.'storage', true); break; case 'settings': - // RainLoop\Providers\Settings\SettingsInterface + // RainLoop\Providers\Settings\ISettings $oResult = new \RainLoop\Providers\Settings\DefaultSettings($this->StorageProvider()); break; case 'settings-local': - // RainLoop\Providers\Settings\SettingsInterface + // RainLoop\Providers\Settings\ISettings $oResult = new \RainLoop\Providers\Settings\DefaultSettings($this->StorageProvider(true)); break; case 'login': @@ -301,7 +301,7 @@ class Actions } break; case 'suggestions': - // \RainLoop\Providers\Suggestions\SuggestionsInterface + // \RainLoop\Providers\Suggestions\ISuggestions // $oResult = new \RainLoop\Providers\Suggestions\TestSuggestions(); if (\RainLoop\Utils::IsOwnCloud()) @@ -7721,7 +7721,7 @@ class Actions $self = $this; return $this->MailClient()->MessageMimeStream( function($rResource, $sContentType, $sFileName, $sMimeIndex = '') use ($self, $oAccount, $sRawKey, $sContentTypeIn, $sFileNameIn, $bDownload, $bThumbnail) { - if (\is_resource($rResource)) + if ($oAccount && \is_resource($rResource)) { $sContentTypeOut = $sContentTypeIn; if (empty($sContentTypeOut)) diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/AddressBook/PdoAddressBook.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/AddressBook/PdoAddressBook.php index 0e1680316..dc27d9384 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/AddressBook/PdoAddressBook.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/AddressBook/PdoAddressBook.php @@ -627,13 +627,8 @@ class PdoAddressBook if (0 < \strlen($sSearch)) { $sCustomSearch = $this->specialConvertSearchValueCustomPhone($sSearch); - if ('%%' === $sCustomSearch) - { - // TODO fix this - $sCustomSearch = ''; - } - $sSearchTypes = implode(',', array( + $sSearchTypes = \implode(',', array( PropertyType::EMAIl, PropertyType::FIRST_NAME, PropertyType::LAST_NAME, PropertyType::NICK_NAME, PropertyType::PHONE, PropertyType::WEB_PAGE )); @@ -1501,7 +1496,8 @@ SQLITEINITIAL; */ private function specialConvertSearchValueCustomPhone($sSearch) { - return '%'.\preg_replace('/[^\d]/', '', $sSearch).'%'; + $sResult = '%'.\preg_replace('/[^\d]/', '', $sSearch).'%'; + return '%%' === $sResult ? '' : $sResult; } /** diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files.php index 638848039..c3539b9c8 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files.php @@ -5,14 +5,14 @@ namespace RainLoop\Providers; class Files extends \RainLoop\Providers\AbstractProvider { /** - * @var \RainLoop\Providers\Files\FilesInterface + * @var \RainLoop\Providers\Files\IFiles */ private $oDriver; /** * @return void */ - public function __construct(\RainLoop\Providers\Files\FilesInterface $oDriver) + public function __construct(\RainLoop\Providers\Files\IFiles $oDriver) { $this->oDriver = $oDriver; } @@ -121,6 +121,6 @@ class Files extends \RainLoop\Providers\AbstractProvider */ public function IsActive() { - return $this->oDriver instanceof \RainLoop\Providers\Files\FilesInterface; + return $this->oDriver instanceof \RainLoop\Providers\Files\IFiles; } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/DefaultStorage.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/FileStorage.php similarity index 98% rename from rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/DefaultStorage.php rename to rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/FileStorage.php index d377ff248..bc2591523 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/DefaultStorage.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/FileStorage.php @@ -2,7 +2,7 @@ namespace RainLoop\Providers\Files; -class DefaultStorage implements \RainLoop\Providers\Files\FilesInterface +class FileStorage implements \RainLoop\Providers\Files\IFiles { /** * @var array diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/FilesInterface.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/IFiles.php similarity index 98% rename from rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/FilesInterface.php rename to rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/IFiles.php index 2c86024ff..cb7aaceae 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/FilesInterface.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Files/IFiles.php @@ -2,7 +2,7 @@ namespace RainLoop\Providers\Files; -interface FilesInterface +interface IFiles { /** * @param \RainLoop\Model\Account $oAccount diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings.php index 31180f14f..bddff7cfd 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings.php @@ -5,16 +5,16 @@ namespace RainLoop\Providers; class Settings extends \RainLoop\Providers\AbstractProvider { /** - * @var \RainLoop\Providers\Settings\SettingsInterface + * @var \RainLoop\Providers\Settings\ISettings */ private $oDriver; /** - * @param \RainLoop\Providers\Settings\SettingsInterface $oDriver + * @param \RainLoop\Providers\Settings\ISettings $oDriver * * @return void */ - public function __construct(\RainLoop\Providers\Settings\SettingsInterface $oDriver) + public function __construct(\RainLoop\Providers\Settings\ISettings $oDriver) { $this->oDriver = $oDriver; } @@ -47,6 +47,6 @@ class Settings extends \RainLoop\Providers\AbstractProvider */ public function IsActive() { - return $this->oDriver instanceof \RainLoop\Providers\Settings\SettingsInterface; + return $this->oDriver instanceof \RainLoop\Providers\Settings\ISettings; } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/DefaultSettings.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/DefaultSettings.php index 032df1ecf..10db4cf15 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/DefaultSettings.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/DefaultSettings.php @@ -2,7 +2,7 @@ namespace RainLoop\Providers\Settings; -class DefaultSettings implements \RainLoop\Providers\Settings\SettingsInterface +class DefaultSettings implements \RainLoop\Providers\Settings\ISettings { const FILE_NAME = 'settings'; const FILE_NAME_LOCAL = 'settings_local'; diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/SettingsInterface.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/ISettings.php similarity index 93% rename from rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/SettingsInterface.php rename to rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/ISettings.php index dba0e83e1..efbdd086d 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/SettingsInterface.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Settings/ISettings.php @@ -2,7 +2,7 @@ namespace RainLoop\Providers\Settings; -interface SettingsInterface +interface ISettings { /** * @param \RainLoop\Model\Account $oAccount diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage.php index 6a0b4d55c..2e24ce366 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage.php @@ -5,14 +5,14 @@ namespace RainLoop\Providers; class Storage extends \RainLoop\Providers\AbstractProvider { /** - * @var \RainLoop\Providers\Storage\StorageInterface + * @var \RainLoop\Providers\Storage\IStorage */ private $oDriver; /** * @return void */ - public function __construct(\RainLoop\Providers\Storage\StorageInterface $oDriver) + public function __construct(\RainLoop\Providers\Storage\IStorage $oDriver) { $this->oDriver = $oDriver; } @@ -102,7 +102,7 @@ class Storage extends \RainLoop\Providers\AbstractProvider */ public function IsActive() { - return $this->oDriver instanceof \RainLoop\Providers\Storage\StorageInterface; + return $this->oDriver instanceof \RainLoop\Providers\Storage\IStorage; } /** @@ -110,7 +110,7 @@ class Storage extends \RainLoop\Providers\AbstractProvider */ public function IsLocal() { - return $this->oDriver instanceof \RainLoop\Providers\Storage\StorageInterface && + return $this->oDriver instanceof \RainLoop\Providers\Storage\IStorage && $this->oDriver->IsLocal(); } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/DefaultStorage.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php similarity index 91% rename from rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/DefaultStorage.php rename to rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php index a7e30f030..50eca4dde 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/DefaultStorage.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/FileStorage.php @@ -2,7 +2,7 @@ namespace RainLoop\Providers\Storage; -class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface +class FileStorage implements \RainLoop\Providers\Storage\IStorage { /** * @var string @@ -14,6 +14,11 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface */ private $bLocal; + /** + * @var \MailSo\Log\Logger + */ + protected $oLogger; + /** * @param string $sStoragePath * @param bool $bLocal = false @@ -24,6 +29,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface { $this->sDataPath = \rtrim(\trim($sStoragePath), '\\/'); $this->bLocal = !!$bLocal; + $this->oLogger = null; } /** @@ -122,7 +128,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface * * @return string */ - private function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false) + public function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false) { if (null === $mAccount) { @@ -186,4 +192,12 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface return $sFilePath; } + + /** + * @param \MailSo\Log\Logger $oLogger + */ + public function SetLogger($oLogger) + { + $this->oLogger = $oLogger instanceof \MailSo\Log\Logger ? $oLogger : null; + } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/StorageInterface.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/IStorage.php similarity index 96% rename from rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/StorageInterface.php rename to rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/IStorage.php index a3d7f87f0..dbef23a4f 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/StorageInterface.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/IStorage.php @@ -2,7 +2,7 @@ namespace RainLoop\Providers\Storage; -interface StorageInterface +interface IStorage { /** * @param \RainLoop\Model\Account|null $oAccount diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/TemproryApcStorage.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/TemproryApcStorage.php new file mode 100644 index 000000000..509122d70 --- /dev/null +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Storage/TemproryApcStorage.php @@ -0,0 +1,78 @@ +generateFileName($oAccount, $iStorageType, $sKey, true), $sValue); + } + + /** + * @param \RainLoop\Model\Account|string|null $oAccount + * @param int $iStorageType + * @param string $sKey + * @param mixed $mDefault = false + * + * @return mixed + */ + public function Get($oAccount, $iStorageType, $sKey, $mDefault = false) + { + $bValue = false; + $mValue = @\apc_fetch($this->generateFileName($oAccount, $iStorageType, $sKey), $bValue); + if (!$bValue) + { + $mValue = $mDefault; + } + + return $mValue; + } + + /** + * @param \RainLoop\Model\Account|string|null $oAccount + * @param int $iStorageType + * @param string $sKey + * + * @return bool + */ + public function Clear($oAccount, $iStorageType, $sKey) + { + @\apc_delete($this->generateFileName($oAccount, $iStorageType, $sKey)); + + return true; + } + + /** + * @param \RainLoop\Model\Account|string $oAccount + * + * @return bool + */ + public function DeleteStorage($oAccount) + { + return !!$oAccount; + } + + /** + * @param \RainLoop\Model\Account|string|null $mAccount + * @param int $iStorageType + * @param string $sKey + * @param bool $bMkDir = false + * @param bool $bForDeleteAction = false + * + * @return string + */ + public function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false) + { + $sFileName = parent::generateFileName($mAccount, $iStorageType, $sKey, false, false); + return $sFileName.'/'.\RainLoop\Utils::GetConnectionToken().'/'; + } +} diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions.php index b66141033..d4b5b27bc 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions.php @@ -5,12 +5,12 @@ namespace RainLoop\Providers; class Suggestions extends \RainLoop\Providers\AbstractProvider { /** - * @var \RainLoop\Providers\Suggestions\SuggestionsInterface + * @var \RainLoop\Providers\Suggestions\ISuggestions */ private $oDriver; /** - * @param \RainLoop\Providers\Suggestions\SuggestionsInterface|null $oDriver = null + * @param \RainLoop\Providers\Suggestions\ISuggestions|null $oDriver = null * * @return void */ @@ -37,6 +37,6 @@ class Suggestions extends \RainLoop\Providers\AbstractProvider */ public function IsActive() { - return $this->oDriver instanceof \RainLoop\Providers\Suggestions\SuggestionsInterface; + return $this->oDriver instanceof \RainLoop\Providers\Suggestions\ISuggestions; } } \ No newline at end of file diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/SuggestionsInterface.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/ISuggestions.php similarity index 88% rename from rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/SuggestionsInterface.php rename to rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/ISuggestions.php index 9d274b9df..cbb8130d2 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/SuggestionsInterface.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/ISuggestions.php @@ -2,7 +2,7 @@ namespace RainLoop\Providers\Suggestions; -interface SuggestionsInterface +interface ISuggestions { /** * @param \RainLoop\Model\Account $oAccount 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 d941b1341..c9e8d7ff4 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 @@ -2,12 +2,12 @@ namespace RainLoop\Providers\Suggestions; -class OwnCloudSuggestions implements \RainLoop\Providers\Suggestions\SuggestionsInterface +class OwnCloudSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions { /** * @var \MailSo\Log\Logger */ - private $oLogger; + protected $oLogger; /** * @param \RainLoop\Model\Account $oAccount diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/TestSuggestions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/TestSuggestions.php index fe8e3ee79..fd9cbfc9c 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/TestSuggestions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions/TestSuggestions.php @@ -2,7 +2,7 @@ namespace RainLoop\Providers\Suggestions; -class TestSuggestions implements \RainLoop\Providers\Suggestions\SuggestionsInterface +class TestSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions { /** * @param \RainLoop\Model\Account $oAccount diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php index b079fe8b8..19d7da5b4 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php @@ -156,6 +156,16 @@ class Service @header('Content-Type: text/html; charset=utf-8'); $this->oHttp->ServerNoCache(); + if (!@\is_dir(APP_DATA_FOLDER_PATH) || !@\is_writable(APP_DATA_FOLDER_PATH)) + { + echo $this->oServiceActions->ErrorTemplates( + 'Permission denied!', + 'RainLoop Webmail cannot access to the data folder "'.APP_DATA_FOLDER_PATH.'"' + ); + + return $this; + } + $aTemplateParameters = $this->indexTemplateParameters($bAdmin); $sCacheFileName = ''; @@ -187,7 +197,7 @@ class Service $sResult .= '][cached:'.($bCached ? 'true' : 'false'); $sResult .= '][hash:'.$aTemplateParameters['{{BaseHash}}']; $sResult .= '][session:'.\md5(\RainLoop\Utils::GetShortToken()); - + if (\RainLoop\Utils::IsOwnCloud()) { $sResult .= '][owncloud:true'; diff --git a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsLicensing.html b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsLicensing.html index 35ae569f2..167f6e894 100644 --- a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsLicensing.html +++ b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsLicensing.html @@ -1,6 +1,6 @@
-
+
RainLoop Webmail is licensed under Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)
license. @@ -30,7 +30,7 @@ Version
-
+

Basic  (Unlim) @@ -53,7 +53,7 @@ Checking…

-
+

Basic

@@ -63,7 +63,7 @@

-
+

Premium (Lifetime) @@ -74,7 +74,7 @@

-
+
diff --git a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsSocial.html b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsSocial.html index 53049b8d1..b67fcc5e8 100644 --- a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsSocial.html +++ b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsSocial.html @@ -1,6 +1,6 @@
-
+
Detailed information on social integration is found at http://rainloop.net/docs/social/
diff --git a/rainloop/v/0.0.0/app/templates/Views/User/SettingsAccounts.html b/rainloop/v/0.0.0/app/templates/Views/User/SettingsAccounts.html index f69c70eee..958b34276 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/SettingsAccounts.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/SettingsAccounts.html @@ -1,7 +1,7 @@
- +
@@ -9,12 +9,6 @@    -    - - -    - -
   @@ -49,6 +43,19 @@
+
+
+ +
+
+ + +    + + +
+
+
diff --git a/rainloop/v/0.0.0/app/templates/Views/User/SystemDropDown.html b/rainloop/v/0.0.0/app/templates/Views/User/SystemDropDown.html index 6e36041b6..1fbc9b8f8 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/SystemDropDown.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/SystemDropDown.html @@ -5,10 +5,12 @@ -   - +--> +   +