diff --git a/plugins/add-x-originating-ip-header/VERSION b/plugins/add-x-originating-ip-header/VERSION deleted file mode 100644 index ea710abb9..000000000 --- a/plugins/add-x-originating-ip-header/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.2 \ No newline at end of file diff --git a/plugins/add-x-originating-ip-header/index.php b/plugins/add-x-originating-ip-header/index.php index 148e27cd1..4ae52229e 100644 --- a/plugins/add-x-originating-ip-header/index.php +++ b/plugins/add-x-originating-ip-header/index.php @@ -2,6 +2,11 @@ class AddXOriginatingIpHeaderPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = 'X-Originating-IP', + VERSION = '2.0', + DESCRIPTION = 'Adds X-Originating-IP header to outgoing message, containing sender\'s IP address.'; + public function Init() : void { $this->addHook('filter.build-message', 'FilterBuildMessage'); diff --git a/plugins/auto-domain-grab/VERSION b/plugins/auto-domain-grab/VERSION deleted file mode 100644 index b123147e2..000000000 --- a/plugins/auto-domain-grab/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 \ No newline at end of file diff --git a/plugins/auto-domain-grab/index.php b/plugins/auto-domain-grab/index.php index 9e6df7e23..1fe9307b5 100644 --- a/plugins/auto-domain-grab/index.php +++ b/plugins/auto-domain-grab/index.php @@ -12,6 +12,10 @@ class AutoDomainGrabPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = '', + CATEGORY = 'General', + DESCRIPTION = ''; private $imap_prefix = "mail."; private $smtp_prefix = "mail."; diff --git a/plugins/black-list/VERSION b/plugins/black-list/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/black-list/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/black-list/index.php b/plugins/black-list/index.php index 1ee8327b8..a820cabda 100644 --- a/plugins/black-list/index.php +++ b/plugins/black-list/index.php @@ -2,6 +2,12 @@ class BlackListPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = 'Black list', + VERSION = '2.0', + CATEGORY = 'Login', + DESCRIPTION = 'Simple black list plugin (with wildcard and exceptions functionality).'; + public function Init() : void { $this->addHook('filter.login-credentials', 'FilterLoginCredentials'); diff --git a/plugins/change-smtp-ehlo-message/VERSION b/plugins/change-smtp-ehlo-message/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/change-smtp-ehlo-message/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/change-smtp-ehlo-message/index.php b/plugins/change-smtp-ehlo-message/index.php index 06fe0ed1b..8860653da 100644 --- a/plugins/change-smtp-ehlo-message/index.php +++ b/plugins/change-smtp-ehlo-message/index.php @@ -2,6 +2,11 @@ class ChangeSmtpEhloMessagePlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = '', + CATEGORY = 'General', + DESCRIPTION = ''; + public function Init() : void { $this->addHook('filter.smtp-credentials', 'FilterSmtpCredentials'); diff --git a/plugins/contact-group-excel-paste/VERSION b/plugins/contact-group-excel-paste/VERSION deleted file mode 100644 index ceab6e11e..000000000 --- a/plugins/contact-group-excel-paste/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1 \ No newline at end of file diff --git a/plugins/contact-group-excel-paste/index.php b/plugins/contact-group-excel-paste/index.php index 67b80e3da..3ad0089b3 100644 --- a/plugins/contact-group-excel-paste/index.php +++ b/plugins/contact-group-excel-paste/index.php @@ -2,6 +2,11 @@ class ContactGroupExcelPastePlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = '', + CATEGORY = 'General', + DESCRIPTION = ''; + public function Init() : void { $this->addJs('js/excel_contact_group.js'); diff --git a/plugins/contacts-suggestions-example/VERSION b/plugins/contacts-suggestions-example/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/contacts-suggestions-example/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/contacts-suggestions-example/index.php b/plugins/contacts-suggestions-example/index.php index 38a2b164f..d2a12187f 100644 --- a/plugins/contacts-suggestions-example/index.php +++ b/plugins/contacts-suggestions-example/index.php @@ -2,6 +2,11 @@ class ContactsSuggestionsExamplePlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = '', + CATEGORY = 'General', + DESCRIPTION = ''; + public function Init() : void { $this->addHook('main.fabrica', 'MainFabrica'); diff --git a/plugins/custom-admin-settings-tab/VERSION b/plugins/custom-admin-settings-tab/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/custom-admin-settings-tab/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/custom-admin-settings-tab/index.php b/plugins/custom-admin-settings-tab/index.php index dc8f6190b..2cc83c8a8 100644 --- a/plugins/custom-admin-settings-tab/index.php +++ b/plugins/custom-admin-settings-tab/index.php @@ -2,6 +2,11 @@ class CustomAdminSettingsTabPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = '', + CATEGORY = 'General', + DESCRIPTION = ''; + /** * @return void */ diff --git a/plugins/custom-auth-example/VERSION b/plugins/custom-auth-example/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/custom-auth-example/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/custom-auth-example/index.php b/plugins/custom-auth-example/index.php index fd3d9c6d8..59f2b0588 100644 --- a/plugins/custom-auth-example/index.php +++ b/plugins/custom-auth-example/index.php @@ -2,6 +2,11 @@ class CustomAuthExamplePlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = '', + CATEGORY = 'Login', + DESCRIPTION = ''; + public function Init() : void { $this->addHook('filter.login-credentials', 'FilterLoginŠ”redentials'); diff --git a/plugins/custom-login-mapping/VERSION b/plugins/custom-login-mapping/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/custom-login-mapping/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/custom-login-mapping/index.php b/plugins/custom-login-mapping/index.php index 0c0faf72a..ac3d577da 100644 --- a/plugins/custom-login-mapping/index.php +++ b/plugins/custom-login-mapping/index.php @@ -2,6 +2,12 @@ class CustomLoginMappingPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = 'Custom Login Mapping', + VERSION = '2.0', + CATEGORY = 'Login', + DESCRIPTION = 'Plugin which allows you to set up custom username by email address.'; + public function Init() : void { $this->addHook('filter.login-credentials', 'FilterLoginŠ”redentials'); diff --git a/plugins/custom-settings-tab/VERSION b/plugins/custom-settings-tab/VERSION deleted file mode 100644 index b123147e2..000000000 --- a/plugins/custom-settings-tab/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 \ No newline at end of file diff --git a/plugins/custom-settings-tab/index.php b/plugins/custom-settings-tab/index.php index 5918a1ece..f55e51f59 100644 --- a/plugins/custom-settings-tab/index.php +++ b/plugins/custom-settings-tab/index.php @@ -2,6 +2,11 @@ class CustomSettingsTabPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = '', + CATEGORY = 'General', + DESCRIPTION = ''; + /** * @return void */ diff --git a/plugins/custom-system-folders/VERSION b/plugins/custom-system-folders/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/custom-system-folders/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/custom-system-folders/index.php b/plugins/custom-system-folders/index.php index 2d9857802..53e3152de 100644 --- a/plugins/custom-system-folders/index.php +++ b/plugins/custom-system-folders/index.php @@ -2,6 +2,11 @@ class CustomSystemFoldersPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = '', + CATEGORY = 'General', + DESCRIPTION = ''; + /** * @var string */ diff --git a/plugins/demo-account/VERSION b/plugins/demo-account/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/demo-account/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/demo-account/index.php b/plugins/demo-account/index.php index 63b6a15bc..0fdf8a6ef 100644 --- a/plugins/demo-account/index.php +++ b/plugins/demo-account/index.php @@ -2,6 +2,11 @@ class DemoAccountPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = '', + CATEGORY = 'Login', + DESCRIPTION = ''; + /** * @return void */ diff --git a/plugins/excel-multirow-maillist-parser/LICENCE b/plugins/excel-multirow-maillist-parser/LICENCE deleted file mode 100644 index 634a69118..000000000 --- a/plugins/excel-multirow-maillist-parser/LICENCE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 https://github.com/sharq88 - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/plugins/excel-multirow-maillist-parser/README b/plugins/excel-multirow-maillist-parser/README deleted file mode 100644 index 9fa264c3c..000000000 --- a/plugins/excel-multirow-maillist-parser/README +++ /dev/null @@ -1 +0,0 @@ -Add ability to paste multi row email addresses from excel. \ No newline at end of file diff --git a/plugins/excel-multirow-maillist-parser/VERSION b/plugins/excel-multirow-maillist-parser/VERSION deleted file mode 100644 index ceab6e11e..000000000 --- a/plugins/excel-multirow-maillist-parser/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1 \ No newline at end of file diff --git a/plugins/excel-multirow-maillist-parser/index.php b/plugins/excel-multirow-maillist-parser/index.php deleted file mode 100644 index 341da40d4..000000000 --- a/plugins/excel-multirow-maillist-parser/index.php +++ /dev/null @@ -1,12 +0,0 @@ -addJs('js/parse_excel_list.js'); // add js file - } -} diff --git a/plugins/excel-multirow-maillist-parser/js/parse_excel_list.js b/plugins/excel-multirow-maillist-parser/js/parse_excel_list.js deleted file mode 100644 index 9f1f8b976..000000000 --- a/plugins/excel-multirow-maillist-parser/js/parse_excel_list.js +++ /dev/null @@ -1,22 +0,0 @@ - -(function(window, $) { - - $(function() { - - $(window.document).on('keyup', '.b-compose .b-header .inputosaurus-input input[type="text"]:first', function() { - - var - $this = $(this), - value = $this.val() - ; - - if (value && value.match(/@/ig).length >= 2) - { - $this.val($this.val().replace(/\n| /ig, ',')); - } - - }); - - }); - -}(window, $)) \ No newline at end of file diff --git a/plugins/ldap-contacts-suggestions/VERSION b/plugins/ldap-contacts-suggestions/VERSION deleted file mode 100644 index 9459d4ba2..000000000 --- a/plugins/ldap-contacts-suggestions/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 diff --git a/plugins/ldap-contacts-suggestions/index.php b/plugins/ldap-contacts-suggestions/index.php index a6b85e184..97aa4177b 100644 --- a/plugins/ldap-contacts-suggestions/index.php +++ b/plugins/ldap-contacts-suggestions/index.php @@ -2,6 +2,12 @@ class LdapContactsSuggestionsPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = 'Contacts suggestions (LDAP)', + VERSION = '2.0', + CATEGORY = 'Security', + DESCRIPTION = 'Plugin that adds functionality to get contacts from LDAP on compose page.'; + public function Init() : void { $this->addHook('main.fabrica', 'MainFabrica'); diff --git a/plugins/ldap-identities/VERSION b/plugins/ldap-identities/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/ldap-identities/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/ldap-identities/index.php b/plugins/ldap-identities/index.php index 64609aa7c..e9d659ae9 100644 --- a/plugins/ldap-identities/index.php +++ b/plugins/ldap-identities/index.php @@ -6,6 +6,16 @@ use RainLoop\Plugins\Property; class LdapIdentitiesPlugin extends AbstractPlugin { + const + NAME = 'LDAP Identities', + VERSION = '2.0', + AUTHOR = 'FWest98', + URL = 'https://github.com/FWest98', + RELEASE = '2020-11-11', + REQUIRED = '2.1.0', + CATEGORY = 'Accounts', + DESCRIPTION = 'Plugin that adds functionality to import account identities from LDAP.'; + public function __construct() { include_once __DIR__ . '/LdapIdentities.php'; @@ -127,4 +137,4 @@ class LdapIdentitiesPlugin extends AbstractPlugin ->SetDescription("The base DN to search in for groups") ]; } -} \ No newline at end of file +} diff --git a/plugins/override-smtp-credentials/VERSION b/plugins/override-smtp-credentials/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/override-smtp-credentials/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/override-smtp-credentials/index.php b/plugins/override-smtp-credentials/index.php index 32b414dfb..9b4732458 100644 --- a/plugins/override-smtp-credentials/index.php +++ b/plugins/override-smtp-credentials/index.php @@ -2,6 +2,12 @@ class OverrideSmtpCredentialsPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = 'Override Smtp Credentials', + VERSION = '2.0', + CATEGORY = 'Filters', + DESCRIPTION = 'Plugin which allows you to override smtp credentials specified users.'; + public function Init() : void { $this->addHook('filter.smtp-credentials', 'FilterSmtpCredentials'); diff --git a/plugins/proxyauth-login-example/VERSION b/plugins/proxyauth-login-example/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/proxyauth-login-example/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/proxyauth-login-example/index.php b/plugins/proxyauth-login-example/index.php index eeac10db6..caf010552 100644 --- a/plugins/proxyauth-login-example/index.php +++ b/plugins/proxyauth-login-example/index.php @@ -2,6 +2,11 @@ class ProxyauthLoginExamplePlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = '', + CATEGORY = 'General', + DESCRIPTION = ''; + public function Init() : void { $this->addHook('event.login-post-login-provide', 'EventLoginPostLoginProvide'); diff --git a/plugins/snowfall-on-login-screen/VERSION b/plugins/snowfall-on-login-screen/VERSION deleted file mode 100644 index b123147e2..000000000 --- a/plugins/snowfall-on-login-screen/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 \ No newline at end of file diff --git a/plugins/snowfall-on-login-screen/index.php b/plugins/snowfall-on-login-screen/index.php index 4064badbe..35813c689 100644 --- a/plugins/snowfall-on-login-screen/index.php +++ b/plugins/snowfall-on-login-screen/index.php @@ -2,6 +2,12 @@ class SnowfallOnLoginScreenPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = 'Snowfall on login screen', + VERSION = '2.0', + CATEGORY = 'Fun', + DESCRIPTION = 'Snowfall on login screen plugin (just for fun).'; + public function Init() : void { $this->addJs('js/snowfall.js'); diff --git a/plugins/white-list/VERSION b/plugins/white-list/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/white-list/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/white-list/index.php b/plugins/white-list/index.php index 56360cdd0..fd01124ee 100644 --- a/plugins/white-list/index.php +++ b/plugins/white-list/index.php @@ -2,6 +2,12 @@ class WhiteListPlugin extends \RainLoop\Plugins\AbstractPlugin { + const + NAME = 'White list', + VERSION = '2.0', + CATEGORY = 'Login', + DESCRIPTION = 'Simple white list plugin (with wildcard and exceptions functionality).'; + public function Init() : void { $this->addHook('filter.login-credentials', 'FilterLoginCredentials'); diff --git a/release.php b/release.php index ac201aa20..8fbc9223f 100755 --- a/release.php +++ b/release.php @@ -2,6 +2,54 @@ getConstants() as $key => $value) { + $manifest_item[\strtolower($key)] = $value; + } + $version = $manifest_item['version']; + if (0 < floatval($version)) { + echo "+ {$name} {$version}\n"; + $manifest_item['type'] = 'plugin'; + $manifest_item['id'] = $name; + $manifest_item['file'] = "{$dir}-{$version}.tgz"; + ksort($manifest_item); + $manifest[$name] = $manifest_item; + $tar_destination = "{$destPath}{$name}-{$version}.tar"; + $tgz_destination = "{$destPath}{$name}-{$version}.tgz"; + @unlink($tgz_destination); + @unlink("{$tar_destination}.gz"); + $tar = new PharData($tar_destination); + $tar->buildFromDirectory('./plugins/', "@{$name}@"); + $tar->compress(Phar::GZ); + unlink($tar_destination); + rename("{$tar_destination}.gz", $tgz_destination); + } else { + echo "- {$name} {$version}\n"; + } + } + + ksort($manifest); + $manifest = json_encode(array_values($manifest)); + $manifest = str_replace('{"', "\n\t{\n\t\t\"", $manifest); + $manifest = str_replace('"}', "\"\n\t}", $manifest); + $manifest = str_replace('}]', "}\n]", $manifest); + $manifest = str_replace('","', "\",\n\t\t\"", $manifest); + $manifest = str_replace('\/', '/', $manifest); + file_put_contents("{$destPath}packages.json", $manifest); + exit; +} + $gulp = trim(`which gulp`); if (!$gulp) { exit('gulp not installed, run as root: npm install --global gulp-cli'); @@ -12,8 +60,6 @@ if (!$rollup) { exit('rollup not installed, run as root: npm install --global rollup'); } -$options = getopt('', ['aur','docker']); - // Arch User Repository // https://aur.archlinux.org/packages/snappymail/ $options['aur'] = isset($options['aur']); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php index 32c71cd66..8c7fc1f84 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -989,7 +989,7 @@ class Actions $aAttachmentsActions = array(); if ($this->GetCapa(false, $bMobile, Enumerations\Capa::ATTACHMENTS_ACTIONS)) { - if (!!\class_exists('ZipArchive')) { + if (\class_exists('ZipArchive')) { $aAttachmentsActions[] = 'zip'; } } diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Admin.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Admin.php index 98959c664..a88d10d33 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Admin.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/Admin.php @@ -489,14 +489,14 @@ trait Admin private function snappyMailRepo() : string { - return 'https://snappymail.eu/repository/'; + return 'https://snappymail.eu/repository/v2/'; } private function rainLoopUpdatable() : bool { - return file_exists(APP_INDEX_ROOT_PATH.'index.php') && - is_writable(APP_INDEX_ROOT_PATH.'index.php') && - is_writable(APP_INDEX_ROOT_PATH.'snappymail/') && + return \file_exists(APP_INDEX_ROOT_PATH.'index.php') && + \is_writable(APP_INDEX_ROOT_PATH.'index.php') && + \is_writable(APP_INDEX_ROOT_PATH.'snappymail/') && APP_VERSION !== APP_DEV_VERSION ; } @@ -684,23 +684,23 @@ trait Admin } } - $bResult = false; - if ('' !== $sResultId) - { - $bResult = \MailSo\Base\Utils::RecRmDir(APP_PLUGINS_PATH.$sResultId); - if ($bResult) - { - $this->pluginEnable($sResultId, false); - } + $bResult = '' !== $sResultId && static::deletePackageDir($sResultId); + if ($bResult) { + $this->pluginEnable($sResultId, false); } return $this->DefaultResponse(__FUNCTION__, $bResult); } + private static function deletePackageDir(string $sId) : bool + { + return !\is_dir(APP_PLUGINS_PATH.$sId) || \MailSo\Base\Utils::RecRmDir(APP_PLUGINS_PATH.$sId); + } + private function downloadRemotePackageByUrl(string $sUrl) : string { $bResult = false; - $sTmp = APP_PRIVATE_DATA.\md5(\microtime(true).$sUrl).'.zip'; + $sTmp = APP_PRIVATE_DATA.\md5(\microtime(true).$sUrl) . \substr($sUrl, -4); $pDest = \fopen($sTmp, 'w+b'); if ($pDest) { @@ -757,40 +757,19 @@ trait Admin } } - $sTmp = ''; $bResult = false; - if ('' !== $sRealFile) + $sTmp = $sRealFile ? $this->downloadRemotePackageByUrl($this->snappyMailRepo().$sRealFile) : null; + if ($sTmp) { - $sTmp = $this->downloadRemotePackageByUrl($this->snappyMailRepo().$sRealFile); - } - - if ('' !== $sTmp) - { - $oArchive = new \ZipArchive(); - $oArchive->open($sTmp); - if ('plugin' === $sType) - { - $bResult = true; - if (\is_dir(APP_PLUGINS_PATH.$sId)) - { - $bResult = \MailSo\Base\Utils::RecRmDir(APP_PLUGINS_PATH.$sId); - if (!$bResult) - { - $this->Logger()->Write('Cannot remove previous plugin folder: '.$sId, \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER'); - } - } - - if ($bResult) - { - $bResult = $oArchive->extractTo(APP_PLUGINS_PATH); - if (!$bResult) - { - $this->Logger()->Write('Cannot extract package files: '.$oArchive->getStatusString(), \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER'); - } + $oArchive = new \PharData($sTmp, 0, $sRealFile); + if (!\is_dir(APP_PLUGINS_PATH.$sId) || static::deletePackageDir($sId)) { + $bResult = $oArchive->extractTo(APP_PLUGINS_PATH); + if (!$bResult) { + $this->Logger()->Write('Cannot extract package files: '.$oArchive->getStatusString(), \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER'); } + } else { + $this->Logger()->Write('Cannot remove previous plugin folder: '.$sId, \MailSo\Log\Enumerations\Type::ERROR, 'INSTALLER'); } - $oArchive->close(); - \unlink($sTmp); } diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Plugins/AbstractPlugin.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Plugins/AbstractPlugin.php index 8ad7f8898..136bc5161 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Plugins/AbstractPlugin.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Plugins/AbstractPlugin.php @@ -4,6 +4,17 @@ namespace RainLoop\Plugins; abstract class AbstractPlugin { + const + NAME = '', + AUTHOR = 'SnappyMail', + URL = 'https://snappymail.eu/', + VERSION = '0.0', + RELEASE = '2020-11-01', + REQUIRED = '2.0.0', + CATEGORY = 'General', + LICENSE = 'MIT', + DESCRIPTION = ''; + /** * @var \RainLoop\Plugins\Manager */ diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Plugins/Manager.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Plugins/Manager.php index d6b7dede6..e6af67aad 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Plugins/Manager.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Plugins/Manager.php @@ -112,35 +112,17 @@ class Manager public function CreatePluginByName(string $sName) : ?\RainLoop\Plugins\AbstractPlugin { $oPlugin = null; - if (\preg_match('/^[a-z0-9\-]+$/', $sName) && - \file_exists(APP_PLUGINS_PATH.$sName.'/index.php')) - { - $sClassName = $this->convertPluginFolderNameToClassName($sName); - if (!\class_exists($sClassName)) - { - include APP_PLUGINS_PATH.$sName.'/index.php'; - } - - if (\class_exists($sClassName)) - { - $oPlugin = new $sClassName(); - if ($oPlugin instanceof \RainLoop\Plugins\AbstractPlugin) - { - $oPlugin - ->SetName($sName) - ->SetPath(APP_PLUGINS_PATH.$sName) - ->SetVersion(\file_exists(APP_PLUGINS_PATH.$sName.'/VERSION') ? - \file_get_contents(APP_PLUGINS_PATH.$sName.'/VERSION') : '') - ->SetPluginManager($this) - ->SetPluginConfig(new \RainLoop\Config\Plugin($sName, $oPlugin->ConfigMap())) - ; - } - else - { - $oPlugin = null; - } - } + $sClassName = $this->loadPluginByName($sName); + if ($sClassName) { + $oPlugin = new $sClassName(); + $oPlugin + ->SetName($sName) + ->SetPath(APP_PLUGINS_PATH.$sName) + ->SetVersion($sClassName::VERSION) + ->SetPluginManager($this) + ->SetPluginConfig(new \RainLoop\Config\Plugin($sName, $oPlugin->ConfigMap())) + ; } return $oPlugin; @@ -156,15 +138,11 @@ class Manager foreach ($aGlob as $sPathName) { $sName = \basename($sPathName); - if (\preg_match('/^[a-z0-9\-]+$/', $sName) && - \file_exists($sPathName.'/index.php')) - { - $aList[] = array( - $sName, - \file_exists($sPathName.'/VERSION') ? - \file_get_contents($sPathName.'/VERSION') : '0.0' - ); - } + $sClassName = $this->loadPluginByName($sName); + $aList[] = array( + $sName, + $sClassName::VERSION + ); } } else @@ -184,6 +162,21 @@ class Manager return \implode($aParts).'Plugin'; } + public function loadPluginByName(string $sName) : ?string + { + if (\preg_match('/^[a-z0-9\-]+$/', $sName) + && \file_exists(APP_PLUGINS_PATH.$sName.'/index.php')) + { + $sClassName = $this->convertPluginFolderNameToClassName($sName); + if (!\class_exists($sClassName)) { + include APP_PLUGINS_PATH.$sName.'/index.php'; + } + if (\class_exists($sClassName) && \is_subclass_of($sClassName, 'RainLoop\\Plugins\\AbstractPlugin')) { + return $sClassName; + } + } + } + public function Actions() : \RainLoop\Actions { return $this->oActions; diff --git a/snappymail/v/0.0.0/app/templates/Views/Admin/AdminSettingsSecurity.html b/snappymail/v/0.0.0/app/templates/Views/Admin/AdminSettingsSecurity.html index c20beeb90..58835381e 100644 --- a/snappymail/v/0.0.0/app/templates/Views/Admin/AdminSettingsSecurity.html +++ b/snappymail/v/0.0.0/app/templates/Views/Admin/AdminSettingsSecurity.html @@ -102,7 +102,7 @@
- šŸ”‘> + šŸ”‘