From cd2c0379db4e900596b86192bf4efee7ebdc4869 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Sat, 28 Jul 2018 21:45:49 +0200 Subject: [PATCH] * [MOD] Improved plugins manager * [MOD] Code refactoring and cleanup * [MOD] Make classes final for performance improvements and avoid some side behaviours --- .../api/Controllers/AccountController.php | 2 +- .../api/Controllers/CategoryController.php | 3 +- .../api/Controllers/ClientController.php | 3 +- .../api/Controllers/ConfigController.php | 2 +- app/modules/api/Controllers/TagController.php | 3 +- app/modules/api/Init.php | 2 +- .../Controllers/AccessManagerController.php | 2 +- .../web/Controllers/AccountController.php | 10 +- .../Controllers/AccountFavoriteController.php | 2 +- .../web/Controllers/AccountFileController.php | 2 +- .../AccountHistoryManagerController.php | 7 +- .../Controllers/AccountManagerController.php | 2 +- .../web/Controllers/AuthTokenController.php | 6 +- .../web/Controllers/BootstrapController.php | 8 +- .../web/Controllers/CategoryController.php | 6 +- .../web/Controllers/ClientController.php | 6 +- .../Controllers/ConfigAccountController.php | 2 +- .../Controllers/ConfigBackupController.php | 2 +- .../ConfigEncryptionController.php | 2 +- .../Controllers/ConfigGeneralController.php | 2 +- .../Controllers/ConfigImportController.php | 2 +- .../web/Controllers/ConfigLdapController.php | 2 +- .../web/Controllers/ConfigMailController.php | 2 +- .../Controllers/ConfigManagerController.php | 6 +- .../web/Controllers/ConfigWikiController.php | 2 +- .../web/Controllers/CustomFieldController.php | 6 +- .../web/Controllers/ErrorController.php | 3 +- .../web/Controllers/EventlogController.php | 2 +- .../Helpers/Account/AccountActionsDto.php | 6 +- .../Helpers/Account/AccountActionsHelper.php | 2 +- .../Helpers/Account/AccountHelper.php | 2 +- .../Helpers/Account/AccountHistoryHelper.php | 4 +- .../Helpers/Account/AccountPasswordHelper.php | 2 +- .../Helpers/Account/AccountSearchHelper.php | 2 +- .../Controllers/Helpers/HelperException.php | 2 +- .../Controllers/Helpers/ItemsGridHelper.php | 2 +- .../web/Controllers/Helpers/LayoutHelper.php | 4 +- .../Controllers/Helpers/TabsGridHelper.php | 6 +- .../web/Controllers/Helpers/TabsHelper.php | 6 +- .../web/Controllers/IndexController.php | 6 +- .../web/Controllers/InstallController.php | 2 +- .../web/Controllers/ItemManagerController.php | 2 +- .../web/Controllers/ItemsController.php | 2 +- .../web/Controllers/LoginController.php | 2 +- .../Controllers/NotificationController.php | 6 +- .../web/Controllers/PluginController.php | 2 +- .../web/Controllers/PublicLinkController.php | 4 +- .../web/Controllers/ResourceController.php | 2 +- .../web/Controllers/StatusController.php | 2 +- app/modules/web/Controllers/TagController.php | 13 +- .../web/Controllers/TaskController.php | 2 +- .../web/Controllers/UpgradeController.php | 2 +- .../web/Controllers/UserController.php | 8 +- .../web/Controllers/UserGroupController.php | 6 +- .../Controllers/UserPassResetController.php | 2 +- .../web/Controllers/UserProfileController.php | 6 +- .../UserSettingsGeneralController.php | 7 +- .../UserSettingsManagerController.php | 2 +- app/modules/web/Forms/AccountForm.php | 2 +- app/modules/web/Forms/AuthTokenForm.php | 7 +- app/modules/web/Forms/CategoryForm.php | 7 +- app/modules/web/Forms/ClientForm.php | 7 +- app/modules/web/Forms/CustomFieldDefForm.php | 7 +- app/modules/web/Forms/FormBase.php | 31 +- app/modules/web/Forms/NotificationForm.php | 3 +- app/modules/web/Forms/PublicLinkForm.php | 9 +- app/modules/web/Forms/TagForm.php | 7 +- app/modules/web/Forms/UserForm.php | 2 +- app/modules/web/Forms/UserGroupForm.php | 7 +- app/modules/web/Forms/UserProfileForm.php | 3 +- app/modules/web/Init.php | 21 +- .../material-blue/views/config/info.inc | 2 +- .../material-blue/views/itemshow/plugin.inc | 2 +- lib/SP/Bootstrap.php | 66 ++-- lib/SP/Core/Dic/Container.php | 202 ------------- lib/SP/Core/Dic/ContainerException.php | 39 --- lib/SP/Core/Dic/DicInterface.php | 60 ---- lib/SP/Core/Dic/InjectableTrait.php | 47 --- lib/SP/Core/Dic/Injector.php | 73 ----- lib/SP/Core/Dic/NotFoundException.php | 38 --- lib/SP/Core/Plugin/PluginDataStore.php | 93 ------ lib/SP/Core/Plugin/PluginUtil.php | 245 --------------- lib/SP/{Core => }/Plugin/PluginBase.php | 8 +- .../{Core => }/Plugin/PluginEventReceiver.php | 6 +- lib/SP/{Core => }/Plugin/PluginInterface.php | 8 +- lib/SP/Plugin/PluginManager.php | 282 ++++++++++++++++++ .../Repositories/Plugin/PluginRepository.php | 14 +- lib/SP/Services/Plugin/PluginService.php | 4 +- lib/SP/Util/Filter.php | 28 +- lib/SP/Util/HttpUtil.php | 43 --- 90 files changed, 517 insertions(+), 1071 deletions(-) delete mode 100644 lib/SP/Core/Dic/Container.php delete mode 100644 lib/SP/Core/Dic/ContainerException.php delete mode 100644 lib/SP/Core/Dic/DicInterface.php delete mode 100644 lib/SP/Core/Dic/InjectableTrait.php delete mode 100644 lib/SP/Core/Dic/Injector.php delete mode 100644 lib/SP/Core/Dic/NotFoundException.php delete mode 100644 lib/SP/Core/Plugin/PluginDataStore.php delete mode 100644 lib/SP/Core/Plugin/PluginUtil.php rename lib/SP/{Core => }/Plugin/PluginBase.php (95%) rename lib/SP/{Core => }/Plugin/PluginEventReceiver.php (95%) rename lib/SP/{Core => }/Plugin/PluginInterface.php (94%) create mode 100644 lib/SP/Plugin/PluginManager.php diff --git a/app/modules/api/Controllers/AccountController.php b/app/modules/api/Controllers/AccountController.php index 4f138ef4..3b7f1dc6 100644 --- a/app/modules/api/Controllers/AccountController.php +++ b/app/modules/api/Controllers/AccountController.php @@ -38,7 +38,7 @@ use SP\Services\Api\ApiResponse; * * @package SP\Modules\Api\Controllers */ -class AccountController extends ControllerBase +final class AccountController extends ControllerBase { /** * @var AccountService diff --git a/app/modules/api/Controllers/CategoryController.php b/app/modules/api/Controllers/CategoryController.php index ba774097..70bf0e65 100644 --- a/app/modules/api/Controllers/CategoryController.php +++ b/app/modules/api/Controllers/CategoryController.php @@ -35,9 +35,10 @@ use SP\Services\Category\CategoryService; /** * Class CategoryController + * * @package SP\Modules\Api\Controllers */ -class CategoryController extends ControllerBase +final class CategoryController extends ControllerBase { /** * @var CategoryService diff --git a/app/modules/api/Controllers/ClientController.php b/app/modules/api/Controllers/ClientController.php index a6ab98ca..4015ee9f 100644 --- a/app/modules/api/Controllers/ClientController.php +++ b/app/modules/api/Controllers/ClientController.php @@ -34,9 +34,10 @@ use SP\Services\Client\ClientService; /** * Class ClientController + * * @package SP\Modules\Api\Controllers */ -class ClientController extends ControllerBase +final class ClientController extends ControllerBase { /** * @var ClientService diff --git a/app/modules/api/Controllers/ConfigController.php b/app/modules/api/Controllers/ConfigController.php index 7ffaad63..73f07272 100644 --- a/app/modules/api/Controllers/ConfigController.php +++ b/app/modules/api/Controllers/ConfigController.php @@ -36,7 +36,7 @@ use SP\Services\Export\XmlExportService; * * @package SP\Modules\Api\Controllers */ -class ConfigController extends ControllerBase +final class ConfigController extends ControllerBase { /** * backupAction diff --git a/app/modules/api/Controllers/TagController.php b/app/modules/api/Controllers/TagController.php index 7e1db56f..91e1fac3 100644 --- a/app/modules/api/Controllers/TagController.php +++ b/app/modules/api/Controllers/TagController.php @@ -34,9 +34,10 @@ use SP\Services\Tag\TagService; /** * Class TagController + * * @package SP\Modules\Api\Controllers */ -class TagController extends ControllerBase +final class TagController extends ControllerBase { /** * @var TagService diff --git a/app/modules/api/Init.php b/app/modules/api/Init.php index 3333d02f..475f6f0b 100644 --- a/app/modules/api/Init.php +++ b/app/modules/api/Init.php @@ -42,7 +42,7 @@ use SP\Util\HttpUtil; * * @package api */ -class Init extends ModuleBase +final class Init extends ModuleBase { /** * @var StatelessContext diff --git a/app/modules/web/Controllers/AccessManagerController.php b/app/modules/web/Controllers/AccessManagerController.php index e6f17e6f..d4a13702 100644 --- a/app/modules/web/Controllers/AccessManagerController.php +++ b/app/modules/web/Controllers/AccessManagerController.php @@ -40,7 +40,7 @@ use SP\Services\UserProfile\UserProfileService; * * @package SP\Modules\Web\Controllers */ -class AccessManagerController extends ControllerBase +final class AccessManagerController extends ControllerBase { /** * @var ItemSearchData diff --git a/app/modules/web/Controllers/AccountController.php b/app/modules/web/Controllers/AccountController.php index b2feba2c..471fd42f 100644 --- a/app/modules/web/Controllers/AccountController.php +++ b/app/modules/web/Controllers/AccountController.php @@ -59,7 +59,7 @@ use SP\Util\Util; * * @package SP\Modules\Web\Controllers */ -class AccountController extends ControllerBase implements CrudControllerInterface +final class AccountController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; @@ -530,7 +530,7 @@ class AccountController extends ControllerBase implements CrudControllerInterfac * @param int $id Account's ID * @param int $parentId */ - public function viewPassAction($id, $parentId) + public function viewPassAction($id, $parentId = 0) { try { $accountPassHelper = $this->dic->get(AccountPasswordHelper::class); @@ -671,7 +671,7 @@ class AccountController extends ControllerBase implements CrudControllerInterfac public function saveCreateAction() { try { - $form = new AccountForm(); + $form = new AccountForm($this->dic); $form->validate(Acl::ACCOUNT_CREATE); $itemData = $form->getItemData(); @@ -718,7 +718,7 @@ class AccountController extends ControllerBase implements CrudControllerInterfac public function saveEditAction($id) { try { - $form = new AccountForm($id); + $form = new AccountForm($this->dic, $id); $form->validate(Acl::ACCOUNT_EDIT); $itemData = $form->getItemData(); @@ -764,7 +764,7 @@ class AccountController extends ControllerBase implements CrudControllerInterfac public function saveEditPassAction($id) { try { - $form = new AccountForm($id); + $form = new AccountForm($this->dic, $id); $form->validate(Acl::ACCOUNT_EDIT_PASS); $this->accountService->editPassword($form->getItemData()); diff --git a/app/modules/web/Controllers/AccountFavoriteController.php b/app/modules/web/Controllers/AccountFavoriteController.php index 84252852..3854e06e 100644 --- a/app/modules/web/Controllers/AccountFavoriteController.php +++ b/app/modules/web/Controllers/AccountFavoriteController.php @@ -33,7 +33,7 @@ use SP\Services\Account\AccountToFavoriteService; * * @package SP\Modules\Web\Controllers */ -class AccountFavoriteController extends SimpleControllerBase +final class AccountFavoriteController extends SimpleControllerBase { use JsonTrait; diff --git a/app/modules/web/Controllers/AccountFileController.php b/app/modules/web/Controllers/AccountFileController.php index 3d7770db..7a8d3f62 100644 --- a/app/modules/web/Controllers/AccountFileController.php +++ b/app/modules/web/Controllers/AccountFileController.php @@ -46,7 +46,7 @@ use SP\Util\Util; * * @package SP\Modules\Web\Controllers */ -class AccountFileController extends ControllerBase implements CrudControllerInterface +final class AccountFileController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; diff --git a/app/modules/web/Controllers/AccountHistoryManagerController.php b/app/modules/web/Controllers/AccountHistoryManagerController.php index 3cced99d..bfa4f19d 100644 --- a/app/modules/web/Controllers/AccountHistoryManagerController.php +++ b/app/modules/web/Controllers/AccountHistoryManagerController.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -35,9 +35,10 @@ use SP\Services\Account\AccountHistoryService; /** * Class AccountHistoryManagerController + * * @package SP\Modules\Web\Controllers */ -class AccountHistoryManagerController extends ControllerBase +final class AccountHistoryManagerController extends ControllerBase { use JsonTrait, ItemTrait; diff --git a/app/modules/web/Controllers/AccountManagerController.php b/app/modules/web/Controllers/AccountManagerController.php index 5e445c5e..18cf3c3d 100644 --- a/app/modules/web/Controllers/AccountManagerController.php +++ b/app/modules/web/Controllers/AccountManagerController.php @@ -38,7 +38,7 @@ use SP\Services\Account\AccountService; * * @package SP\Modules\Web\Controllers */ -class AccountManagerController extends ControllerBase +final class AccountManagerController extends ControllerBase { use JsonTrait, ItemTrait; diff --git a/app/modules/web/Controllers/AuthTokenController.php b/app/modules/web/Controllers/AuthTokenController.php index 22b5037b..328340b7 100644 --- a/app/modules/web/Controllers/AuthTokenController.php +++ b/app/modules/web/Controllers/AuthTokenController.php @@ -44,7 +44,7 @@ use SP\Services\User\UserService; * * @package SP\Modules\Web\Controllers */ -class AuthTokenController extends ControllerBase implements CrudControllerInterface +final class AuthTokenController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; @@ -237,7 +237,7 @@ class AuthTokenController extends ControllerBase implements CrudControllerInterf } try { - $form = new AuthTokenForm(); + $form = new AuthTokenForm($this->dic); $form->validate(Acl::AUTHTOKEN_CREATE); $apiTokenData = $form->getItemData(); @@ -273,7 +273,7 @@ class AuthTokenController extends ControllerBase implements CrudControllerInterf } try { - $form = new AuthTokenForm($id); + $form = new AuthTokenForm($this->dic, $id); $form->validate(Acl::AUTHTOKEN_EDIT); if ($form->isRefresh()) { diff --git a/app/modules/web/Controllers/BootstrapController.php b/app/modules/web/Controllers/BootstrapController.php index 9bca853a..35fd8752 100644 --- a/app/modules/web/Controllers/BootstrapController.php +++ b/app/modules/web/Controllers/BootstrapController.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -36,7 +36,7 @@ use SP\Providers\Auth\Browser\Browser; * * @package SP\Modules\Web\Controllers */ -class BootstrapController extends SimpleControllerBase +final class BootstrapController extends SimpleControllerBase { /** * Returns environment data @@ -48,7 +48,7 @@ class BootstrapController extends SimpleControllerBase { $configData = $this->config->getConfigData(); - $checkStatus= $this->session->getAuthCompleted() && ($this->session->getUserData()->getIsAdminApp() || $configData->isDemoEnabled()); + $checkStatus = $this->session->getAuthCompleted() && ($this->session->getUserData()->getIsAdminApp() || $configData->isDemoEnabled()); $data = [ 'lang' => require CONFIG_PATH . DIRECTORY_SEPARATOR . 'strings.js.inc', diff --git a/app/modules/web/Controllers/CategoryController.php b/app/modules/web/Controllers/CategoryController.php index 5bf59918..145aba9e 100644 --- a/app/modules/web/Controllers/CategoryController.php +++ b/app/modules/web/Controllers/CategoryController.php @@ -42,7 +42,7 @@ use SP\Services\Category\CategoryService; * * @package SP\Modules\Web\Controllers */ -class CategoryController extends ControllerBase implements CrudControllerInterface +final class CategoryController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; @@ -236,7 +236,7 @@ class CategoryController extends ControllerBase implements CrudControllerInterfa } try { - $form = new CategoryForm(); + $form = new CategoryForm($this->dic); $form->validate(Acl::CATEGORY_CREATE); $itemData = $form->getItemData(); @@ -278,7 +278,7 @@ class CategoryController extends ControllerBase implements CrudControllerInterfa } try { - $form = new CategoryForm($id); + $form = new CategoryForm($this->dic, $id); $form->validate(Acl::CATEGORY_EDIT); $itemData = $form->getItemData(); diff --git a/app/modules/web/Controllers/ClientController.php b/app/modules/web/Controllers/ClientController.php index dd35d5e7..ae67dfd6 100644 --- a/app/modules/web/Controllers/ClientController.php +++ b/app/modules/web/Controllers/ClientController.php @@ -43,7 +43,7 @@ use SP\Services\Client\ClientService; * * @package SP\Modules\Web\Controllers */ -class ClientController extends ControllerBase implements CrudControllerInterface +final class ClientController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; @@ -232,7 +232,7 @@ class ClientController extends ControllerBase implements CrudControllerInterface } try { - $form = new ClientForm(); + $form = new ClientForm($this->dic); $form->validate(Acl::CLIENT_CREATE); $itemData = $form->getItemData(); @@ -268,7 +268,7 @@ class ClientController extends ControllerBase implements CrudControllerInterface } try { - $form = new ClientForm($id); + $form = new ClientForm($this->dic, $id); $form->validate(Acl::CLIENT_EDIT); $this->clientService->update($form->getItemData()); diff --git a/app/modules/web/Controllers/ConfigAccountController.php b/app/modules/web/Controllers/ConfigAccountController.php index 1ea91480..b6ae9f38 100644 --- a/app/modules/web/Controllers/ConfigAccountController.php +++ b/app/modules/web/Controllers/ConfigAccountController.php @@ -37,7 +37,7 @@ use SP\Modules\Web\Controllers\Traits\ConfigTrait; * * @package SP\Modules\Web\Controllers */ -class ConfigAccountController extends SimpleControllerBase +final class ConfigAccountController extends SimpleControllerBase { use ConfigTrait; diff --git a/app/modules/web/Controllers/ConfigBackupController.php b/app/modules/web/Controllers/ConfigBackupController.php index ffae6ea5..6ddee5b3 100644 --- a/app/modules/web/Controllers/ConfigBackupController.php +++ b/app/modules/web/Controllers/ConfigBackupController.php @@ -40,7 +40,7 @@ use SP\Services\Export\XmlVerifyService; * * @package SP\Modules\Web\Controllers */ -class ConfigBackupController extends SimpleControllerBase +final class ConfigBackupController extends SimpleControllerBase { use ConfigTrait; diff --git a/app/modules/web/Controllers/ConfigEncryptionController.php b/app/modules/web/Controllers/ConfigEncryptionController.php index 03c2fece..6a1e9651 100644 --- a/app/modules/web/Controllers/ConfigEncryptionController.php +++ b/app/modules/web/Controllers/ConfigEncryptionController.php @@ -44,7 +44,7 @@ use SP\Util\Util; * * @package SP\Modules\Web\Controllers */ -class ConfigEncryptionController extends SimpleControllerBase +final class ConfigEncryptionController extends SimpleControllerBase { use JsonTrait; diff --git a/app/modules/web/Controllers/ConfigGeneralController.php b/app/modules/web/Controllers/ConfigGeneralController.php index 4c3ce412..5929de03 100644 --- a/app/modules/web/Controllers/ConfigGeneralController.php +++ b/app/modules/web/Controllers/ConfigGeneralController.php @@ -37,7 +37,7 @@ use SP\Modules\Web\Controllers\Traits\ConfigTrait; * * @package SP\Modules\Web\Controllers */ -class ConfigGeneralController extends SimpleControllerBase +final class ConfigGeneralController extends SimpleControllerBase { use ConfigTrait; diff --git a/app/modules/web/Controllers/ConfigImportController.php b/app/modules/web/Controllers/ConfigImportController.php index aa5e10c9..78612439 100644 --- a/app/modules/web/Controllers/ConfigImportController.php +++ b/app/modules/web/Controllers/ConfigImportController.php @@ -42,7 +42,7 @@ use SP\Services\Import\ImportService; * * @package SP\Modules\Web\Controllers */ -class ConfigImportController extends SimpleControllerBase +final class ConfigImportController extends SimpleControllerBase { use JsonTrait; diff --git a/app/modules/web/Controllers/ConfigLdapController.php b/app/modules/web/Controllers/ConfigLdapController.php index 2ad92415..71dfe2b2 100644 --- a/app/modules/web/Controllers/ConfigLdapController.php +++ b/app/modules/web/Controllers/ConfigLdapController.php @@ -43,7 +43,7 @@ use SP\Services\Ldap\LdapImportService; * * @package SP\Modules\Web\Controllers */ -class ConfigLdapController extends SimpleControllerBase +final class ConfigLdapController extends SimpleControllerBase { use ConfigTrait; diff --git a/app/modules/web/Controllers/ConfigMailController.php b/app/modules/web/Controllers/ConfigMailController.php index ccdddcf1..e9cf05b9 100644 --- a/app/modules/web/Controllers/ConfigMailController.php +++ b/app/modules/web/Controllers/ConfigMailController.php @@ -39,7 +39,7 @@ use SP\Services\Mail\MailService; * * @package SP\Modules\Web\Controllers */ -class ConfigMailController extends SimpleControllerBase +final class ConfigMailController extends SimpleControllerBase { use ConfigTrait; diff --git a/app/modules/web/Controllers/ConfigManagerController.php b/app/modules/web/Controllers/ConfigManagerController.php index 8b38559c..b55e7d50 100644 --- a/app/modules/web/Controllers/ConfigManagerController.php +++ b/app/modules/web/Controllers/ConfigManagerController.php @@ -29,10 +29,10 @@ use SP\Core\Acl\Acl; use SP\Core\Crypt\CryptSessionHandler; use SP\Core\Events\Event; use SP\Core\Language; -use SP\Core\Plugin\PluginUtil; use SP\Modules\Web\Controllers\Helpers\TabsHelper; use SP\Mvc\View\Components\DataTab; use SP\Mvc\View\Components\SelectItemAdapter; +use SP\Plugin\PluginManager; use SP\Providers\Log\DatabaseLogHandler; use SP\Providers\Mail\MailHandler; use SP\Services\Account\AccountService; @@ -52,7 +52,7 @@ use SP\Util\Util; * * @package SP\Modules\Web\Controllers */ -class ConfigManagerController extends ControllerBase +final class ConfigManagerController extends ControllerBase { /** * @var TabsHelper @@ -334,7 +334,7 @@ class ConfigManagerController extends ControllerBase $template->assign('dbInfo', DatabaseUtil::getDBinfo($this->dic->get(MySQLHandler::class))); $template->assign('dbName', $this->configData->getDbName() . '@' . $this->configData->getDbHost()); $template->assign('configBackupDate', date('r', $this->dic->get(ConfigService::class)->getByParam('config_backup_date', 0))); - $template->assign('plugins', PluginUtil::getLoadedPlugins()); + $template->assign('plugins', $this->dic->get(PluginManager::class)->getLoadedPlugins()); $template->assign('locale', Language::$localeStatus ?: sprintf('%s (%s)', $this->configData->getSiteLang(), __('No instalado'))); $template->assign('securedSession', CryptSessionHandler::$isSecured); diff --git a/app/modules/web/Controllers/ConfigWikiController.php b/app/modules/web/Controllers/ConfigWikiController.php index 1c030679..7c50f6c3 100644 --- a/app/modules/web/Controllers/ConfigWikiController.php +++ b/app/modules/web/Controllers/ConfigWikiController.php @@ -36,7 +36,7 @@ use SP\Modules\Web\Controllers\Traits\ConfigTrait; * * @package SP\Modules\Web\Controllers */ -class ConfigWikiController extends SimpleControllerBase +final class ConfigWikiController extends SimpleControllerBase { use ConfigTrait; diff --git a/app/modules/web/Controllers/CustomFieldController.php b/app/modules/web/Controllers/CustomFieldController.php index 021566e7..49b613d3 100644 --- a/app/modules/web/Controllers/CustomFieldController.php +++ b/app/modules/web/Controllers/CustomFieldController.php @@ -44,7 +44,7 @@ use SP\Services\CustomField\CustomFieldTypeService; * * @package SP\Modules\Web\Controllers */ -class CustomFieldController extends ControllerBase implements CrudControllerInterface +final class CustomFieldController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; @@ -223,7 +223,7 @@ class CustomFieldController extends ControllerBase implements CrudControllerInte } try { - $form = new CustomFieldDefForm(); + $form = new CustomFieldDefForm($this->dic); $form->validate(Acl::CUSTOMFIELD_CREATE); $itemData = $form->getItemData(); @@ -258,7 +258,7 @@ class CustomFieldController extends ControllerBase implements CrudControllerInte } try { - $form = new CustomFieldDefForm($id); + $form = new CustomFieldDefForm($this->dic, $id); $form->validate(Acl::CUSTOMFIELD_EDIT); $itemData = $form->getItemData(); diff --git a/app/modules/web/Controllers/ErrorController.php b/app/modules/web/Controllers/ErrorController.php index 9f3be1f6..c6330d9a 100644 --- a/app/modules/web/Controllers/ErrorController.php +++ b/app/modules/web/Controllers/ErrorController.php @@ -36,7 +36,7 @@ use SP\Mvc\View\Template; * * @package SP\Modules\Web\Controllers */ -class ErrorController +final class ErrorController { /** * @var Template @@ -56,6 +56,7 @@ class ErrorController * * @param Container $container * @param string $actionName + * * @throws \DI\DependencyException * @throws \DI\NotFoundException */ diff --git a/app/modules/web/Controllers/EventlogController.php b/app/modules/web/Controllers/EventlogController.php index cda64f98..301f2a50 100644 --- a/app/modules/web/Controllers/EventlogController.php +++ b/app/modules/web/Controllers/EventlogController.php @@ -38,7 +38,7 @@ use SP\Services\EventLog\EventlogService; * * @package SP\Modules\Web\Controllers */ -class EventlogController extends ControllerBase +final class EventlogController extends ControllerBase { use JsonTrait, ItemTrait; diff --git a/app/modules/web/Controllers/Helpers/Account/AccountActionsDto.php b/app/modules/web/Controllers/Helpers/Account/AccountActionsDto.php index f98baf26..cdb84952 100644 --- a/app/modules/web/Controllers/Helpers/Account/AccountActionsDto.php +++ b/app/modules/web/Controllers/Helpers/Account/AccountActionsDto.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -29,7 +29,7 @@ namespace SP\Modules\Web\Controllers\Helpers\Account; * * @package SP\Modules\Web\Controllers\Helpers\Account */ -class AccountActionsDto +final class AccountActionsDto { /** * @var int diff --git a/app/modules/web/Controllers/Helpers/Account/AccountActionsHelper.php b/app/modules/web/Controllers/Helpers/Account/AccountActionsHelper.php index 1e681ddb..1429deda 100644 --- a/app/modules/web/Controllers/Helpers/Account/AccountActionsHelper.php +++ b/app/modules/web/Controllers/Helpers/Account/AccountActionsHelper.php @@ -38,7 +38,7 @@ use SP\Services\Account\AccountSearchItem; * * @package SP\Modules\Web\Controllers\Helpers */ -class AccountActionsHelper extends HelperBase +final class AccountActionsHelper extends HelperBase { /** * @var ThemeIcons diff --git a/app/modules/web/Controllers/Helpers/Account/AccountHelper.php b/app/modules/web/Controllers/Helpers/Account/AccountHelper.php index fe906f94..5c5b28e4 100644 --- a/app/modules/web/Controllers/Helpers/Account/AccountHelper.php +++ b/app/modules/web/Controllers/Helpers/Account/AccountHelper.php @@ -54,7 +54,7 @@ use SP\Services\UserGroup\UserGroupService; * * @package SP\Modules\Web\Controllers\Helpers */ -class AccountHelper extends HelperBase +final class AccountHelper extends HelperBase { use ItemTrait; diff --git a/app/modules/web/Controllers/Helpers/Account/AccountHistoryHelper.php b/app/modules/web/Controllers/Helpers/Account/AccountHistoryHelper.php index 640f9ff9..2ab5e536 100644 --- a/app/modules/web/Controllers/Helpers/Account/AccountHistoryHelper.php +++ b/app/modules/web/Controllers/Helpers/Account/AccountHistoryHelper.php @@ -45,7 +45,7 @@ use SP\Services\User\UpdatedMasterPassException; * * @package SP\Modules\Web\Controllers\Helpers */ -class AccountHistoryHelper extends HelperBase +final class AccountHistoryHelper extends HelperBase { /** * @var Acl @@ -81,6 +81,8 @@ class AccountHistoryHelper extends HelperBase * @throws UpdatedMasterPassException * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\QueryException + * @throws \SP\Repositories\NoSuchItemException + * @throws \SP\Services\ServiceException */ public function setView(AccountHistoryData $accountHistoryData, $actionId) { diff --git a/app/modules/web/Controllers/Helpers/Account/AccountPasswordHelper.php b/app/modules/web/Controllers/Helpers/Account/AccountPasswordHelper.php index c6e84a5d..560772e5 100644 --- a/app/modules/web/Controllers/Helpers/Account/AccountPasswordHelper.php +++ b/app/modules/web/Controllers/Helpers/Account/AccountPasswordHelper.php @@ -39,7 +39,7 @@ use SP\Util\ImageUtil; * * @package SP\Modules\Web\Controllers\Helpers */ -class AccountPasswordHelper extends HelperBase +final class AccountPasswordHelper extends HelperBase { const TYPE_NORMAL = 0; const TYPE_FULL = 1; diff --git a/app/modules/web/Controllers/Helpers/Account/AccountSearchHelper.php b/app/modules/web/Controllers/Helpers/Account/AccountSearchHelper.php index eaa3298b..f2467c80 100644 --- a/app/modules/web/Controllers/Helpers/Account/AccountSearchHelper.php +++ b/app/modules/web/Controllers/Helpers/Account/AccountSearchHelper.php @@ -47,7 +47,7 @@ use SP\Services\Tag\TagService; * * @package SP\Modules\Web\Controllers\Helpers */ -class AccountSearchHelper extends HelperBase +final class AccountSearchHelper extends HelperBase { /** * @var bool Indica si el filtrado de cuentas está activo diff --git a/app/modules/web/Controllers/Helpers/HelperException.php b/app/modules/web/Controllers/Helpers/HelperException.php index 929ef2d2..abdd3e86 100644 --- a/app/modules/web/Controllers/Helpers/HelperException.php +++ b/app/modules/web/Controllers/Helpers/HelperException.php @@ -31,7 +31,7 @@ use Throwable; * Class HelperException * @package SP\Modules\Web\Controllers\Helpers */ -class HelperException extends Exception +final class HelperException extends Exception { /** * Construct the exception. Note: The message is NOT binary safe. diff --git a/app/modules/web/Controllers/Helpers/ItemsGridHelper.php b/app/modules/web/Controllers/Helpers/ItemsGridHelper.php index 6978d5ee..abe13819 100644 --- a/app/modules/web/Controllers/Helpers/ItemsGridHelper.php +++ b/app/modules/web/Controllers/Helpers/ItemsGridHelper.php @@ -49,7 +49,7 @@ use SP\Util\DateUtil; * * @package SP\Controller */ -class ItemsGridHelper extends HelperBase +final class ItemsGridHelper extends HelperBase { /** * @var float diff --git a/app/modules/web/Controllers/Helpers/LayoutHelper.php b/app/modules/web/Controllers/Helpers/LayoutHelper.php index b04fb6cc..25c97805 100644 --- a/app/modules/web/Controllers/Helpers/LayoutHelper.php +++ b/app/modules/web/Controllers/Helpers/LayoutHelper.php @@ -30,11 +30,11 @@ use SP\Core\Acl\ActionsInterface; use SP\Core\Crypt\CryptPKI; use SP\Core\Exceptions\SPException; use SP\Core\Language; -use SP\Core\Plugin\PluginUtil; use SP\Core\UI\Theme; use SP\Core\UI\ThemeInterface; use SP\Html\DataGrid\DataGridAction; use SP\Http\Uri; +use SP\Plugin\PluginManager; use SP\Services\Install\Installer; use SP\Util\Util; @@ -186,7 +186,7 @@ class LayoutHelper extends HelperBase } // Cargar los recursos de los plugins - foreach (PluginUtil::getLoadedPlugins() as $plugin) { + foreach ($this->dic->get(PluginManager::class)->getLoadedPlugins() as $plugin) { $base = str_replace(BASE_PATH, '', $plugin->getBase()); $jsResources = $plugin->getJsResources(); $cssResources = $plugin->getCssResources(); diff --git a/app/modules/web/Controllers/Helpers/TabsGridHelper.php b/app/modules/web/Controllers/Helpers/TabsGridHelper.php index d17bb4b1..a80b922e 100644 --- a/app/modules/web/Controllers/Helpers/TabsGridHelper.php +++ b/app/modules/web/Controllers/Helpers/TabsGridHelper.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -31,7 +31,7 @@ use SP\Html\DataGrid\DataGridTab; * * @package SP\Modules\Web\Controllers\Helpers */ -class TabsGridHelper extends HelperBase +final class TabsGridHelper extends HelperBase { /** * Máximo numero de acciones antes de agrupar diff --git a/app/modules/web/Controllers/Helpers/TabsHelper.php b/app/modules/web/Controllers/Helpers/TabsHelper.php index 10897cf8..5ec64fa1 100644 --- a/app/modules/web/Controllers/Helpers/TabsHelper.php +++ b/app/modules/web/Controllers/Helpers/TabsHelper.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -31,7 +31,7 @@ use SP\Mvc\View\Components\DataTab; * * @package SP\Modules\Web\Controllers\Helpers */ -class TabsHelper extends HelperBase +final class TabsHelper extends HelperBase { /** * Máximo numero de acciones antes de agrupar diff --git a/app/modules/web/Controllers/IndexController.php b/app/modules/web/Controllers/IndexController.php index fb586c1c..45989d20 100644 --- a/app/modules/web/Controllers/IndexController.php +++ b/app/modules/web/Controllers/IndexController.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -32,7 +32,7 @@ use SP\Modules\Web\Controllers\Helpers\LayoutHelper; * * @package SP\Modules\Web\Controllers */ -class IndexController extends ControllerBase +final class IndexController extends ControllerBase { /** * Index action diff --git a/app/modules/web/Controllers/InstallController.php b/app/modules/web/Controllers/InstallController.php index 94576e6c..45089283 100644 --- a/app/modules/web/Controllers/InstallController.php +++ b/app/modules/web/Controllers/InstallController.php @@ -41,7 +41,7 @@ use SP\Util\Checks; * * @package SP\Modules\Web\Controllers */ -class InstallController extends ControllerBase +final class InstallController extends ControllerBase { use JsonTrait; diff --git a/app/modules/web/Controllers/ItemManagerController.php b/app/modules/web/Controllers/ItemManagerController.php index 79d134a8..67164054 100644 --- a/app/modules/web/Controllers/ItemManagerController.php +++ b/app/modules/web/Controllers/ItemManagerController.php @@ -43,7 +43,7 @@ use SP\Services\Tag\TagService; * * @package SP\Modules\Web\Controllers */ -class ItemManagerController extends ControllerBase +final class ItemManagerController extends ControllerBase { /** * @var ItemSearchData diff --git a/app/modules/web/Controllers/ItemsController.php b/app/modules/web/Controllers/ItemsController.php index a3a1e33b..ffe9dc6d 100644 --- a/app/modules/web/Controllers/ItemsController.php +++ b/app/modules/web/Controllers/ItemsController.php @@ -38,7 +38,7 @@ use SP\Util\Json; * * @package SP\Modules\Web\Controllers */ -class ItemsController extends SimpleControllerBase +final class ItemsController extends SimpleControllerBase { /** * Devolver las cuentas visibles por el usuario diff --git a/app/modules/web/Controllers/LoginController.php b/app/modules/web/Controllers/LoginController.php index 9fc1927e..6630c057 100644 --- a/app/modules/web/Controllers/LoginController.php +++ b/app/modules/web/Controllers/LoginController.php @@ -39,7 +39,7 @@ use SP\Services\Auth\LoginService; * * @package SP\Modules\Web\Controllers */ -class LoginController extends ControllerBase +final class LoginController extends ControllerBase { use JsonTrait; diff --git a/app/modules/web/Controllers/NotificationController.php b/app/modules/web/Controllers/NotificationController.php index c635954a..503a4bc0 100644 --- a/app/modules/web/Controllers/NotificationController.php +++ b/app/modules/web/Controllers/NotificationController.php @@ -45,7 +45,7 @@ use SP\Services\User\UserService; * * @package SP\Modules\Web\Controllers */ -class NotificationController extends ControllerBase implements CrudControllerInterface +final class NotificationController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; @@ -315,7 +315,7 @@ class NotificationController extends ControllerBase implements CrudControllerInt } try { - $form = new NotificationForm(); + $form = new NotificationForm($this->dic); $form->validate(Acl::NOTIFICATION_CREATE); $this->notificationService->create($form->getItemData()); @@ -346,7 +346,7 @@ class NotificationController extends ControllerBase implements CrudControllerInt } try { - $form = new NotificationForm($id); + $form = new NotificationForm($this->dic, $id); $form->validate(Acl::NOTIFICATION_EDIT); $this->notificationService->update($form->getItemData()); diff --git a/app/modules/web/Controllers/PluginController.php b/app/modules/web/Controllers/PluginController.php index 61297f59..6329b355 100644 --- a/app/modules/web/Controllers/PluginController.php +++ b/app/modules/web/Controllers/PluginController.php @@ -41,7 +41,7 @@ use SP\Services\Plugin\PluginService; * * @package web\Controllers */ -class PluginController extends ControllerBase +final class PluginController extends ControllerBase { use JsonTrait, ItemTrait; diff --git a/app/modules/web/Controllers/PublicLinkController.php b/app/modules/web/Controllers/PublicLinkController.php index 12cd442e..019ff7af 100644 --- a/app/modules/web/Controllers/PublicLinkController.php +++ b/app/modules/web/Controllers/PublicLinkController.php @@ -47,7 +47,7 @@ use SP\Util\Util; * * @package SP\Modules\Web\Controllers */ -class PublicLinkController extends ControllerBase implements CrudControllerInterface +final class PublicLinkController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; @@ -266,7 +266,7 @@ class PublicLinkController extends ControllerBase implements CrudControllerInter } try { - $form = new PublicLinkForm(); + $form = new PublicLinkForm($this->dic); $form->validate(Acl::PUBLICLINK_CREATE); $this->publicLinkService->create($form->getItemData()); diff --git a/app/modules/web/Controllers/ResourceController.php b/app/modules/web/Controllers/ResourceController.php index 627d4352..e3d3fa93 100644 --- a/app/modules/web/Controllers/ResourceController.php +++ b/app/modules/web/Controllers/ResourceController.php @@ -32,7 +32,7 @@ use SP\Html\Minify; * * @package SP\Modules\Web\Controllers */ -class ResourceController extends SimpleControllerBase +final class ResourceController extends SimpleControllerBase { /** * @var Minify diff --git a/app/modules/web/Controllers/StatusController.php b/app/modules/web/Controllers/StatusController.php index ae9c5f4f..25b99970 100644 --- a/app/modules/web/Controllers/StatusController.php +++ b/app/modules/web/Controllers/StatusController.php @@ -34,7 +34,7 @@ use SP\Util\Util; * * @package SP\Modules\Web\Controllers */ -class StatusController extends SimpleControllerBase +final class StatusController extends SimpleControllerBase { use JsonTrait; diff --git a/app/modules/web/Controllers/TagController.php b/app/modules/web/Controllers/TagController.php index 1b065353..ef36ae1c 100644 --- a/app/modules/web/Controllers/TagController.php +++ b/app/modules/web/Controllers/TagController.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -41,7 +41,7 @@ use SP\Services\Tag\TagService; * * @package SP\Modules\Web\Controllers */ -class TagController extends ControllerBase implements CrudControllerInterface +final class TagController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; @@ -145,6 +145,7 @@ class TagController extends ControllerBase implements CrudControllerInterface * Edit action * * @param $id + * * @throws \Psr\Container\ContainerExceptionInterface */ public function editAction($id) @@ -174,6 +175,7 @@ class TagController extends ControllerBase implements CrudControllerInterface * Delete action * * @param $id + * * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ @@ -218,7 +220,7 @@ class TagController extends ControllerBase implements CrudControllerInterface } try { - $form = new TagForm(); + $form = new TagForm($this->dic); $form->validate(Acl::TAG_CREATE); $this->tagService->create($form->getItemData()); @@ -247,7 +249,7 @@ class TagController extends ControllerBase implements CrudControllerInterface } try { - $form = new TagForm($id); + $form = new TagForm($this->dic, $id); $form->validate(Acl::TAG_EDIT); $this->tagService->update($form->getItemData()); @@ -268,6 +270,7 @@ class TagController extends ControllerBase implements CrudControllerInterface * View action * * @param $id + * * @throws \Psr\Container\ContainerExceptionInterface */ public function viewAction($id) diff --git a/app/modules/web/Controllers/TaskController.php b/app/modules/web/Controllers/TaskController.php index aba5865c..6e7d1737 100644 --- a/app/modules/web/Controllers/TaskController.php +++ b/app/modules/web/Controllers/TaskController.php @@ -37,7 +37,7 @@ use SP\Services\Task\TaskService; * * @package SP\Modules\Web\Controllers */ -class TaskController +final class TaskController { /** * @var Container diff --git a/app/modules/web/Controllers/UpgradeController.php b/app/modules/web/Controllers/UpgradeController.php index d90c14a5..ca61f325 100644 --- a/app/modules/web/Controllers/UpgradeController.php +++ b/app/modules/web/Controllers/UpgradeController.php @@ -37,7 +37,7 @@ use SP\Services\Upgrade\UpgradeUtil; * * @package SP\Modules\Web\Controllers */ -class UpgradeController extends ControllerBase +final class UpgradeController extends ControllerBase { use JsonTrait; diff --git a/app/modules/web/Controllers/UserController.php b/app/modules/web/Controllers/UserController.php index 25fb4c06..4b366376 100644 --- a/app/modules/web/Controllers/UserController.php +++ b/app/modules/web/Controllers/UserController.php @@ -47,7 +47,7 @@ use SP\Services\UserProfile\UserProfileService; * * @package SP\Modules\Web\Controllers */ -class UserController extends ControllerBase implements CrudControllerInterface +final class UserController extends ControllerBase implements CrudControllerInterface { use JsonTrait; use ItemTrait; @@ -299,7 +299,7 @@ class UserController extends ControllerBase implements CrudControllerInterface } try { - $form = new UserForm(); + $form = new UserForm($this->dic); $form->validate(Acl::USER_CREATE); $itemData = $form->getItemData(); @@ -360,7 +360,7 @@ class UserController extends ControllerBase implements CrudControllerInterface } try { - $form = new UserForm($id); + $form = new UserForm($this->dic, $id); $form->validate(Acl::USER_EDIT); $itemData = $form->getItemData(); @@ -399,7 +399,7 @@ class UserController extends ControllerBase implements CrudControllerInterface } try { - $form = new UserForm($id); + $form = new UserForm($this->dic, $id); $form->validate(Acl::USER_EDIT_PASS); $itemData = $form->getItemData(); diff --git a/app/modules/web/Controllers/UserGroupController.php b/app/modules/web/Controllers/UserGroupController.php index 4c82e5dd..eb47887a 100644 --- a/app/modules/web/Controllers/UserGroupController.php +++ b/app/modules/web/Controllers/UserGroupController.php @@ -45,7 +45,7 @@ use SP\Services\UserGroup\UserToUserGroupService; * * @package SP\Modules\Web\Controllers */ -class UserGroupController extends ControllerBase implements CrudControllerInterface +final class UserGroupController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; @@ -239,7 +239,7 @@ class UserGroupController extends ControllerBase implements CrudControllerInterf } try { - $form = new UserGroupForm(); + $form = new UserGroupForm($this->dic); $form->validate(Acl::GROUP_CREATE); $groupData = $form->getItemData(); @@ -279,7 +279,7 @@ class UserGroupController extends ControllerBase implements CrudControllerInterf } try { - $form = new UserGroupForm($id); + $form = new UserGroupForm($this->dic, $id); $form->validate(Acl::GROUP_EDIT); $groupData = $form->getItemData(); diff --git a/app/modules/web/Controllers/UserPassResetController.php b/app/modules/web/Controllers/UserPassResetController.php index dc7480d6..2c327764 100644 --- a/app/modules/web/Controllers/UserPassResetController.php +++ b/app/modules/web/Controllers/UserPassResetController.php @@ -43,7 +43,7 @@ use SP\Util\ErrorUtil; * * @package SP\Modules\Web\Controllers */ -class UserPassResetController extends ControllerBase +final class UserPassResetController extends ControllerBase { use JsonTrait; /** diff --git a/app/modules/web/Controllers/UserProfileController.php b/app/modules/web/Controllers/UserProfileController.php index 53dcd89c..8fa64746 100644 --- a/app/modules/web/Controllers/UserProfileController.php +++ b/app/modules/web/Controllers/UserProfileController.php @@ -43,7 +43,7 @@ use SP\Services\UserProfile\UserProfileService; * * @package SP\Modules\Web\Controllers */ -class UserProfileController extends ControllerBase implements CrudControllerInterface +final class UserProfileController extends ControllerBase implements CrudControllerInterface { use JsonTrait, ItemTrait; @@ -234,7 +234,7 @@ class UserProfileController extends ControllerBase implements CrudControllerInte } try { - $form = new UserProfileForm(); + $form = new UserProfileForm($this->dic); $form->validate(Acl::PROFILE_CREATE); $profileData = $form->getItemData(); @@ -270,7 +270,7 @@ class UserProfileController extends ControllerBase implements CrudControllerInte } try { - $form = new UserProfileForm($id); + $form = new UserProfileForm($this->dic, $id); $form->validate(Acl::PROFILE_EDIT); $profileData = $form->getItemData(); diff --git a/app/modules/web/Controllers/UserSettingsGeneralController.php b/app/modules/web/Controllers/UserSettingsGeneralController.php index 4079e5ed..16facde8 100644 --- a/app/modules/web/Controllers/UserSettingsGeneralController.php +++ b/app/modules/web/Controllers/UserSettingsGeneralController.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -30,9 +30,10 @@ use SP\Services\User\UserService; /** * Class UserSettingsGeneralController + * * @package SP\Modules\Web\Controllers */ -class UserSettingsGeneralController extends SimpleControllerBase +final class UserSettingsGeneralController extends SimpleControllerBase { use JsonTrait; diff --git a/app/modules/web/Controllers/UserSettingsManagerController.php b/app/modules/web/Controllers/UserSettingsManagerController.php index 21f11d07..72db626f 100644 --- a/app/modules/web/Controllers/UserSettingsManagerController.php +++ b/app/modules/web/Controllers/UserSettingsManagerController.php @@ -36,7 +36,7 @@ use SP\Mvc\View\Components\SelectItemAdapter; * * @package web\Controllers */ -class UserSettingsManagerController extends ControllerBase +final class UserSettingsManagerController extends ControllerBase { /** * @var TabsHelper diff --git a/app/modules/web/Forms/AccountForm.php b/app/modules/web/Forms/AccountForm.php index da7b2668..e668803c 100644 --- a/app/modules/web/Forms/AccountForm.php +++ b/app/modules/web/Forms/AccountForm.php @@ -33,7 +33,7 @@ use SP\Services\Account\AccountRequest; * * @package SP\Account */ -class AccountForm extends FormBase implements FormInterface +final class AccountForm extends FormBase implements FormInterface { /** * @var AccountRequest diff --git a/app/modules/web/Forms/AuthTokenForm.php b/app/modules/web/Forms/AuthTokenForm.php index 6ee799b0..da48e2a8 100644 --- a/app/modules/web/Forms/AuthTokenForm.php +++ b/app/modules/web/Forms/AuthTokenForm.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -33,7 +33,7 @@ use SP\DataModel\AuthTokenData; * * @package SP\Modules\Web\Forms */ -class AuthTokenForm extends FormBase implements FormInterface +final class AuthTokenForm extends FormBase implements FormInterface { /** * @var AuthTokenData @@ -48,6 +48,7 @@ class AuthTokenForm extends FormBase implements FormInterface * Validar el formulario * * @param $action + * * @return AuthTokenForm * @throws \SP\Core\Exceptions\ValidationException */ diff --git a/app/modules/web/Forms/CategoryForm.php b/app/modules/web/Forms/CategoryForm.php index 753457d8..d0dfe0f5 100644 --- a/app/modules/web/Forms/CategoryForm.php +++ b/app/modules/web/Forms/CategoryForm.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -33,7 +33,7 @@ use SP\DataModel\CategoryData; * * @package SP\Modules\Web\Forms */ -class CategoryForm extends FormBase implements FormInterface +final class CategoryForm extends FormBase implements FormInterface { /** * @var CategoryData @@ -44,6 +44,7 @@ class CategoryForm extends FormBase implements FormInterface * Validar el formulario * * @param $action + * * @return bool * @throws \SP\Core\Exceptions\ValidationException */ diff --git a/app/modules/web/Forms/ClientForm.php b/app/modules/web/Forms/ClientForm.php index aaecf13b..4d23777d 100644 --- a/app/modules/web/Forms/ClientForm.php +++ b/app/modules/web/Forms/ClientForm.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -33,7 +33,7 @@ use SP\DataModel\ClientData; * * @package SP\Modules\Web\Forms */ -class ClientForm extends FormBase implements FormInterface +final class ClientForm extends FormBase implements FormInterface { /** * @var ClientData @@ -44,6 +44,7 @@ class ClientForm extends FormBase implements FormInterface * Validar el formulario * * @param $action + * * @return bool * @throws \SP\Core\Exceptions\ValidationException */ diff --git a/app/modules/web/Forms/CustomFieldDefForm.php b/app/modules/web/Forms/CustomFieldDefForm.php index c2640583..54d5bf68 100644 --- a/app/modules/web/Forms/CustomFieldDefForm.php +++ b/app/modules/web/Forms/CustomFieldDefForm.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -33,7 +33,7 @@ use SP\DataModel\CustomFieldDefinitionData; * * @package SP\Modules\Web\Forms */ -class CustomFieldDefForm extends FormBase implements FormInterface +final class CustomFieldDefForm extends FormBase implements FormInterface { /** * @var CustomFieldDefinitionData @@ -44,6 +44,7 @@ class CustomFieldDefForm extends FormBase implements FormInterface * Validar el formulario * * @param $action + * * @return bool * @throws \SP\Core\Exceptions\ValidationException */ diff --git a/app/modules/web/Forms/FormBase.php b/app/modules/web/Forms/FormBase.php index 1b98bc5c..8b287b05 100644 --- a/app/modules/web/Forms/FormBase.php +++ b/app/modules/web/Forms/FormBase.php @@ -24,11 +24,11 @@ namespace SP\Modules\Web\Forms; +use DI\Container; use SP\Config\Config; use SP\Config\ConfigData; use SP\Core\Context\ContextInterface; use SP\Core\Context\SessionContext; -use SP\Core\Dic\InjectableTrait; use SP\Http\Request; /** @@ -38,8 +38,6 @@ use SP\Http\Request; */ abstract class FormBase { - use InjectableTrait; - /** * @var int */ @@ -64,31 +62,22 @@ abstract class FormBase /** * FormBase constructor. * - * @param $itemId + * @param int $itemId + * @param Container $container * - * @throws \SP\Core\Dic\ContainerException + * @throws \DI\DependencyException + * @throws \DI\NotFoundException */ - public function __construct($itemId = null) + public function __construct(Container $container, $itemId = null) { - // FIXME - $this->injectDependencies(); + $this->config = $container->get(Config::class); + $this->configData = $this->config->getConfigData(); + $this->context = $container->get(ContextInterface::class); + $this->request = $container->get(Request::class); $this->itemId = $itemId; } - /** - * @param Config $config - * @param ContextInterface $session - * @param Request $request - */ - public function inject(Config $config, ContextInterface $session, Request $request) - { - $this->config = $config; - $this->configData = $config->getConfigData(); - $this->context = $session; - $this->request = $request; - } - /** * Analizar los datos de la petición HTTP * diff --git a/app/modules/web/Forms/NotificationForm.php b/app/modules/web/Forms/NotificationForm.php index 6f18b3eb..14bd2d17 100644 --- a/app/modules/web/Forms/NotificationForm.php +++ b/app/modules/web/Forms/NotificationForm.php @@ -34,7 +34,7 @@ use SP\DataModel\NotificationData; * * @package SP\Modules\Web\Forms */ -class NotificationForm extends FormBase implements FormInterface +final class NotificationForm extends FormBase implements FormInterface { /** * @var NotificationData @@ -45,6 +45,7 @@ class NotificationForm extends FormBase implements FormInterface * Validar el formulario * * @param $action + * * @return bool * @throws \SP\Core\Exceptions\ValidationException */ diff --git a/app/modules/web/Forms/PublicLinkForm.php b/app/modules/web/Forms/PublicLinkForm.php index c529f45a..7c66a62a 100644 --- a/app/modules/web/Forms/PublicLinkForm.php +++ b/app/modules/web/Forms/PublicLinkForm.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -27,7 +27,6 @@ namespace SP\Modules\Web\Forms; use SP\Core\Acl\ActionsInterface; use SP\Core\Exceptions\ValidationException; use SP\DataModel\PublicLinkData; -use SP\Mgmt\PublicLinks\PublicLink; use SP\Services\PublicLink\PublicLinkService; /** @@ -35,7 +34,7 @@ use SP\Services\PublicLink\PublicLinkService; * * @package SP\Modules\Web\Forms */ -class PublicLinkForm extends FormBase implements FormInterface +final class PublicLinkForm extends FormBase implements FormInterface { /** * @var PublicLinkData @@ -46,9 +45,9 @@ class PublicLinkForm extends FormBase implements FormInterface * Validar el formulario * * @param $action + * * @return bool * @throws ValidationException - * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException */ public function validate($action) { diff --git a/app/modules/web/Forms/TagForm.php b/app/modules/web/Forms/TagForm.php index 7065d8a9..fa904b15 100644 --- a/app/modules/web/Forms/TagForm.php +++ b/app/modules/web/Forms/TagForm.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -33,7 +33,7 @@ use SP\DataModel\TagData; * * @package SP\Modules\Web\Forms */ -class TagForm extends FormBase implements FormInterface +final class TagForm extends FormBase implements FormInterface { /** * @var TagData @@ -44,6 +44,7 @@ class TagForm extends FormBase implements FormInterface * Validar el formulario * * @param $action + * * @return bool * @throws \SP\Core\Exceptions\ValidationException */ diff --git a/app/modules/web/Forms/UserForm.php b/app/modules/web/Forms/UserForm.php index 2b5e9784..9ab8fb13 100644 --- a/app/modules/web/Forms/UserForm.php +++ b/app/modules/web/Forms/UserForm.php @@ -33,7 +33,7 @@ use SP\DataModel\UserData; * * @package SP\Modules\Web\Forms */ -class UserForm extends FormBase implements FormInterface +final class UserForm extends FormBase implements FormInterface { /** * @var UserData diff --git a/app/modules/web/Forms/UserGroupForm.php b/app/modules/web/Forms/UserGroupForm.php index fcdc0eb9..88dfbefd 100644 --- a/app/modules/web/Forms/UserGroupForm.php +++ b/app/modules/web/Forms/UserGroupForm.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link https://syspass.org + * @author nuxsmin + * @link https://syspass.org * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -33,7 +33,7 @@ use SP\DataModel\UserGroupData; * * @package SP\Modules\Web\Forms */ -class UserGroupForm extends FormBase implements FormInterface +final class UserGroupForm extends FormBase implements FormInterface { /** * @var UserGroupData @@ -44,6 +44,7 @@ class UserGroupForm extends FormBase implements FormInterface * Validar el formulario * * @param $action + * * @return bool * @throws \SP\Core\Exceptions\ValidationException */ diff --git a/app/modules/web/Forms/UserProfileForm.php b/app/modules/web/Forms/UserProfileForm.php index 07fc7c4f..cc0adf7c 100644 --- a/app/modules/web/Forms/UserProfileForm.php +++ b/app/modules/web/Forms/UserProfileForm.php @@ -34,7 +34,7 @@ use SP\DataModel\UserProfileData; * * @package SP\Modules\Web\Forms */ -class UserProfileForm extends FormBase implements FormInterface +final class UserProfileForm extends FormBase implements FormInterface { /** * @var UserProfileData @@ -45,6 +45,7 @@ class UserProfileForm extends FormBase implements FormInterface * Validar el formulario * * @param $action + * * @return bool * @throws \SP\Core\Exceptions\ValidationException */ diff --git a/app/modules/web/Init.php b/app/modules/web/Init.php index 1c0dd4a9..f1c09b7c 100644 --- a/app/modules/web/Init.php +++ b/app/modules/web/Init.php @@ -36,6 +36,7 @@ use SP\Core\Crypt\UUIDCookie; use SP\Core\Language; use SP\Core\ModuleBase; use SP\Core\UI\Theme; +use SP\Plugin\PluginManager; use SP\Services\Crypt\SecureSessionService; use SP\Services\Upgrade\UpgradeAppService; use SP\Services\Upgrade\UpgradeDatabaseService; @@ -50,7 +51,7 @@ use SP\Util\HttpUtil; * * @package SP\Modules\Web */ -class Init extends ModuleBase +final class Init extends ModuleBase { /** * List of controllers that don't need to perform fully initialization @@ -61,19 +62,23 @@ class Init extends ModuleBase /** * @var SessionContext */ - protected $context; + private $context; /** * @var Theme */ - protected $theme; + private $theme; /** * @var Language */ - protected $language; + private $language; /** * @var SecureSessionService */ - protected $secureSessionService; + private $secureSessionService; + /** + * @var PluginManager + */ + private $pluginManager; /** * Init constructor. @@ -91,6 +96,7 @@ class Init extends ModuleBase $this->theme = $container->get(Theme::class); $this->language = $container->get(Language::class); $this->secureSessionService = $container->get(SecureSessionService::class); + $this->pluginManager = $container->get(PluginManager::class); } /** @@ -176,10 +182,7 @@ class Init extends ModuleBase $this->initUserSession(); // Load plugins -// PluginUtil::loadPlugins(); - - // Comprobar acciones en URL -// $this->checkPreLoginActions(); + $this->pluginManager->loadPlugins(); if ($this->context->isLoggedIn() && $this->context->getAppStatus() === SessionContext::APP_STATUS_RELOADED) { debugLog('Reload user profile'); diff --git a/app/modules/web/themes/material-blue/views/config/info.inc b/app/modules/web/themes/material-blue/views/config/info.inc index 22e0a35f..ca28c4c5 100644 --- a/app/modules/web/themes/material-blue/views/config/info.inc +++ b/app/modules/web/themes/material-blue/views/config/info.inc @@ -117,7 +117,7 @@