From aae7883b99739c6c58d6fc6665ea221f48c91ef5 Mon Sep 17 00:00:00 2001 From: djmaze Date: Fri, 13 Mar 2020 15:30:39 +0100 Subject: [PATCH] Bugfix: bootstrap jQuery('#') syntax error Changed: use ES2015 Changed: gulp uglify to terser Removed: ChangePassword Removed: nanoscroll Removed: JS polyfills --- dev/Common/Globals.js | 12 +- dev/External/ko.js | 16 - dev/Remote/User/Ajax.js | 12 - dev/Screen/User/Settings.js | 10 - dev/Settings/User/ChangePassword.js | 104 - dev/Styles/@Main.less | 1 - dev/Styles/Scroll.less | 38 - dev/boot.js | 6 - dev/polyfills.js | 5 - package.json | 16 +- .../ChangePasswordCustomSqlDriver.php | 237 -- plugins/change-password-custom-sql/LICENSE | 20 - plugins/change-password-custom-sql/README | 1 - plugins/change-password-custom-sql/README.md | 10 - plugins/change-password-custom-sql/VERSION | 1 - plugins/change-password-custom-sql/index.php | 53 - .../ChangePasswordCyberPanel.php | 138 - plugins/change-password-cyberpanel/LICENSE | 20 - plugins/change-password-cyberpanel/README | 1 - plugins/change-password-cyberpanel/README.md | 10 - plugins/change-password-cyberpanel/VERSION | 1 - plugins/change-password-cyberpanel/index.php | 44 - .../ChangePasswordExampleDriver.php | 47 - plugins/change-password-example/LICENSE | 20 - plugins/change-password-example/VERSION | 1 - plugins/change-password-example/index.php | 41 - .../CpanelChangePasswordDriver.php | 188 -- plugins/cpanel-change-password/LICENSE | 20 - plugins/cpanel-change-password/VERSION | 1 - plugins/cpanel-change-password/index.php | 65 - plugins/cpanel-change-password/xmlapi.php | 2490 ----------------- .../DirectAdminChangePasswordDriver.php | 152 - plugins/directadmin-change-password/LICENSE | 20 - plugins/directadmin-change-password/README | 1 - plugins/directadmin-change-password/VERSION | 1 - plugins/directadmin-change-password/index.php | 55 - .../FroxlorChangePasswordDriver.php | 293 -- plugins/froxlor-change-password/LICENSE | 20 - plugins/froxlor-change-password/README | 1 - plugins/froxlor-change-password/VERSION | 1 - plugins/froxlor-change-password/index.php | 76 - plugins/google-analytics/LICENSE | 20 - plugins/google-analytics/README | 1 - plugins/google-analytics/VERSION | 1 - plugins/google-analytics/index.php | 49 - plugins/google-analytics/js/include.js | 100 - .../HmailserverChangePasswordDriver.php | 138 - plugins/hmailserver-change-password/LICENSE | 20 - plugins/hmailserver-change-password/VERSION | 1 - plugins/hmailserver-change-password/index.php | 67 - .../IspConfigChangePasswordDriver.php | 151 - plugins/ispconfig-change-password/LICENSE | 20 - plugins/ispconfig-change-password/README | 1 - plugins/ispconfig-change-password/VERSION | 1 - plugins/ispconfig-change-password/index.php | 76 - .../ChangePasswordISPmailDriver.php | 276 -- plugins/ispmail-change-password/LICENSE | 20 - plugins/ispmail-change-password/README | 1 - plugins/ispmail-change-password/VERSION | 1 - plugins/ispmail-change-password/index.php | 95 - .../ChangePasswordLdapDriver.php | 242 -- plugins/ldap-change-password/LICENSE | 20 - plugins/ldap-change-password/README | 1 - plugins/ldap-change-password/VERSION | 1 - plugins/ldap-change-password/index.php | 79 - plugins/mailcow-change-password/LICENSE | 20 - .../MailcowChangePasswordDriver.php | 162 -- plugins/mailcow-change-password/README | 5 - plugins/mailcow-change-password/VERSION | 1 - plugins/mailcow-change-password/index.php | 76 - plugins/mailinabox-change-password/LICENSE | 20 - .../MailInABoxChangePasswordDriver.php | 157 -- plugins/mailinabox-change-password/README | 1 - plugins/mailinabox-change-password/VERSION | 1 - plugins/mailinabox-change-password/index.php | 54 - plugins/piwik-analytics/LICENSE | 20 - plugins/piwik-analytics/README | 1 - plugins/piwik-analytics/VERSION | 1 - plugins/piwik-analytics/index.php | 36 - plugins/piwik-analytics/js/include.js | 37 - .../ChangePasswordPoppassdDriver.php | 119 - plugins/poppassd-change-password/LICENSE | 20 - plugins/poppassd-change-password/README | 1 - plugins/poppassd-change-password/VERSION | 1 - plugins/poppassd-change-password/index.php | 52 - .../ChangePasswordPostfixAdminDriver.php | 342 --- plugins/postfixadmin-change-password/LICENSE | 20 - plugins/postfixadmin-change-password/README | 1 - plugins/postfixadmin-change-password/VERSION | 1 - .../postfixadmin-change-password/index.php | 100 - .../postfixadmin-change-password/md5crypt.php | 139 - plugins/recaptcha/LICENSE | 20 - plugins/recaptcha/README | 3 - plugins/recaptcha/VERSION | 1 - plugins/recaptcha/index.php | 151 - plugins/recaptcha/js/recaptcha.js | 95 - plugins/rest-change-password/LICENSE | 20 - plugins/rest-change-password/README | 1 - .../RestChangePasswordDriver.php | 172 -- plugins/rest-change-password/VERSION | 1 - plugins/rest-change-password/index.php | 78 - plugins/vesta-change-password/LICENSE | 20 - plugins/vesta-change-password/README | 1 - plugins/vesta-change-password/VERSION | 1 - .../VestaChangePasswordDriver.php | 146 - plugins/vesta-change-password/index.php | 55 - plugins/virtualmin-change-password/LICENSE | 21 - plugins/virtualmin-change-password/README | 1 - plugins/virtualmin-change-password/VERSION | 1 - .../VirtualminChangePasswordDriver.php | 210 -- plugins/virtualmin-change-password/index.php | 54 - .../ChangePasswordVpopmailDriver.php | 228 -- plugins/vpopmail-change-password/LICENSE | 20 - plugins/vpopmail-change-password/VERSION | 1 - plugins/vpopmail-change-password/index.php | 71 - .../0.0.0/app/libraries/RainLoop/Actions.php | 54 - .../libraries/RainLoop/Config/Application.php | 1 - .../ChangePasswordInterface.php | 10 - .../0.0.0/app/libraries/RainLoop/Service.php | 1 - .../app/libraries/RainLoop/ServiceActions.php | 4 - rainloop/v/0.0.0/app/templates/Index.html | 3 - tasks/config.js | 7 - tasks/js.js | 10 +- vendors/bootstrap/js/bootstrap.js | 4 +- vendors/bootstrap/js/bootstrap.min.js | 4 +- vendors/bootstrap/js/old.bootstrap.min.js | 6 - .../bootstrap/js/old.bootstrap.min.orig.js | 6 - vendors/jquery-nanoscroller/.code-changed | 0 .../jquery.nanoscroller.js | 922 ------ .../jquery.nanoscroller.orig.js | 753 ----- .../jquery.nanoscroller.orig.min.js | 3 - vendors/jquery-nanoscroller/nanoscroller.css | 116 - webpack.config.builder.js | 15 +- 133 files changed, 15 insertions(+), 10295 deletions(-) delete mode 100644 dev/Settings/User/ChangePassword.js delete mode 100644 dev/Styles/Scroll.less delete mode 100644 dev/polyfills.js delete mode 100644 plugins/change-password-custom-sql/ChangePasswordCustomSqlDriver.php delete mode 100644 plugins/change-password-custom-sql/LICENSE delete mode 100644 plugins/change-password-custom-sql/README delete mode 100644 plugins/change-password-custom-sql/README.md delete mode 100644 plugins/change-password-custom-sql/VERSION delete mode 100644 plugins/change-password-custom-sql/index.php delete mode 100644 plugins/change-password-cyberpanel/ChangePasswordCyberPanel.php delete mode 100644 plugins/change-password-cyberpanel/LICENSE delete mode 100644 plugins/change-password-cyberpanel/README delete mode 100644 plugins/change-password-cyberpanel/README.md delete mode 100644 plugins/change-password-cyberpanel/VERSION delete mode 100644 plugins/change-password-cyberpanel/index.php delete mode 100644 plugins/change-password-example/ChangePasswordExampleDriver.php delete mode 100644 plugins/change-password-example/LICENSE delete mode 100644 plugins/change-password-example/VERSION delete mode 100644 plugins/change-password-example/index.php delete mode 100644 plugins/cpanel-change-password/CpanelChangePasswordDriver.php delete mode 100644 plugins/cpanel-change-password/LICENSE delete mode 100644 plugins/cpanel-change-password/VERSION delete mode 100644 plugins/cpanel-change-password/index.php delete mode 100644 plugins/cpanel-change-password/xmlapi.php delete mode 100644 plugins/directadmin-change-password/DirectAdminChangePasswordDriver.php delete mode 100644 plugins/directadmin-change-password/LICENSE delete mode 100644 plugins/directadmin-change-password/README delete mode 100644 plugins/directadmin-change-password/VERSION delete mode 100644 plugins/directadmin-change-password/index.php delete mode 100644 plugins/froxlor-change-password/FroxlorChangePasswordDriver.php delete mode 100644 plugins/froxlor-change-password/LICENSE delete mode 100644 plugins/froxlor-change-password/README delete mode 100644 plugins/froxlor-change-password/VERSION delete mode 100644 plugins/froxlor-change-password/index.php delete mode 100644 plugins/google-analytics/LICENSE delete mode 100644 plugins/google-analytics/README delete mode 100644 plugins/google-analytics/VERSION delete mode 100644 plugins/google-analytics/index.php delete mode 100644 plugins/google-analytics/js/include.js delete mode 100644 plugins/hmailserver-change-password/HmailserverChangePasswordDriver.php delete mode 100644 plugins/hmailserver-change-password/LICENSE delete mode 100644 plugins/hmailserver-change-password/VERSION delete mode 100644 plugins/hmailserver-change-password/index.php delete mode 100644 plugins/ispconfig-change-password/IspConfigChangePasswordDriver.php delete mode 100644 plugins/ispconfig-change-password/LICENSE delete mode 100644 plugins/ispconfig-change-password/README delete mode 100644 plugins/ispconfig-change-password/VERSION delete mode 100644 plugins/ispconfig-change-password/index.php delete mode 100755 plugins/ispmail-change-password/ChangePasswordISPmailDriver.php delete mode 100644 plugins/ispmail-change-password/LICENSE delete mode 100644 plugins/ispmail-change-password/README delete mode 100644 plugins/ispmail-change-password/VERSION delete mode 100755 plugins/ispmail-change-password/index.php delete mode 100644 plugins/ldap-change-password/ChangePasswordLdapDriver.php delete mode 100644 plugins/ldap-change-password/LICENSE delete mode 100644 plugins/ldap-change-password/README delete mode 100644 plugins/ldap-change-password/VERSION delete mode 100644 plugins/ldap-change-password/index.php delete mode 100644 plugins/mailcow-change-password/LICENSE delete mode 100644 plugins/mailcow-change-password/MailcowChangePasswordDriver.php delete mode 100644 plugins/mailcow-change-password/README delete mode 100644 plugins/mailcow-change-password/VERSION delete mode 100644 plugins/mailcow-change-password/index.php delete mode 100644 plugins/mailinabox-change-password/LICENSE delete mode 100644 plugins/mailinabox-change-password/MailInABoxChangePasswordDriver.php delete mode 100644 plugins/mailinabox-change-password/README delete mode 100644 plugins/mailinabox-change-password/VERSION delete mode 100644 plugins/mailinabox-change-password/index.php delete mode 100644 plugins/piwik-analytics/LICENSE delete mode 100644 plugins/piwik-analytics/README delete mode 100644 plugins/piwik-analytics/VERSION delete mode 100644 plugins/piwik-analytics/index.php delete mode 100644 plugins/piwik-analytics/js/include.js delete mode 100644 plugins/poppassd-change-password/ChangePasswordPoppassdDriver.php delete mode 100644 plugins/poppassd-change-password/LICENSE delete mode 100644 plugins/poppassd-change-password/README delete mode 100644 plugins/poppassd-change-password/VERSION delete mode 100644 plugins/poppassd-change-password/index.php delete mode 100755 plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php delete mode 100644 plugins/postfixadmin-change-password/LICENSE delete mode 100644 plugins/postfixadmin-change-password/README delete mode 100644 plugins/postfixadmin-change-password/VERSION delete mode 100755 plugins/postfixadmin-change-password/index.php delete mode 100644 plugins/postfixadmin-change-password/md5crypt.php delete mode 100644 plugins/recaptcha/LICENSE delete mode 100644 plugins/recaptcha/README delete mode 100644 plugins/recaptcha/VERSION delete mode 100644 plugins/recaptcha/index.php delete mode 100644 plugins/recaptcha/js/recaptcha.js delete mode 100644 plugins/rest-change-password/LICENSE delete mode 100644 plugins/rest-change-password/README delete mode 100644 plugins/rest-change-password/RestChangePasswordDriver.php delete mode 100644 plugins/rest-change-password/VERSION delete mode 100644 plugins/rest-change-password/index.php delete mode 100644 plugins/vesta-change-password/LICENSE delete mode 100644 plugins/vesta-change-password/README delete mode 100644 plugins/vesta-change-password/VERSION delete mode 100644 plugins/vesta-change-password/VestaChangePasswordDriver.php delete mode 100644 plugins/vesta-change-password/index.php delete mode 100644 plugins/virtualmin-change-password/LICENSE delete mode 100644 plugins/virtualmin-change-password/README delete mode 100644 plugins/virtualmin-change-password/VERSION delete mode 100644 plugins/virtualmin-change-password/VirtualminChangePasswordDriver.php delete mode 100644 plugins/virtualmin-change-password/index.php delete mode 100755 plugins/vpopmail-change-password/ChangePasswordVpopmailDriver.php delete mode 100755 plugins/vpopmail-change-password/LICENSE delete mode 100755 plugins/vpopmail-change-password/VERSION delete mode 100755 plugins/vpopmail-change-password/index.php delete mode 100644 rainloop/v/0.0.0/app/libraries/RainLoop/Providers/ChangePassword/ChangePasswordInterface.php delete mode 100644 vendors/bootstrap/js/old.bootstrap.min.js delete mode 100644 vendors/bootstrap/js/old.bootstrap.min.orig.js delete mode 100644 vendors/jquery-nanoscroller/.code-changed delete mode 100644 vendors/jquery-nanoscroller/jquery.nanoscroller.js delete mode 100644 vendors/jquery-nanoscroller/jquery.nanoscroller.orig.js delete mode 100644 vendors/jquery-nanoscroller/jquery.nanoscroller.orig.min.js delete mode 100644 vendors/jquery-nanoscroller/nanoscroller.css diff --git a/dev/Common/Globals.js b/dev/Common/Globals.js index 6bc9cf504..305af7d27 100644 --- a/dev/Common/Globals.js +++ b/dev/Common/Globals.js @@ -65,17 +65,7 @@ export const bSafari = !bChrome && -1 < sUserAgent.indexOf('safari'); /** * @type {boolean} */ -export const bMobileDevice = - (/android/i).test(sUserAgent) || - (/iphone/i).test(sUserAgent) || - (/ipod/i).test(sUserAgent) || - (/ipad/i).test(sUserAgent) || - (/blackberry/i).test(sUserAgent); - -/** - * @type {boolean} - */ -export const bDisableNanoScroll = bMobileDevice; +export const bMobileDevice = (/android|iphone|ipod|ipad|blackberry|mobile/i).test(sUserAgent); /** * @type {boolean} diff --git a/dev/External/ko.js b/dev/External/ko.js index f7b11f48b..77e149734 100644 --- a/dev/External/ko.js +++ b/dev/External/ko.js @@ -711,22 +711,6 @@ ko.bindingHandlers.droppable = { } }; -ko.bindingHandlers.nano = { - init: (element) => { - const Globals = require('Common/Globals'), - Settings = require('Storage/Settings'); - - if (!Globals.bDisableNanoScroll && !Settings.appSettingsGet('useNativeScrollbars')) { - $(element) - .addClass('nano') - .nanoScroller({ - iOSNativeScrolling: false, - preventPageScrolling: true - }); - } - } -}; - ko.bindingHandlers.saveTrigger = { init: (element) => { const $el = $(element); diff --git a/dev/Remote/User/Ajax.js b/dev/Remote/User/Ajax.js index 0b5917f65..59ffdea93 100644 --- a/dev/Remote/User/Ajax.js +++ b/dev/Remote/User/Ajax.js @@ -721,18 +721,6 @@ class RemoteUserAjax extends AbstractAjaxRemote { }; } - /** - * @param {?Function} fCallback - * @param {string} prevPassword - * @param {string} newPassword - */ - changePassword(fCallback, prevPassword, newPassword) { - this.defaultRequest(fCallback, 'ChangePassword', { - 'PrevPassword': prevPassword, - 'NewPassword': newPassword - }); - } - /** * @param {?Function} fCallback * @param {string} sFolderFullNameRaw diff --git a/dev/Screen/User/Settings.js b/dev/Screen/User/Settings.js index 59a905fe2..d3e12eea4 100644 --- a/dev/Screen/User/Settings.js +++ b/dev/Screen/User/Settings.js @@ -16,7 +16,6 @@ import { ContactsUserSettings } from 'Settings/User/Contacts'; import { AccountsUserSettings } from 'Settings/User/Accounts'; import { FiltersUserSettings } from 'Settings/User/Filters'; import { SecurityUserSettings } from 'Settings/User/Security'; -import { ChangePasswordUserSettings } from 'Settings/User/ChangePassword'; import { TemplatesUserSettings } from 'Settings/User/Templates'; import { FoldersUserSettings } from 'Settings/User/Folders'; import { ThemesUserSettings } from 'Settings/User/Themes'; @@ -79,15 +78,6 @@ class SettingsUserScreen extends AbstractSettingsScreen { addSettingsViewModel(SecurityUserSettings, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security'); } - if (Settings.settingsGet('ChangePasswordIsAllowed')) { - addSettingsViewModel( - ChangePasswordUserSettings, - 'SettingsChangePassword', - 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', - 'change-password' - ); - } - if (Settings.capa(Capa.Templates)) { addSettingsViewModel( TemplatesUserSettings, diff --git a/dev/Settings/User/ChangePassword.js b/dev/Settings/User/ChangePassword.js deleted file mode 100644 index e737ffe85..000000000 --- a/dev/Settings/User/ChangePassword.js +++ /dev/null @@ -1,104 +0,0 @@ -import _ from '_'; -import ko from 'ko'; - -import { StorageResultType, Notification } from 'Common/Enums'; -import { getNotificationFromResponse, i18n } from 'Common/Translator'; - -import Remote from 'Remote/User/Ajax'; - -import { getApp } from 'Helper/Apps/User'; -import { command } from 'Knoin/Knoin'; - -class ChangePasswordUserSettings { - constructor() { - this.changeProcess = ko.observable(false); - - this.errorDescription = ko.observable(''); - this.passwordMismatch = ko.observable(false); - this.passwordUpdateError = ko.observable(false); - this.passwordUpdateSuccess = ko.observable(false); - - this.currentPassword = ko.observable(''); - this.currentPassword.error = ko.observable(false); - this.newPassword = ko.observable(''); - this.newPassword2 = ko.observable(''); - - this.currentPassword.subscribe(() => { - this.passwordUpdateError(false); - this.passwordUpdateSuccess(false); - this.currentPassword.error(false); - }); - - this.newPassword.subscribe(() => { - this.passwordUpdateError(false); - this.passwordUpdateSuccess(false); - this.passwordMismatch(false); - }); - - this.newPassword2.subscribe(() => { - this.passwordUpdateError(false); - this.passwordUpdateSuccess(false); - this.passwordMismatch(false); - }); - - this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this); - } - - @command( - (self) => - !self.changeProcess() && '' !== self.currentPassword() && '' !== self.newPassword() && '' !== self.newPassword2() - ) - saveNewPasswordCommand() { - if (this.newPassword() !== this.newPassword2()) { - this.passwordMismatch(true); - this.errorDescription(i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH')); - } else { - this.changeProcess(true); - - this.passwordUpdateError(false); - this.passwordUpdateSuccess(false); - this.currentPassword.error(false); - this.passwordMismatch(false); - this.errorDescription(''); - - Remote.changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword()); - } - } - - onHide() { - this.changeProcess(false); - this.currentPassword(''); - this.newPassword(''); - this.newPassword2(''); - this.errorDescription(''); - this.passwordMismatch(false); - this.currentPassword.error(false); - } - - onChangePasswordResponse(result, data) { - this.changeProcess(false); - this.passwordMismatch(false); - this.errorDescription(''); - this.currentPassword.error(false); - - if (StorageResultType.Success === result && data && data.Result) { - this.currentPassword(''); - this.newPassword(''); - this.newPassword2(''); - - this.passwordUpdateSuccess(true); - this.currentPassword.error(false); - - getApp().setClientSideToken(data.Result); - } else { - if (data && Notification.CurrentPasswordIncorrect === data.ErrorCode) { - this.currentPassword.error(true); - } - - this.passwordUpdateError(true); - this.errorDescription(getNotificationFromResponse(data, Notification.CouldNotSaveNewPassword)); - } - } -} - -export { ChangePasswordUserSettings, ChangePasswordUserSettings as default }; diff --git a/dev/Styles/@Main.less b/dev/Styles/@Main.less index 8915d30f5..d1166e5b0 100644 --- a/dev/Styles/@Main.less +++ b/dev/Styles/@Main.less @@ -50,7 +50,6 @@ @import "Ui.less"; @import "Main.less"; @import "Layout.less"; -@import "Scroll.less"; @import "Components.less"; @import "SystemDropDown.less"; @import "Login.less"; diff --git a/dev/Styles/Scroll.less b/dev/Styles/Scroll.less deleted file mode 100644 index 6501c8f41..000000000 --- a/dev/Styles/Scroll.less +++ /dev/null @@ -1,38 +0,0 @@ - -.nano.scroller-shadow-top:before, .nano.scroller-shadow-bottom:after { - content: ""; - position: absolute; - left: 0; - width: 100%; - height: 10px; - z-index: 102; - box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.4); -} - -.nano.scroller-shadow-top:before { - top: -10px; -} - -.nano.scroller-shadow-bottom:after { - bottom: -10px; -} - -.nano.fixIndex.scroller-shadow-top:before, .nano.fixIndex.scroller-shadow-bottom:after { - z-index: 98; -} - -/* -.nano { - .pane .slider { - .transition(top 0.1s ease-out); - } - - .pane2 .slider2 { - .transition(left 0.1s ease-out); - } - - .pane.active .slider, .pane2.active .slider2 { - .transition(none); - } -} -*/ diff --git a/dev/boot.js b/dev/boot.js index 71257f00c..1500f9543 100644 --- a/dev/boot.js +++ b/dev/boot.js @@ -1,9 +1,3 @@ -import elementDatasetPolyfill from 'element-dataset'; -elementDatasetPolyfill(); - -require('json3'); -require('intersection-observer'); - import window from 'window'; import { progressJs } from '../vendors/Progress.js/src/progress.js'; diff --git a/dev/polyfills.js b/dev/polyfills.js deleted file mode 100644 index 61fbc36b2..000000000 --- a/dev/polyfills.js +++ /dev/null @@ -1,5 +0,0 @@ -import 'core-js/features/object/assign'; -import 'core-js/features/array/includes'; -import 'core-js/features/string/includes'; -import 'core-js/features/promise'; -import 'raf/polyfill'; diff --git a/package.json b/package.json index a1114eb16..8ffb34a7c 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "@babel/core": "7.8.4", "@babel/plugin-proposal-class-properties": "7.8.3", "@babel/plugin-proposal-decorators": "7.8.3", - "@babel/plugin-transform-runtime": "7.8.3", "@babel/preset-env": "7.8.4", "@babel/runtime-corejs3": "7.8.4", "autolinker": "3.11.1", @@ -57,9 +56,7 @@ "babel-loader": "8.0.6", "classnames": "2.2.6", "copy-webpack-plugin": "5.1.1", - "core-js": "3.6.4", "css-loader": "3.4.2", - "element-dataset": "2.2.6", "emailjs-addressparser": "2.0.2", "eslint": "6.8.0", "eslint-config-prettier": "6.10.0", @@ -85,24 +82,17 @@ "gulp-size": "3.0.0", "gulp-sourcemaps": "2.6.5", "gulp-stripbom": "1.0.5", + "gulp-terser": "^1.2.0", "gulp-through": "0.4.0", - "gulp-uglify": "3.0.2", "gulp-util": "3.0.8", "gulp-zip": "5.0.1", "ifvisible.js": "1.0.6", - "intersection-observer": "0.7.0", "jquery": "3.4.1", "jquery-backstretch": "2.1.18", - "jquery-migrate": "3.1.0", - "jquery-mousewheel": "3.1.13", - "jquery-scrollstop": "1.2.0", "js-cookie": "2.2.1", - "json-loader": "0.5.7", - "json3": "3.3.3", "knockout": "3.4.2", "knockout-sortable": "1.2.0", "lozad": "1.14.0", - "matchmedia-polyfill": "0.3.2", "moment": "2.24.0", "node-fs": "0.1.7", "normalize.css": "8.0.1", @@ -110,7 +100,6 @@ "opentip": "2.4.3", "pikaday": "1.8.0", "prettier": "1.19.1", - "raf": "3.4.1", "raw-loader": "4.0.0", "rimraf": "3.0.1", "simplestatemanager": "4.1.1", @@ -118,5 +107,6 @@ "underscore": "1.9.2", "webpack": "4.41.5", "webpack-cli": "3.3.10" - } + }, + "dependencies": {} } diff --git a/plugins/change-password-custom-sql/ChangePasswordCustomSqlDriver.php b/plugins/change-password-custom-sql/ChangePasswordCustomSqlDriver.php deleted file mode 100644 index 3185778fa..000000000 --- a/plugins/change-password-custom-sql/ChangePasswordCustomSqlDriver.php +++ /dev/null @@ -1,237 +0,0 @@ -mHost = $mHost; - return $this; - } - - /** - * @param string $mUser - * - * @return \ChangePasswordCustomSqlDriver - */ - public function SetmUser($mUser) - { - $this->mUser = $mUser; - return $this; - } - - /** - * @param string $mPass - * - * @return \ChangePasswordCustomSqlDriver - */ - public function SetmPass($mPass) - { - $this->mPass = $mPass; - return $this; - } - - /** - * @param string $mDatabase - * - * @return \ChangePasswordCustomSqlDriver - */ - public function SetmDatabase($mDatabase) - { - $this->mDatabase = $mDatabase; - return $this; - } - - /** - * @param string $mTable - * - * @return \ChangePasswordCustomSqlDriver - */ - public function SetmTable($mTable) - { - $this->mTable = $mTable; - return $this; - } - - /** - * @param string $mSql - * - * @return \ChangePasswordCustomSqlDriver - */ - public function SetmSql($mSql) - { - $this->mSql = $mSql; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \ChangePasswordCustomSqlDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email(); - } - - /** - * @param \RainLoop\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('Try to change password for '.$oAccount->Email()); - } - - $bResult = false; - - $dsn = 'mysql:host='.$this->mHost.';dbname='.$this->mDatabase.';charset=utf8'; - $options = array( - PDO::ATTR_EMULATE_PREPARES => true, - PDO::ATTR_PERSISTENT => true, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION - ); - - try - { - $conn = new PDO($dsn,$this->mUser,$this->mPass,$options); - - //prepare SQL varaibles - $sEmail = $oAccount->Email(); - $sEmailUser = \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail); - $sEmailDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail); - - // some variables cannot be prepared - $this->mSql = str_replace(array( - ':table' - ), array( - $this->mTable - ), $this->mSql); - - $placeholders = array( - ':email' => $sEmail, - ':oldpass' => $sPrevPassword, - ':newpass' => $sNewPassword, - ':domain' => $sEmailDomain, - ':username' => $sEmailUser - ); - - // we have to check that all placehoders are used in the query, passing any unused placeholders will generate an error - $used_placeholders = array(); - - foreach($placeholders as $placeholder => $value) { - if(preg_match_all('/'.$placeholder . '(?![a-zA-Z0-9\-])'.'/', $this->mSql) === 1) { - // backwards-compabitibility: remove single and double quotes around placeholders - $this->mSql = str_replace('`'.$placeholder.'`', $placeholder, $this->mSql); - $this->mSql = str_replace("'".$placeholder."'", $placeholder, $this->mSql); - $this->mSql = str_replace('"'.$placeholder.'"', $placeholder, $this->mSql); - $used_placeholders[$placeholder] = $value; - } - } - - $statement = $conn->prepare($this->mSql); - - // everything is ready (hopefully), bind the values - foreach($used_placeholders as $placeholder => $value) { - $statement->bindValue($placeholder, $value); - } - - // and execute - $mSqlReturn = $statement->execute(); - - /* can be used for debugging - ob_start(); - $statement->debugDumpParams(); - $r = ob_get_contents(); - ob_end_clean(); - $this->oLogger->Write($r); - */ - - if ($mSqlReturn == true) - { - $bResult = true; - if ($this->oLogger) - { - $this->oLogger->Write('Success! Password changed.'); - } - } - else - { - $bResult = false; - if ($this->oLogger) - { - $this->oLogger->Write('Something went wrong. Either current password is incorrect, or new password does not match criteria.'); - } - } - } - catch (\Exception $oException) - { - $bResult = false; - if ($this->oLogger) - { - $this->oLogger->WriteException($oException); - } - } - - return $bResult; - } -} diff --git a/plugins/change-password-custom-sql/LICENSE b/plugins/change-password-custom-sql/LICENSE deleted file mode 100644 index b5bc06b1b..000000000 --- a/plugins/change-password-custom-sql/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Martin Vilimovsky (vilimovsky@mvcs.cz) - -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. diff --git a/plugins/change-password-custom-sql/README b/plugins/change-password-custom-sql/README deleted file mode 100644 index b35d488fb..000000000 --- a/plugins/change-password-custom-sql/README +++ /dev/null @@ -1 +0,0 @@ -You can use your own SQL (MySQL) statement (with wildcards) to change password \ No newline at end of file diff --git a/plugins/change-password-custom-sql/README.md b/plugins/change-password-custom-sql/README.md deleted file mode 100644 index df03331b8..000000000 --- a/plugins/change-password-custom-sql/README.md +++ /dev/null @@ -1,10 +0,0 @@ -Rainloop change password custom mysql plugin -============================================ - -This plugin adds change password capability to Rainloop webmail by write your own SQL statement - -##### Installation is simple: - -1. Drop the change-password-custom-sql in the plugins directory (eg. _RainLoopDir_/data/data_xxxxx/_default/plugins/*) -2. In rainloop admin panel go to Plugins, and activate change-password-custom-sql. -3. Enter mysql details on the plugin config screen. diff --git a/plugins/change-password-custom-sql/VERSION b/plugins/change-password-custom-sql/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/change-password-custom-sql/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/change-password-custom-sql/index.php b/plugins/change-password-custom-sql/index.php deleted file mode 100644 index 1c86584d1..000000000 --- a/plugins/change-password-custom-sql/index.php +++ /dev/null @@ -1,53 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - include_once __DIR__.'/ChangePasswordCustomSqlDriver.php'; - $oProvider = new ChangePasswordCustomSqlDriver(); - $oProvider - ->SetLogger($this->Manager()->Actions()->Logger()) - ->SetmHost($this->Config()->Get('plugin', 'mHost', '')) - ->SetmUser($this->Config()->Get('plugin', 'mUser', '')) - ->SetmPass($this->Config()->Get('plugin', 'mPass', '')) - ->SetmDatabase($this->Config()->Get('plugin', 'mDatabase', '')) - ->SetmTable($this->Config()->Get('plugin', 'mTable', '')) - ->SetmSql($this->Config()->Get('plugin', 'mSql', '')) - ; - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('mHost')->SetLabel('MySQL Host') - ->SetDefaultValue('127.0.0.1'), - \RainLoop\Plugins\Property::NewInstance('mUser')->SetLabel('MySQL User'), - \RainLoop\Plugins\Property::NewInstance('mPass')->SetLabel('MySQL Password') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD), - \RainLoop\Plugins\Property::NewInstance('mDatabase')->SetLabel('MySQL Database'), - \RainLoop\Plugins\Property::NewInstance('mTable')->SetLabel('MySQL Table'), - \RainLoop\Plugins\Property::NewInstance('mSql')->SetLabel('SQL statement') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('SQL statement (allowed wildcards :table, :email, :oldpass, :newpass, :domain, :username). Use SQL functions for encryption.') - ->SetDefaultValue('UPDATE :table SET password = md5(:newpass) WHERE domain = :domain AND username = :username and oldpass = md5(:oldpass)') - ); - } -} diff --git a/plugins/change-password-cyberpanel/ChangePasswordCyberPanel.php b/plugins/change-password-cyberpanel/ChangePasswordCyberPanel.php deleted file mode 100644 index 0fc1037e3..000000000 --- a/plugins/change-password-cyberpanel/ChangePasswordCyberPanel.php +++ /dev/null @@ -1,138 +0,0 @@ -mHost = $mHost; - return $this; - } - - /** - * @param string $mUser - * - * @return \ChangePasswordCyberPanel - */ - public function SetmUser($mUser) - { - $this->mUser = $mUser; - return $this; - } - - /** - * @param string $mPass - * - * @return \ChangePasswordCyberPanel - */ - public function SetmPass($mPass) - { - $this->mPass = $mPass; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \ChangePasswordCyberPanel - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email(); - } - - /** - * @param \RainLoop\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('Try to change password for '.$oAccount->Email()); - } - - $bResult = false; - $db = mysqli_connect($this->mHost, $this->mUser, $this->mPass, 'cyberpanel'); - - try - { - $sEmail = mysqli_real_escape_string($db, $oAccount->Email()); - $sEmailUser = mysqli_real_escape_string($db, \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail)); - $sEmailDomain = mysqli_real_escape_string($db, \MailSo\Base\Utils::GetDomainFromEmail($sEmail)); - - $password_check_query = "SELECT * FROM e_users WHERE emailOwner_id = '$sEmailDomain' AND email = '$sEmail'"; - $result = mysqli_query($db, $password_check_query); - $password_check = mysqli_fetch_assoc($result); - - if (password_verify($sPrevPassword, substr($password_check['password'], 7))) { - $hashed_password = mysqli_real_escape_string($db, '{CRYPT}'.password_hash($sNewPassword, PASSWORD_BCRYPT, ['cost' => 12,])); - $password_update_query = "UPDATE e_users SET password = '$hashed_password' WHERE emailOwner_id = '$sEmailDomain' AND email = '$sEmail'"; - mysqli_query($db, $password_update_query); - $bResult = true; - if ($this->oLogger) - { - $this->oLogger->Write('Success! The password was changed.'); - } - } else { - $bResult = false; - if ($this->oLogger) - { - $this->oLogger->Write('Something went wrong. Either the current password is incorrect or the new password does not meet the criteria.'); - } - } - } - catch (\Exception $oException) - { - $bResult = false; - if ($this->oLogger) - { - $this->oLogger->WriteException($oException); - } - } - - return $bResult; - } -} diff --git a/plugins/change-password-cyberpanel/LICENSE b/plugins/change-password-cyberpanel/LICENSE deleted file mode 100644 index 67b1540b2..000000000 --- a/plugins/change-password-cyberpanel/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 David Forbush - -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. diff --git a/plugins/change-password-cyberpanel/README b/plugins/change-password-cyberpanel/README deleted file mode 100644 index 0d410bb23..000000000 --- a/plugins/change-password-cyberpanel/README +++ /dev/null @@ -1 +0,0 @@ -This plugin allows you to change passwords of email accounts managed by CyberPanel web panel software diff --git a/plugins/change-password-cyberpanel/README.md b/plugins/change-password-cyberpanel/README.md deleted file mode 100644 index 6bf3ae2d0..000000000 --- a/plugins/change-password-cyberpanel/README.md +++ /dev/null @@ -1,10 +0,0 @@ -RainLoop CyberPanel Password Changing Plugin -============================================ - -This plugin adds password changing capability to RainLoop webmail for servers running CyberPanel web panel software. - -##### Installation is simple: - -1. Place the change-password-cyberpanel folder in the plugins directory (e.g. _RainLoopDir_/data/data_xxxxx/_default/plugins/*). -2. In RainLoop administration panel, go to Plugins and activate change-password-cyberpanel. -3. Enter CyberPanel's SQL user details on the plugin configuration screen. diff --git a/plugins/change-password-cyberpanel/VERSION b/plugins/change-password-cyberpanel/VERSION deleted file mode 100644 index 9459d4ba2..000000000 --- a/plugins/change-password-cyberpanel/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 diff --git a/plugins/change-password-cyberpanel/index.php b/plugins/change-password-cyberpanel/index.php deleted file mode 100644 index 105339f8b..000000000 --- a/plugins/change-password-cyberpanel/index.php +++ /dev/null @@ -1,44 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - include_once __DIR__.'/ChangePasswordCyberPanel.php'; - $oProvider = new ChangePasswordCyberPanel(); - $oProvider - ->SetLogger($this->Manager()->Actions()->Logger()) - ->SetmHost($this->Config()->Get('plugin', 'mHost', '')) - ->SetmUser($this->Config()->Get('plugin', 'mUser', '')) - ->SetmPass($this->Config()->Get('plugin', 'mPass', '')) - ; - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('mHost')->SetLabel('MySQL Host') - ->SetDefaultValue('127.0.0.1'), - \RainLoop\Plugins\Property::NewInstance('mUser')->SetLabel('MySQL User'), - \RainLoop\Plugins\Property::NewInstance('mPass')->SetLabel('MySQL Password') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD) - ); - } -} diff --git a/plugins/change-password-example/ChangePasswordExampleDriver.php b/plugins/change-password-example/ChangePasswordExampleDriver.php deleted file mode 100644 index 1ffd3f3a9..000000000 --- a/plugins/change-password-example/ChangePasswordExampleDriver.php +++ /dev/null @@ -1,47 +0,0 @@ -sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \RainLoop\Model\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Model\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - $bResult = false; - - // TODO - - return $bResult; - } -} \ No newline at end of file diff --git a/plugins/change-password-example/LICENSE b/plugins/change-password-example/LICENSE deleted file mode 100644 index 271342337..000000000 --- a/plugins/change-password-example/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 RainLoop Team - -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. diff --git a/plugins/change-password-example/VERSION b/plugins/change-password-example/VERSION deleted file mode 100644 index b123147e2..000000000 --- a/plugins/change-password-example/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 \ No newline at end of file diff --git a/plugins/change-password-example/index.php b/plugins/change-password-example/index.php deleted file mode 100644 index 7e6a6b13a..000000000 --- a/plugins/change-password-example/index.php +++ /dev/null @@ -1,41 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - include_once __DIR__.'/ChangePasswordExampleDriver.php'; - - $oProvider = new ChangePasswordExampleDriver(); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} \ No newline at end of file diff --git a/plugins/cpanel-change-password/CpanelChangePasswordDriver.php b/plugins/cpanel-change-password/CpanelChangePasswordDriver.php deleted file mode 100644 index 310dfe27a..000000000 --- a/plugins/cpanel-change-password/CpanelChangePasswordDriver.php +++ /dev/null @@ -1,188 +0,0 @@ -sHost = $sHost; - $this->iPost = $iPost; - $this->bSsl = !!$bSsl; - $this->sUser = $sUser; - $this->sPassword = $sPassword; - - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \CpanelChangePasswordDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \CpanelChangePasswordDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Model\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Model\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('Try to change password for '.$oAccount->Email()); - } - - if (!\class_exists('xmlapi')) - { - include_once __DIR__.'/xmlapi.php'; - } - - $bResult = false; - if (!empty($this->sHost) && 0 < $this->iPost && - 0 < \strlen($this->sUser) && 0 < \strlen($this->sPassword) && - $oAccount && \class_exists('xmlapi')) - { - $sEmail = $oAccount->Email(); - $sEmailUser = \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail); - $sEmailDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail); - - $sHost = $this->sHost; - $sHost = \str_replace('{user:domain}', $sEmailDomain, $sHost); - - $sUser = $this->sUser; - $sUser = \str_replace('{user:email}', $sEmail, $sUser); - $sUser = \str_replace('{user:login}', $sEmailUser, $sUser); - - $sPassword = $this->sPassword; - $sPassword = \str_replace('{user:password}', $oAccount->Password(), $sPassword); - - try - { - $oXmlApi = new \xmlapi($sHost); - $oXmlApi->set_port($this->iPost); - $oXmlApi->set_protocol($this->bSsl ? 'https' : 'http'); - $oXmlApi->set_debug(false); - $oXmlApi->set_output('json'); -// $oXmlApi->set_http_client('fopen'); - $oXmlApi->set_http_client('curl'); - $oXmlApi->password_auth($sUser, $sPassword); - - $aArgs = array( - 'email' => $sEmailUser, - 'domain' => $sEmailDomain, - 'password' => $sNewPassword - ); - - $sResult = $oXmlApi->api2_query($sUser, 'Email', 'passwdpop', $aArgs); - if ($sResult) - { - if ($this->oLogger) - { - $this->oLogger->Write('CPANEL: '.$sResult, \MailSo\Log\Enumerations\Type::INFO); - } - - $aResult = @\json_decode($sResult, true); - $bResult = isset($aResult['cpanelresult']['data'][0]['result']) && - !!$aResult['cpanelresult']['data'][0]['result']; - } - - if (!$bResult && $this->oLogger) - { - $this->oLogger->Write('CPANEL: '.$sResult, \MailSo\Log\Enumerations\Type::ERROR); - } - } - catch (\Exception $oException) - { - if ($this->oLogger) - { - $this->oLogger->WriteException($oException); - } - } - } - else - { - if ($this->oLogger) - { - $this->oLogger->Write('CPANEL: Incorrent configuration data', \MailSo\Log\Enumerations\Type::ERROR); - } - } - - return $bResult; - } -} \ No newline at end of file diff --git a/plugins/cpanel-change-password/LICENSE b/plugins/cpanel-change-password/LICENSE deleted file mode 100644 index 271342337..000000000 --- a/plugins/cpanel-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 RainLoop Team - -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. diff --git a/plugins/cpanel-change-password/VERSION b/plugins/cpanel-change-password/VERSION deleted file mode 100644 index a58941b07..000000000 --- a/plugins/cpanel-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.3 \ No newline at end of file diff --git a/plugins/cpanel-change-password/index.php b/plugins/cpanel-change-password/index.php deleted file mode 100644 index 5f2602bdb..000000000 --- a/plugins/cpanel-change-password/index.php +++ /dev/null @@ -1,65 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - $sHost = \trim($this->Config()->Get('plugin', 'host', '')); - $iPost = (int) $this->Config()->Get('plugin', 'port', 2087); - $sUser = (string) $this->Config()->Get('plugin', 'user', ''); - $sPassword = (string) $this->Config()->Get('plugin', 'password', ''); - $bSsl = (bool) $this->Config()->Get('plugin', 'ssl', false); - - if (!empty($sHost) && 0 < $iPost && 0 < \strlen($sUser) && 0 < \strlen($sPassword)) - { - include_once __DIR__.'/CpanelChangePasswordDriver.php'; - - $oProvider = new CpanelChangePasswordDriver(); - $oProvider->SetLogger($this->Manager()->Actions()->Logger()); - $oProvider->SetConfig($sHost, $iPost, $bSsl, $sUser, $sPassword); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - } - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('host')->SetLabel('cPanel Host') - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('port')->SetLabel('cPanel Port') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::INT) - ->SetDefaultValue(2087), - \RainLoop\Plugins\Property::NewInstance('ssl')->SetLabel('Use SSL') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL) - ->SetDefaultValue(false), - \RainLoop\Plugins\Property::NewInstance('user')->SetLabel('cPanel User') - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('password')->SetLabel('cPanel Password') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD) - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} \ No newline at end of file diff --git a/plugins/cpanel-change-password/xmlapi.php b/plugins/cpanel-change-password/xmlapi.php deleted file mode 100644 index 88b85c826..000000000 --- a/plugins/cpanel-change-password/xmlapi.php +++ /dev/null @@ -1,2490 +0,0 @@ -set_hash("username", $accessHash); -* $xmlapi->set_password("username", "password"); -* -* 3.) Execute a function -* $xmlapi->listaccts(); -* -* @category Cpanel -* @package xmlapi -* @copyright 2012 cPanel, Inc. -* @license http://sdk.cpanel.net/license/bsd.html -* @version Release: 1.0.13 -* @link http://twiki.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/XmlApi -* @since Class available since release 0.1 -**/ - -class xmlapi -{ - // should debugging statements be printed? - private $debug = false; - - // The host to connect to - private $host = '127.0.0.1'; - - // the port to connect to - private $port = '2087'; - - // should be the literal strings http or https - private $protocol = 'https'; - - // output that should be given by the xml-api - private $output = 'simplexml'; - - // literal strings hash or password - private $auth_type = null; - - // the actual password or hash - private $auth = null; - - // username to authenticate as - private $user = null; - - // The HTTP Client to use - - private $http_client = 'curl'; - - /** - * Instantiate the XML-API Object - * All parameters to this function are optional and can be set via the accessor functions or constants - * This defaults to password auth, however set_hash can be used to use hash authentication - * - * @param string $host The host to perform queries on - * @param string $user The username to authenticate as - * @param string $password The password to authenticate with - * @return Xml_Api object - */ - public function __construct($host = null, $user = null, $password = null ) - { - // Check if debugging must be enabled - if ( (defined('XMLAPI_DEBUG')) && (XMLAPI_DEBUG == '1') ) { - $this->debug = true; - } - - // Check if raw xml output must be enabled - if ( (defined('XMLAPI_RAW_XML')) && (XMLAPI_RAW_XML == '1') ) { - $this->raw_xml = true; - } - - /** - * Authentication - * This can either be passed at this point or by using the set_hash or set_password functions - **/ - - if ( ( defined('XMLAPI_USER') ) && ( strlen(XMLAPI_USER) > 0 ) ) { - $this->user = XMLAPI_USER; - - // set the authtype to pass and place the password in $this->pass - if ( ( defined('XMLAPI_PASS') ) && ( strlen(XMLAPI_PASS) > 0 ) ) { - $this->auth_type = 'pass'; - $this->auth = XMLAPI_PASS; - } - - // set the authtype to hash and place the hash in $this->auth - if ( ( defined('XMLAPI_HASH') ) && ( strlen(XMLAPI_HASH) > 0 ) ) { - $this->auth_type = 'hash'; - $this->auth = preg_replace("/(\n|\r|\s)/", '', XMLAPI_HASH); - } - - // Throw warning if XMLAPI_HASH and XMLAPI_PASS are defined - if ( ( ( defined('XMLAPI_HASH') ) && ( strlen(XMLAPI_HASH) > 0 ) ) - && ( ( defined('XMLAPI_PASS') ) && ( strlen(XMLAPI_PASS) > 0 ) ) ) { - error_log('warning: both XMLAPI_HASH and XMLAPI_PASS are defined, defaulting to XMLAPI_HASH'); - } - - - // Throw a warning if XMLAPI_HASH and XMLAPI_PASS are undefined and XMLAPI_USER is defined - if ( !(defined('XMLAPI_HASH') ) || !defined('XMLAPI_PASS') ) { - error_log('warning: XMLAPI_USER set but neither XMLAPI_HASH or XMLAPI_PASS have not been defined'); - } - - } - - if ( ( $user != null ) && ( strlen( $user ) < 9 ) ) { - $this->user = $user; - } - - if ($password != null) { - $this->set_password($password); - } - - /** - * Connection - * - * $host/XMLAPI_HOST should always be equal to either the IP of the server or it's hostname - */ - - // Set the host, error if not defined - if ($host == null) { - if ( (defined('XMLAPI_HOST')) && (strlen(XMLAPI_HOST) > 0) ) { - $this->host = XMLAPI_HOST; - } else { - throw new Exception("No host defined"); - } - } else { - $this->host = $host; - } - - // disabling SSL is probably a bad idea.. just saying. - if ( defined('XMLAPI_USE_SSL' ) && (XMLAPI_USE_SSL == '0' ) ) { - $this->protocol = "http"; - } - - // Detemine what the default http client should be. - if ( function_exists('curl_setopt') ) { - $this->http_client = "curl"; - } elseif ( ini_get('allow_url_fopen') ) { - $this->http_client = "fopen"; - } else { - throw new Exception('allow_url_fopen and curl are neither available in this PHP configuration'); - } - - } - - /** - * Accessor Functions - **/ - /** - * Return whether the debug option is set within the object - * - * @return boolean - * @see set_debug() - */ - public function get_debug() - { - return $this->debug; - } - - /** - * Turn on debug mode - * - * Enabling this option will cause this script to print debug information such as - * the queries made, the response XML/JSON and other such pertinent information. - * Calling this function without any parameters will enable debug mode. - * - * @param bool $debug turn on or off debug mode - * @see get_debug() - */ - public function set_debug( $debug = 1 ) - { - $this->debug = $debug; - } - - /** - * Get the host being connected to - * - * This function will return the host being connected to - * @return string host - * @see set_host() - */ - public function get_host() - { - return $this->host; - } - - /** - * Set the host to query - * - * Setting this will set the host to be queried - * @param string $host The host to query - * @see get_host() - */ - public function set_host( $host ) - { - $this->host = $host; - } - - /** - * Get the port to connect to - * - * This will return which port the class is connecting to - * @return int $port - * @see set_port() - */ - public function get_port() - { - return $this->port; - } - - /** - * Set the port to connect to - * - * This will allow a user to define which port needs to be connected to. - * The default port set within the class is 2087 (WHM-SSL) however other ports are optional - * this function will automatically set the protocol to http if the port is equal to: - * - 2082 - * - 2086 - * - 2095 - * - 80 - * @param int $port the port to connect to - * @see set_protocol() - * @see get_port() - */ - public function set_port( $port ) - { - if ( !is_int( $port ) ) { - $port = intval($port); - } - - if ($port < 1 || $port > 65535) { - throw new Exception('non integer or negative integer passed to set_port'); - } - - // Account for ports that are non-ssl - if ($port == '2086' || $port == '2082' || $port == '80' || $port == '2095') { - $this->set_protocol('http'); - } - - $this->port = $port; - } - - /** - * Return the protocol being used to query - * - * This will return the protocol being connected to - * @return string - * @see set_protocol() - */ - public function get_protocol() - { - return $this->protocol; - } - - /** - * Set the protocol to use to query - * - * This will allow you to set the protocol to query cpsrvd with. The only to acceptable values - * to be passed to this function are 'http' or 'https'. Anything else will cause the class to throw - * an Exception. - * @param string $proto the protocol to use to connect to cpsrvd - * @see get_protocol() - */ - public function set_protocol( $proto ) - { - if ($proto != 'https' && $proto != 'http') { - throw new Exception('https and http are the only protocols that can be passed to set_protocol'); - } - $this->protocol = $proto; - } - - /** - * Return what format calls with be returned in - * - * This function will return the currently set output format - * @see set_output() - * @return string - */ - public function get_output() - { - return $this->output; - } - - /** - * Set the output format for call functions - * - * This class is capable of returning data in numerous formats including: - * - json - * - xml - * - {@link http://php.net/simplexml SimpleXML} - * - {@link http://us.php.net/manual/en/language.types.array.php Associative Arrays} - * - * These can be set by passing this class any of the following values: - * - json - return JSON string - * - xml - return XML string - * - simplexml - return SimpleXML object - * - array - Return an associative array - * - * Passing any value other than these to this class will cause an Exception to be thrown. - * @param string $output the output type to be set - * @see get_output() - */ - public function set_output( $output ) - { - if ($output != 'json' && $output != 'xml' && $output != 'array' && $output != 'simplexml') { - throw new Exception('json, xml, array and simplexml are the only allowed values for set_output'); - } - $this->output = $output; - } - - /** - * Return the auth_type being used - * - * This function will return a string containing the auth type in use - * @return string auth type - * @see set_auth_type() - */ - public function get_auth_type() - { - return $this->auth_type; - } - - /** - * Set the auth type - * - * This class is capable of authenticating with both hash auth and password auth - * This function will allow you to manually set which auth_type you are using. - * - * the only accepted parameters for this function are "hash" and "pass" anything else will cuase - * an exception to be thrown - * - * @see set_password() - * @see set_hash() - * @see get_auth_type() - * @param string auth_type the auth type to be set - */ - public function set_auth_type( $auth_type ) - { - if ($auth_type != 'hash' && $auth_type != 'pass') { - throw new Exception('the only two allowable auth types arehash and path'); - } - $this->auth_type = $auth_type; - } - - /** - * Set the password to be autenticated with - * - * This will set the password to be authenticated with, the auth_type will be automatically adjusted - * when this function is used - * - * @param string $pass the password to authenticate with - * @see set_hash() - * @see set_auth_type() - * @see set_user() - */ - public function set_password( $pass ) - { - $this->auth_type = 'pass'; - $this->auth = $pass; - } - - /** - * Set the hash to authenticate with - * - * This will set the hash to authenticate with, the auth_type will automatically be set when this function - * is used. This function will automatically strip the newlines from the hash. - * @param string $hash the hash to autenticate with - * @see set_password() - * @see set_auth_type() - * @see set_user() - */ - public function set_hash( $hash ) - { - $this->auth_type = 'hash'; - $this->auth = preg_replace("/(\n|\r|\s)/", '', $hash); - } - - /** - * Return the user being used for authtication - * - * This will return the username being authenticated against. - * - * @return string - */ - public function get_user() - { - return $this->user; - } - - /** - * Set the user to authenticate against - * - * This will set the user being authenticated against. - * @param string $user username - * @see set_password() - * @see set_hash() - * @see get_user() - */ - public function set_user( $user ) - { - $this->user = $user; - } - - /** - * Set the user and hash to be used for authentication - * - * This function will allow one to set the user AND hash to be authenticated with - * - * @param string $user username - * @param string $hash WHM Access Hash - * @see set_hash() - * @see set_user() - */ - public function hash_auth( $user, $hash ) - { - $this->set_hash( $hash ); - $this->set_user( $user ); - } - - /** - * Set the user and password to be used for authentication - * - * This function will allow one to set the user AND password to be authenticated with - * @param string $user username - * @param string $pass password - * @see set_pass() - * @see set_user() - */ - public function password_auth( $user, $pass ) - { - $this->set_password( $pass ); - $this->set_user( $user ); - } - - /** - * Return XML format - * - * this function will cause call functions to return XML format, this is the same as doing: - * set_output('xml') - * - * @see set_output() - */ - public function return_xml() - { - $this->set_output('xml'); - } - - /** - * Return simplexml format - * - * this function will cause all call functions to return simplexml format, this is the same as doing: - * set_output('simplexml') - * - * @see set_output() - */ - public function return_object() - { - $this->set_output('simplexml'); - } - - /** - * Set the HTTP client to use - * - * This class is capable of two types of HTTP Clients: - * - curl - * - fopen - * - * When using allow url fopen the class will use get_file_contents to perform the query - * The only two acceptable parameters for this function are 'curl' and 'fopen'. - * This will default to fopen, however if allow_url_fopen is disabled inside of php.ini - * it will switch to curl - * - * @param string client The http client to use - * @see get_http_client() - */ - - public function set_http_client( $client ) - { - if ( ( $client != 'curl' ) && ( $client != 'fopen' ) ) { - throw new Exception('only curl and fopen and allowed http clients'); - } - $this->http_client = $client; - } - - /** - * Get the HTTP Client in use - * - * This will return a string containing the HTTP client currently in use - * - * @see set_http_client() - * @return string - */ - public function get_http_client() - { - return $this->http_client; - } - - /* - * Query Functions - * -- - * This is where the actual calling of the XML-API, building API1 & API2 calls happens - */ - - /** - * Perform an XML-API Query - * - * This function will perform an XML-API Query and return the specified output format of the call being made - * - * @param string $function The XML-API call to execute - * @param array $vars An associative array of the parameters to be passed to the XML-API Calls - * @return mixed - */ - public function xmlapi_query( $function, $vars = array() ) - { - // Check to make sure all the data needed to perform the query is in place - if (!$function) { - throw new Exception('xmlapi_query() requires a function to be passed to it'); - } - - if ($this->user == null) { - throw new Exception('no user has been set'); - } - - if ($this->auth ==null) { - throw new Exception('no authentication information has been set'); - } - - // Build the query: - - $query_type = '/xml-api/'; - - if ($this->output == 'json') { - $query_type = '/json-api/'; - } - - $args = http_build_query($vars, '', '&'); - $url = $this->protocol . '://' . $this->host . ':' . $this->port . $query_type . $function; - - if ($this->debug) { - error_log('URL: ' . $url); - error_log('DATA: ' . $args); - } - - // Set the $auth string - - $authstr = ''; - if ($this->auth_type == 'hash') { - $authstr = 'Authorization: WHM ' . $this->user . ':' . $this->auth . "\r\n"; - } elseif ($this->auth_type == 'pass') { - $authstr = 'Authorization: Basic ' . base64_encode($this->user .':'. $this->auth) . "\r\n"; - } else { - throw new Exception('invalid auth_type set'); - } - - if ($this->debug) { - error_log("Authentication Header: " . $authstr ."\n"); - } - - // Perform the query (or pass the info to the functions that actually do perform the query) - - $response = ''; - if ($this->http_client == 'curl') { - $response = $this->curl_query($url, $args, $authstr); - } elseif ($this->http_client == 'fopen') { - $response = $this->fopen_query($url, $args, $authstr); - } - - // fix #1 - $aMatch = array(); - if ($response && false !== stripos($response, '') && - preg_match('/HTTP-EQUIV[\s]?=[\s]?"refresh"/i', $response) && - preg_match('/]+url[\s]?=[\s]?([^">]+)/i', $response, $aMatch) && - !empty($aMatch[1]) && 0 === strpos(trim($aMatch[1]), 'http')) - { - $url = trim($aMatch[1]) . $query_type . $function; - if ($this->debug) { - error_log('new URL: ' . $url); - } - - if ($this->http_client == 'curl') { - $response = $this->curl_query($url, $args, $authstr); - } elseif ($this->http_client == 'fopen') { - $response = $this->fopen_query($url, $args, $authstr); - } - } - // --- - - /* - * Post-Query Block - * Handle response, return proper data types, debug, etc - */ - - // print out the response if debug mode is enabled. - if ($this->debug) { - error_log("RESPONSE:\n " . $response); - } - - // The only time a response should contain is in the case of authentication error - // cPanel 11.25 fixes this issue, but if is in the response, we'll error out. - - if (stristr($response, '') == true) { - if (stristr($response, 'Login Attempt Failed') == true) { - error_log("Login Attempt Failed"); - - return; - } - if (stristr($response, 'action="/login/"') == true) { - error_log("Authentication Error"); - - return; - } - - return; - } - - - // perform simplexml transformation (array relies on this) - if ( ($this->output == 'simplexml') || $this->output == 'array') { - $response = simplexml_load_string($response, null, LIBXML_NOERROR | LIBXML_NOWARNING); - if (!$response) { - error_log("Some error message here"); - - return; - } - if ($this->debug) { - error_log("SimpleXML var_dump:\n" . print_r($response, true)); - } - } - - // perform array tranformation - if ($this->output == 'array') { - $response = $this->unserialize_xml($response); - if ($this->debug) { - error_log("Associative Array var_dump:\n" . print_r($response, true)); - } - } - - return $response; - } - - private function curl_query( $url, $postdata, $authstr ) - { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); - // Return contents of transfer on curl_exec - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - // Allow self-signed certs - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); - // Set the URL - curl_setopt($curl, CURLOPT_URL, $url); - // Increase buffer size to avoid "funny output" exception - curl_setopt($curl, CURLOPT_BUFFERSIZE, 131072); - - // Pass authentication header - $header[0] =$authstr . - "Content-Type: application/x-www-form-urlencoded\r\n" . - "Content-Length: " . strlen($postdata) . "\r\n" . "\r\n" . $postdata; - - curl_setopt($curl, CURLOPT_HTTPHEADER, $header); - - curl_setopt($curl, CURLOPT_POST, 1); - - $result = curl_exec($curl); - if ($result == false) { - throw new Exception("curl_exec threw error \"" . curl_error($curl) . "\" for " . $url . "?" . $postdata ); - } - curl_close($curl); - - return $result; - } - - private function fopen_query( $url, $postdata, $authstr ) - { - if ( !(ini_get('allow_url_fopen') ) ) { - throw new Exception('fopen_query called on system without allow_url_fopen enabled in php.ini'); - } - - $opts = array( - 'http' => array( - 'allow_self_signed' => true, - 'method' => 'POST', - 'header' => $authstr . - "Content-Type: application/x-www-form-urlencoded\r\n" . - "Content-Length: " . strlen($postdata) . "\r\n" . - "\r\n" . $postdata - ) - ); - $context = stream_context_create($opts); - - return file_get_contents($url, false, $context); - } - - - /* - * Convert simplexml to associative arrays - * - * This function will convert simplexml to associative arrays. - */ - private function unserialize_xml($input, $callback = null, $recurse = false) - { - // Get input, loading an xml string with simplexml if its the top level of recursion - $data = ( (!$recurse) && is_string($input) ) ? simplexml_load_string($input) : $input; - // Convert SimpleXMLElements to array - if ($data instanceof SimpleXMLElement) { - $data = (array) $data; - } - // Recurse into arrays - if (is_array($data)) { - foreach ($data as &$item) { - $item = $this->unserialize_xml($item, $callback, true); - } - } - // Run callback and return - return (!is_array($data) && is_callable($callback)) ? call_user_func($callback, $data) : $data; - } - - - /* TO DO: - Implement API1 and API2 query functions!!!!! - */ - /** - * Call an API1 function - * - * This function allows you to call API1 from within the XML-API, This allowes a user to peform actions - * such as adding ftp accounts, etc - * - * @param string $user The username of the account to perform API1 actions on - * @param string $module The module of the API1 call to use - * @param string $function The function of the API1 call - * @param array $args The arguments for the API1 function, this should be a non-associative array - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/CallingAPIFunctions XML API Call documentation - * @link http://docs.cpanel.net/twiki/bin/view/DeveloperResources/ApiRef/WebHome API1 & API2 Call documentation - * @link http://docs.cpanel.net/twiki/bin/view/DeveloperResources/ApiBasics/CallingApiOne API1 Documentation - */ - public function api1_query($user, $module, $function, $args = array() ) - { - if ( !isset($module) || !isset($function) || !isset($user) ) { - error_log("api1_query requires that a module and function are passed to it"); - - return false; - } - - if (!is_array($args)) { - error_log('api1_query requires that it is passed an array as the 4th parameter'); - - return false; - } - - $cpuser = 'cpanel_xmlapi_user'; - $module_type = 'cpanel_xmlapi_module'; - $func_type = 'cpanel_xmlapi_func'; - $api_type = 'cpanel_xmlapi_apiversion'; - - if ( $this->get_output() == 'json' ) { - $cpuser = 'cpanel_jsonapi_user'; - $module_type = 'cpanel_jsonapi_module'; - $func_type = 'cpanel_jsonapi_func'; - $api_type = 'cpanel_jsonapi_apiversion'; - } - - $call = array( - $cpuser => $user, - $module_type => $module, - $func_type => $function, - $api_type => '1' - ); - for ($int = 0; $int < count($args); $int++) { - $call['arg-' . $int] = $args[$int]; - } - - return $this->xmlapi_query('cpanel', $call); - } - - /** - * Call an API2 Function - * - * This function allows you to call an API2 function, this is the modern API for cPanel and should be used in preference over - * API1 when possible - * - * @param string $user The username of the account to perform API2 actions on - * @param string $module The module of the API2 call to use - * @param string $function The function of the API2 call - * @param array $args An associative array containing the arguments for the API2 call - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/CallingAPIFunctions XML API Call documentation - * @link http://docs.cpanel.net/twiki/bin/view/DeveloperResources/ApiRef/WebHome API1 & API2 Call documentation - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ApiTwo Legacy API2 Documentation - * @link http://docs.cpanel.net/twiki/bin/view/DeveloperResources/ApiBasics/CallingApiTwo API2 Documentation - */ - - public function api2_query($user, $module, $function, $args = array()) - { - if (!isset($user) || !isset($module) || !isset($function) ) { - error_log("api2_query requires that a username, module and function are passed to it"); - - return false; - } - if (!is_array($args)) { - error_log("api2_query requires that an array is passed to it as the 4th parameter"); - - return false; - } - - $cpuser = 'cpanel_xmlapi_user'; - $module_type = 'cpanel_xmlapi_module'; - $func_type = 'cpanel_xmlapi_func'; - $api_type = 'cpanel_xmlapi_apiversion'; - - if ( $this->get_output() == 'json' ) { - $cpuser = 'cpanel_jsonapi_user'; - $module_type = 'cpanel_jsonapi_module'; - $func_type = 'cpanel_jsonapi_func'; - $api_type = 'cpanel_jsonapi_apiversion'; - } - - $args[$cpuser] = $user; - $args[$module_type] = $module; - $args[$func_type] = $function; - $args[$api_type] = '2'; - - return $this->xmlapi_query('cpanel', $args); - } - - #### - # XML API Functions - #### - - /** - * Return a list of available XML-API calls - * - * This function will return an array containing all applications available within the XML-API - * - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ListAvailableCalls XML API Call documentation - */ - public function applist() - { - return $this->xmlapi_query('applist'); - } - - #### - # Account functions - #### - - /** - * Create a cPanel Account - * - * This function will allow one to create an account, the $acctconf parameter requires that the follow - * three associations are defined: - * - username - * - password - * - domain - * - * Failure to prive these will cause an error to be logged. Any other key/value pairs as defined by the createaccount call - * documentation are allowed parameters for this call. - * - * @param array $acctconf - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/CreateAccount XML API Call documentation - */ - - public function createacct($acctconf) - { - if (!is_array($acctconf)) { - error_log("createacct requires that first parameter passed to it is an array"); - - return false; - } - if (!isset($acctconf['username']) || !isset($acctconf['password']) || !isset($acctconf['domain'])) { - error_log("createacct requires that username, password & domain elements are in the array passed to it"); - - return false; - } - - return $this->xmlapi_query('createacct', $acctconf); - } - - /** - * Change a cPanel Account's Password - * - * This function will allow you to change the password of a cpanel account - * - * @param string $username The username to change the password of - * @param string $pass The new password for the cPanel Account - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ChangePassword XML API Call documentation - */ - public function passwd($username, $pass) - { - if (!isset($username) || !isset($pass)) { - error_log("passwd requires that an username and password are passed to it"); - - return false; - } - - return $this->xmlapi_query('passwd', array('user' => $username, 'pass' => $pass)); - } - - /** - * Limit an account's monthly bandwidth usage - * - * This function will set an account's bandwidth limit. - * - * @param string $username The username of the cPanel account to modify - * @param int $bwlimit The new bandwidth limit in megabytes - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/LimitBandwidth XML API Call documentation - */ - public function limitbw($username, $bwlimit) - { - if (!isset($username) || !isset($bwlimit)) { - error_log("limitbw requires that an username and bwlimit are passed to it"); - - return false; - } - - return $this->xmlapi_query('limitbw', array('user' => $username, 'bwlimit' => $bwlimit)); - } - - /** - * List accounts on Server - * - * This call will return a list of account on a server, either no parameters or both parameters may be passed to this function. - * - * @param string $searchtype Type of account search to use, allowed values: domain, owner, user, ip or package - * @param string $search the string to search against - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ListAccounts XML API Call documentation - */ - public function listaccts($searchtype = null, $search = null) - { - if ($search) { - return $this->xmlapi_query('listaccts', array('searchtype' => $searchtype, 'search' => $search )); - } - - return $this->xmlapi_query('listaccts'); - } - - /** - * Modify a cPanel account - * - * This call will allow you to change limitations and information about an account. See the XML API call documentation for a list of - * acceptable values for args. - * - * @param string $username The username to modify - * @param array $args the new values for the modified account (see {@link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ModifyAccount modifyacct documentation}) - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ModifyAccount XML API Call documentation - */ - public function modifyacct($username, $args = array()) - { - if (!isset($username)) { - error_log("modifyacct requires that username is passed to it"); - - return false; - } - $args['user'] = $username; - if (sizeof($args) < 2) { - error_log("modifyacct requires that at least one attribute is passed to it"); - - return false; - } - - return $this->xmlapi_query('modifyacct', $args); - } - - /** - * Edit a cPanel Account's Quota - * - * This call will allow you to change a cPanel account's quota - * - * @param string $username The username of the account to modify the quota. - * @param int $quota the new quota in megabytes - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/EditQuota XML API Call documentation - */ - public function editquota($username, $quota) - { - if (!isset($username) || !isset($quota)) { - error_log("editquota requires that an username and quota are passed to it"); - - return false; - } - - return $this->xmlapi_query('editquota', array('user' => $username, 'quota' => $quota)); - } - - /** - * Return a summary of the account's information - * - * This call will return a brief report of information about an account, such as: - * - Disk Limit - * - Disk Used - * - Domain - * - Account Email - * - Theme - * - Start Data - * - * Please see the XML API Call documentation for more information on what is returned by this call - * - * @param string $username The username to retrieve a summary of - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ShowAccountInformation XML API Call documenation - */ - public function accountsummary($username) - { - if (!isset($username)) { - error_log("accountsummary requires that an username is passed to it"); - - return false; - } - - return $this->xmlapi_query('accountsummary', array('user' => $username)); - } - - /** - * Suspend a User's Account - * - * This function will suspend the specified cPanel users account. - * The $reason parameter is optional, but can contain a string of any length - * - * @param string $username The username to suspend - * @param string $reason The reason for the suspension - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SuspendAccount XML API Call documentation - */ - public function suspendacct($username, $reason = null) - { - if (!isset($username)) { - error_log("suspendacct requires that an username is passed to it"); - - return false; - } - if ($reason) { - return $this->xmlapi_query('suspendacct', array('user' => $username, 'reason' => $reason )); - } - - return $this->xmlapi_query('suspendacct', array('user' => $username)); - } - - /** - * List suspended accounts on a server - * - * This function will return an array containing all the suspended accounts on a server - * - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ListSuspended XML API Call documentation - */ - public function listsuspended() - { - return $this->xmlapi_query('listsuspended'); - } - - /** - * Remove an Account - * - * This XML API call will remove an account on the server - * The $keepdns parameter is optional, when enabled this will leave the DNS zone on the server - * - * @param string $username The usename to delete - * @param bool $keepdns When pass a true value, the DNS zone will be retained - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/TerminateAccount - */ - public function removeacct($username, $keepdns = false) - { - if (!isset($username)) { - error_log("removeacct requires that a username is passed to it"); - - return false; - } - if ($keepdns) { - return $this->xmlapi_query('removeacct', array('user' => $username, 'keepdns' => '1')); - } - - return $this->xmlapi_query('removeacct', array('user' => $username)); - } - - /** - * Unsuspend an Account - * - * This XML API call will unsuspend an account - * - * @param string $username The username to unsuspend - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/UnsuspendAcount XML API Call documentation - */ - public function unsuspendacct($username) - { - if (!isset($username)) { - error_log("unsuspendacct requires that a username is passed to it"); - - return false; - } - - return $this->xmlapi_query('unsuspendacct', array('user' => $username)); - } - - /** - * Change an Account's Package - * - * This XML API will change the package associated account. - * - * @param string $username the username to change the package of - * @param string $pkg The package to change the account to. - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ChangePackage XML API Call documentation - */ - public function changepackage($username, $pkg) - { - if (!isset($username) || !isset($pkg)) { - error_log("changepackage requires that username and pkg are passed to it"); - - return false; - } - - return $this->xmlapi_query('changepackage', array('user' => $username, 'pkg' => $pkg)); - } - - /** - * Return the privileges a reseller has in WHM - * - * This will return a list of the privileges that a reseller has to WHM - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ViewPrivileges XML API Call documentation - */ - public function myprivs() - { - return $this->xmlapi_query('myprivs'); - } - - - /** - * Display Data about a Virtual Host - * - * This function will return information about a specific domain. This data is essentially a representation of the data - * Contained in the httpd.conf VirtualHost for the domain. - * - * @return mixed - * @param string $domain The domain to fetch information for - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/DomainUserData - */ - - public function domainuserdata( $domain ) - { - if (!isset( $domain ) ) { - error_log("domainuserdata requires that domain is passed to it"); - - return false; - } - - return $this->xmlapi_query("domainuserdata", array( 'domain' => $domain ) ); - } - - /** - * Change a site's IP Address - * - * This function will allow you to change the IP address that a domain listens on. - * In order to properly call this function Either $user or $domain parameters must be defined - * @param string $ip The $ip address to change the account or domain to - * @param string $user The username to change the IP of - * @param string $domain The domain to change the IP of - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SetSiteIp XML API Call documentation - */ - public function setsiteip ( $ip, $user = null, $domain = null ) - { - if ( !isset($ip) ) { - error_log("setsiteip requires that ip is passed to it"); - - return false; - } - - if ($user == null && $domain == null) { - error_log("setsiteip requires that either domain or user is passed to it"); - - return false; - } - - if ($user == null) { - return $this->xmlapi_query( "setsiteip", array( "ip" => $ip, "domain" => $domain ) ); - } else { - return $this->xmlapi_query( "setsiteip", array( "ip" => $ip, "user" => $user ) ); - } - } - - #### - # DNS Functions - #### - - // This API function lets you create a DNS zone. - /** - * Add a DNS Zone - * - * This XML API function will create a DNS Zone. This will use the "standard" template when - * creating the zone. - * - * @param string $domain The DNS Domain that you wish to create a zone for - * @param string $ip The IP you want the domain to resolve to - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/AddDNSZone XML API Call documentation - */ - public function adddns($domain, $ip) - { - if (!isset($domain) || !isset($ip)) { - error_log("adddns require that domain, ip are passed to it"); - - return false; - } - - return $this->xmlapi_query('adddns', array('domain' => $domain, 'ip' => $ip)); - } - - /** - * Add a record to a zone - * - * This will append a record to a DNS Zone. The $args argument to this function - * must be an associative array containing information about the DNS zone, please - * see the XML API Call documentation for more info - * - * @param string $zone The DNS zone that you want to add the record to - * @param array $args Associative array representing the record to be added - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/AddZoneRecord XML API Call documentation - */ - public function addzonerecord( $zone, $args ) - { - if (!is_array($args)) { - error_log("addzonerecord requires that $args passed to it is an array"); - - return; - } - - $args['zone'] = $zone; - - return $this->xmlapi_query('addzonerecord', $args); - } - - /** - * Edit a Zone Record - * - * This XML API Function will allow you to edit an existing DNS Zone Record. - * This works by passing in the line number of the record you wish to edit. - * Line numbers can be retrieved with dumpzone() - * - * @param string $zone The zone to edit - * @param int $line The line number of the zone to edit - * @param array $args An associative array representing the zone record - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/EditZoneRecord XML API Call documentation - * @see dumpzone() - */ - - public function editzonerecord( $zone, $line, $args ) - { - if (!is_array($args)) { - error_log("editzone requires that $args passed to it is an array"); - - return; - } - - $args['domain'] = $zone; - $args['Line'] = $line; - - return $this->xmlapi_query('editzonerecord', $args); - } - - /** - * Retrieve a DNS Record - * - * This function will return a data structure representing a DNS record, to - * retrieve all lines see dumpzone. - * @param string $zone The zone that you want to retrieve a record from - * @param string $line The line of the zone that you want to retrieve - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/GetZoneRecord XML API Call documentation - */ - public function getzonerecord( $zone, $line ) - { - return $this->xmlapi_query('getzonerecord', array( 'domain' => $zone, 'Line' => $line ) ); - } - - /** - * Remove a DNS Zone - * - * This function will remove a DNS Zone from the server - * - * @param string $domain The domain to be remove - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/DeleteDNSZone XML API Call documentation - */ - public function killdns($domain) - { - if (!isset($domain)) { - error_log("killdns requires that domain is passed to it"); - - return false; - } - - return $this->xmlapi_query('killdns', array('domain' => $domain)); - } - - /** - * Return a List of all DNS Zones on the server - * - * This XML API function will return an array containing all the DNS Zones on the server - * - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ListDNSZone XML API Call documentation - */ - public function listzones() - { - return $this->xmlapi_query('listzones'); - } - - /** - * Return all records in a zone - * - * This function will return all records within a zone. - * @param string $domain The domain to return the records from. - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ListOneZone XML API Call documentation - * @see editdnsrecord() - * @see getdnsrecord() - */ - public function dumpzone($domain) - { - if (!isset($domain)) { - error_log("dumpzone requires that a domain is passed to it"); - - return false; - } - - return $this->xmlapi_query('dumpzone', array('domain' => $domain)); - } - - /** - * Return a Nameserver's IP - * - * This function will return a nameserver's IP - * - * @param string $nameserver The nameserver to lookup - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/LookupIP XML API Call documentation - */ - public function lookupnsip($nameserver) - { - if (!isset($nameserver)) { - error_log("lookupnsip requres that a nameserver is passed to it"); - - return false; - } - - return $this->xmlapi_query('lookupnsip', array('nameserver' => $nameserver)); - } - - /** - * Remove a line from a zone - * - * This function will remove the specified line from a zone - * @param string $zone The zone to remove a line from - * @param int $line The line to remove from the zone - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/RemoveZone XML API Call documentation - */ - public function removezonerecord($zone, $line) - { - if ( !isset($zone) || !isset($line) ) { - error_log("removezone record requires that a zone and line number is passed to it"); - - return false; - } - - return $this->xmlapi_query('removezonerecord', array('zone' => $zone, 'Line' => $line) ); - } - - /** - * Reset a zone - * - * This function will reset a zone removing all custom records. Subdomain records will be readded by scanning the userdata datastore. - * @param string $domain the domain name of the zone to reset - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ResetZone XML API Call documentation - */ - public function resetzone($domain) - { - if ( !isset($domain) ) { - error_log("resetzone requires that a domain name is passed to it"); - - return false; - } - - return $this->xmlapi_query('resetzone', array('domain' => $domain)); - } - - #### - # Package Functions - #### - - /** - * Add a new package - * - * This function will allow you to add a new package - * This function should be passed an associative array containing elements that define package parameters. - * These variables map directly to the parameters for the XML-API Call, please refer to the link below for a complete - * list of possible variable. The "name" element is required. - * @param array $pkg an associative array containing package parameters - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/AddPackage XML API Call documentation - */ - public function addpkg($pkg) - { - if (!isset($pkg['name'])) { - error_log("addpkg requires that name is defined in the array passed to it"); - - return false; - } - - return $this->xmlapi_query('addpkg', $pkg); - } - - /** - * Remove a package - * - * This function allow you to delete a package - * @param string $pkgname The package you wish to delete - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/DeletePackage XML API Call documentation - */ - public function killpkg($pkgname) - { - if (!isset($pkgname)) { - error_log("killpkg requires that the package name is passed to it"); - - return false; - } - - return $this->xmlapi_query('killpkg', array('pkg' => $pkgname)); - } - - /** - * Edit a package - * - * This function allows you to change a package's paremeters. This is passed an associative array defining - * the parameters for the package. The keys within this array map directly to the XML-API call, please see the link - * below for a list of possible keys within this package. The name element is required. - * @param array $pkg An associative array containing new parameters for the package - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/EditPackage XML API Call documentation - */ - public function editpkg($pkg) - { - if (!isset($pkg['name'])) { - error_log("editpkg requires that name is defined in the array passed to it"); - - return false; - } - - return $this->xmlapi_query('editpkg', $pkg); - } - - /** - * List Packages - * - * This function will list all packages available to the user - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ListPackages XML API Call documentation - */ - public function listpkgs() - { - return $this->xmlapi_query('listpkgs'); - } - - #### - # Reseller functions - #### - - /** - * Make a user a reseller - * - * This function will allow you to mark an account as having reseller privileges - * @param string $username The username of the account you wish to add reseller privileges to - * @param int $makeowner Boolean 1 or 0 defining whether the account should own itself or not - * @see setacls() - * @see setresellerlimits() - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/AddResellerPrivileges XML API Call documentation - */ - public function setupreseller($username, $makeowner = true) - { - if (!isset($username)) { - error_log("setupreseller requires that username is passed to it"); - - return false; - } - if ($makeowner) { - return $this->xmlapi_query('setupreseller', array('user' => $username, 'makeowner' => '1')); - } - - return $this->xmlapi_query('setupreseller', array('user' => $username, 'makeowner' => '0')); - } - - /** - * Create a New ACL List - * - * This function allows you to create a new privilege set for reseller accounts. This is passed an - * Associative Array containing the configuration information for this variable. Please see the XML API Call documentation - * For more information. "acllist" is a required element within this array - * @param array $acl an associative array describing the parameters for the ACL to be create - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/CreateResellerACLList XML API Call documentation - */ - public function saveacllist($acl) - { - if (!isset($acl['acllist'])) { - error_log("saveacllist requires that acllist is defined in the array passed to it"); - - return false; - } - - return $this->xmlapi_query('saveacllist', $acl); - } - - - /** - * List available saved ACLs - * - * This function will return a list of Saved ACLs for reseller accounts - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ListCurrentResellerACLLists XML API Call documentation - */ - public function listacls() - { - return $this->xmlapi_query('listacls'); - } - - /** - * List Resellers - * - * This function will return a list of resellers on the server - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ListResellerAccounts XML API Call documentation - */ - public function listresellers() - { - return $this->xmlapi_query('listresellers'); - } - - /** - * Get a reseller's statistics - * - * This function will return general information on a reseller and all it's account individually such as disk usage and bandwidth usage - * - * @param string $username The reseller to be checked - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ListResellersAccountsInformation XML API Call documentation - */ - public function resellerstats($username) - { - if (!isset($username)) { - error_log("resellerstats requires that a username is passed to it"); - - return false; - } - - return $this->xmlapi_query('resellerstats', array('reseller' => $username)); - } - - /** - * Remove Reseller Privileges - * - * This function will remove an account's reseller privileges, this does not remove the account. - * - * @param string $username The username to remove reseller privileges from - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/RemoveResellerPrivileges XML API Call documentation - */ - public function unsetupreseller($username) - { - if (!isset($username)) { - error_log("unsetupreseller requires that a username is passed to it"); - - return false; - } - - return $this->xmlapi_query('unsetupreseller', array('user' => $username)); - } - - /** - * Set a reseller's privileges - * - * This function will allow you to set what parts of WHM a reseller has access to. This is passed an associative array - * containing the privleges that this reseller should have access to. These map directly to the parameters passed to the XML API Call - * Please view the XML API Call documentation for more information. "reseller" is the only required element within this array - * @param array $acl An associative array containing all the ACL information for the reseller - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SetResellersACLList XML API Call documentation - */ - public function setacls($acl) - { - if (!isset($acl['reseller'])) { - error_log("setacls requires that reseller is defined in the array passed to it"); - - return false; - } - - return $this->xmlapi_query('setacls', $acl); - } - - /** - * Terminate a Reseller's Account - * - * This function will terminate a reseller's account and all accounts owned by the reseller - * - * @param string $reseller the name of the reseller to terminate - * @param boolean $terminatereseller Passing this as true will terminate the the reseller's account as well as all the accounts owned by the reseller - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/TerminateResellerandAccounts XML API Call documentation - * - **/ - public function terminatereseller($reseller, $terminatereseller = true) - { - if (!isset($reseller)) { - error_log("terminatereseller requires that username is passed to it"); - - return false; - } - $verify = 'I understand this will irrevocably remove all the accounts owned by the reseller ' . $reseller; - if ($terminatereseller) { - return $this->xmlapi_query('terminatereseller', array('reseller' => $reseller, 'terminatereseller' => '1', 'verify' => $verify)); - } - - return $this->xmlapi_query('terminatereseller', array('reseller' => $reseller, 'terminatereseller' => '0', 'verify' => $verify)); - } - - /** - * Set a reseller's dedicated IP addresses - * - * This function will set a reseller's dedicated IP addresses. If an IP is not passed to this function, - * it will reset the reseller to use the server's main shared IP address. - * @param string $user The username of the reseller to change dedicated IPs for - * @param string $ip The IP to assign to the reseller, this can be a comma-seperated list of IPs to allow for multiple IP addresses - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SetResellerIps XML API Call documentation - */ - public function setresellerips($user, $ip = null) - { - if (!isset($user) ) { - error_log("setresellerips requires that a username is passed to it"); - - return false; - } - $params = array("user" => $user); - if ($ip != null) { - $params['ip'] = $ip; - } - - return $this->xmlapi_query('setresellerips',$params); - } - - /** - * Set Accounting Limits for a reseller account - * - * This function allows you to define limits for reseller accounts not included with in access control such as - * the number of accounts a reseller is allowed to create, the amount of disk space to use. - * This function is passed an associative array defining these limits, these map directly to the parameters for the XML API - * Call, please refer to the XML API Call documentation for more information. The only required parameters is "user" - * - * @param array $reseller_cfg An associative array containing configuration information for the specified reseller - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SetResellerLimits XML API Call documentation - * - */ - public function setresellerlimits( $reseller_cfg ) - { - if ( !isset($reseller_cfg['user'] ) ) { - error_log("setresellerlimits requires that a user is defined in the array passed to it"); - - return false; - } - - return $this->xmlapi_query('setresellerlimits',$reseller_cfg); - } - - /** - * Set a reseller's main IP - * - * This function will allow you to set a reseller's main IP. By default all accounts created by this reseller - * will be created on this IP - * @param string $reseller the username of the reseller to change the main IP of - * @param string $ip The ip you would like this reseller to create accounts on by default - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SetResellerMainIp XML API Call documentation - */ - public function setresellermainip($reseller, $ip) - { - if ( !isset($reseller) || !isset($ip) ) { - error_log("setresellermainip requires that an reseller and ip are passed to it"); - - return false; - } - - return $this->xmlapi_query("setresellermainip", array('user' => $reseller, 'ip' => $ip)); - } - - /** - * Set reseller package limits - * - * This function allows you to define which packages a reseller has access to use - * @param string $user The reseller you wish to define package limits for - * @param boolean $no_limit Whether or not you wish this reseller to have packages limits - * @param string $package if $no_limit is false, then the package you wish to modify privileges for - * @param boolean $allowed if $no_limit is false, then defines if the reseller should have access to the package or not - * @param int $number if $no_limit is false, then defines the number of account a reseller can create of a specific package - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SetResellerPkgLimit XML API Call documentation - */ - public function setresellerpackagelimits($user, $no_limit, $package = null, $allowed = null, $number = null) - { - if (!isset($user) || !isset($no_limit) ) { - error_log("setresellerpackagelimits requires that a username and no_limit are passed to it by default"); - - return false; - } - if ($no_limit) { - return $this->xmlapi_query("setresellerpackagelimits", array( 'user' => $user, "no_limit" => '1') ); - } else { - if ( is_null($package) || is_null($allowed) ) { - error_log('setresellerpackagelimits requires that package and allowed are passed to it if no_limit eq 0'); - - return false; - } - $params = array( - 'user' => $user, - 'no_limit' => '0', - 'package' => $package, - ); - if ($allowed) { - $params['allowed'] = 1; - } else { - $params['allowed'] = 0; - } - if ( !is_null($number) ) { - $params['number'] = $number; - } - - return $this->xmlapi_query('setresellerpackagelimits', $params); - } - } - - /** - * Suspend a reseller and all accounts owned by a reseller - * - * This function, when called will suspend a reseller account and all account owned by said reseller - * @param string $reseller The reseller account to be suspended - * @param string $reason (optional) The reason for suspending the reseller account - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SuspendReseller XML API Call documentation - */ - public function suspendreseller($reseller, $reason = null) - { - if (!isset($reseller) ) { - error_log("suspendreseller requires that the reseller's username is passed to it"); - - return false; - } - $params = array("user" => $reseller); - if ($reason) { - $params['reason'] = $reason; - } - - return $this->xmlapi_query('suspendreseller', $params); - } - - - /** - * Unsuspend a Reseller Account - * - * This function will unsuspend a reseller account and all accounts owned by the reseller in question - * @param string $user The username of the reseller to be unsuspended - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/UnsuspendReseller XML API Call documentation - */ - public function unsuspendreseller($user) - { - if (!isset($user) ) { - error_log("unsuspendreseller requires that a username is passed to it"); - - return false; - } - - return $this->xmlapi_query('unsuspendreseller', array('user' => $user)); - } - - /** - * Get the number of accounts owned by a reseller - * - * This function will return the number of accounts owned by a reseller account, along with information such as the number of active, suspended and accounting limits - * @param string $user The username of the reseller to get account information from - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/AcctCounts XML API Call documentation - */ - public function acctcounts($user) - { - if (!isset($user)) { - error_log('acctcounts requires that a username is passed to it'); - - return false; - } - - return $this->xmlapi_query('acctcounts', array('user' => $user) ); - } - - /** - * Set a reseller's nameservers - * - * This function allows you to change the nameservers that account created by a specific reseller account will use. - * If this function is not passed a $nameservers parameter, it will reset the nameservers for the reseller to the servers's default - * @param string $user The username of the reseller account to grab reseller accounts from - * @param string $nameservers A comma seperate list of nameservers - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SetResellerNameservers XML API Call documentation - */ - public function setresellernameservers($user, $nameservers = null) - { - if (!isset($user)) { - error_log("setresellernameservers requires that a username is passed to it"); - - return false; - } - $params = array('user' => $user); - if ($nameservers) { - $params['nameservers'] = $nameservers; - } - - return $this->xmlapi_query('setresellernameservers', $params); - } - - #### - # Server information - #### - - /** - * Get a server's hostname - * - * This function will return a server's hostname - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/DisplayServerHostname XML API Call documentation - */ - public function gethostname() - { - return $this->xmlapi_query('gethostname'); - } - - /** - * Get the version of cPanel running on the server - * - * This function will return the version of cPanel/WHM running on the remote system - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/DisplaycPanelWHMVersion XML API Call documentation - */ - public function version() - { - return $this->xmlapi_query('version'); - } - - - /** - * Get Load Average - * - * This function will return the loadavg of the remote system - * - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/LoadAvg XML API Call documentation - */ - public function loadavg() - { - return $this->xmlapi_query('loadavg'); - } - - /** - * Get a list of languages on the remote system - * - * This function will return a list of available langauges for the cPanel interface - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/GetLangList XML API Call documentation - * - */ - public function getlanglist() - { - return $this->xmlapi_query('getlanglist'); - } - - #### - # Server administration - #### - - /** - * Reboot server - * - * This function will reboot the server - * @param boolean $force This will determine if the server should be given a graceful or forceful reboot - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/RebootServer XML API Call documentation - */ - public function reboot($force = false) - { - if ($force) { - return $this->xmlapi_query('reboot', array('force' => '1')); - } - - return $this->xmlapi_query('reboot'); - } - - /** - * Add an IP to a server - * - * This function will add an IP alias to your server - * @param string $ip The IP to be added - * @param string $netmask The netmask of the IP to be added - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/AddIPAddress XML API Call documentation - */ - public function addip($ip, $netmask) - { - if (!isset($ip) || !isset($netmask)) { - error_log("addip requires that an IP address and Netmask are passed to it"); - - return false; - } - - return $this->xmlapi_query('addip', array('ip' => $ip, 'netmask' => $netmask)); - } - - // This function allows you to delete an IP address from your server. - /** - * Delete an IP from a server - * - * Remove an IP from the server - * @param string $ip The IP to remove - * @param string $ethernetdev The ethernet device that the IP is bound to - * @param bool $skipifshutdown Whether the function should remove the IP even if the ethernet interface is down - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/DeleteIPAddress XML API Call documentation - */ - public function delip($ip, $ethernetdev = null, $skipifshutdown = false) - { - $args = array(); - if (!isset($ip)) { - error_log("delip requires that an IP is defined in the array passed to it"); - - return false; - } - $args['ip'] = $ip; - if ($ethernetdev) { - $args['ethernetdev'] = $ethernetdev; - } - $args['skipifshutdown'] = ($skipifshutdown) ? '1' : '0'; - - return $this->xmlapi_query('delip', $args); - } - - /** - * List IPs - * - * This should return a list of IPs on a server - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/DeleteIPAddress XML API Call documentation - */ - public function listips() - { - return $this->xmlapi_query('listips'); - } - - /** - * Set Hostname - * - * This function will allow you to set the hostname of the server - * @param string $hostname the hostname that should be assigned to the serve - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SetHostname XML API Call documentation - */ - public function sethostname($hostname) - { - if (!isset($hostname)) { - error_log("sethostname requires that hostname is passed to it"); - - return false; - } - - return $this->xmlapi_query('sethostname', array('hostname' => $hostname)); - } - - /** - * Set the resolvers used by the server - * - * This function will set the resolvers in /etc/resolv.conf for the server - * @param string $nameserver1 The IP of the first nameserver to use - * @param string $nameserver2 The IP of the second namesever to use - * @param string $nameserver3 The IP of the third nameserver to use - * @param string $nameserver4 The IP of the forth nameserver to use - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/SetResolvers XML API Call documentation - */ - public function setresolvers($nameserver1, $nameserver2 = null, $nameserver3 = null) - { - $args = array(); - if (!isset($nameserver1)) { - error_log("setresolvers requires that nameserver1 is defined in the array passed to it"); - - return false; - } - $args['nameserver1'] = $nameserver1; - if ($nameserver2) { - $args['nameserver2'] = $nameserver2; - } - if ($nameserver3) { - $args['nameserver3'] = $nameserver3; - } - - return $this->xmlapi_query('setresolvers', $args); - } - - /** - * Display bandwidth Usage - * - * This function will return all bandwidth usage information for the server, - * The arguments for this can be passed in via an associative array, the elements of this array map directly to the - * parameters of the call, please see the XML API Call documentation for more information - * @param array $args The configuration for what bandwidth information to display - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ShowBw XML API Call documentation - */ - public function showbw($args = null) - { - if (is_array($args)) { - return $this->xmlapi_query('showbw', $args); - } - - return $this->xmlapi_query('showbw'); - } - - public function nvset($key, $value) - { - if (!isset($key) || !isset($value)) { - error_log("nvset requires that key and value are passed to it"); - - return false; - } - - return $this->xmlapi_query('nvset', array('key' => $key, 'value' => $value)); - } - - // This function allows you to retrieve and view a non-volatile variable's value. - public function nvget($key) - { - if (!isset($key)) { - error_log("nvget requires that key is passed to it"); - - return false; - } - - return $this->xmlapi_query('nvget', array('key' => $key)); - } - - #### - # Service functions - #### - - /** - * Restart a Service - * - * This function allows you to restart a service on the server - * @param string $service the service that you wish to restart please view the XML API Call documentation for acceptable values to this parameters - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/RestartService XML API Call documentation - */ - public function restartsrv($service) - { - if (!isset($service)) { - error_log("restartsrv requires that service is passed to it"); - - return false; - } - - return $this->xmlapi_query('restartservice', array('service' => $service)); - } - - /** - * Service Status - * - * This function will return the status of all services on the and whether they are running or not - * @param array $args A single service to filter for. - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ServiceStatus XML API Call documentation - */ - public function servicestatus($args=array()) - { - if (!empty($args) && !is_array($args)) { - $args = array('service'=>$args); - } elseif (!is_array($args)) { - $args = array(); - } - - return $this->xmlapi_query('servicestatus', $args); - } - - /** - * Configure A Service - * - * This function will allow you to enabled or disable services along with their monitoring by chkservd - * @param string $service The service to be monitored - * @param bool $enabled Whether the service should be enabled or not - * @param bool $monitored Whether the service should be monitored or not - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ConfigureService XML API Call documentation - */ - public function configureservice($service, $enabled = true, $monitored = true) - { - if (!isset($service)) { - error_log("configure service requires that a service is passed to it"); - - return false; - } - $params = array('service' => $service); - - if ($enabled) { - $params['enabled'] = 1; - } else { - $params['enabled'] = 0; - } - - if ($monitored) { - $params['monitored'] = 1; - } else { - $params['monitored'] = 0; - } - - return $this->xmlapi_query('configureservice', $params); - - } - - #### - # SSL functions - #### - - /** - * Display information on an SSL host - * - * This function will return information on an SSL Certificate, CSR, cabundle and SSL key for a specified domain - * @param array $args Configuration information for the SSL certificate, please see XML API Call documentation for required values - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/FetchSSL XML API Call documentation - */ - public function fetchsslinfo($args) - { - if ( (isset($args['domain']) && isset($args['crtdata'])) || (!isset($args['domain']) && !isset($args['crtdata'])) ) { - error_log("fetchsslinfo requires domain OR crtdata is passed to it"); - } - if (isset($args['crtdata'])) { - // crtdata must be URL-encoded! - $args['crtdata'] = urlencode(trim($args['crtdata'])); - } - - return $this->xmlapi_query('fetchsslinfo', $args); - } - - /** - * Generate an SSL Certificate - * - * This function will generate an SSL Certificate, the arguments for this map directly to the call for the XML API call. Please consult the XML API Call documentation for more information - * @param array $args the configuration for the SSL Certificate being generated - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/GenerateSSL XML API Call documentation - */ - public function generatessl($args) - { - if (!isset($args['xemail']) || !isset($args['host']) || !isset($args['country']) || !isset($args['state']) || !isset($args['city']) || !isset($args['co']) || !isset($args['cod']) || !isset($args['email']) || !isset($args['pass'])) { - error_log("generatessl requires that xemail, host, country, state, city, co, cod, email and pass are defined in the array passed to it"); - - return false; - } - - return $this->xmlapi_query('generatessl', $args); - } - - /** - * Install an SSL certificate - * - * This function will allow you to install an SSL certificate that is uploaded via the $argument parameter to this call. The arguments for this call map directly to the parameters for the XML API call, - * please consult the XML API Call documentation for more information. - * @param array $args The configuration for the SSL certificate - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/InstallSSL XML API Call documentation - */ - public function installssl($args) - { - if (!isset($args['user']) || !isset($args['domain']) || !isset($args['cert']) || !isset($args['key']) || !isset($args['cab']) || !isset($args['ip'])) { - error_log("installssl requires that user, domain, cert, key, cab and ip are defined in the array passed to it"); - - return false; - } - - return $this->xmlapi_query('installssl', $args); - } - - /** - * List SSL Certs - * - * This function will list all SSL certificates installed on the server - * @return mixed - * @link http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/ListSSL XML API Call documentation - */ - public function listcrts() - { - return $this->xmlapi_query('listcrts'); - } - - #### - # cPanel API1 functions - # Note: A cPanel account username is required - # Some cPanel features must be enabled to be able to use some function (f.e. park, unpark) - #### - - // This API1 function adds a emailaccount for a specific user. - public function addpop($username, $args) - { - if (!isset($username) || !isset($args)) { - error_log("addpop requires that a user and args are passed to it"); - - return false; - } - if (is_array($args) && (sizeof($args) < 3)) { - error_log("addpop requires that args at least contains an email_username, email_password and email_domain"); - - return false; - } - - return $this->api1_query($username, 'Email', 'addpop', $args); - } - - // This API function displays a list of all parked domains for a specific user. - public function park($username, $newdomain, $topdomain) - { - $args = array(); - if ( (!isset($username)) && (!isset($newdomain)) ) { - error_log("park requires that a username and new domain are passed to it"); - - return false; - } - $args['domain'] = $newdomain; - if ($topdomain) { - $args['topdomain'] = $topdomain; - } - - return $this->api2_query($username, 'Park', 'park', $args); - } - - // This API function displays a list of all parked domains for a specific user. - public function unpark($username, $domain) - { - $args = array(); - if ( (!isset($username)) && (!isset($domain)) ) { - error_log("unpark requires that a username and domain are passed to it"); - - return false; - } - $args['domain'] = $domain; - - return $this->api2_query($username, 'Park', 'unpark', $args); - } - - #### - # cPanel API2 functions - # Note: A cPanel account username is required - # Some cPanel features must be enabled to be able to use some function - #### - - // This API2 function allows you to view the diskusage of a emailaccount. - public function getdiskusage($username, $args) - { - if (!isset($username) || !isset($args)) { - error_log("getdiskusage requires that a username and args are passed to it"); - - return false; - } - if (is_array($args) && (!isset($args['domain']) || !isset($args['login']))) { - error_log("getdiskusage requires that args at least contains an email_domain and email_username"); - - return false; - } - - return $this->api2_query($username, 'Email', 'getdiskusage', $args); - } - - // This API2 function allows you to list ftp-users associated with a cPanel account including disk information. - public function listftpwithdisk($username) - { - if (!isset($username)) { - error_log("listftpwithdisk requires that user is passed to it"); - - return false; - } - - return $this->api2_query($username, 'Ftp', 'listftpwithdisk'); - } - - // This API2 function allows you to list ftp-users associated with a cPanel account. - public function listftp($username) - { - if (!isset($username)) { - error_log("listftp requires that user is passed to it"); - - return false; - } - - return $this->api2_query($username, 'Ftp', 'listftp'); - } - - // This API function displays a list of all parked domains for a specific user. - public function listparkeddomains($username, $domain = null) - { - $args = array(); - if (!isset($username)) { - error_log("listparkeddomains requires that a user is passed to it"); - - return false; - } - if (isset($domain)) { - $args['regex'] = $domain; - - return $this->api2_query($username, 'Park', 'listparkeddomains', $args); - } - - return $this->api2_query($username, 'Park', 'listparkeddomains'); - } - - // This API function displays a list of all addon domains for a specific user. - public function listaddondomains($username, $domain = null) - { - $args = array(); - if (!isset($username)) { - error_log("listaddondomains requires that a user is passed to it"); - - return false; - } - if (isset($domain)) { - $args['regex'] = $domain; - - return $this->api2_query($username, 'AddonDomain', 'listaddondomains', $args); - } - - return $this->api2_query($username, 'Park', 'listaddondomains'); - } - - // This API function displays a list of all selected stats for a specific user. - public function stat($username, $args = null) - { - if ( (!isset($username)) || (!isset($args)) ) { - error_log("stat requires that a username and options are passed to it"); - - return false; - } - if (is_array($args)) { - $display = ''; - foreach ($args as $value) { - $display .= $value . '|'; - } - $values['display'] = substr($display, 0, -1); - } else { - $values['display'] = substr($args, 0, -1); - } - - return $this->api2_query($username, 'StatsBar', 'stat', $values); - } - -} diff --git a/plugins/directadmin-change-password/DirectAdminChangePasswordDriver.php b/plugins/directadmin-change-password/DirectAdminChangePasswordDriver.php deleted file mode 100644 index 88cd730ae..000000000 --- a/plugins/directadmin-change-password/DirectAdminChangePasswordDriver.php +++ /dev/null @@ -1,152 +0,0 @@ -sHost = $sHost; - $this->iPort = $iPort; - - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \DirectAdminChangePasswordDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \DirectAdminChangePasswordDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('DirectAdmin: Try to change password for '.$oAccount->Email()); - } - - $bResult = false; - if (!empty($this->sHost) && 0 < $this->iPort && $oAccount) - { - $sEmail = \trim(\strtolower($oAccount->Email())); - - $sHost = \trim($this->sHost); - $sHost = \str_replace('{user:host-imap}', $oAccount->Domain()->IncHost(), $sHost); - $sHost = \str_replace('{user:host-smtp}', $oAccount->Domain()->OutHost(), $sHost); - $sHost = \str_replace('{user:domain}', \MailSo\Base\Utils::GetDomainFromEmail($sEmail), $sHost); - $sHost = \rtrim($this->sHost, '/\\'); - - if (!\preg_match('/^http[s]?:\/\//i', $sHost)) - { - $sHost = 'http://'.$sHost; - } - - $sUrl = $sHost.':'.$this->iPort.'/CMD_CHANGE_EMAIL_PASSWORD'; - - $iCode = 0; - $oHttp = \MailSo\Base\Http::SingletonInstance(); - - if ($this->oLogger) - { - $this->oLogger->Write('DirectAdmin[Api Request]:'.$sUrl); - } - - $mResult = $oHttp->SendPostRequest($sUrl, - array( - 'email' => $sEmail, - 'oldpassword' => $sPrevPassword, - 'password1' => $sNewPassword, - 'password2' => $sNewPassword, - 'api' => '1' - ), 'MailSo Http User Agent (v1)', $iCode, $this->oLogger); - - if (false !== $mResult && 200 === $iCode) - { - $aRes = null; - @\parse_str($mResult, $aRes); - if (is_array($aRes) && (!isset($aRes['error']) || (int) $aRes['error'] !== 1)) - { - $bResult = true; - } - else - { - if ($this->oLogger) - { - $this->oLogger->Write('DirectAdmin[Error]: Response: '.$mResult); - } - } - } - else - { - if ($this->oLogger) - { - $this->oLogger->Write('DirectAdmin[Error]: Empty Response: Code:'.$iCode); - } - } - } - - return $bResult; - } -} \ No newline at end of file diff --git a/plugins/directadmin-change-password/LICENSE b/plugins/directadmin-change-password/LICENSE deleted file mode 100644 index 271342337..000000000 --- a/plugins/directadmin-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 RainLoop Team - -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. diff --git a/plugins/directadmin-change-password/README b/plugins/directadmin-change-password/README deleted file mode 100644 index 5249046b2..000000000 --- a/plugins/directadmin-change-password/README +++ /dev/null @@ -1 +0,0 @@ -Plugin that adds functionality to change the email account password (DirectAdmin). \ No newline at end of file diff --git a/plugins/directadmin-change-password/VERSION b/plugins/directadmin-change-password/VERSION deleted file mode 100644 index b123147e2..000000000 --- a/plugins/directadmin-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 \ No newline at end of file diff --git a/plugins/directadmin-change-password/index.php b/plugins/directadmin-change-password/index.php deleted file mode 100644 index 79244735a..000000000 --- a/plugins/directadmin-change-password/index.php +++ /dev/null @@ -1,55 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - $sHost = \trim($this->Config()->Get('plugin', 'direct_admin_host', '')); - $iPort = (int) $this->Config()->Get('plugin', 'direct_admin_port', 2222); - - if (!empty($sHost) && 0 < $iPort) - { - include_once __DIR__.'/DirectAdminChangePasswordDriver.php'; - - $oProvider = new DirectAdminChangePasswordDriver(); - $oProvider->SetLogger($this->Manager()->Actions()->Logger()); - $oProvider->SetConfig($sHost, $iPort); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - } - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('direct_admin_host')->SetLabel('DirectAdmin Host') - ->SetDefaultValue('') - ->SetDescription('Allowed patterns: {user:host-imap}, {user:host-smtp}, {user:domain}'), - \RainLoop\Plugins\Property::NewInstance('direct_admin_port')->SetLabel('DirectAdmin Port') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::INT) - ->SetDefaultValue(2222), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} \ No newline at end of file diff --git a/plugins/froxlor-change-password/FroxlorChangePasswordDriver.php b/plugins/froxlor-change-password/FroxlorChangePasswordDriver.php deleted file mode 100644 index 6ee9cd553..000000000 --- a/plugins/froxlor-change-password/FroxlorChangePasswordDriver.php +++ /dev/null @@ -1,293 +0,0 @@ -sDsn = $sDsn; - $this->sUser = $sUser; - $this->sPassword = $sPassword; - - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \FroxlorChangePasswordDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \FroxlorChangePasswordDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) { - $this->oLogger->Write('Froxlor: Try to change password for '.$oAccount->Email()); - } - - $bResult = false; - if (!empty($this->sDsn) && 0 < \strlen($this->sUser) && 0 < \strlen($this->sPassword) && $oAccount) - { - try - { - $oPdo = new \PDO($this->sDsn, $this->sUser, $this->sPassword); - $oPdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - - $oStmt = $oPdo->prepare('SELECT password_enc, id FROM mail_users WHERE username = ? LIMIT 1'); - if ($oStmt->execute(array($oAccount->IncLogin()))) - { - $aFetchResult = $oStmt->fetchAll(\PDO::FETCH_ASSOC); - if (\is_array($aFetchResult) && isset($aFetchResult[0]['password_enc'], $aFetchResult[0]['id'])) - { - $sDbPassword = \stripslashes($aFetchResult[0]['password_enc']); - - if ( $this->validatePasswordLogin( $sDbPassword, $sPrevPassword ) ) { - $sEncNewPassword = $this->cryptPassword($sNewPassword, 3); - $oStmt = $oPdo->prepare('UPDATE mail_users SET password_enc = ?,password = ? WHERE id = ?'); - $bResult = (bool) $oStmt->execute( - array($sEncNewPassword, $sNewPassword, $aFetchResult[0]['id'])); - } - } - } - } - catch (\Exception $oException) - { - if ($this->oLogger) - { - $this->oLogger->WriteException($oException); - } - } - } - - return $bResult; - } - - /** - * @param string $sPassword - * @return string - */ - private function cryptPassword($sPassword, $type = 3) - { - return $this->makeCryptPassword($sPassword,$type); - } - - /** - * This file is part of the Froxlor project. - * Copyright (c) 2010 the Froxlor Team (see authors). - * - * For the full copyright and license information, please view the COPYING - * file that was distributed with this source code. You can also view the - * COPYING file online at http://files.froxlor.org/misc/COPYING.txt - * - * @copyright (c) the authors - * @author Michal Wojcik - * @author Michael Kaufmann - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Functions - * - */ - - /** - * Make crypted password from clear text password - * - * @author Michal Wojcik - * @author Michael Kaufmann - * @author Froxlor team (2010-) - * - * 0 - default crypt (depenend on system configuration) - * 1 - MD5 $1$ - * 2 - BLOWFISH $2a$ | $2y$07$ (on php 5.3.7+) - * 3 - SHA-256 $5$ (default) - * 4 - SHA-512 $6$ - * - * @param string $password Password to be crypted - * - * @return string encrypted password - */ - private function makeCryptPassword ($password,$type = 3) { - switch ($type) { - case 0: - $cryptPassword = \crypt($password); - break; - case 1: - $cryptPassword = \crypt($password, '$1$' . $this->generatePassword(true). $this->generatePassword(true)); - break; - case 2: - if (\version_compare(\phpversion(), '5.3.7', '<')) { - $cryptPassword = \crypt($password, '$2a$' . $this->generatePassword(true). $this->generatePassword(true)); - } else { - // Blowfish hashing with a salt as follows: "$2a$", "$2x$" or "$2y$", - // a two digit cost parameter, "$", and 22 characters from the alphabet "./0-9A-Za-z" - $cryptPassword = \crypt( - $password, - '$2y$07$' . \substr($this->generatePassword(true).$this->generatePassword(true).$this->generatePassword(true), 0, 22) - ); - } - break; - case 3: - $cryptPassword = \crypt($password, '$5$' . $this->generatePassword(true). $this->generatePassword(true)); - break; - case 4: - $cryptPassword = \crypt($password, '$6$' . $this->generatePassword(true). $this->generatePassword(true)); - break; - default: - $cryptPassword = \crypt($password); - break; - } - - return $cryptPassword; - } - - /** - * Generates a random password - * - * @param boolean $isSalt - * optional, create a hash for a salt used in makeCryptPassword because crypt() does not like some special characters in its salts, default is false - */ - private function generatePassword($isSalt = false) - { - $alpha_lower = 'abcdefghijklmnopqrstuvwxyz'; - $alpha_upper = \strtoupper($alpha_lower); - $numeric = '0123456789'; - $special = '!?<>§$%&+#='; - $length = 10; - - $pw = $this->special_shuffle($alpha_lower); - $n = \floor(($length) / 4); - $pw .= \mb_substr($this->special_shuffle($alpha_upper), 0, $n); - $pw .= \mb_substr($this->special_shuffle($numeric), 0, $n); - $pw = \mb_substr($pw, - $length); - return $this->special_shuffle($pw); - } - - /** - * multibyte-character safe shuffle function - * - * @param string $str - * - * @return string - */ - private function special_shuffle($str = null) - { - $len = \mb_strlen($str); - $sploded = array(); - while ($len -- > 0) { - $sploded[] = \mb_substr($str, $len, 1); - } - \shuffle($sploded); - return \join('', $sploded); - } - - /** - * Function validatePasswordLogin - * - * compare user password-hash with given user-password - * and check if they are the same - * additionally it updates the hash if the system settings changed - * or if the very old md5() sum is used - * - * @param array $userinfo user-data from table - * @param string $password the password to validate - * @param string $table either panel_customers or panel_admins - * @param string $uid user-id-field in $table - * - * @return boolean - */ - private function validatePasswordLogin($pwd_hash, $password = null) { - - $systype = 3; // SHA256 - $update_hash = false; - // check for good'ole md5 - if (\strlen($pwd_hash) == 32 && \ctype_xdigit($pwd_hash)) { - $pwd_check = \md5($password); - $update_hash = true; - } else { - // cut out the salt from the hash - $pwd_salt = \str_replace(\substr(\strrchr($pwd_hash, "$"), 1), "", $pwd_hash); - // create same hash to compare - $pwd_check = \crypt($password, $pwd_salt); - // check whether the hash needs to be updated - $hash_type_chk = \substr($pwd_hash, 0, 3); - if (($systype == 1 && $hash_type_chk != '$1$') || // MD5 - ($systype == 2 && $hash_type_chk != '$2$') || // BLOWFISH - ($systype == 3 && $hash_type_chk != '$5$') || // SHA256 - ($systype == 4 && $hash_type_chk != '$6$') // SHA512 - ) { - $update_hash = true; - } - } - - return $pwd_check; - } - - -} diff --git a/plugins/froxlor-change-password/LICENSE b/plugins/froxlor-change-password/LICENSE deleted file mode 100644 index 10a788ceb..000000000 --- a/plugins/froxlor-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Bob Kromonos Achten - -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. diff --git a/plugins/froxlor-change-password/README b/plugins/froxlor-change-password/README deleted file mode 100644 index b3a26fa46..000000000 --- a/plugins/froxlor-change-password/README +++ /dev/null @@ -1 +0,0 @@ -Plugin that adds functionality to change the email account password (Froxlor). diff --git a/plugins/froxlor-change-password/VERSION b/plugins/froxlor-change-password/VERSION deleted file mode 100644 index d3827e75a..000000000 --- a/plugins/froxlor-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 diff --git a/plugins/froxlor-change-password/index.php b/plugins/froxlor-change-password/index.php deleted file mode 100644 index 1d30410d3..000000000 --- a/plugins/froxlor-change-password/index.php +++ /dev/null @@ -1,76 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @return string - */ - public function Supported() - { - if (!extension_loaded('pdo') || !class_exists('PDO')) - { - return 'The PHP exention PDO (mysql) must be installed to use this plugin'; - } - - $aDrivers = \PDO::getAvailableDrivers(); - if (!is_array($aDrivers) || !in_array('mysql', $aDrivers)) - { - return 'The PHP exention PDO (mysql) must be installed to use this plugin'; - } - - return ''; - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - $sDsn = \trim($this->Config()->Get('plugin', 'pdo_dsn', '')); - $sUser = (string) $this->Config()->Get('plugin', 'user', ''); - $sPassword = (string) $this->Config()->Get('plugin', 'password', ''); - - if (!empty($sDsn) && 0 < \strlen($sUser) && 0 < \strlen($sPassword)) - { - include_once __DIR__.'/FroxlorChangePasswordDriver.php'; - - $oProvider = new FroxlorChangePasswordDriver(); - $oProvider->SetLogger($this->Manager()->Actions()->Logger()); - $oProvider->SetConfig($sDsn, $sUser, $sPassword); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - } - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('pdo_dsn')->SetLabel('Froxlor PDO dsn') - ->SetDefaultValue('mysql:host=127.0.0.1;dbname=froxlor'), - \RainLoop\Plugins\Property::NewInstance('user')->SetLabel('DB User') - ->SetDefaultValue('root'), - \RainLoop\Plugins\Property::NewInstance('password')->SetLabel('DB Password') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD) - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} diff --git a/plugins/google-analytics/LICENSE b/plugins/google-analytics/LICENSE deleted file mode 100644 index 271342337..000000000 --- a/plugins/google-analytics/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 RainLoop Team - -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. diff --git a/plugins/google-analytics/README b/plugins/google-analytics/README deleted file mode 100644 index c7ddf9b9f..000000000 --- a/plugins/google-analytics/README +++ /dev/null @@ -1 +0,0 @@ -Embed Google Analytics (Universal Analytics) code into your webmail installation pages. \ No newline at end of file diff --git a/plugins/google-analytics/VERSION b/plugins/google-analytics/VERSION deleted file mode 100644 index 400122e60..000000000 --- a/plugins/google-analytics/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.5 \ No newline at end of file diff --git a/plugins/google-analytics/index.php b/plugins/google-analytics/index.php deleted file mode 100644 index 9672558db..000000000 --- a/plugins/google-analytics/index.php +++ /dev/null @@ -1,49 +0,0 @@ -Config()->Get('plugin', 'account', '')) - { - $this->addJs('js/include.js'); - } - } - - /** - * @return array - */ - public function configMapping() - { - $oAccount = \RainLoop\Plugins\Property::NewInstance('account')->SetLabel('Account') - ->SetAllowedInJs(true) - ->SetDefaultValue('') - ; - - if (\method_exists($oAccount, 'SetPlaceholder')) - { - $oAccount->SetPlaceholder('UA-XXXXXXXX-X'); - } - - return array($oAccount, - \RainLoop\Plugins\Property::NewInstance('domain_name')->SetLabel('Domain Name') - ->SetAllowedInJs(true) - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('universal_analytics')->SetLabel('Use Universal Analytics') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL) - ->SetAllowedInJs(true) - ->SetDefaultValue(true), - \RainLoop\Plugins\Property::NewInstance('track_pageview')->SetLabel('Track Pageview') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL) - ->SetAllowedInJs(true) - ->SetDefaultValue(true), - \RainLoop\Plugins\Property::NewInstance('send_events')->SetLabel('Send Events') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL) - ->SetAllowedInJs(true) - ->SetDefaultValue(false) - ); - } -} diff --git a/plugins/google-analytics/js/include.js b/plugins/google-analytics/js/include.js deleted file mode 100644 index 6d73d35db..000000000 --- a/plugins/google-analytics/js/include.js +++ /dev/null @@ -1,100 +0,0 @@ - -$(function () { - - if (!window.rl) - { - return; - } - - var - sAccount = window.rl.pluginSettingsGet('google-analytics', 'account'), - sDomain = window.rl.pluginSettingsGet('google-analytics', 'domain_name'), - bUniversalAnalytics = !!window.rl.pluginSettingsGet('google-analytics', 'universal_analytics'), - bTrackPageview = !!window.rl.pluginSettingsGet('google-analytics', 'track_pageview'), - bSendEvent = !!window.rl.pluginSettingsGet('google-analytics', 'send_events'), - fSendEvent = null - ; - - if (sAccount && '' !== sAccount) - { - if (bUniversalAnalytics) - { - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - - if (window.ga) - { - if (sDomain) - { - window.ga('create', sAccount, sDomain); - } - else - { - window.ga('create', sAccount); - } - - if (bTrackPageview) - { - window.ga('send', 'pageview'); - window.setInterval(function () { - window.ga('send', 'pageview'); - }, 1000 * 60 * 2); - } - - if (bSendEvent) - { - fSendEvent = function(sCategory, sAction, sLabel) { - window.ga('send', 'event', sCategory, sAction, sLabel); - }; - } - } - } - else - { - window._gaq = window._gaq || []; - window._gaq.push(['_setAccount', sAccount]); - - if (sDomain) - { - window._gaq.push(['_setDomainName', sDomain]); - } - - if (bTrackPageview) - { - window._gaq.push(['_trackPageview']); - window.setInterval(function () { - window._gaq.push(['_trackPageview']); - }, 1000 * 60 * 2); - } - - if (bSendEvent) - { - fSendEvent = function(sCategory, sAction, sLabel) { - window._gaq.push(['_trackEvent', sCategory, sAction, sLabel]); - }; - } - - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); - } - - if (fSendEvent) - { - window.rl.addHook('ajax-default-response', function (sAction, oData, sType) { - switch (sAction) - { - case 'Login': - case 'SendMessage': - case 'MessageMove': - case 'MessageDelete': - fSendEvent('RainLoop', sAction, - 'success' === sType && oData && oData['Result'] ? 'true' : 'false'); - break; - } - }); - } - } -}); \ No newline at end of file diff --git a/plugins/hmailserver-change-password/HmailserverChangePasswordDriver.php b/plugins/hmailserver-change-password/HmailserverChangePasswordDriver.php deleted file mode 100644 index d03c9c615..000000000 --- a/plugins/hmailserver-change-password/HmailserverChangePasswordDriver.php +++ /dev/null @@ -1,138 +0,0 @@ -sLogin = $sLogin; - $this->sPassword = $sPassword; - - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \HmailserverChangePasswordDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \HmailserverChangePasswordDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Model\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Model\Account $oHmailAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oHmailAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('Try to change password for '.$oHmailAccount->Email()); - } - - $bResult = false; - - try - { - $oHmailApp = new COM("hMailServer.Application"); - $oHmailApp->Connect(); - - if ($oHmailApp->Authenticate($this->sLogin, $this->sPassword)) - { - $sEmail = $oHmailAccount->Email(); - $sDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail); - - $oHmailDomain = $oHmailApp->Domains->ItemByName($sDomain); - if ($oHmailDomain) - { - $oHmailAccount = $oHmailDomain->Accounts->ItemByAddress($sEmail); - if ($oHmailAccount) - { - $oHmailAccount->Password = $sNewPassword; - $oHmailAccount->Save(); - - $bResult = true; - } - else - { - $this->oLogger->Write('HMAILSERVER: Unknown account ('.$sEmail.')', \MailSo\Log\Enumerations\Type::ERROR); - } - } - else - { - $this->oLogger->Write('HMAILSERVER: Unknown domain ('.$sDomain.')', \MailSo\Log\Enumerations\Type::ERROR); - } - } - else - { - $this->oLogger->Write('HMAILSERVER: Auth error', \MailSo\Log\Enumerations\Type::ERROR); - } - } - catch (\Exception $oException) - { - if ($this->oLogger) - { - $this->oLogger->WriteException($oException); - } - } - - return $bResult; - } -} \ No newline at end of file diff --git a/plugins/hmailserver-change-password/LICENSE b/plugins/hmailserver-change-password/LICENSE deleted file mode 100644 index 4a4ca8d81..000000000 --- a/plugins/hmailserver-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 RainLoop Team - -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. diff --git a/plugins/hmailserver-change-password/VERSION b/plugins/hmailserver-change-password/VERSION deleted file mode 100644 index ea710abb9..000000000 --- a/plugins/hmailserver-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.2 \ No newline at end of file diff --git a/plugins/hmailserver-change-password/index.php b/plugins/hmailserver-change-password/index.php deleted file mode 100644 index c499450e2..000000000 --- a/plugins/hmailserver-change-password/index.php +++ /dev/null @@ -1,67 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @return string - */ - public function Supported() - { - if (!class_exists('COM')) - { - return 'The PHP extension COM must be installed to use this plugin'; - } - - return ''; - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - $sLogin = (string) $this->Config()->Get('plugin', 'login', ''); - $sPassword = (string) $this->Config()->Get('plugin', 'password', ''); - - if (0 < \strlen($sLogin) && 0 < \strlen($sPassword)) - { - include_once __DIR__.'/HmailserverChangePasswordDriver.php'; - - $oProvider = new HmailserverChangePasswordDriver(); - $oProvider->SetLogger($this->Manager()->Actions()->Logger()); - $oProvider->SetConfig($sLogin, $sPassword); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - } - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('login')->SetLabel('HmailServer Admin Login') - ->SetDefaultValue('Administrator'), - \RainLoop\Plugins\Property::NewInstance('password')->SetLabel('HmailServer Admin Password') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD) - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} \ No newline at end of file diff --git a/plugins/ispconfig-change-password/IspConfigChangePasswordDriver.php b/plugins/ispconfig-change-password/IspConfigChangePasswordDriver.php deleted file mode 100644 index 40059247a..000000000 --- a/plugins/ispconfig-change-password/IspConfigChangePasswordDriver.php +++ /dev/null @@ -1,151 +0,0 @@ -sDsn = $sDsn; - $this->sUser = $sUser; - $this->sPassword = $sPassword; - - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \IspConfigChangePasswordDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \IspConfigChangePasswordDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Model\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Model\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('ISP: Try to change password for '.$oAccount->Email()); - } - - $bResult = false; - if (!empty($this->sDsn) && 0 < \strlen($this->sUser) && 0 < \strlen($this->sPassword) && $oAccount) - { - try - { - $oPdo = new \PDO($this->sDsn, $this->sUser, $this->sPassword); - $oPdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - - $oStmt = $oPdo->prepare('SELECT password, mailuser_id FROM mail_user WHERE login = ? LIMIT 1'); - if ($oStmt->execute(array($oAccount->IncLogin()))) - { - $aFetchResult = $oStmt->fetchAll(\PDO::FETCH_ASSOC); - if (\is_array($aFetchResult) && isset($aFetchResult[0]['password'], $aFetchResult[0]['mailuser_id'])) - { - $sDbPassword = \stripslashes($aFetchResult[0]['password']); - $sDbSalt = '$1$'.\substr($sDbPassword, 3, 8).'$'; - - if (\crypt(\stripslashes($sPrevPassword), $sDbSalt) === $sDbPassword) - { - $oStmt = $oPdo->prepare('UPDATE mail_user SET password = ? WHERE mailuser_id = ?'); - $bResult = (bool) $oStmt->execute( - array($this->cryptPassword($sNewPassword), $aFetchResult[0]['mailuser_id'])); - } - } - } - } - catch (\Exception $oException) - { - if ($this->oLogger) - { - $this->oLogger->WriteException($oException); - } - } - } - - return $bResult; - } - - /** - * @param string $sPassword - * @return string - */ - private function cryptPassword($sPassword) - { - $sSalt = ''; - $sBase64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - - for ($iIndex = 0; $iIndex < 8; $iIndex++) - { - $sSalt .= $sBase64[\rand(0, 63)]; - } - - return \crypt($sPassword, '$1$'.$sSalt.'$'); - } -} \ No newline at end of file diff --git a/plugins/ispconfig-change-password/LICENSE b/plugins/ispconfig-change-password/LICENSE deleted file mode 100644 index 271342337..000000000 --- a/plugins/ispconfig-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 RainLoop Team - -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. diff --git a/plugins/ispconfig-change-password/README b/plugins/ispconfig-change-password/README deleted file mode 100644 index 529de7bfb..000000000 --- a/plugins/ispconfig-change-password/README +++ /dev/null @@ -1 +0,0 @@ -Plugin that adds functionality to change the email account password (ISPConfig). \ No newline at end of file diff --git a/plugins/ispconfig-change-password/VERSION b/plugins/ispconfig-change-password/VERSION deleted file mode 100644 index b123147e2..000000000 --- a/plugins/ispconfig-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 \ No newline at end of file diff --git a/plugins/ispconfig-change-password/index.php b/plugins/ispconfig-change-password/index.php deleted file mode 100644 index 34906074f..000000000 --- a/plugins/ispconfig-change-password/index.php +++ /dev/null @@ -1,76 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @return string - */ - public function Supported() - { - if (!extension_loaded('pdo') || !class_exists('PDO')) - { - return 'The PHP extension PDO (mysql) must be installed to use this plugin'; - } - - $aDrivers = \PDO::getAvailableDrivers(); - if (!is_array($aDrivers) || !in_array('mysql', $aDrivers)) - { - return 'The PHP extension PDO (mysql) must be installed to use this plugin'; - } - - return ''; - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - $sDsn = \trim($this->Config()->Get('plugin', 'pdo_dsn', '')); - $sUser = (string) $this->Config()->Get('plugin', 'user', ''); - $sPassword = (string) $this->Config()->Get('plugin', 'password', ''); - - if (!empty($sDsn) && 0 < \strlen($sUser) && 0 < \strlen($sPassword)) - { - include_once __DIR__.'/IspConfigChangePasswordDriver.php'; - - $oProvider = new IspConfigChangePasswordDriver(); - $oProvider->SetLogger($this->Manager()->Actions()->Logger()); - $oProvider->SetConfig($sDsn, $sUser, $sPassword); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - } - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('pdo_dsn')->SetLabel('ISPConfig PDO dsn') - ->SetDefaultValue('mysql:host=127.0.0.1;dbname=dbispconfig'), - \RainLoop\Plugins\Property::NewInstance('user')->SetLabel('DB User') - ->SetDefaultValue('root'), - \RainLoop\Plugins\Property::NewInstance('password')->SetLabel('DB Password') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD) - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} \ No newline at end of file diff --git a/plugins/ispmail-change-password/ChangePasswordISPmailDriver.php b/plugins/ispmail-change-password/ChangePasswordISPmailDriver.php deleted file mode 100755 index 41857bc13..000000000 --- a/plugins/ispmail-change-password/ChangePasswordISPmailDriver.php +++ /dev/null @@ -1,276 +0,0 @@ -sHost = $sHost; - return $this; - } - - /** - * @param int $iPort - * - * @return \ChangePasswordISPmailDriver - */ - public function SetPort($iPort) - { - $this->iPort = (int) $iPort; - return $this; - } - - /** - * @param string $sDatabase - * - * @return \ChangePasswordISPmailDriver - */ - public function SetDatabase($sDatabase) - { - $this->sDatabase = $sDatabase; - return $this; - } - - /** - * @param string $sTable - * - * @return \ChangePasswordISPmailDriver - */ - public function SetTable($sTable) - { - $this->sTable = $sTable; - return $this; - } - - /** - * @param string $sUsercol - * - * @return \ChangePasswordISPmailDriver - */ - public function SetUserColumn($sUsercol) - { - $this->sUsercol = $sUsercol; - return $this; - } - - /** - * @param string $sPasscol - * - * @return \ChangePasswordISPmailDriver - */ - public function SetPasswordColumn($sPasscol) - { - $this->sPasscol = $sPasscol; - return $this; - } - - /** - * @param string $sUser - * - * @return \ChangePasswordISPmailDriver - */ - public function SetUser($sUser) - { - $this->sUser = $sUser; - return $this; - } - - /** - * @param string $sPassword - * - * @return \ChangePasswordISPmailDriver - */ - public function SetPassword($sPassword) - { - $this->sPassword = $sPassword; - return $this; - } - - /** - * @param string $sEncrypt - * - * @return \ChangePasswordISPmailDriver - */ - public function SetEncrypt($sEncrypt) - { - $this->sEncrypt = $sEncrypt; - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \ChangePasswordISPmailDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \ChangePasswordISPmailDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Model\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Model\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('ISPmail: Try to change password for '.$oAccount->Email()); - } - - unset($sPrevPassword); - - $bResult = false; - - if (0 < \strlen($sNewPassword)) - { - try - { - $sDsn = 'mysql:host='.$this->sHost.';port='.$this->iPort.';dbname='.$this->sDatabase; - - $oPdo = new \PDO($sDsn, $this->sUser, $this->sPassword); - $oPdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - - $sUpdatePassword = $this->cryptPassword($sNewPassword, $oPdo); - if (0 < \strlen($sUpdatePassword)) - { - $oStmt = $oPdo->prepare("UPDATE {$this->sTable} SET {$this->sPasscol} = ? WHERE {$this->sUsercol} = ?"); - $bResult = (bool) $oStmt->execute(array($sUpdatePassword, $oAccount->Email())); - } - else - { - if ($this->oLogger) - { - $this->oLogger->Write('ISPmail: Encrypted password is empty', - \MailSo\Log\Enumerations\Type::ERROR); - } - } - - $oPdo = null; - } - catch (\Exception $oException) - { - if ($this->oLogger) - { - $this->oLogger->WriteException($oException); - } - } - } - - return $bResult; - } - - /** - * @param string $sPassword - * @param \PDO $oPdo - * - * @return string - */ - private function cryptPassword($sPassword, $oPdo) - { - $sResult = ''; - $sSalt = substr(str_shuffle('./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'), 0, 16); - switch (strtolower($this->sEncrypt)) - { - default: - case 'plain-md5': - $sResult = '{PLAIN-MD5}' . md5($sPassword); - break; - - case 'sha256-crypt': - $sResult = '{SHA256-CRYPT}' . crypt($sPassword,'$5$'.$sSalt); - break; - } - - return $sResult; - } -} diff --git a/plugins/ispmail-change-password/LICENSE b/plugins/ispmail-change-password/LICENSE deleted file mode 100644 index 2730b2622..000000000 --- a/plugins/ispmail-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Julien Lutran (https://github.com/jlutran) - -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. diff --git a/plugins/ispmail-change-password/README b/plugins/ispmail-change-password/README deleted file mode 100644 index 1fc44b8a3..000000000 --- a/plugins/ispmail-change-password/README +++ /dev/null @@ -1 +0,0 @@ -Plugin that adds functionality to change the email account password (ISPmail). diff --git a/plugins/ispmail-change-password/VERSION b/plugins/ispmail-change-password/VERSION deleted file mode 100644 index d3827e75a..000000000 --- a/plugins/ispmail-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 diff --git a/plugins/ispmail-change-password/index.php b/plugins/ispmail-change-password/index.php deleted file mode 100755 index 43e8e2147..000000000 --- a/plugins/ispmail-change-password/index.php +++ /dev/null @@ -1,95 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @return string - */ - public function Supported() - { - if (!extension_loaded('pdo') || !class_exists('PDO')) - { - return 'The PHP extension PDO (mysql) must be installed to use this plugin'; - } - - $aDrivers = \PDO::getAvailableDrivers(); - if (!is_array($aDrivers) || !in_array('mysql', $aDrivers)) - { - return 'The PHP extension PDO (mysql) must be installed to use this plugin'; - } - - return ''; - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - include_once __DIR__.'/ChangePasswordISPmailDriver.php'; - - $oProvider = new ChangePasswordISPmailDriver(); - - $oProvider - ->SetHost($this->Config()->Get('plugin', 'host', '')) - ->SetPort((int) $this->Config()->Get('plugin', 'port', 3306)) - ->SetDatabase($this->Config()->Get('plugin', 'database', '')) - ->SetTable($this->Config()->Get('plugin', 'table', '')) - ->SetUserColumn($this->Config()->Get('plugin', 'usercol', '')) - ->SetPasswordColumn($this->Config()->Get('plugin', 'passcol', '')) - ->SetUser($this->Config()->Get('plugin', 'user', '')) - ->SetPassword($this->Config()->Get('plugin', 'password', '')) - ->SetEncrypt($this->Config()->Get('plugin', 'encrypt', '')) - ->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))) - ->SetLogger($this->Manager()->Actions()->Logger()) - ; - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('host')->SetLabel('MySQL Host') - ->SetDefaultValue('127.0.0.1'), - \RainLoop\Plugins\Property::NewInstance('port')->SetLabel('MySQL Port') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::INT) - ->SetDefaultValue(3306), - \RainLoop\Plugins\Property::NewInstance('database')->SetLabel('MySQL Database') - ->SetDefaultValue('mailserver'), - \RainLoop\Plugins\Property::NewInstance('table')->SetLabel('MySQL table') - ->SetDefaultValue('virtual_users'), - \RainLoop\Plugins\Property::NewInstance('usercol')->SetLabel('MySQL username column') - ->SetDefaultValue('email'), - \RainLoop\Plugins\Property::NewInstance('passcol')->SetLabel('MySQL password column') - ->SetDefaultValue('password'), - \RainLoop\Plugins\Property::NewInstance('user')->SetLabel('MySQL User') - ->SetDefaultValue('mailuser'), - \RainLoop\Plugins\Property::NewInstance('password')->SetLabel('MySQL Password') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD) - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('encrypt')->SetLabel('Encrypt') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION) - ->SetDefaultValue(array('PLAIN-MD5', 'SHA256-CRYPT')) - ->SetDescription('In what way do you want the passwords to be crypted ?'), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} diff --git a/plugins/ldap-change-password/ChangePasswordLdapDriver.php b/plugins/ldap-change-password/ChangePasswordLdapDriver.php deleted file mode 100644 index 27d735268..000000000 --- a/plugins/ldap-change-password/ChangePasswordLdapDriver.php +++ /dev/null @@ -1,242 +0,0 @@ -sHostName = $sHostName; - $this->iHostPort = $iHostPort; - $this->sUserDnFormat = $sUserDnFormat; - $this->sPasswordField = $sPasswordField; - $this->sPasswordEncType = $sPasswordEncType; - - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \ChangePasswordLdapDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \ChangePasswordLdapDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Model\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - $bResult = false; - - try - { - $sDomain = \MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email()); - $sUserDn = \strtr($this->sUserDnFormat, array( - '{domain}' => $sDomain, - '{domain:dc}' => 'dc='.\strtr($sDomain, array('.' => ',dc=')), - '{email}' => $oAccount->Email(), - '{email:user}' => \MailSo\Base\Utils::GetAccountNameFromEmail($oAccount->Email()), - '{email:domain}' => $sDomain, - '{login}' => $oAccount->Login(), - '{imap:login}' => $oAccount->Login(), - '{imap:host}' => $oAccount->DomainIncHost(), - '{imap:port}' => $oAccount->DomainIncPort(), - '{gecos}' => function_exists('posix_getpwnam') ? posix_getpwnam($oAccount->Login()) : '' - )); - - $oCon = @\ldap_connect($this->sHostName, $this->iHostPort); - if ($oCon) - { - if (!@\ldap_set_option($oCon, LDAP_OPT_PROTOCOL_VERSION, 3)) - { - $this->oLogger->Write( - 'Failed to set LDAP Protocol version to 3, TLS not supported.', - \MailSo\Log\Enumerations\Type::WARNING, - 'LDAP' - ); - } - else if (@!ldap_start_tls($oCon)) - { - $this->oLogger->Write("ldap_start_tls failed: ".$oCon, \MailSo\Log\Enumerations\Type::WARNING, 'LDAP'); - } - - if (!@\ldap_bind($oCon, $sUserDn, $sPrevPassword)) - { - if ($this->oLogger) - { - $sError = $oCon ? @\ldap_error($oCon) : ''; - $iErrno = $oCon ? @\ldap_errno($oCon) : 0; - - $this->oLogger->Write('ldap_bind error: '.$sError.' ('.$iErrno.')', - \MailSo\Log\Enumerations\Type::WARNING, 'LDAP'); - } - - return false; - } - } - else - { - return false; - } - - $sSshaSalt = ''; - $sShaPrefix = '{SHA}'; - $sEncodedNewPassword = $sNewPassword; - switch (\strtolower($this->sPasswordEncType)) - { - case 'ssha': - $sSshaSalt = $this->getSalt(4); - $sShaPrefix = '{SSHA}'; - case 'sha': - switch (true) - { - default: - case \function_exists('sha1'): - $sEncodedNewPassword = $sShaPrefix.\base64_encode(\sha1($sNewPassword.$sSshaSalt, true).$sSshaSalt); - break; - case \function_exists('hash'): - $sEncodedNewPassword = $sShaPrefix.\base64_encode(\hash('sha1', $sNewPassword, true).$sSshaSalt); - break; - case \function_exists('mhash') && defined('MHASH_SHA1'): - $sEncodedNewPassword = $sShaPrefix.\base64_encode(\mhash(MHASH_SHA1, $sNewPassword).$sSshaSalt); - break; - } - break; - case 'md5': - $sEncodedNewPassword = '{MD5}'.\base64_encode(\pack('H*', \md5($sNewPassword))); - break; - case 'crypt': - $sEncodedNewPassword = '{CRYPT}'.\crypt($sNewPassword, $this->getSalt(2)); - break; - } - - $aEntry = array(); - $aEntry[$this->sPasswordField] = (string) $sEncodedNewPassword; - - if (!!@\ldap_modify($oCon, $sUserDn, $aEntry)) - { - $bResult = true; - } - else - { - if ($this->oLogger) - { - $sError = $oCon ? @\ldap_error($oCon) : ''; - $iErrno = $oCon ? @\ldap_errno($oCon) : 0; - - $this->oLogger->Write('ldap_modify error: '.$sError.' ('.$iErrno.')', - \MailSo\Log\Enumerations\Type::WARNING, 'LDAP'); - } - } - } - catch (\Exception $oException) - { - if ($this->oLogger) - { - $this->oLogger->WriteException($oException, - \MailSo\Log\Enumerations\Type::WARNING, 'LDAP'); - } - - $bResult = false; - } - - return $bResult; - } - - /** - * @param int $iLength - * - * @return string - */ - private function getSalt($iLength) - { - $sChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; - $iCharsLength = \strlen($sChars); - - $sResult = ''; - while (\strlen($sResult) < $iLength) - { - $sResult .= \substr($sChars, \rand() % $iCharsLength, 1); - } - - return $sResult; - } -} diff --git a/plugins/ldap-change-password/LICENSE b/plugins/ldap-change-password/LICENSE deleted file mode 100644 index 4aed64b3a..000000000 --- a/plugins/ldap-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 RainLoop Team - -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. diff --git a/plugins/ldap-change-password/README b/plugins/ldap-change-password/README deleted file mode 100644 index 53c1abf7f..000000000 --- a/plugins/ldap-change-password/README +++ /dev/null @@ -1 +0,0 @@ -Plugin that adds functionality to change the email account password (LDAP Password). diff --git a/plugins/ldap-change-password/VERSION b/plugins/ldap-change-password/VERSION deleted file mode 100644 index b123147e2..000000000 --- a/plugins/ldap-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 \ No newline at end of file diff --git a/plugins/ldap-change-password/index.php b/plugins/ldap-change-password/index.php deleted file mode 100644 index 128557937..000000000 --- a/plugins/ldap-change-password/index.php +++ /dev/null @@ -1,79 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @return string - */ - public function Supported() - { - if (!\function_exists('ldap_connect')) - { - return 'The LDAP PHP extension must be installed to use this plugin'; - } - - return ''; - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - $sHostName = \trim($this->Config()->Get('plugin', 'hostname', '')); - $iHostPort = (int) $this->Config()->Get('plugin', 'port', 389); - $sUserDnFormat = \trim($this->Config()->Get('plugin', 'user_dn_format', '')); - $sPasswordField = \trim($this->Config()->Get('plugin', 'password_field', '')); - $sPasswordEncType = \trim($this->Config()->Get('plugin', 'password_enc_type', '')); - - if (!empty($sHostName) && 0 < $iHostPort && !empty($sUserDnFormat) && !empty($sPasswordField) && !empty($sPasswordEncType)) - { - include_once __DIR__.'/ChangePasswordLdapDriver.php'; - - $oProvider = new \ChangePasswordLdapDriver(); - - $oProvider - ->SetConfig($sHostName, $iHostPort, $sUserDnFormat, $sPasswordField, $sPasswordEncType) - ->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))) - ->SetLogger($this->Manager()->Actions()->Logger()) - ; - } - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('hostname')->SetLabel('LDAP hostname') - ->SetDefaultValue('127.0.0.1'), - \RainLoop\Plugins\Property::NewInstance('port')->SetLabel('LDAP port') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::INT) - ->SetDefaultValue(389), - \RainLoop\Plugins\Property::NewInstance('user_dn_format')->SetLabel('User DN format') - ->SetDescription('LDAP user dn format. Supported tokens: {email}, {email:user}, {email:domain}, {login}, {domain}, {domain:dc}, {imap:login}, {imap:host}, {imap:port}, {gecos}') - ->SetDefaultValue('uid={imap:login},ou=Users,{domain:dc}'), - \RainLoop\Plugins\Property::NewInstance('password_field')->SetLabel('Password field') - ->SetDefaultValue('userPassword'), - \RainLoop\Plugins\Property::NewInstance('password_enc_type')->SetLabel('Encryption type') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION) - ->SetDefaultValue(array('SHA', 'SSHA', 'MD5', 'Crypt', 'Clear')), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} diff --git a/plugins/mailcow-change-password/LICENSE b/plugins/mailcow-change-password/LICENSE deleted file mode 100644 index 3a897637b..000000000 --- a/plugins/mailcow-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Caleb Blankemeyer (https://github.com/zikeji) - -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. diff --git a/plugins/mailcow-change-password/MailcowChangePasswordDriver.php b/plugins/mailcow-change-password/MailcowChangePasswordDriver.php deleted file mode 100644 index d8a53be49..000000000 --- a/plugins/mailcow-change-password/MailcowChangePasswordDriver.php +++ /dev/null @@ -1,162 +0,0 @@ -sDsn = $sDsn; - $this->sUser = $sUser; - $this->sPassword = $sPassword; - - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \IspConfigChangePasswordDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \IspConfigChangePasswordDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('Mailcow: Try to change password for '.$oAccount->Email()); - } - - $bResult = false; - if (!empty($this->sDsn) && 0 < \strlen($this->sUser) && 0 < \strlen($this->sPassword) && $oAccount) - { - try - { - $oPdo = new \PDO($this->sDsn, $this->sUser, $this->sPassword); - $oPdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - - $oStmt = $oPdo->prepare('SELECT password, username FROM mailbox WHERE username = ? LIMIT 1'); - if ($oStmt->execute(array($oAccount->IncLogin()))) - { - $aFetchResult = $oStmt->fetchAll(\PDO::FETCH_ASSOC); - if (\is_array($aFetchResult) && isset($aFetchResult[0]['password'], $aFetchResult[0]['username'])) - { - $sDbPassword = $aFetchResult[0]['password']; - if (\substr($sDbPassword, 0, 14) === '{SHA512-CRYPT}') { - $sDbSalt = \substr($sDbPassword, 17, 16); - } else { - $sDbSalt = \substr($sDbPassword, 3, 16); - } - - if ('{SHA512-CRYPT}'.\crypt($sPrevPassword, '$6$'.$sDbSalt) === $sDbPassword) - { - $oStmt = $oPdo->prepare('UPDATE mailbox SET password = ? WHERE username = ?'); - if ($oStmt->execute(array($this->cryptPassword($sNewPassword), $aFetchResult[0]['username']))) { - $oStmt = $oPdo ->prepare('UPDATE users SET digesta1=MD5(CONCAT(?, ":SabreDAV:", ?)) WHERE username=?'); - if ($oStmt->execute(array($aFetchResult[0]['username'],$sNewPassword,$aFetchResult[0]['username']))) { - //the MailCow & SabreDav have been updated, now update the doveadm password - exec("/usr/bin/doveadm pw -s SHA512-CRYPT -p $sNewPassword", $hash, $return); - $bResult = true; - } - } - } - } - } - } - catch (\Exception $oException) - { - if ($this->oLogger) - { - $this->oLogger->WriteException($oException); - } - } - } - - return $bResult; - } - - /** - * @param string $sPassword - * @return string - */ - private function cryptPassword($sPassword) - { - $sSalt = ''; - $sBase64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - - for ($iIndex = 0; $iIndex < 16; $iIndex++) - { - $sSalt .= $sBase64[\rand(0, 63)]; - } - - $crypted = \crypt($sPassword, '$6$'.$sSalt); - return '{SHA512-CRYPT}'.$crypted; - } -} diff --git a/plugins/mailcow-change-password/README b/plugins/mailcow-change-password/README deleted file mode 100644 index 2d75466b9..000000000 --- a/plugins/mailcow-change-password/README +++ /dev/null @@ -1,5 +0,0 @@ -Plugin that adds functionality to change the email account password with the email frontend [mailcow](https://github.com/andryyy/mailcow). - -Changes the SQL password (for the default ui for users), the dovecot password, and the SabreDAV password. Essentially does what their own PHP script does. It also ensures the old password matches the actual old password (something their Roundcube plugin does not do). - -This plugin is a modification of the [ispconfig-change-password](https://github.com/RainLoop/rainloop-webmail/tree/master/plugins/ipsconfig-change-password) plugin. diff --git a/plugins/mailcow-change-password/VERSION b/plugins/mailcow-change-password/VERSION deleted file mode 100644 index d3827e75a..000000000 --- a/plugins/mailcow-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 diff --git a/plugins/mailcow-change-password/index.php b/plugins/mailcow-change-password/index.php deleted file mode 100644 index 0329f9837..000000000 --- a/plugins/mailcow-change-password/index.php +++ /dev/null @@ -1,76 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @return string - */ - public function Supported() - { - if (!extension_loaded('pdo') || !class_exists('PDO')) - { - return 'The PHP extension PDO (mysql) must be installed to use this plugin'; - } - - $aDrivers = \PDO::getAvailableDrivers(); - if (!is_array($aDrivers) || !in_array('mysql', $aDrivers)) - { - return 'The PHP extension PDO (mysql) must be installed to use this plugin'; - } - - return ''; - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - $sDsn = \trim($this->Config()->Get('plugin', 'pdo_dsn', '')); - $sUser = (string) $this->Config()->Get('plugin', 'user', ''); - $sPassword = (string) $this->Config()->Get('plugin', 'password', ''); - - if (!empty($sDsn) && 0 < \strlen($sUser) && 0 < \strlen($sPassword)) - { - include_once __DIR__.'/MailcowChangePasswordDriver.php'; - - $oProvider = new MailcowChangePasswordDriver(); - $oProvider->SetLogger($this->Manager()->Actions()->Logger()); - $oProvider->SetConfig($sDsn, $sUser, $sPassword); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - } - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('pdo_dsn')->SetLabel('Mailcow PDO dsn') - ->SetDefaultValue('mysql:host=127.0.0.1;dbname=mailcow'), - \RainLoop\Plugins\Property::NewInstance('user')->SetLabel('DB User') - ->SetDefaultValue('mailcow'), - \RainLoop\Plugins\Property::NewInstance('password')->SetLabel('DB Password') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD) - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} diff --git a/plugins/mailinabox-change-password/LICENSE b/plugins/mailinabox-change-password/LICENSE deleted file mode 100644 index 6ebe205bf..000000000 --- a/plugins/mailinabox-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Marius Gripsgard - -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. diff --git a/plugins/mailinabox-change-password/MailInABoxChangePasswordDriver.php b/plugins/mailinabox-change-password/MailInABoxChangePasswordDriver.php deleted file mode 100644 index 95534f543..000000000 --- a/plugins/mailinabox-change-password/MailInABoxChangePasswordDriver.php +++ /dev/null @@ -1,157 +0,0 @@ -sHost = $sHost; - $this->sAdminUser = $sAdminUser; - $this->sAdminPassword = $sAdminPassword; - return $this; - } - /** - * @param string $sAllowedEmails - * - * @return \MailInABoxChangePasswordDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \MailInABoxChangePasswordDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - return $this; - } - /** - * @param string $sDesc - * @param int $iType = \MailSo\Log\Enumerations\Type::INFO - * - * @return \MailInABoxChangePasswordDriver - */ - public function WriteLog($sDesc, $iType = \MailSo\Log\Enumerations\Type::INFO) - { - if ($this->oLogger) - { - $this->oLogger->Write($sDesc, $iType); - } - return $this; - } - /** - * @param \RainLoop\Model\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - /** - * @param \RainLoop\Model\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - $this->WriteLog('Mail-in-a-box: Try to change password for '.$oAccount->Email()); - $bResult = false; - if (!empty($this->sHost) && !empty($this->sAdminUser) && !empty($this->sAdminPassword) && $oAccount) - { - $this->WriteLog('Mail-in-a-box:[Check] Required Fields Present'); - $sEmail = \trim(\strtolower($oAccount->Email())); - $sHost = \rtrim(\trim($this->sHost), '/'); - $sUrl = $sHost.'/admin/mail/users/password'; - - $sAdminUser = $this->sAdminUser; - $sAdminPassword = $this->sAdminPassword; - $iCode = 0; - $aPost = array( - 'email' => $sEmail, - 'password' => $sNewPassword, - ); - $aOptions = array( - CURLOPT_URL => $sUrl, - CURLOPT_HEADER => false, - CURLOPT_FAILONERROR => true, - CURLOPT_SSL_VERIFYPEER => false, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_POST => true, - CURLOPT_POSTFIELDS => \http_build_query($aPost, '', '&'), - CURLOPT_TIMEOUT => 20, - CURLOPT_SSL_VERIFYHOST => false, - CURLOPT_USERPWD => $sAdminUser.':'.$sAdminPassword, - CURLOPT_HTTPAUTH => CURLAUTH_BASIC - ); - $oCurl = \curl_init(); - \curl_setopt_array($oCurl, $aOptions); - $this->WriteLog('Mail-in-a-box: Send post request: '.$sUrl); - $mResult = \curl_exec($oCurl); - $iCode = (int) \curl_getinfo($oCurl, CURLINFO_HTTP_CODE); - $sContentType = (string) \curl_getinfo($oCurl, CURLINFO_CONTENT_TYPE); - $this->WriteLog('Mail-in-a-box: Post request result: (Status: '.$iCode.', ContentType: '.$sContentType.')'); - if (false === $mResult || 200 !== $iCode) - { - $this->WriteLog('Mail-in-a-box: Error: '.\curl_error($oCurl), \MailSo\Log\Enumerations\Type::WARNING); - } - if (\is_resource($oCurl)) - { - \curl_close($oCurl); - } - if (false !== $mResult && 200 === $iCode) - { - $this->WriteLog('Mail-in-a-box: Password Change Status: Success'); - $bResult = true; - } - else - { - $this->WriteLog('Mail-in-a-box[Error]: Empty Response: Code: '.$iCode); - } - } - return $bResult; - } -} diff --git a/plugins/mailinabox-change-password/README b/plugins/mailinabox-change-password/README deleted file mode 100644 index 9f419ce62..000000000 --- a/plugins/mailinabox-change-password/README +++ /dev/null @@ -1 +0,0 @@ -Plugin that adds functionality to change the email account password (Mail-in-a-Box). diff --git a/plugins/mailinabox-change-password/VERSION b/plugins/mailinabox-change-password/VERSION deleted file mode 100644 index d3827e75a..000000000 --- a/plugins/mailinabox-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 diff --git a/plugins/mailinabox-change-password/index.php b/plugins/mailinabox-change-password/index.php deleted file mode 100644 index b88235e54..000000000 --- a/plugins/mailinabox-change-password/index.php +++ /dev/null @@ -1,54 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - include_once __DIR__.'/MailInABoxChangePasswordDriver.php'; - $sHost = \trim($this->Config()->Get('plugin', 'host', '')); - $sAdminUser = (string) $this->Config()->Get('plugin', 'admin_user', ''); - $sAdminPassword = (string) $this->Config()->Get('plugin', 'admin_password', ''); - $oProvider = new \MailInABoxChangePasswordDriver(); - $oProvider->SetLogger($this->Manager()->Actions()->Logger()); - $oProvider->SetConfig($sHost, $sAdminUser, $sAdminPassword); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - break; - } - } - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('host')->SetLabel('Mail-in-a-box Host') - ->SetDefaultValue('https://box.mailinabox.email') - ->SetDescription('Mail-in-a-box host URL. Example: https://box.mailinabox.email'), - \RainLoop\Plugins\Property::NewInstance('admin_user')->SetLabel('Admin User') - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('admin_password')->SetLabel('Admin Password') - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} diff --git a/plugins/piwik-analytics/LICENSE b/plugins/piwik-analytics/LICENSE deleted file mode 100644 index 271342337..000000000 --- a/plugins/piwik-analytics/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 RainLoop Team - -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. diff --git a/plugins/piwik-analytics/README b/plugins/piwik-analytics/README deleted file mode 100644 index 9b69b68ca..000000000 --- a/plugins/piwik-analytics/README +++ /dev/null @@ -1 +0,0 @@ -Embed Piwik Analytics (Open source web analytics platform) code into your webmail installation pages. \ No newline at end of file diff --git a/plugins/piwik-analytics/VERSION b/plugins/piwik-analytics/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/piwik-analytics/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/piwik-analytics/index.php b/plugins/piwik-analytics/index.php deleted file mode 100644 index 1932a0717..000000000 --- a/plugins/piwik-analytics/index.php +++ /dev/null @@ -1,36 +0,0 @@ -Config()->Get('plugin', 'piwik_url', '') && - '' !== $this->Config()->Get('plugin', 'site_id', '')) - { - $this->addJs('js/include.js'); - } - } - - /** - * @return array - */ - public function configMapping() - { - $oUrl = \RainLoop\Plugins\Property::NewInstance('piwik_url')->SetLabel('Piwik URL') - ->SetAllowedInJs(true); - - $oSiteID = \RainLoop\Plugins\Property::NewInstance('site_id')->SetLabel('Site ID') - ->SetAllowedInJs(true); - - if (\method_exists($oUrl, 'SetPlaceholder')) - { - $oUrl->SetPlaceholder('http://'); - $oSiteID->SetPlaceholder(''); - } - - return array($oUrl, $oSiteID); - } -} diff --git a/plugins/piwik-analytics/js/include.js b/plugins/piwik-analytics/js/include.js deleted file mode 100644 index a5ab3328a..000000000 --- a/plugins/piwik-analytics/js/include.js +++ /dev/null @@ -1,37 +0,0 @@ - -$(function () { - - if (!window.rl) - { - return; - } - - var - sPiwikURL = '' + window.rl.pluginSettingsGet('piwik-analytics', 'piwik_url'), - sSiteID = '' + window.rl.pluginSettingsGet('piwik-analytics', 'site_id') - ; - - if ('' !== sPiwikURL && '' !== sSiteID) - { - sPiwikURL = sPiwikURL.replace(/[\\\/\s]+$/, '') + '/'; - if (!/^https?:/i.test(sPiwikURL)) - { - sPiwikURL = 'http://' + sPiwikURL; - } - - window._paq = window._paq || []; - (function(window){ - window._paq.push(['setSiteId', sSiteID]); - window._paq.push(['setTrackerUrl', sPiwikURL + 'piwik.php']); - window._paq.push(['trackPageView']); - window.setInterval(function () { - window._paq.push(['trackPageView']); - }, 1000 * 60 * 2); - var d = window.document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0]; - g.type = 'text/javascript'; g.defer = true; g.async = true; g.src = sPiwikURL + 'piwik.js'; - if (s && s.parentNode) { - s.parentNode.insertBefore(g, s); - } - }(window)); - } -}); \ No newline at end of file diff --git a/plugins/poppassd-change-password/ChangePasswordPoppassdDriver.php b/plugins/poppassd-change-password/ChangePasswordPoppassdDriver.php deleted file mode 100644 index 9cb2851c2..000000000 --- a/plugins/poppassd-change-password/ChangePasswordPoppassdDriver.php +++ /dev/null @@ -1,119 +0,0 @@ -sHost = $sHost; - return $this; - } - - /** - * @param int $iPort - * - * @return \ChangePasswordPoppassdDriver - */ - public function SetPort($iPort) - { - $this->iPort = (int) $iPort; - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \ChangePasswordPoppassdDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \ChangePasswordPoppassdDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Model\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Model\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - $bResult = false; - - try - { - $oPoppassdClient = \MailSo\Poppassd\PoppassdClient::NewInstance(); - if ($this->oLogger instanceof \MailSo\Log\Logger) - { - $oPoppassdClient->SetLogger($this->oLogger); - } - - $oPoppassdClient - ->Connect($this->sHost, $this->iPort) - ->Login($oAccount->Login(), $oAccount->Password()) - ->NewPass($sNewPassword) - ->LogoutAndDisconnect() - ; - - $bResult = true; - } - catch (\Exception $oException) - { - $bResult = false; - } - - return $bResult; - } -} \ No newline at end of file diff --git a/plugins/poppassd-change-password/LICENSE b/plugins/poppassd-change-password/LICENSE deleted file mode 100644 index 271342337..000000000 --- a/plugins/poppassd-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 RainLoop Team - -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. diff --git a/plugins/poppassd-change-password/README b/plugins/poppassd-change-password/README deleted file mode 100644 index 6be76f713..000000000 --- a/plugins/poppassd-change-password/README +++ /dev/null @@ -1 +0,0 @@ -Plugin that adds functionality to change the email account password (POPPASSD). \ No newline at end of file diff --git a/plugins/poppassd-change-password/VERSION b/plugins/poppassd-change-password/VERSION deleted file mode 100644 index b123147e2..000000000 --- a/plugins/poppassd-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 \ No newline at end of file diff --git a/plugins/poppassd-change-password/index.php b/plugins/poppassd-change-password/index.php deleted file mode 100644 index cb90487f3..000000000 --- a/plugins/poppassd-change-password/index.php +++ /dev/null @@ -1,52 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - include_once __DIR__.'/ChangePasswordPoppassdDriver.php'; - - $oProvider = new ChangePasswordPoppassdDriver(); - - $oProvider - ->SetHost($this->Config()->Get('plugin', 'host', '')) - ->SetPort((int) $this->Config()->Get('plugin', 'port', 106)) - ->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))) - ->SetLogger($this->Manager()->Actions()->Logger()) - ; - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('host')->SetLabel('POPPASSD Host') - ->SetDefaultValue('127.0.0.1'), - \RainLoop\Plugins\Property::NewInstance('port')->SetLabel('POPPASSD Port') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::INT) - ->SetDefaultValue(106), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} diff --git a/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php b/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php deleted file mode 100755 index d52d13c11..000000000 --- a/plugins/postfixadmin-change-password/ChangePasswordPostfixAdminDriver.php +++ /dev/null @@ -1,342 +0,0 @@ -sEngine = $sEngine; - return $this; - } - - /** - * @param string $sHost - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetHost($sHost) - { - $this->sHost = $sHost; - return $this; - } - - /** - * @param int $iPort - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetPort($iPort) - { - $this->iPort = (int) $iPort; - return $this; - } - - /** - * @param string $sDatabase - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetDatabase($sDatabase) - { - $this->sDatabase = $sDatabase; - return $this; - } - - /** - * @param string $sTable - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetTable($sTable) - { - $this->sTable = $sTable; - return $this; - } - - /** - * @param string $sUsercol - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetUserColumn($sUsercol) - { - $this->sUsercol = $sUsercol; - return $this; - } - - /** - * @param string $sPasscol - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetPasswordColumn($sPasscol) - { - $this->sPasscol = $sPasscol; - return $this; - } - - /** - * @param string $sUser - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetUser($sUser) - { - $this->sUser = $sUser; - return $this; - } - - /** - * @param string $sPassword - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetPassword($sPassword) - { - $this->sPassword = $sPassword; - return $this; - } - - /** - * @param string $sEncrypt - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetEncrypt($sEncrypt) - { - $this->sEncrypt = $sEncrypt; - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \ChangePasswordPostfixAdminDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Model\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Model\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('Postfix: Try to change password for '.$oAccount->Email()); - } - - unset($sPrevPassword); - - $bResult = false; - - if (0 < \strlen($sNewPassword)) - { - try - { - $sDsn = ''; - switch($this->sEngine){ - case 'MySQL': - $sDsn = 'mysql:host='.$this->sHost.';port='.$this->iPort.';dbname='.$this->sDatabase; - break; - case 'PostgreSQL': - $sDsn = 'pgsql:host='.$this->sHost.';port='.$this->iPort.';dbname='.$this->sDatabase; - break; - default: - $sDsn = 'mysql:host='.$this->sHost.';port='.$this->iPort.';dbname='.$this->sDatabase; - break; - } - - - $oPdo = new \PDO($sDsn, $this->sUser, $this->sPassword); - $oPdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - - $sUpdatePassword = $this->cryptPassword($sNewPassword, $oPdo); - if (0 < \strlen($sUpdatePassword)) - { - $oStmt = $oPdo->prepare("UPDATE {$this->sTable} SET {$this->sPasscol} = ? WHERE {$this->sUsercol} = ?"); - $bResult = (bool) $oStmt->execute(array($sUpdatePassword, $oAccount->Email())); - } - else - { - if ($this->oLogger) - { - $this->oLogger->Write('Postfix: Encrypted password is empty', - \MailSo\Log\Enumerations\Type::ERROR); - } - } - - $oPdo = null; - } - catch (\Exception $oException) - { - if ($this->oLogger) - { - $this->oLogger->WriteException($oException); - } - } - } - - return $bResult; - } - - /** - * @param string $sPassword - * @param \PDO $oPdo - * - * @return string - */ - private function cryptPassword($sPassword, $oPdo) - { - $sResult = ''; - if (function_exists('random_bytes')) { - $sSalt = substr(base64_encode(random_bytes(32)), 0, 16); - } else { - $sSalt = substr(str_shuffle('./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'), 0, 16); - } - switch (strtolower($this->sEncrypt)) - { - default: - case 'plain': - case 'cleartext': - $sResult = '{PLAIN}' . $sPassword; - break; - - case 'md5crypt': - include_once __DIR__.'/md5crypt.php'; - $sResult = '{MD5-CRYPT}' . md5crypt($sPassword); - break; - - case 'md5': - $sResult = '{PLAIN-MD5}' . md5($sPassword); - break; - - case 'system': - $sResult = '{CRYPT}' . crypt($sPassword); - break; - - case 'sha256-crypt': - $sResult = '{SHA256-CRYPT}' . crypt($sPassword,'$5$'.$sSalt); - break; - - case 'sha512-crypt': - $sResult = '{SHA512-CRYPT}' . crypt($sPassword,'$6$'.$sSalt); - break; - - case 'mysql_encrypt': - if($this->sEngine == 'MySQL'){ - $oStmt = $oPdo->prepare('SELECT ENCRYPT(?) AS encpass'); - if ($oStmt->execute(array($sPassword))) - { - $aFetchResult = $oStmt->fetchAll(\PDO::FETCH_ASSOC); - if (\is_array($aFetchResult) && isset($aFetchResult[0]['encpass'])) - { - $sResult = $aFetchResult[0]['encpass']; - } - } - }else{ - throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CouldNotSaveNewPassword); - } - break; - } - - return $sResult; - } -} diff --git a/plugins/postfixadmin-change-password/LICENSE b/plugins/postfixadmin-change-password/LICENSE deleted file mode 100644 index c6cb63dbf..000000000 --- a/plugins/postfixadmin-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 RainLoop Team, @zaffkea - -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. diff --git a/plugins/postfixadmin-change-password/README b/plugins/postfixadmin-change-password/README deleted file mode 100644 index 342f4d4b5..000000000 --- a/plugins/postfixadmin-change-password/README +++ /dev/null @@ -1 +0,0 @@ -Plugin that adds functionality to change the email account password (PostfixAdmin). \ No newline at end of file diff --git a/plugins/postfixadmin-change-password/VERSION b/plugins/postfixadmin-change-password/VERSION deleted file mode 100644 index 7e32cd569..000000000 --- a/plugins/postfixadmin-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.3 diff --git a/plugins/postfixadmin-change-password/index.php b/plugins/postfixadmin-change-password/index.php deleted file mode 100755 index c0f9e40a7..000000000 --- a/plugins/postfixadmin-change-password/index.php +++ /dev/null @@ -1,100 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @return string - */ - public function Supported() - { - if (!extension_loaded('pdo') || !class_exists('PDO')) - { - return 'The PHP extension PDO must be installed to use this plugin'; - } - - $aDrivers = \PDO::getAvailableDrivers(); - if (!is_array($aDrivers) || (!in_array('mysql', $aDrivers) && !in_array('pgsql', $aDrivers))) - { - return 'The PHP extension PDO (mysql or pgsql) must be installed to use this plugin'; - } - - return ''; - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - include_once __DIR__.'/ChangePasswordPostfixAdminDriver.php'; - - $oProvider = new ChangePasswordPostfixAdminDriver(); - - $oProvider - ->SetEngine($this->Config()->Get('plugin', 'engine','')) - ->SetHost($this->Config()->Get('plugin', 'host', '')) - ->SetPort((int) $this->Config()->Get('plugin', 'port', 3306)) - ->SetDatabase($this->Config()->Get('plugin', 'database', '')) - ->SetTable($this->Config()->Get('plugin', 'table', '')) - ->SetUserColumn($this->Config()->Get('plugin', 'usercol', '')) - ->SetPasswordColumn($this->Config()->Get('plugin', 'passcol', '')) - ->SetUser($this->Config()->Get('plugin', 'user', '')) - ->SetPassword($this->Config()->Get('plugin', 'password', '')) - ->SetEncrypt($this->Config()->Get('plugin', 'encrypt', '')) - ->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))) - ->SetLogger($this->Manager()->Actions()->Logger()) - ; - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('engine')->SetLabel('Engine') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION) - ->SetDefaultValue(array('MySQL', 'PostgreSQL')) - ->SetDescription('Database Engine'), - \RainLoop\Plugins\Property::NewInstance('host')->SetLabel('Host') - ->SetDefaultValue('127.0.0.1'), - \RainLoop\Plugins\Property::NewInstance('port')->SetLabel('Port') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::INT) - ->SetDefaultValue(3306), - \RainLoop\Plugins\Property::NewInstance('database')->SetLabel('Database') - ->SetDefaultValue('postfixadmin'), - \RainLoop\Plugins\Property::NewInstance('table')->SetLabel('table') - ->SetDefaultValue('mailbox'), - \RainLoop\Plugins\Property::NewInstance('usercol')->SetLabel('username column') - ->SetDefaultValue('username'), - \RainLoop\Plugins\Property::NewInstance('passcol')->SetLabel('password column') - ->SetDefaultValue('password'), - \RainLoop\Plugins\Property::NewInstance('user')->SetLabel('User') - ->SetDefaultValue('postfixadmin'), - \RainLoop\Plugins\Property::NewInstance('password')->SetLabel('Password') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD) - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('encrypt')->SetLabel('Encrypt') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION) - ->SetDefaultValue(array('md5crypt', 'md5', 'system', 'cleartext', 'mysql_encrypt', 'SHA256-CRYPT', 'SHA512-CRYPT')) - ->SetDescription('In what way do you want the passwords to be crypted ?'), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} diff --git a/plugins/postfixadmin-change-password/md5crypt.php b/plugins/postfixadmin-change-password/md5crypt.php deleted file mode 100644 index 616de859c..000000000 --- a/plugins/postfixadmin-change-password/md5crypt.php +++ /dev/null @@ -1,139 +0,0 @@ - 0; $i -= 16) - { - if ($i > 16) - { - $ctx .= substr($final,0,16); - } - else - { - $ctx .= substr($final,0,$i); - } - } - - $i = strlen($pw); - - while ($i > 0) - { - if ($i & 1) - { - $ctx .= chr(0); - } - else - { - $ctx .= $pw[0]; - } - - $i = $i >> 1; - } - - $final = hex2bin(md5($ctx)); - - for ($i=0; $i<1000; $i++) - { - $ctx1 = ""; - if ($i & 1) - { - $ctx1 .= $pw; - } - else - { - $ctx1 .= substr($final,0,16); - } - if ($i % 3) - { - $ctx1 .= $salt; - } - if ($i % 7) - { - $ctx1 .= $pw; - } - if ($i & 1) - { - $ctx1 .= substr($final, 0, 16); - } - else - { - $ctx1 .= $pw; - } - - $final = hex2bin(md5($ctx1)); - } - - $passwd = ""; - $passwd .= to64(((ord($final[0]) << 16) | (ord($final[6]) << 8) | (ord($final[12]))), 4); - $passwd .= to64(((ord($final[1]) << 16) | (ord($final[7]) << 8) | (ord($final[13]))), 4); - $passwd .= to64(((ord($final[2]) << 16) | (ord($final[8]) << 8) | (ord($final[14]))), 4); - $passwd .= to64(((ord($final[3]) << 16) | (ord($final[9]) << 8) | (ord($final[15]))), 4); - $passwd .= to64(((ord($final[4]) << 16) | (ord($final[10]) << 8) | (ord($final[5]))), 4); - $passwd .= to64(ord($final[11]), 2); - - return $magic.$salt.'$'.$passwd; -} - -function create_salt() -{ - srand((double) microtime() * 1000000); - return substr(md5(rand(0,9999999)), 0, 8); -} - -// PHP around 5.3.8 includes hex2bin as native function - http://php.net/hex2bin -if (!function_exists('hex2bin')) -{ - function hex2bin($str) - { - $len = strlen($str); - $nstr = ""; - for ($i = 0; $i < $len; $i += 2) - { - $num = sscanf(substr($str, $i, 2), "%x"); - $nstr .= chr($num[0]); - } - - return $nstr; - } -} - -function to64($v, $n) -{ - $ITOA64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - $ret = ""; - - while (($n - 1) >= 0) - { - $n--; - $ret .= $ITOA64[$v & 0x3f]; - $v = $v >> 6; - } - - return $ret; -} \ No newline at end of file diff --git a/plugins/recaptcha/LICENSE b/plugins/recaptcha/LICENSE deleted file mode 100644 index 4aed64b3a..000000000 --- a/plugins/recaptcha/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 RainLoop Team - -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. diff --git a/plugins/recaptcha/README b/plugins/recaptcha/README deleted file mode 100644 index ee29dbafc..000000000 --- a/plugins/recaptcha/README +++ /dev/null @@ -1,3 +0,0 @@ -A CAPTCHA (v2) is a program that can generate and grade tests that humans can pass but current computer programs cannot. -For example, humans can read distorted text as the one shown below, but current computer programs can't. -More info at http://www.google.com/recaptcha \ No newline at end of file diff --git a/plugins/recaptcha/VERSION b/plugins/recaptcha/VERSION deleted file mode 100644 index 616187889..000000000 --- a/plugins/recaptcha/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.2 \ No newline at end of file diff --git a/plugins/recaptcha/index.php b/plugins/recaptcha/index.php deleted file mode 100644 index 5e0c299ce..000000000 --- a/plugins/recaptcha/index.php +++ /dev/null @@ -1,151 +0,0 @@ -UseLangs(true); - - $this->addJs('js/recaptcha.js'); - - $this->addHook('ajax.action-pre-call', 'AjaxActionPreCall'); - $this->addHook('filter.ajax-response', 'FilterAjaxResponse'); - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('public_key')->SetLabel('Site key') - ->SetAllowedInJs(true) - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('private_key')->SetLabel('Secret key') - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('theme')->SetLabel('Theme') - ->SetAllowedInJs(true) - ->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION) - ->SetDefaultValue(array('light', 'dark')), - \RainLoop\Plugins\Property::NewInstance('error_limit')->SetLabel('Limit') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION) - ->SetDefaultValue(array(0, 1, 2, 3, 4, 5)) - ->SetDescription('') - ); - } - - /** - * @return string - */ - private function getCaptchaCacherKey() - { - return 'CaptchaNew/Login/'.\RainLoop\Utils::GetConnectionToken(); - } - - /** - * @return int - */ - private function getLimit() - { - $iConfigLimit = $this->Config()->Get('plugin', 'error_limit', 0); - if (0 < $iConfigLimit) - { - $oCacher = $this->Manager()->Actions()->Cacher(); - $sLimit = $oCacher && $oCacher->IsInited() ? $oCacher->Get($this->getCaptchaCacherKey()) : '0'; - - if (0 < \strlen($sLimit) && \is_numeric($sLimit)) - { - $iConfigLimit -= (int) $sLimit; - } - } - - return $iConfigLimit; - } - - /** - * @return void - */ - public function FilterAppDataPluginSection($bAdmin, $bAuth, &$aData) - { - if (!$bAdmin && !$bAuth && \is_array($aData)) - { - $aData['show_captcha_on_login'] = 1 > $this->getLimit(); - } - } - - /** - * @param string $sAction - */ - public function AjaxActionPreCall($sAction) - { - if ('Login' === $sAction && 0 >= $this->getLimit()) - { - $bResult = false; - - $sResult = $this->Manager()->Actions()->Http()->SendPostRequest( - 'https://www.google.com/recaptcha/api/siteverify', - array( - 'secret' => $this->Config()->Get('plugin', 'private_key', ''), - 'response' => $this->Manager()->Actions()->GetActionParam('RecaptchaResponse', '') - ) - ); - - if ($sResult) - { - $aResp = @\json_decode($sResult, true); - if (\is_array($aResp) && isset($aResp['success']) && $aResp['success']) - { - $bResult = true; - } - } - - if (!$bResult) - { - $this->Manager()->Actions()->Logger()->Write('RecaptchaResponse:'.$sResult); - throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CaptchaError); - } - } - } - - /** - * @param string $sAction - * @param array $aResponseItem - */ - public function FilterAjaxResponse($sAction, &$aResponseItem) - { - if ('Login' === $sAction && $aResponseItem && isset($aResponseItem['Result'])) - { - $oCacher = $this->Manager()->Actions()->Cacher(); - $iConfigLimit = (int) $this->Config()->Get('plugin', 'error_limit', 0); - - $sKey = $this->getCaptchaCacherKey(); - - if (0 < $iConfigLimit && $oCacher && $oCacher->IsInited()) - { - if (false === $aResponseItem['Result']) - { - $iLimit = 0; - $sLimut = $oCacher->Get($sKey); - if (0 < \strlen($sLimut) && \is_numeric($sLimut)) - { - $iLimit = (int) $sLimut; - } - - $oCacher->Set($sKey, ++$iLimit); - - if ($iConfigLimit <= $iLimit) - { - $aResponseItem['Captcha'] = true; - } - } - else - { - $oCacher->Delete($sKey); - } - } - } - } -} diff --git a/plugins/recaptcha/js/recaptcha.js b/plugins/recaptcha/js/recaptcha.js deleted file mode 100644 index 10e42794c..000000000 --- a/plugins/recaptcha/js/recaptcha.js +++ /dev/null @@ -1,95 +0,0 @@ -(function ($, window) { - - $(function () { - - var - nId = null, - bStarted = false - ; - - function ShowRecaptcha() - { - if (window.grecaptcha && window.rl) - { - if (null === nId) - { - var - oEl = null, - oLink = $('.plugin-mark-Login-BottomControlGroup') - ; - - if (oLink && oLink[0]) - { - oEl = $('
'); - - $(oLink[0]).after(oEl); - - nId = window.grecaptcha.render(oEl[0], { - 'sitekey': window.rl.pluginSettingsGet('recaptcha', 'public_key'), - 'theme': window.rl.pluginSettingsGet('recaptcha', 'theme') - }); - } - } - } - } - - window.__globalShowRecaptcha = ShowRecaptcha; - - function StartRecaptcha() - { - if (!window.grecaptcha && window.rl) - { - $.getScript('https://www.google.com/recaptcha/api.js?onload=__globalShowRecaptcha&render=explicit&hl=' + window.rl.settingsGet('Language')); - } - else - { - ShowRecaptcha(); - } - } - - if (window.rl) - { - window.rl.addHook('user-login-submit', function (fSubmitResult) { - if (null !== nId && !window.grecaptcha.getResponse(nId)) - { - fSubmitResult(105); - } - }); - - window.rl.addHook('view-model-on-show', function (sName, oViewModel) { - if (!bStarted && oViewModel && - ('View:RainLoop:Login' === sName || 'View/App/Login' === sName || 'LoginViewModel' === sName || 'LoginAppView' === sName) && - window.rl.pluginSettingsGet('recaptcha', 'show_captcha_on_login')) - { - bStarted = true; - StartRecaptcha(); - } - }); - - window.rl.addHook('ajax-default-request', function (sAction, oParameters) { - if ('Login' === sAction && oParameters && null !== nId && window.grecaptcha) - { - oParameters['RecaptchaResponse'] = window.grecaptcha.getResponse(nId); - } - }); - - window.rl.addHook('ajax-default-response', function (sAction, oData, sType) { - if ('Login' === sAction) - { - if (!oData || 'success' !== sType || !oData['Result']) - { - if (null !== nId && window.grecaptcha) - { - window.grecaptcha.reset(nId); - } - else if (oData && oData['Captcha']) - { - StartRecaptcha(); - } - } - } - }); - } - }); - -}($, window)); \ No newline at end of file diff --git a/plugins/rest-change-password/LICENSE b/plugins/rest-change-password/LICENSE deleted file mode 100644 index 271342337..000000000 --- a/plugins/rest-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 RainLoop Team - -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. diff --git a/plugins/rest-change-password/README b/plugins/rest-change-password/README deleted file mode 100644 index f045f42e7..000000000 --- a/plugins/rest-change-password/README +++ /dev/null @@ -1 +0,0 @@ -Plugin that adds functionality to change the email account password (Generic REST). \ No newline at end of file diff --git a/plugins/rest-change-password/RestChangePasswordDriver.php b/plugins/rest-change-password/RestChangePasswordDriver.php deleted file mode 100644 index 72a77fefb..000000000 --- a/plugins/rest-change-password/RestChangePasswordDriver.php +++ /dev/null @@ -1,172 +0,0 @@ -sUrl = $sUrl; - $this->sKey = $sKey; - - return $this; - } - - $oProvider->SetFieldNames($sFieldEmail, $sFieldOldpassword, $sFieldNewpassword); - - /** - * @param string $sFieldEmail - * @param string $sFieldOldpassword - * @param string $sFieldNewpassword - * - * @return \RestChangePasswordDriver - */ - public function SetFieldNames($sFieldEmail, $sFieldOldpassword, $sFieldNewpassword) - { - $this->sFieldEmail = $sFieldEmail; - $this->sFieldOldpassword = $sFieldOldpassword; - $this->sFieldNewpassword = $sFieldNewpassword; - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \RestChangePasswordDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \RestChangePasswordDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('Rest: Try to change password for '.$oAccount->Email()); - } - - $bResult = false; - if (!empty($this->sHost) && 0 < $this->iPort && $oAccount) - { - $sEmail = \trim(\strtolower($oAccount->Email())); - - # Adding the REST Api key to the url, try to use always https - $sUrl = str_replace('://', '://'+$this->sKey+"@", $this->sUrl); - - $iCode = 0; - $oHttp = \MailSo\Base\Http::SingletonInstance(); - - if ($this->oLogger) - { - $this->oLogger->Write('Rest[Api Request]:'.$sUrl); - } - - $mResult = $oHttp->SendPostRequest($sUrl, - array( - $this->sFieldEmail => $sEmail, - $this->sFieldOldpassword => $sPrevPassword, - $this->sFieldNewpassword => $sNewPassword, - ), 'MailSo Http User Agent (v1)', $iCode, $this->oLogger); - - if (false !== $mResult && 200 === $iCode) - { - $aRes = null; - @\parse_str($mResult, $aRes); - if (is_array($aRes) && (!isset($aRes['error']) || (int) $aRes['error'] !== 1)) - { - $bResult = true; - } - else - { - if ($this->oLogger) - { - $this->oLogger->Write('Rest[Error]: Response: '.$mResult); - } - } - } - else - { - if ($this->oLogger) - { - $this->oLogger->Write('Rest[Error]: Empty Response: Code:'.$iCode); - } - } - } - - return $bResult; - } -} diff --git a/plugins/rest-change-password/VERSION b/plugins/rest-change-password/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/rest-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/rest-change-password/index.php b/plugins/rest-change-password/index.php deleted file mode 100644 index 63aeaa446..000000000 --- a/plugins/rest-change-password/index.php +++ /dev/null @@ -1,78 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - $sUrl = \trim($this->Config()->Get('plugin', 'rest_url', '')); - $sKey = \trim($this->Config()->Get('plugin', 'rest_key', '')); - - $sFieldEmail = \trim($this->Config()->Get('plugin', 'rest_field_email', '')); - $sFieldOldpassword = \trim($this->Config()->Get('plugin', 'rest_field_oldpassword', '')); - $sFieldNewpassword = \trim($this->Config()->Get('plugin', 'rest_field_newpassword', '')); - - if (!empty($sHost) && (!empty($sKey))) - { - include_once __DIR__.'/RestChangePasswordDriver.php'; - - $oProvider = new RestChangePasswordDriver(); - $oProvider->SetLogger($this->Manager()->Actions()->Logger()); - $oProvider->SetConfig($sUrl, $sKey); - $oProvider->SetFieldNames($sFieldEmail, $sFieldOldpassword, $sFieldNewpassword); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - } - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('rest_url') - ->SetLabel('REST API Url') - ->SetDefaultValue('') - ->SetDescription('Ex: http://localhost:8080/api/change_password or https://domain.com/api/user/passsword_update'), - \RainLoop\Plugins\Property::NewInstance('rest_key') - ->SetLabel('REST API key') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD) - ->SetDescription('REST API Key for authentication, if you have "user" and "passsword" enter it as "user:password"') - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('rest_field_email') - ->SetLabel('Field "email" name') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Enter the name of the REST field name for email') - ->SetDefaultValue('email'), - \RainLoop\Plugins\Property::NewInstance('rest_field_oldpassword') - ->SetLabel('Field "oldpassword" name') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Enter the name of the REST field name for oldpassword') - ->SetDefaultValue('oldpassword'), - \RainLoop\Plugins\Property::NewInstance('rest_field_newpassword') - ->SetLabel('Field "newpassword" name') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Enter the name of the REST field name for newpassword') - ->SetDefaultValue('newpassword'), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} diff --git a/plugins/vesta-change-password/LICENSE b/plugins/vesta-change-password/LICENSE deleted file mode 100644 index 271342337..000000000 --- a/plugins/vesta-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 RainLoop Team - -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. diff --git a/plugins/vesta-change-password/README b/plugins/vesta-change-password/README deleted file mode 100644 index 4f2f06281..000000000 --- a/plugins/vesta-change-password/README +++ /dev/null @@ -1 +0,0 @@ -Plugin that adds functionality to change the email account password (Vesta Control Panel). \ No newline at end of file diff --git a/plugins/vesta-change-password/VERSION b/plugins/vesta-change-password/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/vesta-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/vesta-change-password/VestaChangePasswordDriver.php b/plugins/vesta-change-password/VestaChangePasswordDriver.php deleted file mode 100644 index cbb8be5c1..000000000 --- a/plugins/vesta-change-password/VestaChangePasswordDriver.php +++ /dev/null @@ -1,146 +0,0 @@ -sHost = $sHost; - $this->iPort = $iPort; - - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \VestaChangePasswordDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \VestaChangePasswordDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param \RainLoop\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('Vesta: Try to change password for '.$oAccount->Email()); - } - - $bResult = false; - if (!empty($this->sHost) && 0 < $this->iPort && $oAccount) - { - $sEmail = \trim(\strtolower($oAccount->Email())); - - $sHost = \trim($this->sHost); - $sHost = \str_replace('{user:host-imap}', $oAccount->Domain()->IncHost(), $sHost); - $sHost = \str_replace('{user:host-smtp}', $oAccount->Domain()->OutHost(), $sHost); - $sHost = \str_replace('{user:domain}', \MailSo\Base\Utils::GetDomainFromEmail($sEmail), $sHost); - $sHost = \rtrim($this->sHost, '/\\'); - $sHost = 'https://'.$sHost; - - $sUrl = $sHost.':'.$this->iPort.'/reset/mail/'; - - $iCode = 0; - $oHttp = \MailSo\Base\Http::SingletonInstance(); - - if ($this->oLogger) - { - $this->oLogger->Write('Vesta[Api Request]:'.$sUrl); - } - - $mResult = $oHttp->SendPostRequest($sUrl, - array( - 'email' => $sEmail, - 'password' => $sPrevPassword, - 'new' => $sNewPassword, - ), 'MailSo Http User Agent (v1)', $iCode, $this->oLogger); - - if (false !== $mResult && 200 === $iCode) - { - $aRes = null; - @\parse_str($mResult, $aRes); - if (is_array($aRes) && (!isset($aRes['error']) || (int) $aRes['error'] !== 1)) - { - $bResult = true; - } - else - { - if ($this->oLogger) - { - $this->oLogger->Write('Vesta[Error]: Response: '.$mResult); - } - } - } - else - { - if ($this->oLogger) - { - $this->oLogger->Write('Vesta[Error]: Empty Response: Code:'.$iCode); - } - } - } - - return $bResult; - } -} diff --git a/plugins/vesta-change-password/index.php b/plugins/vesta-change-password/index.php deleted file mode 100644 index 2453541d8..000000000 --- a/plugins/vesta-change-password/index.php +++ /dev/null @@ -1,55 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - $sHost = \trim($this->Config()->Get('plugin', 'vesta_host', '')); - $iPort = (int) $this->Config()->Get('plugin', 'vesta_port', 8083); - - if (!empty($sHost) && 0 < $iPort) - { - include_once __DIR__.'/VestaChangePasswordDriver.php'; - - $oProvider = new VestaChangePasswordDriver(); - $oProvider->SetLogger($this->Manager()->Actions()->Logger()); - $oProvider->SetConfig($sHost, $iPort); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - } - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('vesta_host')->SetLabel('Vesta Host') - ->SetDefaultValue('') - ->SetDescription('Ex: localhost or domain.com'), - \RainLoop\Plugins\Property::NewInstance('Vesta_port')->SetLabel('Vesta Port') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::INT) - ->SetDefaultValue(8083), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} diff --git a/plugins/virtualmin-change-password/LICENSE b/plugins/virtualmin-change-password/LICENSE deleted file mode 100644 index c364cecf0..000000000 --- a/plugins/virtualmin-change-password/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 icedman21 - -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. diff --git a/plugins/virtualmin-change-password/README b/plugins/virtualmin-change-password/README deleted file mode 100644 index 58f2e0378..000000000 --- a/plugins/virtualmin-change-password/README +++ /dev/null @@ -1 +0,0 @@ -This plugin utilizes Virtualmin's remote API to change user passwords. The plugin requires the Admin user name and password to succesfully execute the password change. The host and port where Virtualmin listens on is also needed. See https://www.virtualmin.com/documentation/developer/http for more information. \ No newline at end of file diff --git a/plugins/virtualmin-change-password/VERSION b/plugins/virtualmin-change-password/VERSION deleted file mode 100644 index 9f8e9b69a..000000000 --- a/plugins/virtualmin-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/plugins/virtualmin-change-password/VirtualminChangePasswordDriver.php b/plugins/virtualmin-change-password/VirtualminChangePasswordDriver.php deleted file mode 100644 index c4fbd72d6..000000000 --- a/plugins/virtualmin-change-password/VirtualminChangePasswordDriver.php +++ /dev/null @@ -1,210 +0,0 @@ -sHost = $sHost; - $this->sAdminUser = $sAdminUser; - $this->sAdminPassword = $sAdminPassword; - - return $this; - } - - /** - * @param string $sAllowedEmails - * - * @return \VirtualminChangePasswordDriver - */ - public function SetAllowedEmails($sAllowedEmails) - { - $this->sAllowedEmails = $sAllowedEmails; - - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \VirtualminChangePasswordDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param string $sDesc - * @param int $iType = \MailSo\Log\Enumerations\Type::INFO - * - * @return \VirtualminChangePasswordDriver - */ - public function WriteLog($sDesc, $iType = \MailSo\Log\Enumerations\Type::INFO) - { - if ($this->oLogger) - { - $this->oLogger->Write($sDesc, $iType); - } - - return $this; - } - - /** - * @param \RainLoop\Model\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return $oAccount && $oAccount->Email() && - \RainLoop\Plugins\Helper::ValidateWildcardValues($oAccount->Email(), $this->sAllowedEmails); - } - - /** - * @param \RainLoop\Model\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - $this->WriteLog('Virtualmin: Try to change password for '.$oAccount->Email()); - - $bResult = false; - if (!empty($this->sHost) && !empty($this->sAdminUser) && !empty($this->sAdminPassword) && $oAccount) - { - $this->WriteLog('Virtualmin:[Check] Required Fields Present'); - - $sEmail = \trim(\strtolower($oAccount->Email())); - $sEmailUser = \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail); - $sEmailDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail); - - $sHost = \rtrim(\trim($this->sHost), '/'); - $sUrl = $sHost.'/virtual-server/remote.cgi'; - - $sAdminUser = $this->sAdminUser; - $sAdminPassword = $this->sAdminPassword; - - $iCode = 0; - - $aPost = array( - 'user' => $sEmailUser, - 'pass' => $sNewPassword, - 'domain' => $sEmailDomain, - 'program' => 'modify-user' - ); - - $aOptions = array( - CURLOPT_URL => $sUrl, - CURLOPT_HEADER => false, - CURLOPT_FAILONERROR => true, - CURLOPT_SSL_VERIFYPEER => false, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_POST => true, - CURLOPT_POSTFIELDS => \http_build_query($aPost, '', '&'), - CURLOPT_TIMEOUT => 20, - CURLOPT_SSL_VERIFYHOST => false, - CURLOPT_USERPWD => $sAdminUser.':'.$sAdminPassword - ); - - $oCurl = \curl_init(); - \curl_setopt_array($oCurl, $aOptions); - - $this->WriteLog('Virtualmin: Send post request: '.$sUrl); - - $mResult = \curl_exec($oCurl); - - $iCode = (int) \curl_getinfo($oCurl, CURLINFO_HTTP_CODE); - $sContentType = (string) \curl_getinfo($oCurl, CURLINFO_CONTENT_TYPE); - - $this->WriteLog('Virtualmin: Post request result: (Status: '.$iCode.', ContentType: '.$sContentType.')'); - if (false === $mResult || 200 !== $iCode) - { - $this->WriteLog('Virtualmin: Error: '.\curl_error($oCurl), \MailSo\Log\Enumerations\Type::WARNING); - } - - if (\is_resource($oCurl)) - { - \curl_close($oCurl); - } - - if (false !== $mResult && 200 === $iCode) - { - $aRes = null; - @\parse_str($mResult, $aRes); - if (\is_array($aRes) && (!isset($aRes['error']) || (int) $aRes['error'] !== 1)) - { - $iPos = \strpos($mResult, 'Exit status: '); - - if ($iPos !== false) - { - $aStatus = \explode(' ', $mResult); - $sStatus = \trim(\array_pop($aStatus)); - - if ('0' === $sStatus) - { - $this->WriteLog('Virtualmin: Password Change Status: Success'); - $bResult = true; - } - else - { - $this->WriteLog('Virtualmin[Error]: Response: '.$mResult); - } - } - } - else - { - $this->WriteLog('Virtualmin[Error]: Response: '.$mResult); - } - } - else - { - $this->WriteLog('Virtualmin[Error]: Empty Response: Code: '.$iCode); - } - } - - return $bResult; - } -} diff --git a/plugins/virtualmin-change-password/index.php b/plugins/virtualmin-change-password/index.php deleted file mode 100644 index b4c0a86f6..000000000 --- a/plugins/virtualmin-change-password/index.php +++ /dev/null @@ -1,54 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - include_once __DIR__.'/VirtualminChangePasswordDriver.php'; - - $sHost = \trim($this->Config()->Get('plugin', 'host', '')); - $sAdminUser = (string) $this->Config()->Get('plugin', 'admin_user', ''); - $sAdminPassword = (string) $this->Config()->Get('plugin', 'admin_password', ''); - - $oProvider = new \VirtualminChangePasswordDriver(); - $oProvider->SetLogger($this->Manager()->Actions()->Logger()); - $oProvider->SetConfig($sHost, $sAdminUser, $sAdminPassword); - $oProvider->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', '')))); - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('host')->SetLabel('Virtualmin Host') - ->SetDefaultValue('https://localhost:10000') - ->SetDescription('Virtualmin host URL. Example: https://example.com:10000'), - \RainLoop\Plugins\Property::NewInstance('admin_user')->SetLabel('Admin User') - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('admin_password')->SetLabel('Admin Password') - ->SetDefaultValue(''), - \RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net') - ->SetDefaultValue('*') - ); - } -} diff --git a/plugins/vpopmail-change-password/ChangePasswordVpopmailDriver.php b/plugins/vpopmail-change-password/ChangePasswordVpopmailDriver.php deleted file mode 100755 index 7013d226e..000000000 --- a/plugins/vpopmail-change-password/ChangePasswordVpopmailDriver.php +++ /dev/null @@ -1,228 +0,0 @@ -mHost = $mHost; - return $this; - } - - /** - * @param string $mUser - * - * @return \ChangePasswordVpopmailDriver - */ - public function SetmUser($mUser) - { - $this->mUser = $mUser; - return $this; - } - - /** - * @param string $mPass - * - * @return \ChangePasswordVpopmailDriver - */ - public function SetmPass($mPass) - { - $this->mPass = $mPass; - return $this; - } - - /** - * @param string $mDatabase - * - * @return \ChangePasswordVpopmailDriver - */ - public function SetmDatabase($mDatabase) - { - $this->mDatabase = $mDatabase; - return $this; - } - - /** - * @param string $mTable - * - * @return \ChangePasswordVpopmailDriver - */ - public function SetmTable($mTable) - { - $this->mTable = $mTable; - return $this; - } - - /** - * @param string $mColumn - * - * @return \ChangePasswordVpopmailDriver - */ - public function SetmColumn($mColumn) - { - $this->mColumn = $mColumn; - return $this; - } - - /** - * @param \MailSo\Log\Logger $oLogger - * - * @return \ChangePasswordVpopmailDriver - */ - public function SetLogger($oLogger) - { - if ($oLogger instanceof \MailSo\Log\Logger) - { - $this->oLogger = $oLogger; - } - - return $this; - } - - /** - * @param array $aDomains - * - * @return bool - */ - public function SetAllowedDomains($aDomains) - { - if (\is_array($aDomains) && 0 < \count($aDomains)) - { - $this->aDomains = $aDomains; - } - - return $this; - } - - /** - * @param \RainLoop\Account $oAccount - * - * @return bool - */ - public function PasswordChangePossibility($oAccount) - { - return 0 === \count($this->aDomains) || ($oAccount && \in_array(\strtolower( - \MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email)), $this->aDomains)); - } - - /** - * @param \RainLoop\Account $oAccount - * @param string $sPrevPassword - * @param string $sNewPassword - * - * @return bool - */ - public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNewPassword) - { - if ($this->oLogger) - { - $this->oLogger->Write('Try to change password for '.$oAccount->Email()); - } - - if (empty($this->mHost) || empty($this->mDatabase) || empty($this->mColumn) || empty($this->mTable)) - { - return false; - } - - $bResult = false; - - $sDsn = 'mysql:host='.$this->mHost.';dbname='.$this->mDatabase.';charset=utf8'; - $aOptions = array( - PDO::ATTR_EMULATE_PREPARES => false, - PDO::ATTR_PERSISTENT => true, - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION - ); - - $sLoginPart = \MailSo\Base\Utils::GetAccountNameFromEmail($oAccount->Email()); - $sDomainPart = \MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email()); - - try - { - $oConn = new PDO($sDsn, $this->mUser, $this->mPass, $aOptions); - - $oSelect = $oConn->prepare('SELECT '.$this->mColumn.' FROM '.$this->mTable.' WHERE pw_name=? AND pw_domain=? LIMIT 1'); - $oSelect->execute(array($sLoginPart, $sDomainPart)); - - $aColCrypt = $oSelect->fetchAll(PDO::FETCH_ASSOC); - - $sCryptPass = isset($aColCrypt[0][$this->mColumn]) ? $aColCrypt[0][$this->mColumn] : ''; - if (0 < \strlen($sCryptPass) && \crypt($sPrevPassword, $sCryptPass) === $sCryptPass) - { - $oUpdate = $oConn->prepare('UPDATE '.$this->mTable.' SET '.$this->mColumn.'=ENCRYPT(?,concat("$1$",right(md5(rand()), 8 ),"$")), pw_clear_passwd=\'\' WHERE pw_name=? AND pw_domain=?'); - $oUpdate->execute(array( - $sNewPassword, - $sLoginPart, - $sDomainPart - )); - - $bResult = true; - if ($this->oLogger) - { - $this->oLogger->Write('Success! Password changed.'); - } - } - else - { - $bResult = false; - if ($this->oLogger) - { - $this->oLogger->Write('Something went wrong. Either current password is incorrect, or new password does not match criteria.'); - } - } - } - catch (\Exception $oException) - { - $bResult = false; - if ($this->oLogger) - { - $this->oLogger->WriteException($oException); - } - } - - return $bResult; - } -} diff --git a/plugins/vpopmail-change-password/LICENSE b/plugins/vpopmail-change-password/LICENSE deleted file mode 100755 index 6739d4b4e..000000000 --- a/plugins/vpopmail-change-password/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Almas at Dusal.net - -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. diff --git a/plugins/vpopmail-change-password/VERSION b/plugins/vpopmail-change-password/VERSION deleted file mode 100755 index 9459d4ba2..000000000 --- a/plugins/vpopmail-change-password/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.1 diff --git a/plugins/vpopmail-change-password/index.php b/plugins/vpopmail-change-password/index.php deleted file mode 100755 index 8eb5fd5fe..000000000 --- a/plugins/vpopmail-change-password/index.php +++ /dev/null @@ -1,71 +0,0 @@ -addHook('main.fabrica', 'MainFabrica'); - } - - /** - * @param string $sName - * @param mixed $oProvider - */ - public function MainFabrica($sName, &$oProvider) - { - switch ($sName) - { - case 'change-password': - - include_once __DIR__.'/ChangePasswordVpopmailDriver.php'; - - $oProvider = new ChangePasswordVpopmailDriver(); - - $sDomains = \strtolower(\trim(\preg_replace('/[\s;,]+/', ' ', - $this->Config()->Get('plugin', 'domains', '')))); - - if (0 < \strlen($sDomains)) - { - $aDomains = \explode(' ', $sDomains); - $oProvider->SetAllowedDomains($aDomains); - } - - $oProvider - ->SetLogger($this->Manager()->Actions()->Logger()) - ->SetmHost($this->Config()->Get('plugin', 'mHost', '')) - ->SetmUser($this->Config()->Get('plugin', 'mUser', '')) - ->SetmPass($this->Config()->Get('plugin', 'mPass', '')) - ->SetmDatabase($this->Config()->Get('plugin', 'mDatabase', '')) - ->SetmTable($this->Config()->Get('plugin', 'mTable', '')) - ->SetmColumn($this->Config()->Get('plugin', 'mColumn', '')) - ; - - break; - } - } - - /** - * @return array - */ - public function configMapping() - { - return array( - \RainLoop\Plugins\Property::NewInstance('domains')->SetLabel('Allowed Domains') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING_TEXT) - ->SetDescription('Allowed domains, space as delimiter') - ->SetDefaultValue('gmail.com yahoo.com'), - \RainLoop\Plugins\Property::NewInstance('mHost')->SetLabel('MySQL Host') - ->SetDefaultValue('localhost'), - \RainLoop\Plugins\Property::NewInstance('mUser')->SetLabel('MySQL User') - ->SetDefaultValue('vpopmail'), - \RainLoop\Plugins\Property::NewInstance('mPass')->SetLabel('MySQL Password') - ->SetType(\RainLoop\Enumerations\PluginPropertyType::PASSWORD), - \RainLoop\Plugins\Property::NewInstance('mDatabase')->SetLabel('MySQL Database') - ->SetDefaultValue('vpopmail'), - \RainLoop\Plugins\Property::NewInstance('mTable')->SetLabel('MySQL Table') - ->SetDefaultValue('vpopmail'), - \RainLoop\Plugins\Property::NewInstance('mColumn')->SetLabel('MySQL Column') - ->SetDefaultValue('pw_passwd') - ); - } -} 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 d4e5a19bf..0412f44ea 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -96,11 +96,6 @@ class Actions */ private $oSuggestionsProvider; - /** - * @var \RainLoop\Providers\ChangePassword - */ - private $oChangePasswordProvider; - /** * @var \RainLoop\Providers\TwoFactorAuth */ @@ -144,7 +139,6 @@ class Actions $this->oDomainProvider = null; $this->oAddressBookProvider = null; $this->oSuggestionsProvider = null; - $this->oChangePasswordProvider = null; $this->oTwoFactorAuthProvider = null; $this->sSpecAuthToken = ''; @@ -313,9 +307,6 @@ class Actions $mResult = array(); } - break; - case 'change-password': - // \RainLoop\Providers\ChangePassword\ChangePasswordInterface break; case 'two-factor-auth': // \RainLoop\Providers\TwoFactorAuth\TwoFactorAuthInterface @@ -693,21 +684,6 @@ class Actions return $this->oFiltersProvider; } - /** - * @return \RainLoop\Providers\ChangePassword - */ - public function ChangePasswordProvider() - { - if (null === $this->oChangePasswordProvider) - { - $this->oChangePasswordProvider = new \RainLoop\Providers\ChangePassword( - $this, $this->fabrica('change-password'), !!$this->Config()->Get('labs', 'check_new_password_strength', true) - ); - } - - return $this->oChangePasswordProvider; - } - /** * @return \RainLoop\Providers\TwoFactorAuth */ @@ -1289,7 +1265,6 @@ class Actions 'folderSpecLimit' => (int) $oConfig->Get('labs', 'folders_spec_limit', 50), 'faviconStatus' => (bool) $oConfig->Get('labs', 'favicon_status', true), 'allowCmdInterface' => (bool) $oConfig->Get('labs', 'allow_cmd', false), - 'useNativeScrollbars' => (bool) $oConfig->Get('interface', 'use_native_scrollbars', false), 'listPermanentFiltered' => '' !== \trim(\RainLoop\Api::Config()->Get('labs', 'imap_message_list_permanent_filter', '')), 'themes' => $this->GetThemes($bMobile, false), 'languages' => $this->GetLanguages(false), @@ -1350,7 +1325,6 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack 'StartupUrl' => \trim(\ltrim(\trim($oConfig->Get('labs', 'startup_url', '')), '#/')), 'SieveAllowFileintoInbox' => (bool) $oConfig->Get('labs', 'sieve_allow_fileinto_inbox', false), 'ContactsIsAllowed' => false, - 'ChangePasswordIsAllowed' => false, 'RequireTwoFactor' => false, 'Community' => true, 'PremType' => false, @@ -1402,7 +1376,6 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack $aResult['OutLogin'] = $oAccount->OutLogin(); $aResult['AccountHash'] = $oAccount->Hash(); $aResult['AccountSignMe'] = $oAccount->SignMe(); - $aResult['ChangePasswordIsAllowed'] = $this->ChangePasswordProvider()->PasswordChangePossibility($oAccount); $aResult['ContactsIsAllowed'] = $oAddressBookProvider->IsActive(); $aResult['ContactsSyncIsAllowed'] = (bool) $oConfig->Get('contacts', 'allow_sync', false); $aResult['ContactsSyncInterval'] = (int) $oConfig->Get('contacts', 'sync_interval', 20); @@ -4337,33 +4310,6 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack return $this->DefaultResponse(__FUNCTION__, 'Pong'); } - public function DoChangePassword() : array - { - $mResult = false; - - $oAccount = $this->getAccountFromToken(); - if ($oAccount) - { - try - { - $mResult = $this->ChangePasswordProvider()->ChangePassword( - $oAccount, - $this->GetActionParam('PrevPassword', ''), - $this->GetActionParam('NewPassword', '') - ); - } - catch (\Throwable $oException) - { - $this->loginErrorDelay(); - $this->Logger()->Write('Error: Can\'t change password for '.$oAccount->Email().' account.', \MailSo\Log\Enumerations\Type::NOTICE); - - throw $oException; - } - } - - return $this->DefaultResponse(__FUNCTION__, $mResult); - } - public function DoWelcomeClose() : array { $oAccount = $this->getAccountFromToken(); diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php index 59c967cf4..90c0fb9e3 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -134,7 +134,6 @@ class Application extends \RainLoop\Config\AbstractConfig 'interface' => array( 'show_attachment_thumbnail' => array(true, ''), - 'use_native_scrollbars' => array(false), 'new_move_to_folder_button' => array(true) ), diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/ChangePassword/ChangePasswordInterface.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/ChangePassword/ChangePasswordInterface.php deleted file mode 100644 index 5b129919a..000000000 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/ChangePassword/ChangePasswordInterface.php +++ /dev/null @@ -1,10 +0,0 @@ - $sAppleTouchLink ? '' : '', '{{BaseAppMainCssLink}}' => $this->staticPath('css/app'.($bAppCssDebug ? '' : '.min').'.css'), '{{BaseAppThemeCssLink}}' => $this->oActions->ThemeLink($sTheme, $bAdmin), - '{{BaseAppPolyfillsScriptLink}}' => $this->staticPath('js/'.($bAppJsDebug ? '' : 'min/').'polyfills'.($bAppJsDebug ? '' : '.min').'.js'), '{{BaseAppBootScriptLink}}' => $this->staticPath('js/'.($bAppJsDebug ? '' : 'min/').'boot'.($bAppJsDebug ? '' : '.min').'.js'), '{{BaseViewport}}' => $bMobile ? 'width=device-width,initial-scale=1,user-scalable=no' : 'width=950,maximum-scale=2', '{{BaseContentSecurityPolicy}}' => $sContentSecurityPolicy ? 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 2414830b8..7d244cf1b 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -132,10 +132,6 @@ class ServiceActions case 'DoAccountAdd': $this->Logger()->AddSecret($this->oActions->GetActionParam('Password', '')); break; - case 'DoChangePassword': - $this->Logger()->AddSecret($this->oActions->GetActionParam('PrevPassword', '')); - $this->Logger()->AddSecret($this->oActions->GetActionParam('NewPassword', '')); - break; } $this->Logger()->Write(\MailSo\Base\Utils::Php2js($aPost, $this->Logger()), diff --git a/rainloop/v/0.0.0/app/templates/Index.html b/rainloop/v/0.0.0/app/templates/Index.html index 8c6a3af89..0bdad7be6 100644 --- a/rainloop/v/0.0.0/app/templates/Index.html +++ b/rainloop/v/0.0.0/app/templates/Index.html @@ -14,9 +14,6 @@ - {{BaseContentSecurityPolicy}} {{BaseAppHeadScriptLink}} diff --git a/tasks/config.js b/tasks/config.js index 718535547..9bbe52c9d 100644 --- a/tasks/config.js +++ b/tasks/config.js @@ -53,7 +53,6 @@ config.paths.css = { 'node_modules/normalize.css/normalize.css', 'vendors/jquery-ui/css/smoothness/jquery-ui-1.10.3.custom.css', 'vendors/fontastic/styles.css', - 'vendors/jquery-nanoscroller/nanoscroller.css', 'vendors/jquery-letterfx/jquery-letterfx.min.css', 'vendors/inputosaurus/inputosaurus.css', 'vendors/flags/flags-fixed.css', @@ -75,12 +74,8 @@ config.paths.js = { name: 'libs.js', src: [ 'node_modules/jquery/dist/jquery.min.js', - 'node_modules/jquery-migrate/dist/jquery-migrate.min.js', - 'node_modules/jquery-mousewheel/jquery.mousewheel.js', - 'node_modules/jquery-scrollstop/jquery.scrollstop.js', 'node_modules/jquery-backstretch/jquery.backstretch.min.js', 'vendors/jquery-ui/js/jquery-ui-1.10.3.custom.min.js', // custom - 'vendors/jquery-nanoscroller/jquery.nanoscroller.js', // custom (modified) 'vendors/jquery-wakeup/jquery.wakeup.js', // no-npm 'vendors/jquery-letterfx/jquery-letterfx.min.js', // no-npm 'vendors/inputosaurus/inputosaurus.js', // custom (modified) @@ -95,8 +90,6 @@ config.paths.js = { 'node_modules/moment/min/moment.min.js', 'node_modules/knockout/build/output/knockout-latest.js', 'node_modules/knockout-sortable/build/knockout-sortable.min.js ', - 'node_modules/matchmedia-polyfill/matchMedia.js', - 'node_modules/matchmedia-polyfill/matchMedia.addListener.js', 'node_modules/simplestatemanager/dist/ssm.min.js', 'node_modules/autolinker/dist/Autolinker.min.js', 'node_modules/opentip/lib/opentip.js', diff --git a/tasks/js.js b/tasks/js.js index 0258ad2fc..ed2f3a61c 100644 --- a/tasks/js.js +++ b/tasks/js.js @@ -5,7 +5,7 @@ const concat = require('gulp-concat-util'), header = require('gulp-header'), rename = require('gulp-rename'), replace = require('gulp-replace'), - uglify = require('gulp-uglify'), + terser = require('gulp-terser'), plumber = require('gulp-plumber'), gulpif = require('gulp-if'), eol = require('gulp-eol'), @@ -64,13 +64,7 @@ const jsMin = () => .pipe(gulpif(config.source, sourcemaps.init({ loadMaps: true }))) .pipe(replace(/"rainloop\/v\/([^/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"')) .pipe(rename({ suffix: '.min' })) - .pipe( - uglify({ - mangle: true, - compress: true, - ie8: false - }) - ) + .pipe(terser()) .pipe(eol('\n', true)) .pipe(gulpif(config.source, sourcemaps.write('./'))) .pipe( diff --git a/vendors/bootstrap/js/bootstrap.js b/vendors/bootstrap/js/bootstrap.js index 59f9baf2a..4a718379a 100644 --- a/vendors/bootstrap/js/bootstrap.js +++ b/vendors/bootstrap/js/bootstrap.js @@ -756,7 +756,7 @@ selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } - $parent = selector && $(selector) + $parent = selector && 1 < selector.length && $(selector) if (!$parent || !$parent.length) $parent = $this.parent() @@ -2277,4 +2277,4 @@ }) -}(window.jQuery); \ No newline at end of file +}(window.jQuery); diff --git a/vendors/bootstrap/js/bootstrap.min.js b/vendors/bootstrap/js/bootstrap.min.js index 59f43909a..447bac130 100644 --- a/vendors/bootstrap/js/bootstrap.min.js +++ b/vendors/bootstrap/js/bootstrap.min.js @@ -3,7 +3,7 @@ * Copyright 2013 Twitter, Inc. * http://www.apache.org/licenses/LICENSE-2.0.txt */ -!function(e){"use strict";e(function(){e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("closed").remove()}var n=e(this),r=n.attr("data-target"),i;r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),i=e(r),t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()};var r=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("alert");i||r.data("alert",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.alert.data-api",t,n.prototype.close)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.data(),i=n.is("input")?"val":"html";e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(t){var n=this.getActiveIndex(),r=this;if(t>this.$items.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){r.to(t)}):n==t?this.pause().cycle():this.slide(t>n?"next":"prev",e(this.$items[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(t,n){var r=this.$element.find(".item.active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this,f;this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u](),f=e.Event("slide",{relatedTarget:i[0],direction:o});if(i.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var t=e(a.$indicators.children()[a.getActiveIndex()]);t&&t.addClass("active")}));if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var r=e(this),i=r.data("carousel"),s=e.extend({},e.fn.carousel.defaults,typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.pause().cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=e.extend({},i.data(),n.data()),o;i.carousel(s),(o=n.attr("data-slide-to"))&&i.data("carousel").pause().to(o).cycle(),t.preventDefault()})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning||this.$element.hasClass("in"))return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),e.support.transition&&this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning||!this.$element.hasClass("in"))return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var n=e.fn.collapse;e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=e.extend({},e.fn.collapse.defaults,r.data(),typeof n=="object"&&n);i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();n[e(i).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(i).collapse(s)})}(window.jQuery),!function(e){"use strict";function r(){e(".dropdown-backdrop").remove(),e(t).each(function(){i(e(this)).removeClass("open")})}function i(t){var n=t.attr("data-target"),r;n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),r=n&&e(n);if(!r||!r.length)r=t.parent();return r}var t="[data-toggle=dropdown]",n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),s,o;if(n.is(".disabled, :disabled"))return;return s=i(n),o=s.hasClass("open"),r(),o||("ontouchstart"in document.documentElement&&e('