From ff7e6e3519fcd17d07fa1442871ba1c8d3f69937 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Tue, 17 Oct 2017 02:00:52 +0200 Subject: [PATCH] * [ADD] Work in progress * [ADD] Using URL routing * [ADD] Using dependency injection * [MOD] Big app structure changes --- .gitignore | 9 +- ajax/ajax_accGetFiles.php | 55 -- ajax/ajax_accSearch.php | 56 -- ajax/ajax_checkConnection.php | 2 +- ajax/ajax_configSave.php | 2 +- ajax/ajax_eventlog.php | 8 +- ajax/ajax_filesMgmt.php | 16 +- ajax/ajax_getContent.php | 29 +- ajax/ajax_getEnvironment.php | 66 -- ajax/ajax_getItems.php | 2 +- ajax/ajax_install.php | 2 +- ajax/ajax_itemSave.php | 2 +- ajax/ajax_itemSearch.php | 2 +- ajax/ajax_itemShow.php | 2 +- ajax/ajax_noticeSearch.php | 2 +- ajax/ajax_noticeShow.php | 2 +- ajax/ajax_passReset.php | 2 +- ajax/ajax_task.php | 2 +- ajax/ajax_upgrade.php | 2 +- ajax/ajax_userPrefsSave.php | 17 +- ajax/ajax_wiki.php | 2 +- api.php | 2 +- {backup => app/backup}/.blank | 0 {config => app/cache}/.blank | 0 {inc/Plugins => app/config}/.blank | 0 app/config/config.php | 47 + app/config/config.php.old | 47 + app/config/config.xml | 103 +++ app/config/config.xml.orig | 103 +++ .../main/sessionbar.inc => app/config/key.pem | 0 app/config/pubkey.pem | 6 + .../locales/ca_ES/LC_MESSAGES/messages.mo | Bin .../locales/ca_ES/LC_MESSAGES/messages.po | 0 .../locales/de_DE/LC_MESSAGES/messages.mo | Bin .../locales/de_DE/LC_MESSAGES/messages.po | 0 .../locales/en_US/LC_MESSAGES/messages.mo | Bin .../locales/en_US/LC_MESSAGES/messages.po | 0 .../locales/fr_FR/LC_MESSAGES/messages.mo | Bin .../locales/fr_FR/LC_MESSAGES/messages.po | 0 .../locales/hu_HU/LC_MESSAGES/messages.mo | Bin .../locales/hu_HU/LC_MESSAGES/messages.po | 0 .../locales/it_IT/LC_MESSAGES/messages.mo | Bin .../locales/it_IT/LC_MESSAGES/messages.po | 0 .../locales/nl_NL/LC_MESSAGES/messages.mo | Bin .../locales/nl_NL/LC_MESSAGES/messages.po | 0 .../locales/po_PO/LC_MESSAGES/messages.mo | Bin .../locales/po_PO/LC_MESSAGES/messages.po | 0 .../locales/pt_BR/LC_MESSAGES/messages.mo | Bin .../locales/pt_BR/LC_MESSAGES/messages.po | 0 .../locales/ru_RU/LC_MESSAGES/messages.mo | Bin .../locales/ru_RU/LC_MESSAGES/messages.po | 0 .../web/Controllers/AccountController.php | 373 ++++++++ .../web/Controllers/BootstrapController.php | 75 ++ .../web/Controllers/Helpers/AccountHelper.php | 288 ++++++ .../Helpers/AccountSearchHelper.php | 383 ++++++++ .../web/Controllers/Helpers/HelperBase.php | 81 ++ .../web/Controllers/Helpers/LayoutHelper.php | 292 +++++++ .../web/Controllers/IndexController.php | 108 +++ .../web/Controllers/ItemsController.php | 95 ++ .../web/Controllers/LoginController.php | 129 +++ .../web/Controllers}/MainController.php | 107 +-- .../web/Controllers/PassresetController.php | 69 ++ .../web/Controllers/SimpleControllerBase.php | 93 ++ app/modules/web/module.php | 27 + app/modules/web/plugins/.blank | 0 .../web}/themes/material-blue/css/LICENSE | 0 .../themes/material-blue/css/Roboto_300.woff2 | Bin .../themes/material-blue/css/Roboto_400.woff2 | Bin .../themes/material-blue/css/Roboto_500.woff2 | Bin .../themes/material-blue/css/Roboto_600.woff2 | Bin .../web}/themes/material-blue/css/_base.scss | 1 + .../themes/material-blue/css/_elements.scss | 0 .../web}/themes/material-blue/css/_login.scss | 2 +- .../web}/themes/material-blue/css/fonts.css | 0 .../themes/material-blue/css/fonts.min.css | 0 .../material-blue/css/material-custom.css | 0 .../material-blue/css/material-custom.min.css | 0 .../themes/material-blue/css/material.min.css | 0 .../material-blue/css/mdl-datetimepicker.css | 0 .../css/mdl-datetimepicker.css.map | 0 .../css/mdl-datetimepicker.min.css | 0 .../material-blue/css/mdl-datetimepicker.scss | 0 .../css/mdl-jquery-modal-dialog.css | 0 .../css/mdl-jquery-modal-dialog.css.map | 0 .../css/mdl-jquery-modal-dialog.min.css | 0 .../css/mdl-jquery-modal-dialog.scss | 0 .../themes/material-blue/css/search-card.css | 0 .../material-blue/css/search-card.css.map | 0 .../material-blue/css/search-card.min.css | 0 .../themes/material-blue/css/search-card.scss | 0 .../themes/material-blue/css/search-grid.css | 0 .../material-blue/css/search-grid.css.map | 0 .../material-blue/css/search-grid.min.css | 0 .../themes/material-blue/css/search-grid.scss | 0 .../material-blue/css/selectize-custom.css | 0 .../css/selectize-custom.css.map | 0 .../css/selectize-custom.min.css | 0 .../material-blue/css/selectize-custom.scss | 0 .../material-blue/css/selectize.custom.css | 0 .../css/selectize.custom.min.css | 0 .../themes/material-blue/css/styles-wiki.css | 0 .../material-blue/css/styles-wiki.css.map | 0 .../material-blue/css/styles-wiki.min.css | 0 .../themes/material-blue/css/styles-wiki.scss | 0 .../web}/themes/material-blue/css/styles.css | 4 +- .../themes/material-blue/css/styles.css.map | 2 +- .../themes/material-blue/css/styles.min.css | 2 +- .../web}/themes/material-blue/css/styles.scss | 2 +- .../web}/themes/material-blue/css/toastr.css | 0 .../themes/material-blue/css/toastr.css.map | 0 .../themes/material-blue/css/toastr.min.css | 0 .../web}/themes/material-blue/css/toastr.scss | 0 .../web}/themes/material-blue/inc/Icons.php | 0 .../web}/themes/material-blue/index.php | 2 +- .../web}/themes/material-blue/js/LICENSE | 0 .../web}/themes/material-blue/js/app-theme.js | 0 .../themes/material-blue/js/app-theme.min.js | 0 .../js/bootstrap-material-datetimepicker.js | 0 .../bootstrap-material-datetimepicker.min.js | 0 .../web}/themes/material-blue/js/material.js | 0 .../themes/material-blue/js/material.min.js | 0 .../js/mdl-jquery-modal-dialog.js | 0 .../js/mdl-jquery-modal-dialog.min.js | 0 .../views/_partials}/body-content.inc | 0 .../views/_partials}/body-end.inc | 0 .../views/_partials}/body-footer.inc | 0 .../views/_partials}/body-header-menu.inc | 0 .../views/_partials}/body-header.inc | 0 .../views/_partials}/body-start.inc | 0 .../views/_partials}/error-list.inc | 0 .../material-blue/views/_partials/error.inc | 37 +- .../material-blue/views/_partials}/header.inc | 0 .../views/_partials/sessionbar.inc | 0 .../views/account/account-editpass.inc | 0 .../views/account/account-link.inc | 0 .../views/account/account-permissions.inc | 0 .../material-blue/views/account/account.inc | 6 +- .../material-blue/views/account/actions.inc | 5 +- .../material-blue/views/account/details.inc | 0 .../views/account/files-list.inc | 0 .../material-blue/views/account/files.inc | 0 .../views/account/linkedAccounts.inc | 0 .../material-blue/views/account/request.inc | 0 .../views/account/search-header.inc | 0 .../views/account/search-index.inc | 0 .../views/account/search-rows.inc | 0 .../views/account/search-searchbox.inc | 0 .../material-blue/views/account/viewpass.inc | 0 .../views/common/aux-customfields.inc | 0 .../material-blue/views/common/debug.inc | 2 +- .../material-blue/views/common/errorfancy.inc | 0 .../material-blue/views/common/tabs-end.inc | 0 .../material-blue/views/common/tabs-start.inc | 0 .../material-blue/views/config/accounts.inc | 26 +- .../material-blue/views/config/backup.inc | 0 .../material-blue/views/config/encryption.inc | 0 .../views/config/general-auth.inc | 10 +- .../views/config/general-events.inc | 10 +- .../views/config/general-proxy.inc | 10 +- .../views/config/general-site.inc | 18 +- .../material-blue/views/config/general.inc | 0 .../material-blue/views/config/import.inc | 4 +- .../material-blue/views/config/info.inc | 0 .../material-blue/views/config/ldap.inc | 18 +- .../material-blue/views/config/mail.inc | 18 +- .../material-blue/views/config/wiki.inc | 20 +- .../material-blue/views/eventlog/eventlog.inc | 0 .../views/grid/datagrid-nav-full.inc | 0 .../views/grid/datagrid-rows.inc | 0 .../views/grid/datagrid-table.inc | 0 .../views/grid/datatabs-grid.inc | 0 .../views/itemshow/categories.inc | 0 .../views/itemshow/customers.inc | 0 .../views/itemshow/customfields.inc | 0 .../material-blue/views/itemshow/groups.inc | 0 .../material-blue/views/itemshow/plugins.inc | 0 .../material-blue/views/itemshow/profiles.inc | 0 .../views/itemshow/publiclinks.inc | 0 .../material-blue/views/itemshow/tags.inc | 0 .../material-blue/views/itemshow/tokens.inc | 0 .../material-blue/views/itemshow/users.inc | 0 .../views/itemshow/userspass.inc | 0 .../material-blue/views/login}/login.inc | 2 +- .../material-blue/views/login}/logout.inc | 0 .../material-blue/views/main/install.inc | 0 .../material-blue/views/main/update.inc | 0 .../material-blue/views/main/upgrade.inc | 0 .../views/noticeshow/notices.inc | 0 .../views/passreset}/passreset.inc | 0 .../userpreferences/preferences-site.inc | 0 .../material-blue/views/wiki/wikipage.inc | 0 app/temp/.blank | 0 composer.json | 9 +- composer.lock | 171 +++- inc/Base.php | 53 -- inc/BaseFunctions.php | 103 --- inc/themes/material-blue/views/main/error.inc | 16 - index.php | 21 +- js/app-actions.min.js | 45 - js/zxcvbn-async.js | 30 - js/zxcvbn-async.min.js | 1 - lib/Base.php | 106 +++ lib/BaseFunctions.php | 167 ++++ {inc => lib}/SP/Account/Account.php | 36 +- {inc => lib}/SP/Account/AccountAcl.php | 142 ++- {inc => lib}/SP/Account/AccountBase.php | 16 + {inc => lib}/SP/Account/AccountCrypt.php | 94 +- {inc => lib}/SP/Account/AccountFavorites.php | 8 +- {inc => lib}/SP/Account/AccountHistory.php | 22 +- .../SP/Account/AccountHistoryCrypt.php | 91 +- .../SP/Account/AccountHistoryUtil.php | 23 +- {inc => lib}/SP/Account/AccountInterface.php | 0 {inc => lib}/SP/Account/AccountSearch.php | 107 ++- {inc => lib}/SP/Account/AccountTags.php | 10 +- {inc => lib}/SP/Account/AccountUtil.php | 74 +- .../SP/Account/AccountsSearchItem.php | 24 +- {inc => lib}/SP/Account/UserAccounts.php | 10 +- {inc => lib}/SP/Api/ApiBase.php | 4 +- {inc => lib}/SP/Api/ApiInterface.php | 0 {inc => lib}/SP/Api/ApiRequest.php | 0 {inc => lib}/SP/Api/ApiUtil.php | 0 {inc => lib}/SP/Api/SyspassApi.php | 0 {inc => lib}/SP/Auth/Auth.php | 33 +- {inc => lib}/SP/Auth/AuthDataBase.php | 0 {inc => lib}/SP/Auth/AuthInterface.php | 0 {inc => lib}/SP/Auth/AuthResult.php | 0 {inc => lib}/SP/Auth/AuthUtil.php | 0 {inc => lib}/SP/Auth/Browser/Browser.php | 34 +- .../SP/Auth/Browser/BrowserAuthData.php | 0 {inc => lib}/SP/Auth/Database/Database.php | 2 - .../SP/Auth/Database/DatabaseAuthData.php | 0 {inc => lib}/SP/Auth/Ldap/LdapAuthData.php | 0 {inc => lib}/SP/Auth/Ldap/LdapBase.php | 28 +- {inc => lib}/SP/Auth/Ldap/LdapInterface.php | 0 {inc => lib}/SP/Auth/Ldap/LdapMsAds.php | 2 +- {inc => lib}/SP/Auth/Ldap/LdapStd.php | 2 +- {inc => lib}/SP/Auth/Ldap/LdapUtil.php | 0 lib/SP/Bootstrap.php | 824 ++++++++++++++++++ {inc => lib}/SP/Config/Config.php | 197 +++-- {inc => lib}/SP/Config/ConfigDB.php | 12 +- {inc => lib}/SP/Config/ConfigData.php | 2 +- {inc => lib}/SP/Config/ConfigInterface.php | 0 lib/SP/Config/ConfigUtil.php | 87 ++ .../SP/Controller/AccountController.php | 54 +- .../SP/Controller/AccountSearchController.php | 34 +- .../SP/Controller/ChecksController.php | 0 .../SP/Controller/ConfigActionController.php | 48 +- .../SP/Controller/ConfigController.php | 29 +- {inc => lib}/SP/Controller/ControllerBase.php | 251 +++--- .../SP/Controller/EventlogController.php | 4 +- .../Controller/GridItemsSearchController.php | 0 .../SP/Controller/GridTabControllerBase.php | 2 +- {inc => lib}/SP/Controller/Grids/GridBase.php | 29 +- {inc => lib}/SP/Controller/Grids/Items.php | 2 +- {inc => lib}/SP/Controller/Grids/Notices.php | 4 +- .../SP/Controller/ItemActionController.php | 15 +- .../SP/Controller/ItemControllerInterface.php | 0 .../SP/Controller/ItemListController.php | 11 +- .../SP/Controller/ItemSearchController.php | 4 +- .../SP/Controller/ItemShowController.php | 12 +- .../SP/Controller/ItemsController.php | 0 .../SP/Controller/LoginController.php | 54 +- .../SP/Controller/MainActionController.php | 50 +- .../SP/Controller/NoticeShowController.php | 4 +- .../SP/Controller/NoticesController.php | 2 +- .../SP/Controller/NoticesSearchController.php | 4 +- .../SP/Controller/RequestControllerTrait.php | 70 +- .../SP/Controller/TabControllerBase.php | 0 {inc => lib}/SP/Controller/TabsInterface.php | 0 {inc => lib}/SP/Controller/TaskController.php | 0 .../Controller/UserPreferencesController.php | 10 +- {inc => lib}/SP/Controller/WikiController.php | 8 +- {inc => lib}/SP/Core/Acl.php | 145 +-- {inc => lib}/SP/Core/ActionsInterface.php | 0 {inc => lib}/SP/Core/Backup.php | 107 ++- {inc => lib}/SP/Core/Crypt/Cookie.php | 0 {inc => lib}/SP/Core/Crypt/Crypt.php | 0 .../SP/Core/Crypt/CryptSessionHandler.php | 0 {inc => lib}/SP/Core/Crypt/Hash.php | 0 .../SP/Core/Crypt/SecureKeyCookie.php | 0 {inc => lib}/SP/Core/Crypt/Session.php | 2 +- {inc => lib}/SP/Core/Crypt/Vault.php | 2 +- {inc => lib}/SP/Core/CryptMasterPass.php | 2 +- {inc => lib}/SP/Core/CryptPKI.php | 18 +- {inc => lib}/SP/Core/DiFactory.php | 22 +- lib/SP/Core/Dic/Container.php | 185 ++++ .../SP/Core/Dic/ContainerException.php | 18 +- lib/SP/Core/Dic/DicInterface.php | 60 ++ lib/SP/Core/Dic/NotFoundException.php | 38 + .../SP/Core/Events/EventDispatcher.php | 0 .../SP/Core/Events/EventDispatcherBase.php | 6 +- .../Core/Events/EventDispatcherInterface.php | 0 {inc => lib}/SP/Core/Events/EventReceiver.php | 0 .../SP/Core/Exceptions/AuthException.php | 0 lib/SP/Core/Exceptions/ConfigException.php | 35 + .../Core/Exceptions/ConstraintException.php | 0 .../Core/Exceptions/FileNotFoundException.php | 0 .../Exceptions/InvalidArgumentException.php | 0 .../Core/Exceptions/InvalidClassException.php | 0 .../SP/Core/Exceptions/ItemException.php | 0 .../SP/Core/Exceptions/QueryException.php | 0 .../SP/Core/Exceptions/SPException.php | 0 .../Core/Exceptions/ValidationException.php | 0 {inc => lib}/SP/Core/Init.php | 85 +- {inc => lib}/SP/Core/Installer.php | 82 +- {inc => lib}/SP/Core/ItemsTypeInterface.php | 0 {inc => lib}/SP/Core/Language.php | 55 +- {inc => lib}/SP/Core/Messages/LogMessage.php | 0 {inc => lib}/SP/Core/Messages/MessageBase.php | 0 .../SP/Core/Messages/MessageInterface.php | 0 .../SP/Core/Messages/NoticeMessage.php | 0 {inc => lib}/SP/Core/Messages/TaskMessage.php | 0 {inc => lib}/SP/Core/OldCrypt.php | 9 +- {inc => lib}/SP/Core/Plugin/PluginBase.php | 0 .../SP/Core/Plugin/PluginDataStore.php | 0 .../SP/Core/Plugin/PluginInterface.php | 0 {inc => lib}/SP/Core/Plugin/PluginUtil.php | 27 +- lib/SP/Core/Session/Session.php | 259 ++++++ .../SP/Core/SessionFactory.php | 182 +--- {inc => lib}/SP/Core/SessionUtil.php | 34 +- {inc => lib}/SP/Core/Task.php | 0 {inc => lib}/SP/Core/TaskFactory.php | 0 {inc => lib}/SP/Core/Template.php | 55 +- lib/SP/Core/Traits/InjectableTrait.php | 50 ++ {inc => lib}/SP/Core/UI/Theme.php | 73 +- {inc => lib}/SP/Core/UI/ThemeIconsBase.php | 0 .../SP/Core/UI/ThemeIconsInterface.php | 0 {inc => lib}/SP/Core/UI/ThemeInterface.php | 2 +- {inc => lib}/SP/Core/Upgrade/Account.php | 12 +- {inc => lib}/SP/Core/Upgrade/Category.php | 16 +- {inc => lib}/SP/Core/Upgrade/Check.php | 4 +- {inc => lib}/SP/Core/Upgrade/Crypt.php | 8 +- {inc => lib}/SP/Core/Upgrade/Customer.php | 16 +- {inc => lib}/SP/Core/Upgrade/Group.php | 20 +- {inc => lib}/SP/Core/Upgrade/Profile.php | 14 +- {inc => lib}/SP/Core/Upgrade/Upgrade.php | 154 ++-- {inc => lib}/SP/Core/Upgrade/User.php | 28 +- {inc => lib}/SP/Core/XmlExport.php | 40 +- {inc => lib}/SP/DataModel/AccountData.php | 0 {inc => lib}/SP/DataModel/AccountExtData.php | 0 .../SP/DataModel/AccountHistoryData.php | 0 .../SP/DataModel/AccountSearchData.php | 0 {inc => lib}/SP/DataModel/ApiTokenData.php | 0 {inc => lib}/SP/DataModel/CategoryData.php | 0 .../SP/DataModel/CustomFieldBaseData.php | 0 {inc => lib}/SP/DataModel/CustomFieldData.php | 0 .../SP/DataModel/CustomFieldDefData.php | 0 {inc => lib}/SP/DataModel/CustomerData.php | 0 {inc => lib}/SP/DataModel/DataModelBase.php | 0 .../SP/DataModel/DataModelInterface.php | 0 {inc => lib}/SP/DataModel/FileData.php | 0 {inc => lib}/SP/DataModel/FileExtData.php | 0 .../SP/DataModel/GroupAccountsData.php | 2 +- {inc => lib}/SP/DataModel/GroupData.php | 0 {inc => lib}/SP/DataModel/GroupUsersData.php | 2 +- {inc => lib}/SP/DataModel/InstallData.php | 0 {inc => lib}/SP/DataModel/ItemSearchData.php | 0 {inc => lib}/SP/DataModel/NoticeData.php | 0 {inc => lib}/SP/DataModel/PluginData.php | 0 {inc => lib}/SP/DataModel/ProfileBaseData.php | 0 {inc => lib}/SP/DataModel/ProfileData.php | 0 .../SP/DataModel/PublicLinkBaseData.php | 0 {inc => lib}/SP/DataModel/PublicLinkData.php | 0 .../SP/DataModel/PublicLinkListData.php | 0 {inc => lib}/SP/DataModel/TagData.php | 0 {inc => lib}/SP/DataModel/TrackData.php | 0 {inc => lib}/SP/DataModel/UserData.php | 0 {inc => lib}/SP/DataModel/UserLoginData.php | 0 {inc => lib}/SP/DataModel/UserPassData.php | 0 .../SP/DataModel/UserPassRecoverData.php | 0 .../SP/DataModel/UserPreferencesData.php | 0 {inc => lib}/SP/Forms/AccountForm.php | 6 +- {inc => lib}/SP/Forms/ApiTokenForm.php | 0 {inc => lib}/SP/Forms/CategoryForm.php | 0 {inc => lib}/SP/Forms/CustomFieldDefForm.php | 0 {inc => lib}/SP/Forms/CustomerForm.php | 0 {inc => lib}/SP/Forms/FormBase.php | 29 +- {inc => lib}/SP/Forms/FormInterface.php | 0 {inc => lib}/SP/Forms/GroupForm.php | 0 {inc => lib}/SP/Forms/NoticeForm.php | 0 {inc => lib}/SP/Forms/ProfileForm.php | 0 {inc => lib}/SP/Forms/PublicLinkForm.php | 0 {inc => lib}/SP/Forms/TagForm.php | 0 {inc => lib}/SP/Forms/UserForm.php | 12 +- {inc => lib}/SP/Html/Assets/FontIcon.php | 6 +- {inc => lib}/SP/Html/Assets/IconBase.php | 0 {inc => lib}/SP/Html/Assets/IconInterface.php | 0 {inc => lib}/SP/Html/Assets/ImageIcon.php | 0 {inc => lib}/SP/Html/DataGrid/DataGrid.php | 0 .../SP/Html/DataGrid/DataGridAction.php | 0 .../SP/Html/DataGrid/DataGridActionBase.php | 0 .../Html/DataGrid/DataGridActionInterface.php | 0 .../SP/Html/DataGrid/DataGridActionSearch.php | 0 .../SP/Html/DataGrid/DataGridActionType.php | 0 .../SP/Html/DataGrid/DataGridBase.php | 29 +- .../SP/Html/DataGrid/DataGridData.php | 0 .../SP/Html/DataGrid/DataGridDataBase.php | 0 .../Html/DataGrid/DataGridDataInterface.php | 0 .../SP/Html/DataGrid/DataGridHeader.php | 0 .../SP/Html/DataGrid/DataGridHeaderBase.php | 0 .../Html/DataGrid/DataGridHeaderInterface.php | 0 .../SP/Html/DataGrid/DataGridHeaderSort.php | 0 .../SP/Html/DataGrid/DataGridInterface.php | 0 .../SP/Html/DataGrid/DataGridPager.php | 0 .../SP/Html/DataGrid/DataGridPagerBase.php | 0 .../Html/DataGrid/DataGridPagerInterface.php | 0 .../SP/Html/DataGrid/DataGridSort.php | 0 .../Html/DataGrid/DataGridSortInterface.php | 0 {inc => lib}/SP/Html/DataGrid/DataGridTab.php | 0 {inc => lib}/SP/Html/Html.php | 0 {inc => lib}/SP/Html/Minify.php | 10 +- {inc => lib}/SP/Http/Cookies.php | 0 {inc => lib}/SP/Http/JsonResponse.php | 0 {inc => lib}/SP/Http/Message.php | 0 {inc => lib}/SP/Http/Request.php | 4 +- {inc => lib}/SP/Http/Response.php | 22 + {inc => lib}/SP/Http/XMLRPCResponseParse.php | 0 {inc => lib}/SP/Import/CsvImport.php | 0 {inc => lib}/SP/Import/CsvImportBase.php | 0 {inc => lib}/SP/Import/FileImport.php | 0 {inc => lib}/SP/Import/Import.php | 8 +- {inc => lib}/SP/Import/ImportBase.php | 0 {inc => lib}/SP/Import/ImportInterface.php | 0 {inc => lib}/SP/Import/ImportParams.php | 0 {inc => lib}/SP/Import/KeepassImport.php | 0 {inc => lib}/SP/Import/KeepassXImport.php | 0 {inc => lib}/SP/Import/SyspassImport.php | 0 {inc => lib}/SP/Import/XmlFileImport.php | 0 {inc => lib}/SP/Import/XmlImport.php | 0 {inc => lib}/SP/Import/XmlImportTrait.php | 0 {inc => lib}/SP/Log/AbstractLogger.php | 0 {inc => lib}/SP/Log/ActionLog.php | 36 + {inc => lib}/SP/Log/Email.php | 17 +- {inc => lib}/SP/Log/Log.php | 28 +- {inc => lib}/SP/Log/LogLevel.php | 0 {inc => lib}/SP/Log/LogUtil.php | 0 {inc => lib}/SP/Log/LoggerInterface.php | 0 {inc => lib}/SP/Log/Syslog.php | 30 +- {inc => lib}/SP/Mgmt/ApiTokens/ApiToken.php | 30 +- .../SP/Mgmt/ApiTokens/ApiTokenBase.php | 0 .../SP/Mgmt/ApiTokens/ApiTokenSearch.php | 8 +- .../SP/Mgmt/ApiTokens/ApiTokensUtil.php | 16 +- {inc => lib}/SP/Mgmt/Categories/Category.php | 22 +- .../SP/Mgmt/Categories/CategoryBase.php | 0 .../SP/Mgmt/Categories/CategorySearch.php | 6 +- .../SP/Mgmt/CustomFields/CustomField.php | 14 +- .../SP/Mgmt/CustomFields/CustomFieldBase.php | 0 .../SP/Mgmt/CustomFields/CustomFieldDef.php | 18 +- .../CustomFields/CustomFieldDefSearch.php | 6 +- .../SP/Mgmt/CustomFields/CustomFieldTypes.php | 0 .../SP/Mgmt/CustomFields/CustomFieldsUtil.php | 16 +- {inc => lib}/SP/Mgmt/Customers/Customer.php | 26 +- .../SP/Mgmt/Customers/CustomerBase.php | 0 .../SP/Mgmt/Customers/CustomerSearch.php | 6 +- {inc => lib}/SP/Mgmt/Files/File.php | 12 +- {inc => lib}/SP/Mgmt/Files/FileBase.php | 0 {inc => lib}/SP/Mgmt/Files/FileSearch.php | 9 +- {inc => lib}/SP/Mgmt/Files/FileUtil.php | 10 +- {inc => lib}/SP/Mgmt/Groups/Group.php | 22 +- {inc => lib}/SP/Mgmt/Groups/GroupAccounts.php | 12 +- .../SP/Mgmt/Groups/GroupAccountsBase.php | 0 .../SP/Mgmt/Groups/GroupAccountsUtil.php | 4 +- {inc => lib}/SP/Mgmt/Groups/GroupBase.php | 0 {inc => lib}/SP/Mgmt/Groups/GroupSearch.php | 6 +- {inc => lib}/SP/Mgmt/Groups/GroupUsers.php | 14 +- .../SP/Mgmt/Groups/GroupUsersBase.php | 0 {inc => lib}/SP/Mgmt/Groups/GroupUtil.php | 4 +- {inc => lib}/SP/Mgmt/ItemBaseInterface.php | 0 {inc => lib}/SP/Mgmt/ItemBaseTrait.php | 38 +- {inc => lib}/SP/Mgmt/ItemInterface.php | 0 {inc => lib}/SP/Mgmt/ItemSearchInterface.php | 0 {inc => lib}/SP/Mgmt/ItemSelectInterface.php | 0 {inc => lib}/SP/Mgmt/ItemTrait.php | 0 {inc => lib}/SP/Mgmt/Notices/Notice.php | 34 +- {inc => lib}/SP/Mgmt/Notices/NoticeBase.php | 0 {inc => lib}/SP/Mgmt/Notices/NoticeSearch.php | 16 +- {inc => lib}/SP/Mgmt/Plugins/Plugin.php | 30 +- {inc => lib}/SP/Mgmt/Plugins/PluginBase.php | 0 {inc => lib}/SP/Mgmt/Plugins/PluginSearch.php | 6 +- {inc => lib}/SP/Mgmt/Profiles/Profile.php | 28 +- {inc => lib}/SP/Mgmt/Profiles/ProfileBase.php | 0 .../SP/Mgmt/Profiles/ProfileSearch.php | 6 +- {inc => lib}/SP/Mgmt/Profiles/ProfileUtil.php | 8 +- .../SP/Mgmt/PublicLinks/PublicLink.php | 30 +- .../SP/Mgmt/PublicLinks/PublicLinkBase.php | 22 +- .../SP/Mgmt/PublicLinks/PublicLinkSearch.php | 6 +- {inc => lib}/SP/Mgmt/Tags/Tag.php | 18 +- {inc => lib}/SP/Mgmt/Tags/TagBase.php | 0 {inc => lib}/SP/Mgmt/Tags/TagSearch.php | 6 +- {inc => lib}/SP/Mgmt/Tracks/Track.php | 16 +- {inc => lib}/SP/Mgmt/Tracks/TrackBase.php | 0 {inc => lib}/SP/Mgmt/Users/User.php | 28 +- {inc => lib}/SP/Mgmt/Users/UserBase.php | 7 + {inc => lib}/SP/Mgmt/Users/UserLdap.php | 18 +- {inc => lib}/SP/Mgmt/Users/UserLdapSync.php | 6 +- {inc => lib}/SP/Mgmt/Users/UserMigrate.php | 10 +- {inc => lib}/SP/Mgmt/Users/UserPass.php | 29 +- .../SP/Mgmt/Users/UserPassRecover.php | 10 +- .../SP/Mgmt/Users/UserPassRecoverBase.php | 0 .../SP/Mgmt/Users/UserPreferences.php | 6 +- .../SP/Mgmt/Users/UserPreferencesBase.php | 0 .../SP/Mgmt/Users/UserPreferencesUtil.php | 17 +- {inc => lib}/SP/Mgmt/Users/UserSSO.php | 16 +- {inc => lib}/SP/Mgmt/Users/UserSearch.php | 12 +- {inc => lib}/SP/Mgmt/Users/UserUtil.php | 16 +- .../Controller/CrudControllerInterface.php | 38 + lib/SP/Mvc/View/View.php | 239 +++++ lib/SP/Mvc/View/ViewInterface.php | 124 +++ lib/SP/Services/LoginService.php | 621 +++++++++++++ .../SP/Storage/CacheableInterface.php | 22 +- .../SP/Storage/DBStorageInterface.php | 12 +- {inc => lib}/SP/Storage/DBUtil.php | 62 +- lib/SP/Storage/Database.php | 211 +++++ .../DB.php => lib/SP/Storage/DbWrapper.php | 172 +--- .../SP/Storage/FileStorageInterface.php | 3 +- {inc => lib}/SP/Storage/MySQLHandler.php | 91 +- {inc => lib}/SP/Storage/QueryData.php | 0 {inc => lib}/SP/Storage/XmlHandler.php | 21 +- {inc => lib}/SP/Util/ArrayUtil.php | 0 {inc => lib}/SP/Util/Checks.php | 152 ---- {inc => lib}/SP/Util/Connection.php | 0 {inc => lib}/SP/Util/ConnectionInterface.php | 0 {inc => lib}/SP/Util/Filter.php | 0 {inc => lib}/SP/Util/HttpUtil.php | 9 +- {inc => lib}/SP/Util/ImageUtil.php | 0 {inc => lib}/SP/Util/Json.php | 0 {inc => lib}/SP/Util/Util.php | 76 +- {inc => lib}/SP/Util/Wiki/DokuWikiApi.php | 16 +- {inc => lib}/SP/Util/Wiki/DokuWikiApiBase.php | 30 +- .../SP/Util/Wiki/DokuWikiApiParse.php | 0 {inc => lib}/SplClassLoader.php | 0 {css => public/css}/css.php | 6 +- {css => public/css}/fonts.css | 0 {css => public/css}/fonts.min.css | 0 .../css}/fonts/MaterialIcons-Regular.eot | Bin .../css}/fonts/MaterialIcons-Regular.svg | 0 .../css}/fonts/MaterialIcons-Regular.ttf | Bin .../css}/fonts/MaterialIcons-Regular.woff | Bin .../css}/fonts/MaterialIcons-Regular.woff2 | Bin .../css}/fonts/NotoSans-Regular-webfont.ttf | Bin {css => public/css}/jquery-ui.min.css | 0 .../css}/jquery-ui.structure.min.css | 0 {css => public/css}/jquery.tagsinput.min.css | 0 {css => public/css}/magnific-popup.css | 0 {css => public/css}/magnific-popup.min.css | 0 {css => public/css}/material-icons.css | 0 {css => public/css}/material-icons.min.css | 0 {css => public/css}/reset.min.css | 0 {css => public/css}/toastr.css | 0 {css => public/css}/toastr.min.css | 0 {imgs => public/images}/logo_full_bg.png | Bin {imgs => public/images}/logo_full_nobg.png | Bin {imgs => public/images}/logo_icon.png | Bin {js => public/js}/app-actions.js | 68 +- public/js/app-actions.min.js | 45 + {js => public/js}/app-main.js | 6 +- {js => public/js}/app-main.min.js | 18 +- {js => public/js}/app-requests.js | 0 {js => public/js}/app-requests.min.js | 0 {js => public/js}/app-triggers.js | 6 +- {js => public/js}/app-triggers.min.js | 4 +- {js => public/js}/app.js | 0 {js => public/js}/app.min.js | 0 {js => public/js}/clipboard.js | 0 {js => public/js}/clipboard.min.js | 0 {js => public/js}/eventsource.js | 0 {js => public/js}/eventsource.min.js | 0 {js => public/js}/jquery-3.2.0.js | 0 {js => public/js}/jquery-3.2.0.min.js | 0 {js => public/js}/jquery-migrate-3.0.0.js | 0 {js => public/js}/jquery-migrate-3.0.0.min.js | 0 {js => public/js}/jquery.fileDownload.min.js | 0 {js => public/js}/jquery.magnific-popup.js | 0 .../js}/jquery.magnific-popup.min.js | 0 {js => public/js}/js.php | 4 +- {js => public/js}/jsencrypt.js | 0 {js => public/js}/jsencrypt.min.js | 0 {js => public/js}/moment-timezone.js | 0 {js => public/js}/moment-timezone.min.js | 0 {js => public/js}/moment.js | 0 {js => public/js}/moment.min.js | 0 {js => public/js}/selectize-plugins.js | 0 {js => public/js}/selectize-plugins.min.js | 0 {js => public/js}/selectize.js | 0 {js => public/js}/selectize.min.js | 0 {js => public/js}/spark-md5.js | 0 {js => public/js}/spark-md5.min.js | 0 {js => public/js}/strings.js.php | 2 +- {js => public/js}/toastr.js | 0 {js => public/js}/toastr.min.js | 0 public/js/zxcvbn-async.js | 26 + public/js/zxcvbn-async.min.js | 1 + {js => public/js}/zxcvbn.min.js | 0 {inc/sql => schemas}/110.sql | 0 {inc/sql => schemas}/1121.sql | 0 {inc/sql => schemas}/11213.sql | 0 {inc/sql => schemas}/11219.sql | 0 {inc/sql => schemas}/1122.sql | 0 {inc/sql => schemas}/11220.sql | 0 {inc/sql => schemas}/1123.sql | 0 {inc/sql => schemas}/12001.sql | 0 {inc/sql => schemas}/12002.sql | 0 {inc/sql => schemas}/13000000000.sql | 0 {inc/sql => schemas}/13016100601.sql | 0 {inc/sql => schemas}/20017011302.sql | 0 {inc/sql => schemas}/20017011701.sql | 0 {inc/sql => schemas}/20017012901.sql | 0 {inc/sql => schemas}/21017022601.sql | 0 {inc/sql => schemas}/21317031402.sql | 0 {inc/sql => schemas}/22017050101.sql | 0 {inc/sql => schemas}/dbstructure.sql | 0 vendor/composer/autoload_classmap.php | 357 -------- vendor/composer/autoload_namespaces.php | 1 + vendor/composer/autoload_psr4.php | 5 +- vendor/composer/autoload_real.php | 11 +- vendor/composer/autoload_static.php | 388 +-------- vendor/composer/installed.json | 261 ++++-- .../random_compat/lib/cast_to_int.php | 3 +- .../lib/random_bytes_libsodium_legacy.php | 4 +- .../random_compat/lib/random_int.php | 4 +- vendor/paragonie/random_compat/psalm.xml | 1 + 621 files changed, 8684 insertions(+), 3460 deletions(-) delete mode 100644 ajax/ajax_accGetFiles.php delete mode 100644 ajax/ajax_accSearch.php delete mode 100644 ajax/ajax_getEnvironment.php rename {backup => app/backup}/.blank (100%) rename {config => app/cache}/.blank (100%) rename {inc/Plugins => app/config}/.blank (100%) create mode 100644 app/config/config.php create mode 100644 app/config/config.php.old create mode 100644 app/config/config.xml create mode 100644 app/config/config.xml.orig rename inc/themes/material-blue/views/main/sessionbar.inc => app/config/key.pem (100%) create mode 100644 app/config/pubkey.pem rename {inc => app}/locales/ca_ES/LC_MESSAGES/messages.mo (100%) rename {inc => app}/locales/ca_ES/LC_MESSAGES/messages.po (100%) rename {inc => app}/locales/de_DE/LC_MESSAGES/messages.mo (100%) rename {inc => app}/locales/de_DE/LC_MESSAGES/messages.po (100%) rename {inc => app}/locales/en_US/LC_MESSAGES/messages.mo (100%) rename {inc => app}/locales/en_US/LC_MESSAGES/messages.po (100%) rename {inc => app}/locales/fr_FR/LC_MESSAGES/messages.mo (100%) rename {inc => app}/locales/fr_FR/LC_MESSAGES/messages.po (100%) rename {inc => app}/locales/hu_HU/LC_MESSAGES/messages.mo (100%) rename {inc => app}/locales/hu_HU/LC_MESSAGES/messages.po (100%) rename {inc => app}/locales/it_IT/LC_MESSAGES/messages.mo (100%) rename {inc => app}/locales/it_IT/LC_MESSAGES/messages.po (100%) rename {inc => app}/locales/nl_NL/LC_MESSAGES/messages.mo (100%) rename {inc => app}/locales/nl_NL/LC_MESSAGES/messages.po (100%) rename {inc => app}/locales/po_PO/LC_MESSAGES/messages.mo (100%) rename {inc => app}/locales/po_PO/LC_MESSAGES/messages.po (100%) rename {inc => app}/locales/pt_BR/LC_MESSAGES/messages.mo (100%) rename {inc => app}/locales/pt_BR/LC_MESSAGES/messages.po (100%) rename {inc => app}/locales/ru_RU/LC_MESSAGES/messages.mo (100%) rename {inc => app}/locales/ru_RU/LC_MESSAGES/messages.po (100%) create mode 100644 app/modules/web/Controllers/AccountController.php create mode 100644 app/modules/web/Controllers/BootstrapController.php create mode 100644 app/modules/web/Controllers/Helpers/AccountHelper.php create mode 100644 app/modules/web/Controllers/Helpers/AccountSearchHelper.php create mode 100644 app/modules/web/Controllers/Helpers/HelperBase.php create mode 100644 app/modules/web/Controllers/Helpers/LayoutHelper.php create mode 100644 app/modules/web/Controllers/IndexController.php create mode 100644 app/modules/web/Controllers/ItemsController.php create mode 100644 app/modules/web/Controllers/LoginController.php rename {inc/SP/Controller => app/modules/web/Controllers}/MainController.php (83%) create mode 100644 app/modules/web/Controllers/PassresetController.php create mode 100644 app/modules/web/Controllers/SimpleControllerBase.php create mode 100644 app/modules/web/module.php create mode 100644 app/modules/web/plugins/.blank rename {inc => app/modules/web}/themes/material-blue/css/LICENSE (100%) rename {inc => app/modules/web}/themes/material-blue/css/Roboto_300.woff2 (100%) rename {inc => app/modules/web}/themes/material-blue/css/Roboto_400.woff2 (100%) rename {inc => app/modules/web}/themes/material-blue/css/Roboto_500.woff2 (100%) rename {inc => app/modules/web}/themes/material-blue/css/Roboto_600.woff2 (100%) rename {inc => app/modules/web}/themes/material-blue/css/_base.scss (97%) rename {inc => app/modules/web}/themes/material-blue/css/_elements.scss (100%) rename {inc => app/modules/web}/themes/material-blue/css/_login.scss (93%) rename {inc => app/modules/web}/themes/material-blue/css/fonts.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/fonts.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/material-custom.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/material-custom.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/material.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/mdl-datetimepicker.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/mdl-datetimepicker.css.map (100%) rename {inc => app/modules/web}/themes/material-blue/css/mdl-datetimepicker.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/mdl-datetimepicker.scss (100%) rename {inc => app/modules/web}/themes/material-blue/css/mdl-jquery-modal-dialog.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/mdl-jquery-modal-dialog.css.map (100%) rename {inc => app/modules/web}/themes/material-blue/css/mdl-jquery-modal-dialog.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/mdl-jquery-modal-dialog.scss (100%) rename {inc => app/modules/web}/themes/material-blue/css/search-card.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/search-card.css.map (100%) rename {inc => app/modules/web}/themes/material-blue/css/search-card.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/search-card.scss (100%) rename {inc => app/modules/web}/themes/material-blue/css/search-grid.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/search-grid.css.map (100%) rename {inc => app/modules/web}/themes/material-blue/css/search-grid.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/search-grid.scss (100%) rename {inc => app/modules/web}/themes/material-blue/css/selectize-custom.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/selectize-custom.css.map (100%) rename {inc => app/modules/web}/themes/material-blue/css/selectize-custom.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/selectize-custom.scss (100%) rename {inc => app/modules/web}/themes/material-blue/css/selectize.custom.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/selectize.custom.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/styles-wiki.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/styles-wiki.css.map (100%) rename {inc => app/modules/web}/themes/material-blue/css/styles-wiki.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/styles-wiki.scss (100%) rename {inc => app/modules/web}/themes/material-blue/css/styles.css (99%) rename {inc => app/modules/web}/themes/material-blue/css/styles.css.map (77%) rename {inc => app/modules/web}/themes/material-blue/css/styles.min.css (80%) rename {inc => app/modules/web}/themes/material-blue/css/styles.scss (99%) rename {inc => app/modules/web}/themes/material-blue/css/toastr.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/toastr.css.map (100%) rename {inc => app/modules/web}/themes/material-blue/css/toastr.min.css (100%) rename {inc => app/modules/web}/themes/material-blue/css/toastr.scss (100%) rename {inc => app/modules/web}/themes/material-blue/inc/Icons.php (100%) rename {inc => app/modules/web}/themes/material-blue/index.php (98%) rename {inc => app/modules/web}/themes/material-blue/js/LICENSE (100%) rename {inc => app/modules/web}/themes/material-blue/js/app-theme.js (100%) rename {inc => app/modules/web}/themes/material-blue/js/app-theme.min.js (100%) rename {inc => app/modules/web}/themes/material-blue/js/bootstrap-material-datetimepicker.js (100%) rename {inc => app/modules/web}/themes/material-blue/js/bootstrap-material-datetimepicker.min.js (100%) rename {inc => app/modules/web}/themes/material-blue/js/material.js (100%) rename {inc => app/modules/web}/themes/material-blue/js/material.min.js (100%) rename {inc => app/modules/web}/themes/material-blue/js/mdl-jquery-modal-dialog.js (100%) rename {inc => app/modules/web}/themes/material-blue/js/mdl-jquery-modal-dialog.min.js (100%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/_partials}/body-content.inc (100%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/_partials}/body-end.inc (100%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/_partials}/body-footer.inc (100%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/_partials}/body-header-menu.inc (100%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/_partials}/body-header.inc (100%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/_partials}/body-start.inc (100%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/_partials}/error-list.inc (100%) rename inc/SP/Config/ConfigUtil.php => app/modules/web/themes/material-blue/views/_partials/error.inc (60%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/_partials}/header.inc (100%) create mode 100644 app/modules/web/themes/material-blue/views/_partials/sessionbar.inc rename {inc => app/modules/web}/themes/material-blue/views/account/account-editpass.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/account/account-link.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/account/account-permissions.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/account/account.inc (97%) rename {inc => app/modules/web}/themes/material-blue/views/account/actions.inc (98%) rename {inc => app/modules/web}/themes/material-blue/views/account/details.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/account/files-list.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/account/files.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/account/linkedAccounts.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/account/request.inc (100%) rename inc/themes/material-blue/views/accountsearch/header.inc => app/modules/web/themes/material-blue/views/account/search-header.inc (100%) rename inc/themes/material-blue/views/accountsearch/index.inc => app/modules/web/themes/material-blue/views/account/search-index.inc (100%) rename inc/themes/material-blue/views/accountsearch/rows.inc => app/modules/web/themes/material-blue/views/account/search-rows.inc (100%) rename inc/themes/material-blue/views/accountsearch/searchbox.inc => app/modules/web/themes/material-blue/views/account/search-searchbox.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/account/viewpass.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/common/aux-customfields.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/common/debug.inc (85%) rename {inc => app/modules/web}/themes/material-blue/views/common/errorfancy.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/common/tabs-end.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/common/tabs-start.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/config/accounts.inc (94%) rename {inc => app/modules/web}/themes/material-blue/views/config/backup.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/config/encryption.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/config/general-auth.inc (90%) rename {inc => app/modules/web}/themes/material-blue/views/config/general-events.inc (88%) rename {inc => app/modules/web}/themes/material-blue/views/config/general-proxy.inc (94%) rename {inc => app/modules/web}/themes/material-blue/views/config/general-site.inc (91%) rename {inc => app/modules/web}/themes/material-blue/views/config/general.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/config/import.inc (98%) rename {inc => app/modules/web}/themes/material-blue/views/config/info.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/config/ldap.inc (96%) rename {inc => app/modules/web}/themes/material-blue/views/config/mail.inc (93%) rename {inc => app/modules/web}/themes/material-blue/views/config/wiki.inc (96%) rename {inc => app/modules/web}/themes/material-blue/views/eventlog/eventlog.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/grid/datagrid-nav-full.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/grid/datagrid-rows.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/grid/datagrid-table.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/grid/datatabs-grid.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/categories.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/customers.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/customfields.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/groups.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/plugins.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/profiles.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/publiclinks.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/tags.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/tokens.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/users.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/itemshow/userspass.inc (100%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/login}/login.inc (98%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/login}/logout.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/main/install.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/main/update.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/main/upgrade.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/noticeshow/notices.inc (100%) rename {inc/themes/material-blue/views/main => app/modules/web/themes/material-blue/views/passreset}/passreset.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/userpreferences/preferences-site.inc (100%) rename {inc => app/modules/web}/themes/material-blue/views/wiki/wikipage.inc (100%) create mode 100644 app/temp/.blank delete mode 100644 inc/Base.php delete mode 100644 inc/BaseFunctions.php delete mode 100644 inc/themes/material-blue/views/main/error.inc delete mode 100644 js/app-actions.min.js delete mode 100644 js/zxcvbn-async.js delete mode 100644 js/zxcvbn-async.min.js create mode 100644 lib/Base.php create mode 100644 lib/BaseFunctions.php rename {inc => lib}/SP/Account/Account.php (95%) rename {inc => lib}/SP/Account/AccountAcl.php (76%) rename {inc => lib}/SP/Account/AccountBase.php (89%) rename {inc => lib}/SP/Account/AccountCrypt.php (82%) rename {inc => lib}/SP/Account/AccountFavorites.php (94%) rename {inc => lib}/SP/Account/AccountHistory.php (97%) rename {inc => lib}/SP/Account/AccountHistoryCrypt.php (84%) rename {inc => lib}/SP/Account/AccountHistoryUtil.php (89%) rename {inc => lib}/SP/Account/AccountInterface.php (100%) rename {inc => lib}/SP/Account/AccountSearch.php (83%) rename {inc => lib}/SP/Account/AccountTags.php (95%) rename {inc => lib}/SP/Account/AccountUtil.php (81%) rename {inc => lib}/SP/Account/AccountsSearchItem.php (93%) rename {inc => lib}/SP/Account/UserAccounts.php (95%) rename {inc => lib}/SP/Api/ApiBase.php (98%) rename {inc => lib}/SP/Api/ApiInterface.php (100%) rename {inc => lib}/SP/Api/ApiRequest.php (100%) rename {inc => lib}/SP/Api/ApiUtil.php (100%) rename {inc => lib}/SP/Api/SyspassApi.php (100%) rename {inc => lib}/SP/Auth/Auth.php (85%) rename {inc => lib}/SP/Auth/AuthDataBase.php (100%) rename {inc => lib}/SP/Auth/AuthInterface.php (100%) rename {inc => lib}/SP/Auth/AuthResult.php (100%) rename {inc => lib}/SP/Auth/AuthUtil.php (100%) rename {inc => lib}/SP/Auth/Browser/Browser.php (81%) rename {inc => lib}/SP/Auth/Browser/BrowserAuthData.php (100%) rename {inc => lib}/SP/Auth/Database/Database.php (97%) rename {inc => lib}/SP/Auth/Database/DatabaseAuthData.php (100%) rename {inc => lib}/SP/Auth/Ldap/LdapAuthData.php (100%) rename {inc => lib}/SP/Auth/Ldap/LdapBase.php (96%) rename {inc => lib}/SP/Auth/Ldap/LdapInterface.php (100%) rename {inc => lib}/SP/Auth/Ldap/LdapMsAds.php (98%) rename {inc => lib}/SP/Auth/Ldap/LdapStd.php (98%) rename {inc => lib}/SP/Auth/Ldap/LdapUtil.php (100%) create mode 100644 lib/SP/Bootstrap.php rename {inc => lib}/SP/Config/Config.php (51%) rename {inc => lib}/SP/Config/ConfigDB.php (96%) rename {inc => lib}/SP/Config/ConfigData.php (99%) rename {inc => lib}/SP/Config/ConfigInterface.php (100%) create mode 100644 lib/SP/Config/ConfigUtil.php rename {inc => lib}/SP/Controller/AccountController.php (90%) rename {inc => lib}/SP/Controller/AccountSearchController.php (93%) rename {inc => lib}/SP/Controller/ChecksController.php (100%) rename {inc => lib}/SP/Controller/ConfigActionController.php (96%) rename {inc => lib}/SP/Controller/ConfigController.php (91%) rename {inc => lib}/SP/Controller/ControllerBase.php (60%) rename {inc => lib}/SP/Controller/EventlogController.php (96%) rename {inc => lib}/SP/Controller/GridItemsSearchController.php (100%) rename {inc => lib}/SP/Controller/GridTabControllerBase.php (96%) rename {inc => lib}/SP/Controller/Grids/GridBase.php (80%) rename {inc => lib}/SP/Controller/Grids/Items.php (99%) rename {inc => lib}/SP/Controller/Grids/Notices.php (98%) rename {inc => lib}/SP/Controller/ItemActionController.php (98%) rename {inc => lib}/SP/Controller/ItemControllerInterface.php (100%) rename {inc => lib}/SP/Controller/ItemListController.php (96%) rename {inc => lib}/SP/Controller/ItemSearchController.php (99%) rename {inc => lib}/SP/Controller/ItemShowController.php (97%) rename {inc => lib}/SP/Controller/ItemsController.php (100%) rename {inc => lib}/SP/Controller/LoginController.php (93%) rename {inc => lib}/SP/Controller/MainActionController.php (78%) rename {inc => lib}/SP/Controller/NoticeShowController.php (97%) rename {inc => lib}/SP/Controller/NoticesController.php (97%) rename {inc => lib}/SP/Controller/NoticesSearchController.php (97%) rename {inc => lib}/SP/Controller/RequestControllerTrait.php (74%) rename {inc => lib}/SP/Controller/TabControllerBase.php (100%) rename {inc => lib}/SP/Controller/TabsInterface.php (100%) rename {inc => lib}/SP/Controller/TaskController.php (100%) rename {inc => lib}/SP/Controller/UserPreferencesController.php (91%) rename {inc => lib}/SP/Controller/WikiController.php (90%) rename {inc => lib}/SP/Core/Acl.php (77%) rename {inc => lib}/SP/Core/ActionsInterface.php (100%) rename {inc => lib}/SP/Core/Backup.php (74%) rename {inc => lib}/SP/Core/Crypt/Cookie.php (100%) rename {inc => lib}/SP/Core/Crypt/Crypt.php (100%) rename {inc => lib}/SP/Core/Crypt/CryptSessionHandler.php (100%) rename {inc => lib}/SP/Core/Crypt/Hash.php (100%) rename {inc => lib}/SP/Core/Crypt/SecureKeyCookie.php (100%) rename {inc => lib}/SP/Core/Crypt/Session.php (97%) rename {inc => lib}/SP/Core/Crypt/Vault.php (98%) rename {inc => lib}/SP/Core/CryptMasterPass.php (98%) rename {inc => lib}/SP/Core/CryptPKI.php (84%) rename {inc => lib}/SP/Core/DiFactory.php (86%) create mode 100644 lib/SP/Core/Dic/Container.php rename ajax/ajax_doLogin.php => lib/SP/Core/Dic/ContainerException.php (74%) create mode 100644 lib/SP/Core/Dic/DicInterface.php create mode 100644 lib/SP/Core/Dic/NotFoundException.php rename {inc => lib}/SP/Core/Events/EventDispatcher.php (100%) rename {inc => lib}/SP/Core/Events/EventDispatcherBase.php (95%) rename {inc => lib}/SP/Core/Events/EventDispatcherInterface.php (100%) rename {inc => lib}/SP/Core/Events/EventReceiver.php (100%) rename {inc => lib}/SP/Core/Exceptions/AuthException.php (100%) create mode 100644 lib/SP/Core/Exceptions/ConfigException.php rename {inc => lib}/SP/Core/Exceptions/ConstraintException.php (100%) rename {inc => lib}/SP/Core/Exceptions/FileNotFoundException.php (100%) rename {inc => lib}/SP/Core/Exceptions/InvalidArgumentException.php (100%) rename {inc => lib}/SP/Core/Exceptions/InvalidClassException.php (100%) rename {inc => lib}/SP/Core/Exceptions/ItemException.php (100%) rename {inc => lib}/SP/Core/Exceptions/QueryException.php (100%) rename {inc => lib}/SP/Core/Exceptions/SPException.php (100%) rename {inc => lib}/SP/Core/Exceptions/ValidationException.php (100%) rename {inc => lib}/SP/Core/Init.php (89%) rename {inc => lib}/SP/Core/Installer.php (90%) rename {inc => lib}/SP/Core/ItemsTypeInterface.php (100%) rename {inc => lib}/SP/Core/Language.php (79%) rename {inc => lib}/SP/Core/Messages/LogMessage.php (100%) rename {inc => lib}/SP/Core/Messages/MessageBase.php (100%) rename {inc => lib}/SP/Core/Messages/MessageInterface.php (100%) rename {inc => lib}/SP/Core/Messages/NoticeMessage.php (100%) rename {inc => lib}/SP/Core/Messages/TaskMessage.php (100%) rename {inc => lib}/SP/Core/OldCrypt.php (96%) rename {inc => lib}/SP/Core/Plugin/PluginBase.php (100%) rename {inc => lib}/SP/Core/Plugin/PluginDataStore.php (100%) rename {inc => lib}/SP/Core/Plugin/PluginInterface.php (100%) rename {inc => lib}/SP/Core/Plugin/PluginUtil.php (87%) create mode 100644 lib/SP/Core/Session/Session.php rename inc/SP/Core/Session.php => lib/SP/Core/SessionFactory.php (79%) rename {inc => lib}/SP/Core/SessionUtil.php (80%) rename {inc => lib}/SP/Core/Task.php (100%) rename {inc => lib}/SP/Core/TaskFactory.php (100%) rename {inc => lib}/SP/Core/Template.php (89%) create mode 100644 lib/SP/Core/Traits/InjectableTrait.php rename {inc => lib}/SP/Core/UI/Theme.php (72%) rename {inc => lib}/SP/Core/UI/ThemeIconsBase.php (100%) rename {inc => lib}/SP/Core/UI/ThemeIconsInterface.php (100%) rename {inc => lib}/SP/Core/UI/ThemeInterface.php (98%) rename {inc => lib}/SP/Core/Upgrade/Account.php (88%) rename {inc => lib}/SP/Core/Upgrade/Category.php (89%) rename {inc => lib}/SP/Core/Upgrade/Check.php (97%) rename {inc => lib}/SP/Core/Upgrade/Crypt.php (96%) rename {inc => lib}/SP/Core/Upgrade/Customer.php (89%) rename {inc => lib}/SP/Core/Upgrade/Group.php (89%) rename {inc => lib}/SP/Core/Upgrade/Profile.php (90%) rename {inc => lib}/SP/Core/Upgrade/Upgrade.php (80%) rename {inc => lib}/SP/Core/Upgrade/User.php (90%) rename {inc => lib}/SP/Core/XmlExport.php (95%) rename {inc => lib}/SP/DataModel/AccountData.php (100%) rename {inc => lib}/SP/DataModel/AccountExtData.php (100%) rename {inc => lib}/SP/DataModel/AccountHistoryData.php (100%) rename {inc => lib}/SP/DataModel/AccountSearchData.php (100%) rename {inc => lib}/SP/DataModel/ApiTokenData.php (100%) rename {inc => lib}/SP/DataModel/CategoryData.php (100%) rename {inc => lib}/SP/DataModel/CustomFieldBaseData.php (100%) rename {inc => lib}/SP/DataModel/CustomFieldData.php (100%) rename {inc => lib}/SP/DataModel/CustomFieldDefData.php (100%) rename {inc => lib}/SP/DataModel/CustomerData.php (100%) rename {inc => lib}/SP/DataModel/DataModelBase.php (100%) rename {inc => lib}/SP/DataModel/DataModelInterface.php (100%) rename {inc => lib}/SP/DataModel/FileData.php (100%) rename {inc => lib}/SP/DataModel/FileExtData.php (100%) rename {inc => lib}/SP/DataModel/GroupAccountsData.php (98%) rename {inc => lib}/SP/DataModel/GroupData.php (100%) rename {inc => lib}/SP/DataModel/GroupUsersData.php (98%) rename {inc => lib}/SP/DataModel/InstallData.php (100%) rename {inc => lib}/SP/DataModel/ItemSearchData.php (100%) rename {inc => lib}/SP/DataModel/NoticeData.php (100%) rename {inc => lib}/SP/DataModel/PluginData.php (100%) rename {inc => lib}/SP/DataModel/ProfileBaseData.php (100%) rename {inc => lib}/SP/DataModel/ProfileData.php (100%) rename {inc => lib}/SP/DataModel/PublicLinkBaseData.php (100%) rename {inc => lib}/SP/DataModel/PublicLinkData.php (100%) rename {inc => lib}/SP/DataModel/PublicLinkListData.php (100%) rename {inc => lib}/SP/DataModel/TagData.php (100%) rename {inc => lib}/SP/DataModel/TrackData.php (100%) rename {inc => lib}/SP/DataModel/UserData.php (100%) rename {inc => lib}/SP/DataModel/UserLoginData.php (100%) rename {inc => lib}/SP/DataModel/UserPassData.php (100%) rename {inc => lib}/SP/DataModel/UserPassRecoverData.php (100%) rename {inc => lib}/SP/DataModel/UserPreferencesData.php (100%) rename {inc => lib}/SP/Forms/AccountForm.php (95%) rename {inc => lib}/SP/Forms/ApiTokenForm.php (100%) rename {inc => lib}/SP/Forms/CategoryForm.php (100%) rename {inc => lib}/SP/Forms/CustomFieldDefForm.php (100%) rename {inc => lib}/SP/Forms/CustomerForm.php (100%) rename {inc => lib}/SP/Forms/FormBase.php (70%) rename {inc => lib}/SP/Forms/FormInterface.php (100%) rename {inc => lib}/SP/Forms/GroupForm.php (100%) rename {inc => lib}/SP/Forms/NoticeForm.php (100%) rename {inc => lib}/SP/Forms/ProfileForm.php (100%) rename {inc => lib}/SP/Forms/PublicLinkForm.php (100%) rename {inc => lib}/SP/Forms/TagForm.php (100%) rename {inc => lib}/SP/Forms/UserForm.php (90%) rename {inc => lib}/SP/Html/Assets/FontIcon.php (92%) rename {inc => lib}/SP/Html/Assets/IconBase.php (100%) rename {inc => lib}/SP/Html/Assets/IconInterface.php (100%) rename {inc => lib}/SP/Html/Assets/ImageIcon.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGrid.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridAction.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridActionBase.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridActionInterface.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridActionSearch.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridActionType.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridBase.php (94%) rename {inc => lib}/SP/Html/DataGrid/DataGridData.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridDataBase.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridDataInterface.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridHeader.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridHeaderBase.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridHeaderInterface.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridHeaderSort.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridInterface.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridPager.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridPagerBase.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridPagerInterface.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridSort.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridSortInterface.php (100%) rename {inc => lib}/SP/Html/DataGrid/DataGridTab.php (100%) rename {inc => lib}/SP/Html/Html.php (100%) rename {inc => lib}/SP/Html/Minify.php (96%) rename {inc => lib}/SP/Http/Cookies.php (100%) rename {inc => lib}/SP/Http/JsonResponse.php (100%) rename {inc => lib}/SP/Http/Message.php (100%) rename {inc => lib}/SP/Http/Request.php (99%) rename {inc => lib}/SP/Http/Response.php (89%) rename {inc => lib}/SP/Http/XMLRPCResponseParse.php (100%) rename {inc => lib}/SP/Import/CsvImport.php (100%) rename {inc => lib}/SP/Import/CsvImportBase.php (100%) rename {inc => lib}/SP/Import/FileImport.php (100%) rename {inc => lib}/SP/Import/Import.php (95%) rename {inc => lib}/SP/Import/ImportBase.php (100%) rename {inc => lib}/SP/Import/ImportInterface.php (100%) rename {inc => lib}/SP/Import/ImportParams.php (100%) rename {inc => lib}/SP/Import/KeepassImport.php (100%) rename {inc => lib}/SP/Import/KeepassXImport.php (100%) rename {inc => lib}/SP/Import/SyspassImport.php (100%) rename {inc => lib}/SP/Import/XmlFileImport.php (100%) rename {inc => lib}/SP/Import/XmlImport.php (100%) rename {inc => lib}/SP/Import/XmlImportTrait.php (100%) rename {inc => lib}/SP/Log/AbstractLogger.php (100%) rename {inc => lib}/SP/Log/ActionLog.php (74%) rename {inc => lib}/SP/Log/Email.php (94%) rename {inc => lib}/SP/Log/Log.php (90%) rename {inc => lib}/SP/Log/LogLevel.php (100%) rename {inc => lib}/SP/Log/LogUtil.php (100%) rename {inc => lib}/SP/Log/LoggerInterface.php (100%) rename {inc => lib}/SP/Log/Syslog.php (84%) rename {inc => lib}/SP/Mgmt/ApiTokens/ApiToken.php (94%) rename {inc => lib}/SP/Mgmt/ApiTokens/ApiTokenBase.php (100%) rename {inc => lib}/SP/Mgmt/ApiTokens/ApiTokenSearch.php (92%) rename {inc => lib}/SP/Mgmt/ApiTokens/ApiTokensUtil.php (79%) rename {inc => lib}/SP/Mgmt/Categories/Category.php (93%) rename {inc => lib}/SP/Mgmt/Categories/CategoryBase.php (100%) rename {inc => lib}/SP/Mgmt/Categories/CategorySearch.php (94%) rename {inc => lib}/SP/Mgmt/CustomFields/CustomField.php (97%) rename {inc => lib}/SP/Mgmt/CustomFields/CustomFieldBase.php (100%) rename {inc => lib}/SP/Mgmt/CustomFields/CustomFieldDef.php (95%) rename {inc => lib}/SP/Mgmt/CustomFields/CustomFieldDefSearch.php (96%) rename {inc => lib}/SP/Mgmt/CustomFields/CustomFieldTypes.php (100%) rename {inc => lib}/SP/Mgmt/CustomFields/CustomFieldsUtil.php (96%) rename {inc => lib}/SP/Mgmt/Customers/Customer.php (93%) rename {inc => lib}/SP/Mgmt/Customers/CustomerBase.php (100%) rename {inc => lib}/SP/Mgmt/Customers/CustomerSearch.php (94%) rename {inc => lib}/SP/Mgmt/Files/File.php (96%) rename {inc => lib}/SP/Mgmt/Files/FileBase.php (100%) rename {inc => lib}/SP/Mgmt/Files/FileSearch.php (91%) rename {inc => lib}/SP/Mgmt/Files/FileUtil.php (93%) rename {inc => lib}/SP/Mgmt/Groups/Group.php (94%) rename {inc => lib}/SP/Mgmt/Groups/GroupAccounts.php (95%) rename {inc => lib}/SP/Mgmt/Groups/GroupAccountsBase.php (100%) rename {inc => lib}/SP/Mgmt/Groups/GroupAccountsUtil.php (96%) rename {inc => lib}/SP/Mgmt/Groups/GroupBase.php (100%) rename {inc => lib}/SP/Mgmt/Groups/GroupSearch.php (94%) rename {inc => lib}/SP/Mgmt/Groups/GroupUsers.php (95%) rename {inc => lib}/SP/Mgmt/Groups/GroupUsersBase.php (100%) rename {inc => lib}/SP/Mgmt/Groups/GroupUtil.php (95%) rename {inc => lib}/SP/Mgmt/ItemBaseInterface.php (100%) rename {inc => lib}/SP/Mgmt/ItemBaseTrait.php (76%) rename {inc => lib}/SP/Mgmt/ItemInterface.php (100%) rename {inc => lib}/SP/Mgmt/ItemSearchInterface.php (100%) rename {inc => lib}/SP/Mgmt/ItemSelectInterface.php (100%) rename {inc => lib}/SP/Mgmt/ItemTrait.php (100%) rename {inc => lib}/SP/Mgmt/Notices/Notice.php (92%) rename {inc => lib}/SP/Mgmt/Notices/NoticeBase.php (100%) rename {inc => lib}/SP/Mgmt/Notices/NoticeSearch.php (90%) rename {inc => lib}/SP/Mgmt/Plugins/Plugin.php (93%) rename {inc => lib}/SP/Mgmt/Plugins/PluginBase.php (100%) rename {inc => lib}/SP/Mgmt/Plugins/PluginSearch.php (94%) rename {inc => lib}/SP/Mgmt/Profiles/Profile.php (91%) rename {inc => lib}/SP/Mgmt/Profiles/ProfileBase.php (100%) rename {inc => lib}/SP/Mgmt/Profiles/ProfileSearch.php (94%) rename {inc => lib}/SP/Mgmt/Profiles/ProfileUtil.php (97%) rename {inc => lib}/SP/Mgmt/PublicLinks/PublicLink.php (94%) rename {inc => lib}/SP/Mgmt/PublicLinks/PublicLinkBase.php (86%) rename {inc => lib}/SP/Mgmt/PublicLinks/PublicLinkSearch.php (96%) rename {inc => lib}/SP/Mgmt/Tags/Tag.php (94%) rename {inc => lib}/SP/Mgmt/Tags/TagBase.php (100%) rename {inc => lib}/SP/Mgmt/Tags/TagSearch.php (93%) rename {inc => lib}/SP/Mgmt/Tracks/Track.php (94%) rename {inc => lib}/SP/Mgmt/Tracks/TrackBase.php (100%) rename {inc => lib}/SP/Mgmt/Users/User.php (95%) rename {inc => lib}/SP/Mgmt/Users/UserBase.php (91%) rename {inc => lib}/SP/Mgmt/Users/UserLdap.php (94%) rename {inc => lib}/SP/Mgmt/Users/UserLdapSync.php (95%) rename {inc => lib}/SP/Mgmt/Users/UserMigrate.php (96%) rename {inc => lib}/SP/Mgmt/Users/UserPass.php (93%) rename {inc => lib}/SP/Mgmt/Users/UserPassRecover.php (96%) rename {inc => lib}/SP/Mgmt/Users/UserPassRecoverBase.php (100%) rename {inc => lib}/SP/Mgmt/Users/UserPreferences.php (97%) rename {inc => lib}/SP/Mgmt/Users/UserPreferencesBase.php (100%) rename {inc => lib}/SP/Mgmt/Users/UserPreferencesUtil.php (87%) rename {inc => lib}/SP/Mgmt/Users/UserSSO.php (93%) rename {inc => lib}/SP/Mgmt/Users/UserSearch.php (89%) rename {inc => lib}/SP/Mgmt/Users/UserUtil.php (93%) create mode 100644 lib/SP/Mvc/Controller/CrudControllerInterface.php create mode 100644 lib/SP/Mvc/View/View.php create mode 100644 lib/SP/Mvc/View/ViewInterface.php create mode 100644 lib/SP/Services/LoginService.php rename ajax/ajax_checkUpds.php => lib/SP/Storage/CacheableInterface.php (71%) rename {inc => lib}/SP/Storage/DBStorageInterface.php (84%) rename {inc => lib}/SP/Storage/DBUtil.php (85%) create mode 100644 lib/SP/Storage/Database.php rename inc/SP/Storage/DB.php => lib/SP/Storage/DbWrapper.php (55%) rename {inc => lib}/SP/Storage/FileStorageInterface.php (95%) rename {inc => lib}/SP/Storage/MySQLHandler.php (73%) rename {inc => lib}/SP/Storage/QueryData.php (100%) rename {inc => lib}/SP/Storage/XmlHandler.php (92%) rename {inc => lib}/SP/Util/ArrayUtil.php (100%) rename {inc => lib}/SP/Util/Checks.php (54%) rename {inc => lib}/SP/Util/Connection.php (100%) rename {inc => lib}/SP/Util/ConnectionInterface.php (100%) rename {inc => lib}/SP/Util/Filter.php (100%) rename {inc => lib}/SP/Util/HttpUtil.php (94%) rename {inc => lib}/SP/Util/ImageUtil.php (100%) rename {inc => lib}/SP/Util/Json.php (100%) rename {inc => lib}/SP/Util/Util.php (90%) rename {inc => lib}/SP/Util/Wiki/DokuWikiApi.php (94%) rename {inc => lib}/SP/Util/Wiki/DokuWikiApiBase.php (89%) rename {inc => lib}/SP/Util/Wiki/DokuWikiApiParse.php (100%) rename {inc => lib}/SplClassLoader.php (100%) rename {css => public/css}/css.php (92%) rename {css => public/css}/fonts.css (100%) rename {css => public/css}/fonts.min.css (100%) rename {css => public/css}/fonts/MaterialIcons-Regular.eot (100%) rename {css => public/css}/fonts/MaterialIcons-Regular.svg (100%) rename {css => public/css}/fonts/MaterialIcons-Regular.ttf (100%) rename {css => public/css}/fonts/MaterialIcons-Regular.woff (100%) rename {css => public/css}/fonts/MaterialIcons-Regular.woff2 (100%) rename {css => public/css}/fonts/NotoSans-Regular-webfont.ttf (100%) rename {css => public/css}/jquery-ui.min.css (100%) rename {css => public/css}/jquery-ui.structure.min.css (100%) rename {css => public/css}/jquery.tagsinput.min.css (100%) rename {css => public/css}/magnific-popup.css (100%) rename {css => public/css}/magnific-popup.min.css (100%) rename {css => public/css}/material-icons.css (100%) rename {css => public/css}/material-icons.min.css (100%) rename {css => public/css}/reset.min.css (100%) rename {css => public/css}/toastr.css (100%) rename {css => public/css}/toastr.min.css (100%) rename {imgs => public/images}/logo_full_bg.png (100%) rename {imgs => public/images}/logo_full_nobg.png (100%) rename {imgs => public/images}/logo_icon.png (100%) rename {js => public/js}/app-actions.js (96%) create mode 100644 public/js/app-actions.min.js rename {js => public/js}/app-main.js (99%) rename {js => public/js}/app-main.min.js (64%) rename {js => public/js}/app-requests.js (100%) rename {js => public/js}/app-requests.min.js (100%) rename {js => public/js}/app-triggers.js (98%) rename {js => public/js}/app-triggers.min.js (91%) rename {js => public/js}/app.js (100%) rename {js => public/js}/app.min.js (100%) rename {js => public/js}/clipboard.js (100%) rename {js => public/js}/clipboard.min.js (100%) rename {js => public/js}/eventsource.js (100%) rename {js => public/js}/eventsource.min.js (100%) rename {js => public/js}/jquery-3.2.0.js (100%) rename {js => public/js}/jquery-3.2.0.min.js (100%) rename {js => public/js}/jquery-migrate-3.0.0.js (100%) rename {js => public/js}/jquery-migrate-3.0.0.min.js (100%) rename {js => public/js}/jquery.fileDownload.min.js (100%) rename {js => public/js}/jquery.magnific-popup.js (100%) rename {js => public/js}/jquery.magnific-popup.min.js (100%) rename {js => public/js}/js.php (95%) rename {js => public/js}/jsencrypt.js (100%) rename {js => public/js}/jsencrypt.min.js (100%) rename {js => public/js}/moment-timezone.js (100%) rename {js => public/js}/moment-timezone.min.js (100%) rename {js => public/js}/moment.js (100%) rename {js => public/js}/moment.min.js (100%) rename {js => public/js}/selectize-plugins.js (100%) rename {js => public/js}/selectize-plugins.min.js (100%) rename {js => public/js}/selectize.js (100%) rename {js => public/js}/selectize.min.js (100%) rename {js => public/js}/spark-md5.js (100%) rename {js => public/js}/spark-md5.min.js (100%) rename {js => public/js}/strings.js.php (99%) rename {js => public/js}/toastr.js (100%) rename {js => public/js}/toastr.min.js (100%) create mode 100644 public/js/zxcvbn-async.js create mode 100644 public/js/zxcvbn-async.min.js rename {js => public/js}/zxcvbn.min.js (100%) rename {inc/sql => schemas}/110.sql (100%) rename {inc/sql => schemas}/1121.sql (100%) rename {inc/sql => schemas}/11213.sql (100%) rename {inc/sql => schemas}/11219.sql (100%) rename {inc/sql => schemas}/1122.sql (100%) rename {inc/sql => schemas}/11220.sql (100%) rename {inc/sql => schemas}/1123.sql (100%) rename {inc/sql => schemas}/12001.sql (100%) rename {inc/sql => schemas}/12002.sql (100%) rename {inc/sql => schemas}/13000000000.sql (100%) rename {inc/sql => schemas}/13016100601.sql (100%) rename {inc/sql => schemas}/20017011302.sql (100%) rename {inc/sql => schemas}/20017011701.sql (100%) rename {inc/sql => schemas}/20017012901.sql (100%) rename {inc/sql => schemas}/21017022601.sql (100%) rename {inc/sql => schemas}/21317031402.sql (100%) rename {inc/sql => schemas}/22017050101.sql (100%) rename {inc/sql => schemas}/dbstructure.sql (100%) diff --git a/.gitignore b/.gitignore index 13d06bef..5bac1cb5 100644 --- a/.gitignore +++ b/.gitignore @@ -45,11 +45,12 @@ crashlytics.properties crashlytics-build.properties fabric.properties -backup/* -config/* +app/cache/* +app/backup/* +app/config/* res/ tools/ -tmp/ -inc/Plugins/* +app/temp/* +app/modules/web/plugins/* !.blank \ No newline at end of file diff --git a/ajax/ajax_accGetFiles.php b/ajax/ajax_accGetFiles.php deleted file mode 100644 index 9369c364..00000000 --- a/ajax/ajax_accGetFiles.php +++ /dev/null @@ -1,55 +0,0 @@ -. - */ - -use SP\Controller\ItemListController; -use SP\Core\Init; -use SP\Core\SessionUtil; -use SP\Http\Request; -use SP\Http\Response; -use SP\Util\Checks; - -define('APP_ROOT', dirname(__DIR__)); - -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -if (!Init::isLoggedIn()) { - return; -} - -if (!Checks::fileIsEnabled()) { - echo __('Gestión de archivos deshabilitada'); - return false; -} - -$sk = Request::analyze('sk', false); - -if (!$sk || !SessionUtil::checkSessionKey($sk)) { - Response::printHtmlError(__('CONSULTA INVÁLIDA')); -} - -$Controller = new ItemListController(); -$Controller->getAccountFiles(); -$Controller->view(); \ No newline at end of file diff --git a/ajax/ajax_accSearch.php b/ajax/ajax_accSearch.php deleted file mode 100644 index 372a59c9..00000000 --- a/ajax/ajax_accSearch.php +++ /dev/null @@ -1,56 +0,0 @@ -. - */ - -use SP\Controller\AccountSearchController; -use SP\Core\Init; -use SP\Http\Request; -use SP\Core\SessionUtil; -use SP\Http\Response; - -define('APP_ROOT', dirname(__DIR__)); - -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; - -Request::checkReferer('GET'); - -if (!Init::isLoggedIn()) { - Response::printJson(__('La sesión no se ha iniciado o ha caducado'), 10); -} - -$sk = Request::analyze('sk', false); - -if (!$sk || !SessionUtil::checkSessionKey($sk)) { - Response::printJson(__('CONSULTA INVÁLIDA')); -} - -$Controller = new AccountSearchController(); -$Controller->setIsAjax(true); -$Controller->getSearch(); - -$data = [ - 'sk' => SessionUtil::getSessionKey(), - 'html' => $Controller->render() -]; - -Response::printJson($data, 0); \ No newline at end of file diff --git a/ajax/ajax_checkConnection.php b/ajax/ajax_checkConnection.php index f4276701..c583f55c 100644 --- a/ajax/ajax_checkConnection.php +++ b/ajax/ajax_checkConnection.php @@ -27,7 +27,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('POST'); diff --git a/ajax/ajax_configSave.php b/ajax/ajax_configSave.php index 79573b80..5e73aaad 100644 --- a/ajax/ajax_configSave.php +++ b/ajax/ajax_configSave.php @@ -27,7 +27,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('POST'); diff --git a/ajax/ajax_eventlog.php b/ajax/ajax_eventlog.php index 132c5d0c..d394c3bb 100644 --- a/ajax/ajax_eventlog.php +++ b/ajax/ajax_eventlog.php @@ -25,17 +25,15 @@ use SP\Controller\EventlogController; use SP\Core\Init; use SP\Http\Request; +use SP\Util\Util; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('GET'); -if (!Init::isLoggedIn()) { - \SP\Util\Util::logout(); -} - $Controller = new EventlogController(); +$Controller->checkLoggedIn(); $Controller->doAction(); $Controller->view(); \ No newline at end of file diff --git a/ajax/ajax_filesMgmt.php b/ajax/ajax_filesMgmt.php index 6cb26ef4..d59fc201 100644 --- a/ajax/ajax_filesMgmt.php +++ b/ajax/ajax_filesMgmt.php @@ -23,10 +23,8 @@ */ use SP\Account\AccountUtil; -use SP\Config\Config; use SP\Core\ActionsInterface; use SP\Core\Exceptions\SPException; -use SP\Core\Init; use SP\Core\SessionUtil; use SP\DataModel\FileData; use SP\Html\Html; @@ -35,16 +33,15 @@ use SP\Http\Response; use SP\Log\Log; use SP\Mgmt\Files\File; use SP\Mgmt\Files\FileUtil; -use SP\Util\Checks; use SP\Util\Util; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('POST'); -if (!Init::isLoggedIn()) { +if (!Util::isLoggedIn($dic->get(\SP\Core\SessionFactory::class))) { Util::logout(); } @@ -54,7 +51,10 @@ if (!$sk || !SessionUtil::checkSessionKey($sk)) { Response::printJson(__('CONSULTA INVÁLIDA')); } -if (!Checks::fileIsEnabled()) { +/** @var \SP\Config\ConfigData $ConfigData */ +$ConfigData = $dic->get(\SP\Config\ConfigData::class); + +if (!$ConfigData->isFilesEnabled()) { Response::printJson(__('Gestión de archivos deshabilitada')); } @@ -72,8 +72,8 @@ if ($actionId === ActionsInterface::ACTION_ACC_FILES_UPLOAD) { $LogMessage->setAction(__('Subir Archivo', false)); - $allowedExts = Config::getConfig()->getFilesAllowedExts(); - $allowedSize = Config::getConfig()->getFilesAllowedSize(); + $allowedExts = $ConfigData->getFilesAllowedExts(); + $allowedSize = $ConfigData->getFilesAllowedSize(); if (count($allowedExts) === 0) { $LogMessage->addDescription(__('No hay extensiones permitidas', false)); diff --git a/ajax/ajax_getContent.php b/ajax/ajax_getContent.php index 7240ab66..7bdc374d 100644 --- a/ajax/ajax_getContent.php +++ b/ajax/ajax_getContent.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -22,7 +22,6 @@ * along with sysPass. If not, see . */ -use SP\Config\Config; use SP\Controller\AccountController; use SP\Controller\AccountSearchController; use SP\Controller\ConfigController; @@ -31,9 +30,7 @@ use SP\Controller\ItemListController; use SP\Controller\NoticesController; use SP\Controller\UserPreferencesController; use SP\Core\ActionsInterface; -use SP\Core\DiFactory; -use SP\Core\Init; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\Template; use SP\Http\Request; use SP\Http\Response; @@ -41,11 +38,18 @@ use SP\Util\Util; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('GET'); -if (!Init::isLoggedIn()) { +/** @var \SP\Storage\Database $db */ +$db = $dic->get(\SP\Storage\Database::class); +/** @var SessionFactory $session */ +$session = $dic->get(SessionFactory::class); +/** @var \SP\Core\UI\Theme $theme */ +$theme = $dic->get(\SP\Core\UI\Theme::class); + +if (!Util::isLoggedIn($session)) { Util::logout(); } @@ -58,7 +62,7 @@ if (!Request::analyze('actionId', 0, true)) { $actionId = Request::analyze('actionId', 0); $itemId = Request::analyze('itemId', 0); -$UserData = Session::getUserData(); +$UserData = SessionFactory::getUserData(); $Tpl = new Template(); $Tpl->assign('actionId', $actionId); @@ -69,7 +73,7 @@ $Tpl->assign('userId', $UserData->getUserId()); $Tpl->assign('userGroupId', $UserData->getUserGroupId()); $Tpl->assign('userIsAdminApp', $UserData->isUserIsAdminApp()); $Tpl->assign('userIsAdminAcc', $UserData->isUserIsAdminAcc()); -$Tpl->assign('themeUri', DiFactory::getTheme()->getThemeUri()); +$Tpl->assign('themeUri', $theme->getThemeUri()); switch ($actionId) { case ActionsInterface::ACTION_ACC_SEARCH: @@ -136,8 +140,11 @@ switch ($actionId) { break; } +/** @var \SP\Config\ConfigData $ConfigData */ +$ConfigData = $dic->get(\SP\Config\ConfigData::class); + // Se comprueba si se debe de mostrar la vista de depuración -if ($UserData->isUserIsAdminApp() && Config::getConfig()->isDebug()) { +if ($UserData->isUserIsAdminApp() && $ConfigData->isDebug()) { $Controller->getDebug(); } diff --git a/ajax/ajax_getEnvironment.php b/ajax/ajax_getEnvironment.php deleted file mode 100644 index 2b4ee9ac..00000000 --- a/ajax/ajax_getEnvironment.php +++ /dev/null @@ -1,66 +0,0 @@ -. - */ - -use SP\Auth\Browser\Browser; -use SP\Config\Config; -use SP\Core\CryptPKI; -use SP\Core\Init; -use SP\Core\Plugin\PluginUtil; -use SP\Core\Session; -use SP\Http\Cookies; -use SP\Http\Request; -use SP\Http\Response; -use SP\Util\Checks; - -define('APP_ROOT', dirname(__DIR__)); - -require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; -require APP_ROOT . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'strings.js.php'; - -Request::checkReferer('GET'); - -$Config = Config::getConfig(); - -$data = [ - 'lang' => $stringsJsLang, - 'locale' => $Config->getSiteLang(), - 'app_root' => Init::$WEBURI, - 'pk' => '', - 'max_file_size' => $Config->getFilesAllowedSize(), - 'check_updates' => Session::getAuthCompleted() && ($Config->isCheckUpdates() || $Config->isChecknotices()) && (Session::getUserData()->isUserIsAdminApp() || Checks::demoIsEnabled()), - 'timezone' => date_default_timezone_get(), - 'debug' => DEBUG || $Config->isDebug(), - 'cookies_enabled' => Cookies::checkCookies(), - 'plugins' => PluginUtil::getEnabledPlugins(), - 'loggedin' => Init::isLoggedIn(), - 'authbasic_autologin' => Browser::getServerAuthUser() && Config::getConfig()->isAuthBasicAutoLoginEnabled() -]; - -try { - $CryptPKI = new CryptPKI(); - $data['pk'] = Session::getPublicKey() ?: $CryptPKI->getPublicKey(); -} catch (Exception $e) { -} - -Response::printJson($data, 0); \ No newline at end of file diff --git a/ajax/ajax_getItems.php b/ajax/ajax_getItems.php index 6e3fab49..1d006bd5 100644 --- a/ajax/ajax_getItems.php +++ b/ajax/ajax_getItems.php @@ -27,7 +27,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('GET'); diff --git a/ajax/ajax_install.php b/ajax/ajax_install.php index 69443646..d0a97d50 100644 --- a/ajax/ajax_install.php +++ b/ajax/ajax_install.php @@ -32,7 +32,7 @@ use SP\Util\Json; define('APP_ROOT', dirname(__DIR__)); define('IS_INSTALLER', 1); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('POST'); diff --git a/ajax/ajax_itemSave.php b/ajax/ajax_itemSave.php index 8bcc393f..7bbb8aaf 100644 --- a/ajax/ajax_itemSave.php +++ b/ajax/ajax_itemSave.php @@ -27,7 +27,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('POST'); diff --git a/ajax/ajax_itemSearch.php b/ajax/ajax_itemSearch.php index 59a2909c..d308e9c9 100644 --- a/ajax/ajax_itemSearch.php +++ b/ajax/ajax_itemSearch.php @@ -27,7 +27,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('GET'); diff --git a/ajax/ajax_itemShow.php b/ajax/ajax_itemShow.php index 769e6544..ec0da55a 100644 --- a/ajax/ajax_itemShow.php +++ b/ajax/ajax_itemShow.php @@ -27,7 +27,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('GET'); diff --git a/ajax/ajax_noticeSearch.php b/ajax/ajax_noticeSearch.php index 037acf47..6f5bebff 100644 --- a/ajax/ajax_noticeSearch.php +++ b/ajax/ajax_noticeSearch.php @@ -27,7 +27,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('GET'); diff --git a/ajax/ajax_noticeShow.php b/ajax/ajax_noticeShow.php index 8ee02abc..f4974c94 100644 --- a/ajax/ajax_noticeShow.php +++ b/ajax/ajax_noticeShow.php @@ -27,7 +27,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('GET'); diff --git a/ajax/ajax_passReset.php b/ajax/ajax_passReset.php index 7a4eadb8..b48a01eb 100644 --- a/ajax/ajax_passReset.php +++ b/ajax/ajax_passReset.php @@ -36,7 +36,7 @@ use SP\Util\Json; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('POST'); diff --git a/ajax/ajax_task.php b/ajax/ajax_task.php index 9b4a37bf..7814b009 100644 --- a/ajax/ajax_task.php +++ b/ajax/ajax_task.php @@ -27,7 +27,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; session_write_close(); diff --git a/ajax/ajax_upgrade.php b/ajax/ajax_upgrade.php index 06e631bf..43e15c09 100644 --- a/ajax/ajax_upgrade.php +++ b/ajax/ajax_upgrade.php @@ -28,7 +28,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); define('IS_UPGRADE', 1); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('GET'); diff --git a/ajax/ajax_userPrefsSave.php b/ajax/ajax_userPrefsSave.php index f7c930dc..dcabce24 100644 --- a/ajax/ajax_userPrefsSave.php +++ b/ajax/ajax_userPrefsSave.php @@ -26,7 +26,7 @@ use Plugins\Authenticator\Authenticator; use SP\Core\ActionsInterface; use SP\Core\Init; use SP\Core\Language; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\Exceptions\SPException; use SP\Core\DiFactory; use SP\Http\JsonResponse; @@ -40,13 +40,20 @@ use SP\Util\Util; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('POST'); $Json = new JsonResponse(); -if (!Init::isLoggedIn()) { +/** @var \SP\Storage\Database $db */ +$db = $dic->get(\SP\Storage\Database::class); +/** @var SessionFactory $session */ +$session = $dic->get(SessionFactory::class); +/** @var \SP\Core\UI\Theme $theme */ +$theme = $dic->get(\SP\Core\UI\Theme::class); + +if (!Util::isLoggedIn($session)) { $Json->setStatus(10); $Json->setDescription(__('La sesión no se ha iniciado o ha caducado')); Json::returnJson($Json); @@ -80,10 +87,10 @@ if ($actionId === ActionsInterface::ACTION_USR_PREFERENCES_GENERAL) { UserPreferences::getItem($UserPreferencesData)->update(); // Forzar la detección del lenguaje tras actualizar Language::setLanguage(true); - DiFactory::getTheme()->initTheme(true); + $theme->initTheme(true); // Actualizar las preferencias en la sesión y recargar la página - Session::setUserPreferences($UserPreferencesData); + SessionFactory::setUserPreferences($UserPreferencesData); Util::reload(); $Json->setStatus(0); diff --git a/ajax/ajax_wiki.php b/ajax/ajax_wiki.php index d3cc27d2..5530c738 100644 --- a/ajax/ajax_wiki.php +++ b/ajax/ajax_wiki.php @@ -27,7 +27,7 @@ use SP\Http\Request; define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; Request::checkReferer('GET'); diff --git a/api.php b/api.php index 361cc002..44455eaa 100644 --- a/api.php +++ b/api.php @@ -27,7 +27,7 @@ use SP\Log\Log; define('APP_ROOT', '.'); -require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; header('Content-type: application/json'); diff --git a/backup/.blank b/app/backup/.blank similarity index 100% rename from backup/.blank rename to app/backup/.blank diff --git a/config/.blank b/app/cache/.blank similarity index 100% rename from config/.blank rename to app/cache/.blank diff --git a/inc/Plugins/.blank b/app/config/.blank similarity index 100% rename from inc/Plugins/.blank rename to app/config/.blank diff --git a/app/config/config.php b/app/config/config.php new file mode 100644 index 00000000..5c46bb4c --- /dev/null +++ b/app/config/config.php @@ -0,0 +1,47 @@ + 12, + 'account_link' => 1, + 'account_passtoimage' => false, + 'checknotices' => true, + 'checkupdates' => true, + 'config_hash' => '53489a9c67140c7a72d12b71cb1eefd5', + 'dbhost' => 'localhost', + 'dbname' => 'syspass', + 'dbpass' => 'ff6555bb87aa43d732346d2224736095', + 'dbuser' => 'sp_admin', + 'debug' => false, + 'demo_enabled' => false, + 'files_allowed_exts' => 'PDF,JPG,GIF,PNG,ODT,ODS,DOC,DOCX,XLS,XSL,VSD,TXT,CSV,BAK', + 'files_allowed_size' => 1024, + 'files_enabled' => true, + 'globalsearch' => false, + 'installed' => 1, + 'ldap_base' => '', + 'ldap_enabled' => false, + 'ldap_group' => '', + 'ldap_server' => '', + 'ldap_userattr' => '', + 'log_enabled' => true, + 'mail_enabled' => false, + 'mail_from' => '', + 'mail_server' => '', + 'passwordsalt' => 'b6417b24176faa7d6543dc05874ca6', + 'proxy_enabled' => false, + 'proxy_pass' => '', + 'proxy_port' => '', + 'proxy_server' => '', + 'proxy_user' => '', + 'resultsascards' => false, + 'session_timeout' => '300', + 'site_lang' => '', + 'sitetheme' => 'material-blue', + 'version' => '1316011001', + 'wiki_enabled' => false, + 'wiki_filter' => '', + 'wiki_pageurl' => '', + 'wiki_searchurl' => '', +); diff --git a/app/config/config.php.old b/app/config/config.php.old new file mode 100644 index 00000000..5c46bb4c --- /dev/null +++ b/app/config/config.php.old @@ -0,0 +1,47 @@ + 12, + 'account_link' => 1, + 'account_passtoimage' => false, + 'checknotices' => true, + 'checkupdates' => true, + 'config_hash' => '53489a9c67140c7a72d12b71cb1eefd5', + 'dbhost' => 'localhost', + 'dbname' => 'syspass', + 'dbpass' => 'ff6555bb87aa43d732346d2224736095', + 'dbuser' => 'sp_admin', + 'debug' => false, + 'demo_enabled' => false, + 'files_allowed_exts' => 'PDF,JPG,GIF,PNG,ODT,ODS,DOC,DOCX,XLS,XSL,VSD,TXT,CSV,BAK', + 'files_allowed_size' => 1024, + 'files_enabled' => true, + 'globalsearch' => false, + 'installed' => 1, + 'ldap_base' => '', + 'ldap_enabled' => false, + 'ldap_group' => '', + 'ldap_server' => '', + 'ldap_userattr' => '', + 'log_enabled' => true, + 'mail_enabled' => false, + 'mail_from' => '', + 'mail_server' => '', + 'passwordsalt' => 'b6417b24176faa7d6543dc05874ca6', + 'proxy_enabled' => false, + 'proxy_pass' => '', + 'proxy_port' => '', + 'proxy_server' => '', + 'proxy_user' => '', + 'resultsascards' => false, + 'session_timeout' => '300', + 'site_lang' => '', + 'sitetheme' => 'material-blue', + 'version' => '1316011001', + 'wiki_enabled' => false, + 'wiki_filter' => '', + 'wiki_pageurl' => '', + 'wiki_searchurl' => '', +); diff --git a/app/config/config.xml b/app/config/config.xml new file mode 100644 index 00000000..3227adc0 --- /dev/null +++ b/app/config/config.xml @@ -0,0 +1,103 @@ + + + 12 + 0 + 1 + 0 + 1 + + 1 + 36294f0e4218f177180b419cf2a853bf765b2f6d + 1 + 0 + 1505767472 + c49414b14004c75fcd3b6578814941f9 + + 22017050101 + syspass-db + syspass + G0fq^NjmQ2lr:e3o + 3306 + + sp_admin + 0 + 0 + 0 + + + + + + 0 + 300049b78c19e759bc589f9a56dbb6473bf7cc9c + + PDF + JPG + GIF + PNG + ODT + ODS + DOC + DOCX + XLS + XSL + VSD + TXT + CSV + BAK + RDP + KEY + + 1024 + 1 + 1 + 0 + 1 + 0 + dc=demo1,dc=freeipa,dc=org + Secret123 + uid=admin,cn=users,cn=accounts,dc=demo1,dc=freeipa,dc=org + 1 + 1 + 0 + + + ipa.demo1.freeipa.org + + 1 + 1 + 1 + test@syspass.org + &J$wkt+1QheO + 25 + 0 + + mail.syspass.org + test@syspass.org + 0 + fcc85b56f961971ed30b2ca0073e9fde4fd2e7c893106da2963a5a2b5dcb + 0 + + 8080 + + + 0 + 0 + 600 + 3 + 0 + 900 + en_US + material-blue + 0 + 0 + 0 + 514 + 0 + + + 0 + + + + diff --git a/app/config/config.xml.orig b/app/config/config.xml.orig new file mode 100644 index 00000000..3227adc0 --- /dev/null +++ b/app/config/config.xml.orig @@ -0,0 +1,103 @@ + + + 12 + 0 + 1 + 0 + 1 + + 1 + 36294f0e4218f177180b419cf2a853bf765b2f6d + 1 + 0 + 1505767472 + c49414b14004c75fcd3b6578814941f9 + + 22017050101 + syspass-db + syspass + G0fq^NjmQ2lr:e3o + 3306 + + sp_admin + 0 + 0 + 0 + + + + + + 0 + 300049b78c19e759bc589f9a56dbb6473bf7cc9c + + PDF + JPG + GIF + PNG + ODT + ODS + DOC + DOCX + XLS + XSL + VSD + TXT + CSV + BAK + RDP + KEY + + 1024 + 1 + 1 + 0 + 1 + 0 + dc=demo1,dc=freeipa,dc=org + Secret123 + uid=admin,cn=users,cn=accounts,dc=demo1,dc=freeipa,dc=org + 1 + 1 + 0 + + + ipa.demo1.freeipa.org + + 1 + 1 + 1 + test@syspass.org + &J$wkt+1QheO + 25 + 0 + + mail.syspass.org + test@syspass.org + 0 + fcc85b56f961971ed30b2ca0073e9fde4fd2e7c893106da2963a5a2b5dcb + 0 + + 8080 + + + 0 + 0 + 600 + 3 + 0 + 900 + en_US + material-blue + 0 + 0 + 0 + 514 + 0 + + + 0 + + + + diff --git a/inc/themes/material-blue/views/main/sessionbar.inc b/app/config/key.pem similarity index 100% rename from inc/themes/material-blue/views/main/sessionbar.inc rename to app/config/key.pem diff --git a/app/config/pubkey.pem b/app/config/pubkey.pem new file mode 100644 index 00000000..5831de08 --- /dev/null +++ b/app/config/pubkey.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCm3GrBV/VrnCzpClpnXKrh2P0J +AY/DMf4h5bzod0G5UciVQVBZiXyjeIM4mNawkJZ94sl5KjmznmBYy7fXL1Bpvsjz +hnegpbBo0rgJKrHXhnTzVSyMiCW03BUyBYosjex6ZNZTmyuvyrBiW+nWKEAuDqby +z6TAMF9Z4TBiZE9mqQIDAQAB +-----END PUBLIC KEY----- \ No newline at end of file diff --git a/inc/locales/ca_ES/LC_MESSAGES/messages.mo b/app/locales/ca_ES/LC_MESSAGES/messages.mo similarity index 100% rename from inc/locales/ca_ES/LC_MESSAGES/messages.mo rename to app/locales/ca_ES/LC_MESSAGES/messages.mo diff --git a/inc/locales/ca_ES/LC_MESSAGES/messages.po b/app/locales/ca_ES/LC_MESSAGES/messages.po similarity index 100% rename from inc/locales/ca_ES/LC_MESSAGES/messages.po rename to app/locales/ca_ES/LC_MESSAGES/messages.po diff --git a/inc/locales/de_DE/LC_MESSAGES/messages.mo b/app/locales/de_DE/LC_MESSAGES/messages.mo similarity index 100% rename from inc/locales/de_DE/LC_MESSAGES/messages.mo rename to app/locales/de_DE/LC_MESSAGES/messages.mo diff --git a/inc/locales/de_DE/LC_MESSAGES/messages.po b/app/locales/de_DE/LC_MESSAGES/messages.po similarity index 100% rename from inc/locales/de_DE/LC_MESSAGES/messages.po rename to app/locales/de_DE/LC_MESSAGES/messages.po diff --git a/inc/locales/en_US/LC_MESSAGES/messages.mo b/app/locales/en_US/LC_MESSAGES/messages.mo similarity index 100% rename from inc/locales/en_US/LC_MESSAGES/messages.mo rename to app/locales/en_US/LC_MESSAGES/messages.mo diff --git a/inc/locales/en_US/LC_MESSAGES/messages.po b/app/locales/en_US/LC_MESSAGES/messages.po similarity index 100% rename from inc/locales/en_US/LC_MESSAGES/messages.po rename to app/locales/en_US/LC_MESSAGES/messages.po diff --git a/inc/locales/fr_FR/LC_MESSAGES/messages.mo b/app/locales/fr_FR/LC_MESSAGES/messages.mo similarity index 100% rename from inc/locales/fr_FR/LC_MESSAGES/messages.mo rename to app/locales/fr_FR/LC_MESSAGES/messages.mo diff --git a/inc/locales/fr_FR/LC_MESSAGES/messages.po b/app/locales/fr_FR/LC_MESSAGES/messages.po similarity index 100% rename from inc/locales/fr_FR/LC_MESSAGES/messages.po rename to app/locales/fr_FR/LC_MESSAGES/messages.po diff --git a/inc/locales/hu_HU/LC_MESSAGES/messages.mo b/app/locales/hu_HU/LC_MESSAGES/messages.mo similarity index 100% rename from inc/locales/hu_HU/LC_MESSAGES/messages.mo rename to app/locales/hu_HU/LC_MESSAGES/messages.mo diff --git a/inc/locales/hu_HU/LC_MESSAGES/messages.po b/app/locales/hu_HU/LC_MESSAGES/messages.po similarity index 100% rename from inc/locales/hu_HU/LC_MESSAGES/messages.po rename to app/locales/hu_HU/LC_MESSAGES/messages.po diff --git a/inc/locales/it_IT/LC_MESSAGES/messages.mo b/app/locales/it_IT/LC_MESSAGES/messages.mo similarity index 100% rename from inc/locales/it_IT/LC_MESSAGES/messages.mo rename to app/locales/it_IT/LC_MESSAGES/messages.mo diff --git a/inc/locales/it_IT/LC_MESSAGES/messages.po b/app/locales/it_IT/LC_MESSAGES/messages.po similarity index 100% rename from inc/locales/it_IT/LC_MESSAGES/messages.po rename to app/locales/it_IT/LC_MESSAGES/messages.po diff --git a/inc/locales/nl_NL/LC_MESSAGES/messages.mo b/app/locales/nl_NL/LC_MESSAGES/messages.mo similarity index 100% rename from inc/locales/nl_NL/LC_MESSAGES/messages.mo rename to app/locales/nl_NL/LC_MESSAGES/messages.mo diff --git a/inc/locales/nl_NL/LC_MESSAGES/messages.po b/app/locales/nl_NL/LC_MESSAGES/messages.po similarity index 100% rename from inc/locales/nl_NL/LC_MESSAGES/messages.po rename to app/locales/nl_NL/LC_MESSAGES/messages.po diff --git a/inc/locales/po_PO/LC_MESSAGES/messages.mo b/app/locales/po_PO/LC_MESSAGES/messages.mo similarity index 100% rename from inc/locales/po_PO/LC_MESSAGES/messages.mo rename to app/locales/po_PO/LC_MESSAGES/messages.mo diff --git a/inc/locales/po_PO/LC_MESSAGES/messages.po b/app/locales/po_PO/LC_MESSAGES/messages.po similarity index 100% rename from inc/locales/po_PO/LC_MESSAGES/messages.po rename to app/locales/po_PO/LC_MESSAGES/messages.po diff --git a/inc/locales/pt_BR/LC_MESSAGES/messages.mo b/app/locales/pt_BR/LC_MESSAGES/messages.mo similarity index 100% rename from inc/locales/pt_BR/LC_MESSAGES/messages.mo rename to app/locales/pt_BR/LC_MESSAGES/messages.mo diff --git a/inc/locales/pt_BR/LC_MESSAGES/messages.po b/app/locales/pt_BR/LC_MESSAGES/messages.po similarity index 100% rename from inc/locales/pt_BR/LC_MESSAGES/messages.po rename to app/locales/pt_BR/LC_MESSAGES/messages.po diff --git a/inc/locales/ru_RU/LC_MESSAGES/messages.mo b/app/locales/ru_RU/LC_MESSAGES/messages.mo similarity index 100% rename from inc/locales/ru_RU/LC_MESSAGES/messages.mo rename to app/locales/ru_RU/LC_MESSAGES/messages.mo diff --git a/inc/locales/ru_RU/LC_MESSAGES/messages.po b/app/locales/ru_RU/LC_MESSAGES/messages.po similarity index 100% rename from inc/locales/ru_RU/LC_MESSAGES/messages.po rename to app/locales/ru_RU/LC_MESSAGES/messages.po diff --git a/app/modules/web/Controllers/AccountController.php b/app/modules/web/Controllers/AccountController.php new file mode 100644 index 00000000..195a6596 --- /dev/null +++ b/app/modules/web/Controllers/AccountController.php @@ -0,0 +1,373 @@ +. + */ + +namespace SP\Modules\Web\Controllers; + +use SP\Controller\ControllerBase; +use SP\Core\ActionsInterface; +use SP\Core\Exceptions\SPException; +use SP\Core\SessionUtil; +use SP\Http\Request; +use SP\Http\Response; +use SP\Mgmt\Files\FileUtil; +use SP\Modules\Web\Controllers\Helpers\AccountHelper; +use SP\Modules\Web\Controllers\Helpers\AccountSearchHelper; +use SP\Mvc\Controller\CrudControllerInterface; + +/** + * Class AccountController + * + * @package SP\Modules\Web\Controllers + */ +class AccountController extends ControllerBase implements CrudControllerInterface +{ + /** + * Index action + */ + public function indexAction() + { + try { + $AccountSearchHelper = new AccountSearchHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $AccountSearchHelper->getSearchBox(); + $AccountSearchHelper->getSearch(); + + $this->eventDispatcher->notifyEvent('show.account.search', $this); + + $this->view(); + } catch (SPException $e) { + $this->showError(self::ERR_EXCEPTION); + } + } + + /** + * Search action + */ + public function searchAction() + { + try { + $AccountSearchHelper = new AccountSearchHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $AccountSearchHelper->getSearch(); + + $this->eventDispatcher->notifyEvent('show.account.search', $this); + + $data = [ + 'sk' => SessionUtil::getSessionKey(), + 'html' => $this->render() + ]; + + Response::printJson($data, 0); + } catch (SPException $e) { + $this->showError(self::ERR_EXCEPTION); + } + } + + /** + * View action + * + * @param $id + */ + public function viewAction($id) + { + try { + $AccountHelper = new AccountHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $AccountHelper->setAccountData($id, ActionsInterface::ACTION_ACC_VIEW); + + // Obtener los datos de la cuenta antes y comprobar el acceso + if (!$AccountHelper->checkAccess($this)) { + return; + } + + $this->view->addTemplate('account'); + $this->view->assign('title', + [ + 'class' => 'titleNormal', + 'name' => __('Detalles de Cuenta'), + 'icon' => $this->icons->getIconView()->getIcon() + ] + ); + + $this->view->assign('isView', true); + + $AccountHelper->getAccount()->incrementViewCounter(); + $AccountHelper->setCommonData(); + + $this->eventDispatcher->notifyEvent('show.account.view', $this); + + $this->view(); + } catch (SPException $e) { + $this->showError(self::ERR_EXCEPTION); + } + } + + /** + * Obtener los datos para la vista de archivos de una cuenta + * + * @param int $id + * @return bool|void + */ + public function listFilesAction($id) + { + if (!$this->configData->isFilesEnabled()) { + die(__('Gestión de archivos deshabilitada')); + } + + try { + $this->setAction(ActionsInterface::ACTION_ACC_FILES); + + $this->view->addTemplate('files-list', 'account'); + + $this->view->assign('accountId', $id); + $this->view->assign('deleteEnabled', Request::analyze('del', 0)); + $this->view->assign('files', FileUtil::getAccountFiles($id)); + $this->view->assign('sk', SessionUtil::getSessionKey(true)); + + if (!is_array($this->view->files) || count($this->view->files) === 0) { + return; + } + + $this->eventDispatcher->notifyEvent('show.account.listfiles', $this); + + $this->view(); + } catch (SPException $e) { + $this->showError(self::ERR_EXCEPTION); + } + } + + /** + * Create action + */ + public function createAction() + { + try { + $AccountHelper = new AccountHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $AccountHelper->setActionId(ActionsInterface::ACTION_ACC_NEW); + + // Obtener los datos de la cuenta antes y comprobar el acceso + if (!$AccountHelper->checkAccess($this)) { + return; + } + + $this->view->addTemplate('account'); + $this->view->assign('title', + [ + 'class' => 'titleGreen', + 'name' => __('Nueva Cuenta'), + 'icon' => $this->icons->getIconAdd()->getIcon() + ] + ); + +// SessionFactory::setLastAcountId(0); + $AccountHelper->setCommonData(); + + $this->eventDispatcher->notifyEvent('show.account.new', $this); + + $this->view(); + } catch (SPException $e) { + $this->showError(self::ERR_EXCEPTION); + } + } + + /** + * Edit action + * + * @param $id + */ + public function editAction($id) + { + try { + $AccountHelper = new AccountHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $AccountHelper->setAccountData($id, ActionsInterface::ACTION_ACC_EDIT); + + // Obtener los datos de la cuenta antes y comprobar el acceso + if (!$AccountHelper->checkAccess($this)) { + return; + } + + $this->view->addTemplate('account'); + $this->view->assign('title', + [ + 'class' => 'titleOrange', + 'name' => __('Editar Cuenta'), + 'icon' => $this->icons->getIconEdit()->getIcon() + ] + ); + + $AccountHelper->getAccount()->incrementViewCounter(); + $AccountHelper->setCommonData(); + + $this->eventDispatcher->notifyEvent('show.account.edit', $this); + + $this->view(); + } catch (SPException $e) { + $this->showError(self::ERR_EXCEPTION); + } + } + + /** + * Save or modify action + * + * @param $id + */ + public function saveAction($id) + { + // TODO: Implement saveAction() method. + } + + /** + * Delete action + * + * @param $id + */ + public function deleteAction($id) + { + try { + $AccountHelper = new AccountHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $AccountHelper->setAccountData($id, ActionsInterface::ACTION_ACC_DELETE); + + // Obtener los datos de la cuenta antes y comprobar el acceso + if (!$AccountHelper->checkAccess($this)) { + return; + } + + $this->view->addTemplate('account'); + $this->view->assign('title', + [ + 'class' => 'titleRed', + 'name' => __('Eliminar Cuenta'), + 'icon' => $this->icons->getIconDelete()->getIcon() + ] + ); + + $AccountHelper->setCommonData(); + + $this->eventDispatcher->notifyEvent('show.account.delete', $this); + + $this->view(); + } catch (SPException $e) { + $this->showError(self::ERR_EXCEPTION); + } + } + + /** + * Obtener los datos para mostrar el interface para modificar la clave de cuenta + * + * @param $id + */ + public function editPassAction($id) + { + try { + $AccountHelper = new AccountHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $AccountHelper->setAccountData($id, ActionsInterface::ACTION_ACC_EDIT_PASS); + + // Obtener los datos de la cuenta antes y comprobar el acceso + if (!$AccountHelper->checkAccess($this)) { + return; + } + + $this->view->addTemplate('account-editpass'); + $this->view->assign('title', + [ + 'class' => 'titleOrange', + 'name' => __('Modificar Clave de Cuenta'), + 'icon' => $this->icons->getIconEditPass()->getIcon() + ] + ); + + $this->view->assign('accountPassDateChange', gmdate('Y-m-d', $AccountHelper->getAccount()->getAccountData()->getAccountPassDateChange())); + + $this->eventDispatcher->notifyEvent('show.account.editpass', $this); + + $this->view(); + } catch (SPException $e) { + $this->showError(self::ERR_EXCEPTION); + } + } + + /** + * Obtener los datos para mostrar el interface para ver cuenta en fecha concreta + * + * @param $id + */ + public function viewHistoryAction($id) + { + try { + $AccountHelper = new AccountHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $AccountHelper->setAccountDataHistory($id, ActionsInterface::ACTION_ACC_VIEW_HISTORY); + + // Obtener los datos de la cuenta antes y comprobar el acceso + if (!$AccountHelper->checkAccess($this)) { + return; + } + + $this->view->addTemplate('account'); + $this->view->assign('title', + [ + 'class' => 'titleNormal', + 'name' => __('Detalles de Cuenta'), + 'icon' => 'access_time' + ] + ); + + $this->view->assign('isView', true); + $AccountHelper->getAccount()->setAccountIsHistory(1); + + $AccountHelper->setCommonData(); + + $this->eventDispatcher->notifyEvent('show.account.viewhistory', $this); + + $this->view(); + } catch (SPException $e) { + $this->showError(self::ERR_EXCEPTION); + } + } + + /** + * Obtener los datos para mostrar el interface de solicitud de cambios en una cuenta + * + * @param $id + */ + public function requestAccessAction($id) + { + try { + $AccountHelper = new AccountHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $AccountHelper->setAccountDataHistory($id, ActionsInterface::ACTION_ACC_REQUEST); + + $this->view->addTemplate('request'); + + $this->eventDispatcher->notifyEvent('show.account.request', $this); + + $this->view(); + } catch (SPException $e) { + $this->showError(self::ERR_EXCEPTION); + } + } + + /** + * Initialize class + */ + protected function initialize() + { + $this->checkLoggedIn(); + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/BootstrapController.php b/app/modules/web/Controllers/BootstrapController.php new file mode 100644 index 00000000..88e7e780 --- /dev/null +++ b/app/modules/web/Controllers/BootstrapController.php @@ -0,0 +1,75 @@ +. + */ + +namespace SP\Modules\Web\Controllers; + +use Exception; +use SP\Auth\Browser\Browser; +use SP\Bootstrap; +use SP\Core\CryptPKI; +use SP\Core\Plugin\PluginUtil; +use SP\Core\SessionFactory; +use SP\Http\Cookies; +use SP\Http\Response; + +/** + * Class BootstrapController + * + * @package SP\Modules\Web\Controllers + */ +class BootstrapController extends SimpleControllerBase +{ + /** + * Returns environment data + */ + public function getEnvironmentAction() + { + $configData = $this->config->getConfigData(); + + $data = [ + 'lang' => require PUBLIC_PATH . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'strings.js.php', + 'locale' => $configData->getSiteLang(), + 'app_root' => Bootstrap::$WEBURI, + 'pk' => '', + 'max_file_size' => $configData->getFilesAllowedSize(), + 'check_updates' => $this->session->getAuthCompleted() + && ($configData->isCheckUpdates() || $configData->isChecknotices()) + && ($this->session->getUserData()->isUserIsAdminApp() || $configData->isDemoEnabled()), + 'timezone' => date_default_timezone_get(), + 'debug' => DEBUG || $configData->isDebug(), + 'cookies_enabled' => Cookies::checkCookies(), + 'plugins' => PluginUtil::getEnabledPlugins(), + 'loggedin' => $this->session->isLoggedIn(), + 'authbasic_autologin' => Browser::getServerAuthUser() && $configData->isAuthBasicAutoLoginEnabled() + ]; + + try { + $CryptPKI = new CryptPKI(); + $data['pk'] = SessionFactory::getPublicKey() ?: $CryptPKI->getPublicKey(); + } catch (Exception $e) { + } + + Response::printJson($data, 0); + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/Helpers/AccountHelper.php b/app/modules/web/Controllers/Helpers/AccountHelper.php new file mode 100644 index 00000000..007c9d66 --- /dev/null +++ b/app/modules/web/Controllers/Helpers/AccountHelper.php @@ -0,0 +1,288 @@ +. + */ + +namespace SP\Modules\Web\Controllers\Helpers; + +use SP\Account\Account; +use SP\Account\AccountAcl; +use SP\Account\AccountHistory; +use SP\Account\AccountUtil; +use SP\Account\UserAccounts; +use SP\Controller\ControllerBase; +use SP\Core\Acl; +use SP\Core\ActionsInterface; +use SP\Core\Init; +use SP\Core\SessionUtil; +use SP\DataModel\AccountExtData; +use SP\DataModel\CustomFieldData; +use SP\Mgmt\Categories\Category; +use SP\Mgmt\Customers\Customer; +use SP\Mgmt\CustomFields\CustomField; +use SP\Mgmt\Groups\Group; +use SP\Mgmt\Groups\GroupAccountsUtil; +use SP\Mgmt\PublicLinks\PublicLink; +use SP\Mgmt\Tags\Tag; +use SP\Mgmt\Users\UserPass; +use SP\Mgmt\Users\UserUtil; +use SP\Util\Json; + +/** + * Class AccountHelper + * + * @package SP\Modules\Web\Controllers\Helpers + */ +class AccountHelper extends HelperBase +{ + /** @var Acl */ + protected $acl; + /** + * @var string + */ + private $actionId; + /** + * @var AccountAcl + */ + private $AccountAcl; + /** + * @var Account|AccountHistory instancia para el manejo de datos de una cuenta + */ + private $Account; + /** + * @var int con el id de la cuenta + */ + private $id; + /** + * @var AccountExtData + */ + private $AccountData; + + /** + * @param Acl $acl + */ + public function inject(Acl $acl) + { + $this->acl = $acl; + } + + /** + * Establecer las variables que contienen la información de la cuenta. + * + * @param $accountId + * @param $actionId + * @throws \SP\Core\Exceptions\SPException + */ + public function setAccountData($accountId, $actionId) + { + $this->id = $accountId; + $this->actionId = $actionId; + + $Account = new Account(new AccountExtData($accountId)); + $this->Account = $Account; + $this->AccountData = $Account->getData(); + + $this->view->assign('accountId', $this->id); + $this->view->assign('accountData', $this->AccountData); + $this->view->assign('gotData', $this->isGotData()); + } + + /** + * @return boolean + */ + private function isGotData() + { + return $this->AccountData !== null; + } + + /** + * Establecer las variables que contienen la información de la cuenta en una fecha concreta. + * + * @param $accountId + * @param $actionId + * @throws \SP\Core\Exceptions\SPException + */ + public function setAccountDataHistory($accountId, $actionId) + { + $this->id = $accountId; + $this->actionId = $actionId; + + $Account = new AccountHistory(new AccountExtData()); + $Account->setId($accountId); + $this->Account = $Account; + $this->AccountData = $Account->getData(); + + $this->view->assign('accountId', $this->AccountData->getAccountId()); + $this->view->assign('accountData', $this->AccountData); + $this->view->assign('gotData', $this->isGotData()); + $this->view->assign('accountHistoryId', $accountId); + } + + /** + * @return AccountAcl + */ + public function getAccountAcl() + { + return $this->AccountAcl; + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Establecer variables comunes del formulario para todos los interfaces + * + * @throws \SP\Core\Exceptions\SPException + */ + public function setCommonData() + { + $userProfileData = $this->session->getUserProfile(); + + $this->getCustomFieldsForItem(); + + if ($this->isGotData()) { + $this->view->assign('accountIsHistory', $this->getAccount()->getAccountIsHistory()); + $this->view->assign('accountOtherUsers', UserAccounts::getUsersInfoForAccount($this->id)); + $this->view->assign('accountOtherGroups', GroupAccountsUtil::getGroupsInfoForAccount($this->id)); + $this->view->assign('accountTagsJson', Json::getJson(array_keys($this->getAccount()->getAccountData()->getTags()))); + $this->view->assign('historyData', AccountHistory::getAccountList($this->AccountData->getAccountId())); + $this->view->assign('isModified', strtotime($this->AccountData->getAccountDateEdit()) !== false); + $this->view->assign('maxFileSize', round($this->configData->getFilesAllowedSize() / 1024, 1)); + $this->view->assign('filesAllowedExts', implode(',', $this->configData->getFilesAllowedExts())); + + $PublicLinkData = PublicLink::getItem()->getHashForItem($this->id); + + $publicLinkUrl = ($this->configData->isPublinksEnabled() && $PublicLinkData ? Init::$WEBURI . '/index.php?h=' . $PublicLinkData->getPublicLinkHash() . '&a=link' : null); + $this->view->assign('publicLinkUrl', $publicLinkUrl); + $this->view->assign('publicLinkId', $PublicLinkData ? $PublicLinkData->getPublicLinkId() : 0); + + $this->view->assign('accountPassDate', date('Y-m-d H:i:s', $this->AccountData->getAccountPassDate())); + $this->view->assign('accountPassDateChange', date('Y-m-d', $this->AccountData->getAccountPassDateChange() ?: 0)); + } else { + $this->view->assign('accountPassDateChange', date('Y-m-d', time() + 7776000)); + } + + $this->view->assign('actionId', Acl::getActionRoute($this->actionId)); + $this->view->assign('categories', Category::getItem()->getItemsForSelect()); + $this->view->assign('customers', Customer::getItem()->getItemsForSelectByUser()); + $this->view->assign('otherUsers', UserUtil::getUsersLogin()); + $this->view->assign('otherUsersJson', Json::getJson($this->view->otherUsers)); + $this->view->assign('otherGroups', Group::getItem()->getItemsForSelect()); + $this->view->assign('otherGroupsJson', Json::getJson($this->view->otherGroups)); + $this->view->assign('tagsJson', Json::getJson(Tag::getItem()->getItemsForSelect())); + $this->view->assign('allowPrivate', $userProfileData->isAccPrivate()); + $this->view->assign('allowPrivateGroup', $userProfileData->isAccPrivateGroup()); + $this->view->assign('mailRequestEnabled', $this->configData->isMailRequestsEnabled()); + $this->view->assign('passToImageEnabled', $this->configData->isAccountPassToImage()); + + $this->view->assign('otherAccounts', AccountUtil::getAccountsForUser($this->id, $this->session)); + $this->view->assign('linkedAccounts', AccountUtil::getLinkedAccounts($this->id, $this->session)); + + $this->view->assign('addCustomerEnabled', $this->acl->checkUserAccess(ActionsInterface::ACTION_MGM_CUSTOMERS)); + $this->view->assign('addCategoryEnabled', $this->acl->checkUserAccess(ActionsInterface::ACTION_MGM_CATEGORIES)); + + $this->view->assign('disabled', $this->view->isView ? 'disabled' : ''); + $this->view->assign('readonly', $this->view->isView ? 'readonly' : ''); + + $this->view->assign('showViewCustomPass', $this->AccountAcl->isShowViewPass()); + $this->view->assign('AccountAcl', $this->AccountAcl); + } + + /** + * Obtener la lista de campos personalizados y sus valores + */ + private function getCustomFieldsForItem() + { + $this->view->assign('customFields', CustomField::getItem(new CustomFieldData(ActionsInterface::ACTION_ACC))->getById($this->id)); + } + + /** + * @return \SP\Account\Account|AccountHistory + */ + public function getAccount() + { + return $this->Account ?: new Account(new AccountExtData()); + } + + /** + * Comprobar si el usuario dispone de acceso al módulo + * + * @param ControllerBase $controller + * @return bool + */ + public function checkAccess(ControllerBase $controller) + { + $this->view->assign('showLogo', false); + + $Acl = new AccountAcl($this->Account, $this->actionId); + $this->AccountAcl = $Acl; + + if (!$this->acl->checkUserAccess($this->actionId)) { + $controller->showError(ControllerBase::ERR_PAGE_NO_PERMISSION); + return false; + } + + if (!UserPass::checkUserUpdateMPass($this->session->getUserData()->getUserId())) { + $controller->showError(ControllerBase::ERR_UPDATE_MPASS); + return false; + } + + if ($this->id > 0) { + $this->AccountAcl = $Acl->getAcl(); + + if (!$this->AccountAcl->checkAccountAccess()) { + $controller->showError(ControllerBase::ERR_ACCOUNT_NO_PERMISSION); + return false; + } + +// SessionFactory::setAccountAcl($this->AccountAcl->save()); + } + + return true; + } + + /** + * @param string $actionId + */ + public function setActionId($actionId) + { + $this->actionId = $actionId; + } + + /** + * Initialize + */ + protected function initialize() + { + $this->view->assign('changesHash'); + $this->view->assign('chkUserEdit'); + $this->view->assign('chkGroupEdit'); + $this->view->assign('gotData', $this->isGotData()); + $this->view->assign('isView', false); + $this->view->assign('sk', SessionUtil::getSessionKey(true)); + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/Helpers/AccountSearchHelper.php b/app/modules/web/Controllers/Helpers/AccountSearchHelper.php new file mode 100644 index 00000000..c737e6f9 --- /dev/null +++ b/app/modules/web/Controllers/Helpers/AccountSearchHelper.php @@ -0,0 +1,383 @@ +. + */ + +namespace SP\Modules\Web\Controllers\Helpers; + +use SP\Account\AccountSearch; +use SP\Account\AccountsSearchItem; +use SP\Core\ActionsInterface; +use SP\Core\SessionUtil; +use SP\Html\DataGrid\DataGrid; +use SP\Html\DataGrid\DataGridAction; +use SP\Html\DataGrid\DataGridActionSearch; +use SP\Html\DataGrid\DataGridActionType; +use SP\Html\DataGrid\DataGridData; +use SP\Html\DataGrid\DataGridHeaderSort; +use SP\Html\DataGrid\DataGridPager; +use SP\Html\DataGrid\DataGridSort; +use SP\Http\Request; +use SP\Mgmt\Categories\Category; +use SP\Mgmt\Customers\Customer; +use SP\Mgmt\Tags\Tag; + +/** + * Class AccountSearch + * + * @package SP\Modules\Web\Controllers\Helpers + */ +class AccountSearchHelper extends HelperBase +{ + /** @var bool Indica si el filtrado de cuentas está activo */ + private $filterOn = false; + /** @var string */ + private $sk; + /** @var int */ + private $queryTimeStart = 0; + /** @var bool */ + private $isAjax = false; + /** @var AccountSearch */ + private $search; + + /** + * @param boolean $isAjax + */ + public function setIsAjax($isAjax) + { + $this->isAjax = $isAjax; + } + + /** + * Obtener los datos para la caja de búsqueda + */ + public function getSearchBox() + { + $this->view->addTemplate('search-searchbox'); + + $this->view->assign('customers', Customer::getItem()->getItemsForSelectByUser()); + $this->view->assign('categories', Category::getItem()->getItemsForSelect()); + $this->view->assign('tags', Tag::getItem()->getItemsForSelect()); + } + + /** + * Obtener los resultados de una búsqueda + * + * @throws \InvalidArgumentException + * @throws \ReflectionException + * @throws \Psr\Container\ContainerExceptionInterface + */ + public function getSearch() + { + $this->view->addTemplate('search-index'); + + $this->view->assign('isAjax', $this->isAjax); + + $this->filterOn = ($this->search->getSortKey() > 1 + || $this->search->getCustomerId() + || $this->search->getCategoryId() + || $this->search->getTagsId() + || $this->search->getTxtSearch() + || $this->search->isSearchFavorites() + || $this->search->isSortViews()); + + $UserPreferences = $this->session->getUserPreferences(); + + AccountsSearchItem::$accountLink = $UserPreferences->isAccountLink(); + AccountsSearchItem::$topNavbar = $UserPreferences->isTopNavbar(); + AccountsSearchItem::$optionalActions = $UserPreferences->isOptionalActions(); + AccountsSearchItem::$wikiEnabled = $this->configData->isWikiEnabled(); + AccountsSearchItem::$dokuWikiEnabled = $this->configData->isDokuwikiEnabled(); + AccountsSearchItem::$isDemoMode = $this->configData->isDemoEnabled(); + + if (AccountsSearchItem::$wikiEnabled) { + $wikiFilter = array_map(function ($value) { + return preg_quote($value, '/'); + }, $this->configData->getWikiFilter()); + + $this->view->assign('wikiFilter', implode('|', $wikiFilter)); + $this->view->assign('wikiPageUrl', $this->configData->getWikiPageurl()); + } + + $Grid = $this->getGrid(); + $Grid->getData()->setData($this->search->processSearchResults()); + $Grid->updatePager(); + $Grid->setTime(round(microtime() - $this->queryTimeStart, 5)); + + + // Establecer el filtro de búsqueda en la sesión como un objeto + $this->session->setSearchFilters($this->search); + + $this->view->assign('data', $Grid); + } + + /** + * Devuelve la matriz a utilizar en la vista + * + * @return DataGrid + * @throws \Psr\Container\ContainerExceptionInterface + * @throws \ReflectionException + */ + private function getGrid() + { + $icons = $this->view->getTheme()->getIcons(); + + $GridActionView = new DataGridAction(); + $GridActionView->setId(ActionsInterface::ACTION_ACC_VIEW); + $GridActionView->setType(DataGridActionType::VIEW_ITEM); + $GridActionView->setName(__('Detalles de Cuenta')); + $GridActionView->setTitle(__('Detalles de Cuenta')); + $GridActionView->setIcon($icons->getIconView()); + $GridActionView->setReflectionFilter(AccountsSearchItem::class, 'isShowView'); + $GridActionView->addData('action-id', 'account/view'); + $GridActionView->addData('action-sk', $this->sk); + $GridActionView->addData('onclick', 'account/view'); + + $GridActionViewPass = new DataGridAction(); + $GridActionViewPass->setId(ActionsInterface::ACTION_ACC_VIEW_PASS); + $GridActionViewPass->setType(DataGridActionType::VIEW_ITEM); + $GridActionViewPass->setName(__('Ver Clave')); + $GridActionViewPass->setTitle(__('Ver Clave')); + $GridActionViewPass->setIcon($icons->getIconViewPass()); + $GridActionViewPass->setReflectionFilter(AccountsSearchItem::class, 'isShowViewPass'); + $GridActionViewPass->addData('action-id', 'account/showpass'); + $GridActionViewPass->addData('action-full', 1); + $GridActionViewPass->addData('action-sk', $this->sk); + $GridActionViewPass->addData('onclick', 'account/showpass'); + + // Añadir la clase para usar el portapapeles + $ClipboardIcon = $icons->getIconClipboard()->setClass('clip-pass-button'); + + $GridActionCopyPass = new DataGridAction(); + $GridActionCopyPass->setId(ActionsInterface::ACTION_ACC_VIEW_PASS); + $GridActionCopyPass->setType(DataGridActionType::VIEW_ITEM); + $GridActionCopyPass->setName(__('Copiar Clave en Portapapeles')); + $GridActionCopyPass->setTitle(__('Copiar Clave en Portapapeles')); + $GridActionCopyPass->setIcon($ClipboardIcon); + $GridActionCopyPass->setReflectionFilter(AccountsSearchItem::class, 'isShowCopyPass'); + $GridActionCopyPass->addData('action-id', 'account/showpass'); + $GridActionCopyPass->addData('action-full', 0); + $GridActionCopyPass->addData('action-sk', $this->sk); + $GridActionCopyPass->addData('useclipboard', '1'); + + $GridActionEdit = new DataGridAction(); + $GridActionEdit->setId(ActionsInterface::ACTION_ACC_EDIT); + $GridActionEdit->setType(DataGridActionType::EDIT_ITEM); + $GridActionEdit->setName(__('Editar Cuenta')); + $GridActionEdit->setTitle(__('Editar Cuenta')); + $GridActionEdit->setIcon($icons->getIconEdit()); + $GridActionEdit->setReflectionFilter(AccountsSearchItem::class, 'isShowEdit'); + $GridActionEdit->addData('action-id', ActionsInterface::ACTION_ACC_EDIT); + $GridActionEdit->addData('action-sk', $this->sk); + $GridActionEdit->addData('onclick', 'account/edit'); + + $GridActionCopy = new DataGridAction(); + $GridActionCopy->setId(ActionsInterface::ACTION_ACC_COPY); + $GridActionCopy->setType(DataGridActionType::NEW_ITEM); + $GridActionCopy->setName(__('Copiar Cuenta')); + $GridActionCopy->setTitle(__('Copiar Cuenta')); + $GridActionCopy->setIcon($icons->getIconCopy()); + $GridActionCopy->setReflectionFilter(AccountsSearchItem::class, 'isShowCopy'); + $GridActionCopy->addData('action-id', ActionsInterface::ACTION_ACC_COPY); + $GridActionCopy->addData('action-sk', $this->sk); + $GridActionCopy->addData('onclick', 'account/copy'); + + $GridActionDel = new DataGridAction(); + $GridActionDel->setId(ActionsInterface::ACTION_ACC_DELETE); + $GridActionDel->setType(DataGridActionType::DELETE_ITEM); + $GridActionDel->setName(__('Eliminar Cuenta')); + $GridActionDel->setTitle(__('Eliminar Cuenta')); + $GridActionDel->setIcon($icons->getIconDelete()); + $GridActionDel->setReflectionFilter(AccountsSearchItem::class, 'isShowDelete'); + $GridActionDel->addData('action-id', ActionsInterface::ACTION_ACC_DELETE); + $GridActionDel->addData('action-sk', $this->sk); + $GridActionDel->addData('onclick', 'account/delete'); + + $GridActionRequest = new DataGridAction(); + $GridActionRequest->setId(ActionsInterface::ACTION_ACC_REQUEST); + $GridActionRequest->setName(__('Solicitar Modificación')); + $GridActionRequest->setTitle(__('Solicitar Modificación')); + $GridActionRequest->setIcon($icons->getIconEmail()); + $GridActionRequest->setReflectionFilter(AccountsSearchItem::class, 'isShowRequest'); + $GridActionRequest->addData('action-id', ActionsInterface::ACTION_ACC_REQUEST); + $GridActionRequest->addData('action-sk', $this->sk); + $GridActionRequest->addData('onclick', 'account/show'); + + $GridActionOptional = new DataGridAction(); + $GridActionOptional->setId(0); + $GridActionOptional->setName(__('Más Acciones')); + $GridActionOptional->setTitle(__('Más Acciones')); + $GridActionOptional->setIcon($icons->getIconOptional()); + $GridActionOptional->setReflectionFilter(AccountsSearchItem::class, 'isShowOptional'); + $GridActionOptional->addData('onclick', 'account/menu'); + + $GridPager = new DataGridPager(); + $GridPager->setIconPrev($icons->getIconNavPrev()); + $GridPager->setIconNext($icons->getIconNavNext()); + $GridPager->setIconFirst($icons->getIconNavFirst()); + $GridPager->setIconLast($icons->getIconNavLast()); + $GridPager->setSortKey($this->search->getSortKey()); + $GridPager->setSortOrder($this->search->getSortOrder()); + $GridPager->setLimitStart($this->search->getLimitStart()); + $GridPager->setLimitCount($this->search->getLimitCount()); + $GridPager->setOnClickFunction('account/sort'); + $GridPager->setFilterOn($this->filterOn); + $GridPager->setSourceAction(new DataGridActionSearch(ActionsInterface::ACTION_ACC_SEARCH)); + + $UserPreferences = $this->session->getUserPreferences(); + + $showOptionalActions = $UserPreferences->isOptionalActions() || $UserPreferences->isResultsAsCards() || ($UserPreferences->getUserId() === 0 && $this->configData->isResultsAsCards()); + + $Grid = new DataGrid(); + $Grid->setId('gridSearch'); + $Grid->setDataHeaderTemplate('search-header', $this->view->getBase()); + $Grid->setDataRowTemplate('search-rows', $this->view->getBase()); + $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid'); + $Grid->setHeader($this->getHeaderSort()); + $Grid->setDataActions($GridActionView); + $Grid->setDataActions($GridActionViewPass); + $Grid->setDataActions($GridActionCopyPass); + $Grid->setDataActions($GridActionEdit, !$showOptionalActions); + $Grid->setDataActions($GridActionCopy, !$showOptionalActions); + $Grid->setDataActions($GridActionDel, !$showOptionalActions); + $Grid->setDataActions($GridActionRequest); + $Grid->setPager($GridPager); + $Grid->setData(new DataGridData()); + + return $Grid; + } + + /** + * Devolver la cabecera con los campos de ordenación + * + * @return DataGridHeaderSort + */ + private function getHeaderSort() + { + $icons = $this->view->getTheme()->getIcons(); + + $GridSortCustomer = new DataGridSort(); + $GridSortCustomer->setName(__('Cliente')) + ->setTitle(__('Ordenar por Cliente')) + ->setSortKey(AccountSearch::SORT_CUSTOMER) + ->setIconUp($icons->getIconUp()) + ->setIconDown($icons->getIconDown()); + + $GridSortName = new DataGridSort(); + $GridSortName->setName(__('Nombre')) + ->setTitle(__('Ordenar por Nombre')) + ->setSortKey(AccountSearch::SORT_NAME) + ->setIconUp($icons->getIconUp()) + ->setIconDown($icons->getIconDown()); + + $GridSortCategory = new DataGridSort(); + $GridSortCategory->setName(__('Categoría')) + ->setTitle(__('Ordenar por Categoría')) + ->setSortKey(AccountSearch::SORT_CATEGORY) + ->setIconUp($icons->getIconUp()) + ->setIconDown($icons->getIconDown()); + + $GridSortLogin = new DataGridSort(); + $GridSortLogin->setName(__('Usuario')) + ->setTitle(__('Ordenar por Usuario')) + ->setSortKey(AccountSearch::SORT_LOGIN) + ->setIconUp($icons->getIconUp()) + ->setIconDown($icons->getIconDown()); + + $GridSortUrl = new DataGridSort(); + $GridSortUrl->setName(__('URL / IP')) + ->setTitle(__('Ordenar por URL / IP')) + ->setSortKey(AccountSearch::SORT_URL) + ->setIconUp($icons->getIconUp()) + ->setIconDown($icons->getIconDown()); + + $GridHeaderSort = new DataGridHeaderSort(); + $GridHeaderSort->addSortField($GridSortCustomer) + ->addSortField($GridSortName) + ->addSortField($GridSortCategory) + ->addSortField($GridSortLogin) + ->addSortField($GridSortUrl); + + return $GridHeaderSort; + } + + /** + * Initialize + * + * @throws \Psr\Container\ContainerExceptionInterface + */ + protected function initialize() + { + $this->queryTimeStart = microtime(); + $this->sk = SessionUtil::getSessionKey(true); + $this->view->assign('sk', $this->sk); + $this->setVars(); + } + + /** + * Establecer las variables necesarias para las plantillas + */ + private function setVars() + { + $userData = $this->session->getUserData(); + + $this->view->assign('isAdmin', $userData->isUserIsAdminApp() || $userData->isUserIsAdminAcc()); + $this->view->assign('showGlobalSearch', $this->configData->isGlobalSearch() && $this->session->getUserProfile()->isAccGlobalSearch()); + + // Obtener el filtro de búsqueda desde la sesión + $this->search = $this->getFilters(); + + $this->view->assign('searchCustomer', $this->search->getCustomerId()); + $this->view->assign('searchCategory', $this->search->getCategoryId()); + $this->view->assign('searchTags', $this->search->getTagsId()); + $this->view->assign('searchTxt', $this->search->getTxtSearch()); + $this->view->assign('searchGlobal', $this->search->getGlobalSearch()); + $this->view->assign('searchFavorites', $this->search->isSearchFavorites()); + } + + /** + * Set search filters + * + * @return AccountSearch + */ + private function getFilters() + { + if (empty(Request::analyze('sk'))) { + // Obtener el filtro de búsqueda desde la sesión + return $this->session->getSearchFilters(); + } + + $this->search = new AccountSearch(); + $this->search->setSortKey(Request::analyze('skey', 0)); + $this->search->setSortOrder(Request::analyze('sorder', 0)); + $this->search->setLimitStart(Request::analyze('start', 0)); + $this->search->setLimitCount(Request::analyze('rpp', 0)); + $this->search->setGlobalSearch(Request::analyze('gsearch', false)); + $this->search->setCustomerId(Request::analyze('customer', 0)); + $this->search->setCategoryId(Request::analyze('category', 0)); + $this->search->setTagsId(Request::analyze('tags')); + $this->search->setSearchFavorites(Request::analyze('searchfav', false)); + $this->search->setTxtSearch(Request::analyze('search')); + + return $this->search; + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/Helpers/HelperBase.php b/app/modules/web/Controllers/Helpers/HelperBase.php new file mode 100644 index 00000000..a6f52126 --- /dev/null +++ b/app/modules/web/Controllers/Helpers/HelperBase.php @@ -0,0 +1,81 @@ +. + */ + +namespace SP\Modules\Web\Controllers\Helpers; + +use SP\Config\Config; +use SP\Config\ConfigData; +use SP\Core\Events\EventDispatcher; +use SP\Core\Session\Session; +use SP\Core\Template; +use SP\Core\Traits\InjectableTrait; + +/** + * Class HelperBase + * + * @package SP\Modules\Web\Controllers\Helpers + */ +abstract class HelperBase +{ + use InjectableTrait; + + /** + * @var Template + */ + protected $view; + /** + * @var ConfigData + */ + protected $configData; + /** + * @var Session + */ + protected $session; + /** + * @var EventDispatcher + */ + protected $eventDispatcher; + + /** + * Constructor + * + * @param Template $template + * @param Config $config + * @param Session $session + * @param EventDispatcher $eventDispatcher + */ + final public function __construct(Template $template, Config $config, Session $session, EventDispatcher $eventDispatcher) + { + $this->injectDependencies(); + + $this->view = $template; + $this->configData = $config->getConfigData(); + $this->session = $session; + $this->eventDispatcher = $eventDispatcher; + + if (method_exists($this, 'initialize')) { + $this->initialize(); + } + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/Helpers/LayoutHelper.php b/app/modules/web/Controllers/Helpers/LayoutHelper.php new file mode 100644 index 00000000..b85b3481 --- /dev/null +++ b/app/modules/web/Controllers/Helpers/LayoutHelper.php @@ -0,0 +1,292 @@ +. + */ + +namespace SP\Modules\Web\Controllers\Helpers; + +use SP\Bootstrap; +use SP\Core\Acl; +use SP\Core\ActionsInterface; +use SP\Core\Exceptions\SPException; +use SP\Core\Language; +use SP\Core\Plugin\PluginUtil; +use SP\Core\SessionUtil; +use SP\Core\UI\Theme; +use SP\Core\UI\ThemeInterface; +use SP\Html\DataGrid\DataGridAction; +use SP\Mgmt\Notices\Notice; +use SP\Util\Checks; +use SP\Util\Util; + +/** + * Class LayoutHelper + * + * @package SP\Modules\Web\Controllers\Helpers + */ +class LayoutHelper extends HelperBase +{ + /** @var bool */ + protected $loggedIn; + /** @var ThemeInterface */ + protected $theme; + + /** + * @param Theme $theme + */ + public function inject(Theme $theme) + { + $this->theme = $theme; + } + + /** + * Inicializar las variables para la vista principal de la aplicación + */ + public function initBody() + { + $this->view->assign('startTime', microtime()); + + $this->view->addPartial('header'); + $this->view->addPartial('body-start'); + + $this->view->assign('useLayout', true); + $this->view->assign('isInstalled', $this->configData->isInstalled()); + $this->view->assign('sk', SessionUtil::getSessionKey(true)); + $this->view->assign('appInfo', Util::getAppInfo()); + $this->view->assign('appVersion', Util::getVersionString()); + $this->view->assign('isDemoMode', $this->configData->isDemoEnabled()); + $this->view->assign('icons', $this->theme->getIcons()); + $this->view->assign('logoIcon', Bootstrap::$WEBURI . '/public/images/logo_icon.png'); + $this->view->assign('logoNoText', Bootstrap::$WEBURI . '/public/images/logo_icon.svg'); + $this->view->assign('logo', Bootstrap::$WEBURI . '/public/images/logo_full_bg.png'); + $this->view->assign('logonobg', Bootstrap::$WEBURI . '/public/images/logo_full_nobg.png'); + $this->view->assign('httpsEnabled', Checks::httpsEnabled()); + + $this->loggedIn = $this->session->isLoggedIn(); + + $this->view->assign('loggedIn', $this->loggedIn); + $this->view->assign('lang', $this->loggedIn ? Language::$userLang : Language::$globalLang); + $this->view->assign('loadApp', $this->session->getAuthCompleted()); + + + try { + // Cargar la clave pública en la sesión + SessionUtil::loadPublicKey(); + } catch (SPException $e) { + debugLog($e->getMessage(), true); + } + + $this->getResourcesLinks(); + $this->setResponseHeaders(); + } + + /** + * Obtener los datos para la cabcera de la página + */ + protected function getResourcesLinks() + { + $version = Util::getVersionStringNormalized(); + + $jsVersionHash = md5($version); + $this->view->append('jsLinks', Bootstrap::$WEBROOT . '/public/js/js.php?v=' . $jsVersionHash); + $this->view->append('jsLinks', Bootstrap::$WEBROOT . '/public/js/js.php?g=1&v=' . $jsVersionHash); + + $themeInfo = $this->theme->getThemeInfo(); + + if (isset($themeInfo['js'])) { + $themeJsBase = urlencode($this->theme->getThemePath() . DIRECTORY_SEPARATOR . 'js'); + $themeJsFiles = urlencode(implode(',', $themeInfo['js'])); + + $this->view->append('jsLinks', Bootstrap::$WEBROOT . '/public/js/js.php?f=' . $themeJsFiles . '&b=' . $themeJsBase . '&v=' . $jsVersionHash); + } + + if ($this->loggedIn && $this->session->getUserPreferences()->getUserId() > 0) { + $resultsAsCards = $this->session->getUserPreferences()->isResultsAsCards(); + } else { + $resultsAsCards = $this->configData->isResultsAsCards(); + } + + $cssVersionHash = md5($version . $resultsAsCards); + $this->view->append('cssLinks', Bootstrap::$WEBROOT . '/public/css/css.php?v=' . $cssVersionHash); + + if (isset($themeInfo['css'])) { + if ($resultsAsCards) { + $themeInfo['css'][] = 'search-card.min.css'; + } else { + $themeInfo['css'][] = 'search-grid.min.css'; + } + + if ($this->configData->isDokuwikiEnabled()) { + $themeInfo['css'][] = 'styles-wiki.min.css'; + } + + $themeCssBase = urlencode($this->theme->getThemePath() . DIRECTORY_SEPARATOR . 'css'); + $themeCssFiles = urlencode(implode(',', $themeInfo['css'])); + + $this->view->append('cssLinks', Bootstrap::$WEBROOT . '/public/css/css.php?f=' . $themeCssFiles . '&b=' . $themeCssBase . '&v=' . $jsVersionHash); + } + + // Cargar los recursos de los plugins + foreach (PluginUtil::getLoadedPlugins() as $Plugin) { + $base = str_replace(BASE_PATH, '', $Plugin->getBase()); + $jsResources = $Plugin->getJsResources(); + $cssResources = $Plugin->getCssResources(); + + if (count($jsResources) > 0) { + $this->view->append('jsLinks', Bootstrap::$WEBROOT . '/public/js/js.php?f=' . urlencode(implode(',', $jsResources)) . '&b=' . urlencode($base . DIRECTORY_SEPARATOR . 'js') . '&v=' . $jsVersionHash); + } + + if (count($cssResources) > 0) { + $this->view->append('cssLinks', Bootstrap::$WEBROOT . '/public/css/css.php?f=' . urlencode(implode(',', $cssResources)) . '&b=' . urlencode($base . DIRECTORY_SEPARATOR . 'css') . '&v=' . $jsVersionHash); + } + } + } + + /** + * Establecer las cabeceras HTTP + */ + private function setResponseHeaders() + { + // UTF8 Headers + header('Content-Type: text/html; charset=UTF-8'); + + // Cache Control + header('Cache-Control: public, no-cache, max-age=0, must-revalidate'); + header('Pragma: public; max-age=0'); + } + + /** + * Establecer la variable de página de la vista + * + * @param $page + */ + public function setPage($page) + { + $this->view->assign('page', $page); + } + + /** + * Obtener los datos para la mostrar la barra de sesión + */ + public function getSessionBar() + { + $this->view->addPartial('sessionbar'); + + $userType = null; + + $userData = $this->session->getUserData(); + $icons = $this->theme->getIcons(); + + if ($userData->isUserIsAdminApp()) { + $userType = $icons->getIconAppAdmin(); + } elseif ($userData->isUserIsAdminAcc()) { + $userType = $icons->getIconAccAdmin(); + } + + $this->view->assign('userType', $userType); + $this->view->assign('userId', $userData->getUserId()); + $this->view->assign('userLogin', mb_strtoupper($userData->getUserLogin())); + $this->view->assign('userName', $userData->getUserName() ?: mb_strtoupper($this->view->userLogin)); + $this->view->assign('userGroup', $userData->getUsergroupName()); + $this->view->assign('showPassIcon', !($this->configData->isLdapEnabled() && $userData->isUserIsLdap())); + $this->view->assign('userNotices', count(Notice::getItem()->getAllActiveForUser())); + } + + /** + * Obtener los datos para mostrar el menú de acciones + * + * @param Acl $acl + */ + public function getMenu(Acl $acl) + { + $this->view->addPartial('body-header-menu'); + + $icons = $this->theme->getIcons(); + + $ActionSearch = new DataGridAction(); + $ActionSearch->setId('account'); + $ActionSearch->setTitle(__('Buscar')); + $ActionSearch->setIcon($icons->getIconSearch()); + $ActionSearch->setData(['historyReset' => 1, 'view' => 'search']); + + $this->view->append('actions', $ActionSearch); + + if ($acl->checkUserAccess(ActionsInterface::ACTION_ACC_NEW)) { + $ActionNew = new DataGridAction(); + $ActionNew->setId('account/create'); + $ActionNew->setTitle(__('Nueva Cuenta')); + $ActionNew->setIcon($icons->getIconAdd()); + $ActionNew->setData(['historyReset' => 0, 'view' => 'account']); + + $this->view->append('actions', $ActionNew); + } + + if ($acl->checkUserAccess(ActionsInterface::ACTION_USR)) { + $ActionUsr = new DataGridAction(); + $ActionUsr->setId('users'); + $ActionUsr->setTitle(__('Usuarios y Accesos')); + $ActionUsr->setIcon($icons->getIconAccount()); + $ActionUsr->setData(['historyReset' => 0, 'view' => 'datatabs']); + + $this->view->append('actions', $ActionUsr); + } + + if ($acl->checkUserAccess(ActionsInterface::ACTION_MGM)) { + $ActionMgm = new DataGridAction(); + $ActionMgm->setId('items'); + $ActionMgm->setTitle(__('Elementos y Personalización')); + $ActionMgm->setIcon($icons->getIconGroup()); + $ActionMgm->setData(['historyReset' => 0, 'view' => 'datatabs']); + + $this->view->append('actions', $ActionMgm); + } + + if ($acl->checkUserAccess(ActionsInterface::ACTION_CFG)) { + $ActionConfig = new DataGridAction(); + $ActionConfig->setId('config'); + $ActionConfig->setTitle(__('Configuración')); + $ActionConfig->setIcon($icons->getIconSettings()); + $ActionConfig->setData(['historyReset' => 1, 'view' => 'config']); + + $this->view->append('actions', $ActionConfig); + } + + if ($acl->checkUserAccess(ActionsInterface::ACTION_EVL) && $this->configData->isLogEnabled()) { + $ActionEventlog = new DataGridAction(); + $ActionEventlog->setId('eventlog'); + $ActionEventlog->setTitle(__('Registro de Eventos')); + $ActionEventlog->setIcon($icons->getIconHeadline()); + $ActionEventlog->setData(['historyReset' => 1, 'view' => 'eventlog']); + + $this->view->append('actions', $ActionEventlog); + } + } + + /** + * @param bool $loggedIn + */ + protected function setLoggedIn($loggedIn) + { + $this->loggedIn = (bool)$loggedIn; + $this->view->assign('loggedIn', $this->loggedIn); + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/IndexController.php b/app/modules/web/Controllers/IndexController.php new file mode 100644 index 00000000..9b5fa2ef --- /dev/null +++ b/app/modules/web/Controllers/IndexController.php @@ -0,0 +1,108 @@ +. + */ + +namespace SP\Modules\Web\Controllers; + +use SP\Controller\ControllerBase; +use SP\Http\Response; +use SP\Modules\Web\Controllers\Helpers\LayoutHelper; +use SP\Util\Util; + +/** + * Class IndexController + * + * @package SP\Modules\Web\Controllers + */ +class IndexController extends ControllerBase +{ + /** + * Index action + * + * @throws \SP\Core\Exceptions\SPException + */ + public function indexAction() + { + if (!$this->session->isLoggedIn()) { + Response::redirect('index.php?r=login'); + } else { + $LayoutHelper = new LayoutHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $LayoutHelper->setPage('main'); + $LayoutHelper->initBody(); + $LayoutHelper->getSessionBar(); + $LayoutHelper->getMenu($this->acl); + + $this->view->addPartial('body-content'); + $this->view->addPartial('body-footer'); + $this->view->addPartial('body-end'); + + $this->view(); + } + } + + /** + * Updates checking action + */ + public function checkUpdatesAction() + { + $this->checkLoggedIn(); + + $this->view->addTemplate('update'); + + $this->view->assign('hasUpdates', false); + $this->view->assign('updateStatus', null); + + if ($this->configData->isCheckUpdates()) { + $updates = Util::checkUpdates(); + + if (is_array($updates)) { + $description = nl2br($updates['description']); + $version = $updates['version']; + + $this->view->assign('hasUpdates', true); + $this->view->assign('title', $updates['title']); + $this->view->assign('url', $updates['url']); + $this->view->assign('description', sprintf('%s - %s

%s', __('Descargar nueva versión'), $version, $description)); + } else { + $this->view->assign('updateStatus', $updates); + } + } + + if ($this->configData->isChecknotices()) { + $notices = Util::checkNotices(); + $numNotices = count($notices); + $noticesTitle = ''; + + if ($notices !== false && $numNotices > 0) { + $noticesTitle = __('Avisos de sysPass') . '
'; + + foreach ($notices as $notice) { + $noticesTitle .= '
' . $notice[0]; + } + } + + $this->view->assign('numNotices', $numNotices); + $this->view->assign('noticesTitle', $noticesTitle); + } + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/ItemsController.php b/app/modules/web/Controllers/ItemsController.php new file mode 100644 index 00000000..d5d698eb --- /dev/null +++ b/app/modules/web/Controllers/ItemsController.php @@ -0,0 +1,95 @@ +. + */ + +namespace SP\Modules\Web\Controllers; + +use SP\Account\AccountUtil; +use SP\Controller\RequestControllerTrait; +use SP\Core\SessionUtil; +use SP\DataModel\DataModelInterface; +use SP\Util\Json; + +/** + * Class ItemsController + * + * @package SP\Modules\Web\Controllers + */ +class ItemsController +{ + use RequestControllerTrait; + + /** + * ItemsController constructor. + */ + public function __construct() + { + $this->init(); + } + + /** + * Devolver las cuentas visubles por el usuario + * + * @param $accountId + */ + public function accountsUserAction($accountId) + { + $outItems = []; + + foreach (AccountUtil::getAccountsForUser($accountId, $this->session) as $account) { + $obj = new \stdClass(); + $obj->id = $account->account_id; + $obj->name = $account->customer_name . ' - ' . $account->account_name; + + $outItems[] = $obj; + } + + $this->JsonResponse->setStatus(0); + $this->JsonResponse->setData($outItems); + $this->JsonResponse->setCsrf(SessionUtil::getSessionKey()); + + Json::returnJson($this->JsonResponse); + } + + /** + * Preparar los elementos para devolverlos + * + * @param array $items + * @return array + */ + protected function prepareItems(array $items) + { + $outItems = []; + + /** @var DataModelInterface $item */ + foreach ($items as $item) { + $obj = new \stdClass(); + $obj->id = $item->getId(); + $obj->name = $item->getName(); + + $outItems[] = $obj; + } + + return $outItems; + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/LoginController.php b/app/modules/web/Controllers/LoginController.php new file mode 100644 index 00000000..30171cde --- /dev/null +++ b/app/modules/web/Controllers/LoginController.php @@ -0,0 +1,129 @@ +. + */ + +namespace SP\Modules\Web\Controllers; + +use SP\Controller\ControllerBase; +use SP\Core\SessionFactory; +use SP\Core\SessionUtil; +use SP\Html\Html; +use SP\Http\Response; +use SP\Log\Log; +use SP\Modules\Web\Controllers\Helpers\LayoutHelper; +use SP\Services\LoginService; +use SP\Util\Json; + +/** + * Class LoginController + * + * @package SP\Modules\Web\Controllers + */ +class LoginController extends ControllerBase +{ + /** + * Login action + * + * @throws \InvalidArgumentException + */ + public function loginAction() + { + $LoginService = new LoginService($this->config, $this->session, $this->theme, $this->eventDispatcher); + return Json::returnJson($LoginService->doLogin()); + } + + /** + * Logout action + */ + public function logoutAction() + { + if ($this->session->isLoggedIn()) { + $inactiveTime = abs(round((time() - SessionFactory::getLastActivity()) / 60, 2)); + $totalTime = abs(round((time() - SessionFactory::getStartActivity()) / 60, 2)); + + $Log = new Log(); + $LogMessage = $Log->getLogMessage(); + $LogMessage->setAction(__('Finalizar sesión', false)); + $LogMessage->addDetails(__('Usuario', false), SessionFactory::getUserData()->getUserLogin()); + $LogMessage->addDetails(__('Tiempo inactivo', false), $inactiveTime . ' min.'); + $LogMessage->addDetails(__('Tiempo total', false), $totalTime . ' min.'); + $Log->writeLog(); + + SessionUtil::cleanSession(); + SessionFactory::setLoggedOut(true); + + $LayoutHelper = new LayoutHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $LayoutHelper->setPage('logout'); + $LayoutHelper->initBody(); + + $this->view->addTemplate('logout'); + + $this->view->addPartial('body-footer'); + $this->view->addPartial('body-end'); + $this->view(); + } else { + Response::redirect('index.php?r=login'); + } + } + + /** + * Index action + */ + public function indexAction() + { + $LayoutHelper = new LayoutHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $LayoutHelper->setPage('login'); + $LayoutHelper->initBody(); + + if (SessionFactory::getLoggedOut() === true) { + SessionFactory::setLoggedOut(); + + $this->view->assign('loggedOut', 1); + } else { + $this->view->assign('loggedOut', 0); + } + + $this->view->addTemplate('login'); + + $this->view->addPartial('body-footer'); + $this->view->addPartial('body-end'); + + $this->view->assign('useLayout', false); + $this->view->assign('mailEnabled', $this->configData->isMailEnabled()); + $this->view->assign('updated', SessionFactory::getAppUpdated()); + + SessionFactory::setAppUpdated(false); + + $getParams = []; + + // Comprobar y parsear los parámetros GET para pasarlos como POST en los inputs + if (count($_GET) > 0) { + foreach ($_GET as $param => $value) { + $getParams['g_' . Html::sanitizeFull($param)] = Html::sanitizeFull($value); + } + } + + $this->view->assign('getParams', $getParams); + $this->view(); + } +} \ No newline at end of file diff --git a/inc/SP/Controller/MainController.php b/app/modules/web/Controllers/MainController.php similarity index 83% rename from inc/SP/Controller/MainController.php rename to app/modules/web/Controllers/MainController.php index 008d6cc7..d1449489 100644 --- a/inc/SP/Controller/MainController.php +++ b/app/modules/web/Controllers/MainController.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -22,12 +22,13 @@ * along with sysPass. If not, see . */ -namespace SP\Controller; +namespace SP\Modules\Web\Controllers; defined('APP_ROOT') || die(); use SP\Account\AccountUtil; -use SP\Config\Config; +use SP\Controller\AccountController; +use SP\Controller\ControllerBase; use SP\Core\Acl; use SP\Core\ActionsInterface; use SP\Core\DiFactory; @@ -36,7 +37,7 @@ use SP\Core\Init; use SP\Core\Language; use SP\Core\Messages\NoticeMessage; use SP\Core\Plugin\PluginUtil; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\SessionUtil; use SP\Core\Task; use SP\Core\Template; @@ -98,30 +99,29 @@ class MainController extends ControllerBase implements ActionsInterface $this->view->addTemplate('body-start'); $this->view->assign('useLayout', true); - $this->view->assign('isInstalled', Config::getConfig()->isInstalled()); + $this->view->assign('isInstalled', $this->configData->isInstalled()); $this->view->assign('sk', SessionUtil::getSessionKey(true)); $this->view->assign('appInfo', Util::getAppInfo()); $this->view->assign('appVersion', Util::getVersionString()); - $this->view->assign('isDemoMode', Checks::demoIsEnabled()); - $this->view->assign('icons', DiFactory::getTheme()->getIcons()); - $this->view->assign('logoIcon', Init::$WEBURI . '/imgs/logo_icon.png'); - $this->view->assign('logoNoText', Init::$WEBURI . '/imgs/logo_icon.svg'); - $this->view->assign('logo', Init::$WEBURI . '/imgs/logo_full_bg.png'); - $this->view->assign('logonobg', Init::$WEBURI . '/imgs/logo_full_nobg.png'); + $this->view->assign('isDemoMode', $this->configData->isDemoEnabled()); + $this->view->assign('icons', $this->theme->getIcons()); + $this->view->assign('logoIcon', Init::$WEBURI . '/public/images/logo_icon.png'); + $this->view->assign('logoNoText', Init::$WEBURI . '/public/images/logo_icon.svg'); + $this->view->assign('logo', Init::$WEBURI . '/public/images/logo_full_bg.png'); + $this->view->assign('logonobg', Init::$WEBURI . '/public/images/logo_full_nobg.png'); $this->view->assign('httpsEnabled', Checks::httpsEnabled()); - $this->view->assign('lang', Init::isLoggedIn() ? Language::$userLang : Language::$globalLang); - $this->view->assign('loadApp', Session::getAuthCompleted()); + $this->setLoggedIn(Util::isLoggedIn($this->session)); + + $this->view->assign('lang', $this->loggedIn ? Language::$userLang : Language::$globalLang); + $this->view->assign('loadApp', SessionFactory::getAuthCompleted()); - $this->setLoggedIn(Init::isLoggedIn()); try { // Cargar la clave pública en la sesión SessionUtil::loadPublicKey(); } catch (SPException $e) { debugLog($e->getMessage(), true); - } catch (\phpseclib\Exception\FileNotFoundException $e) { - debugLog($e->getMessage(), true); } $this->getResourcesLinks(); @@ -134,29 +134,28 @@ class MainController extends ControllerBase implements ActionsInterface public function getResourcesLinks() { $version = Util::getVersionStringNormalized(); - $theme = DiFactory::getTheme(); $jsVersionHash = md5($version); - $this->view->append('jsLinks', Init::$WEBROOT . '/js/js.php?v=' . $jsVersionHash); - $this->view->append('jsLinks', Init::$WEBROOT . '/js/js.php?g=1&v=' . $jsVersionHash); + $this->view->append('jsLinks', Init::$WEBROOT . '/public/js/js.php?v=' . $jsVersionHash); + $this->view->append('jsLinks', Init::$WEBROOT . '/public/js/js.php?g=1&v=' . $jsVersionHash); - $themeInfo = $theme->getThemeInfo(); + $themeInfo = $this->theme->getThemeInfo(); if (isset($themeInfo['js'])) { - $themeJsBase = urlencode($theme->getThemePath() . DIRECTORY_SEPARATOR . 'js'); + $themeJsBase = urlencode($this->theme->getThemePath() . DIRECTORY_SEPARATOR . 'js'); $themeJsFiles = urlencode(implode(',', $themeInfo['js'])); - $this->view->append('jsLinks', Init::$WEBROOT . '/js/js.php?f=' . $themeJsFiles . '&b=' . $themeJsBase . '&v=' . $jsVersionHash); + $this->view->append('jsLinks', Init::$WEBROOT . '/public/js/js.php?f=' . $themeJsFiles . '&b=' . $themeJsBase . '&v=' . $jsVersionHash); } - if (Init::isLoggedIn() && Session::getUserPreferences()->getUserId() > 0) { - $resultsAsCards = Session::getUserPreferences()->isResultsAsCards(); + if ($this->loggedIn && SessionFactory::getUserPreferences()->getUserId() > 0) { + $resultsAsCards = SessionFactory::getUserPreferences()->isResultsAsCards(); } else { - $resultsAsCards = Checks::resultsCardsIsEnabled(); + $resultsAsCards = $this->configData->isResultsAsCards(); } $cssVersionHash = md5($version . $resultsAsCards); - $this->view->append('cssLinks', Init::$WEBROOT . '/css/css.php?v=' . $cssVersionHash); + $this->view->append('cssLinks', Init::$WEBROOT . '/public/css/css.php?v=' . $cssVersionHash); if (isset($themeInfo['css'])) { if ($resultsAsCards) { @@ -165,28 +164,28 @@ class MainController extends ControllerBase implements ActionsInterface $themeInfo['css'][] = 'search-grid.min.css'; } - if (Checks::dokuWikiIsEnabled()) { + if ($this->configData->isDokuwikiEnabled()) { $themeInfo['css'][] = 'styles-wiki.min.css'; } - $themeCssBase = urlencode($theme->getThemePath() . DIRECTORY_SEPARATOR . 'css'); + $themeCssBase = urlencode($this->theme->getThemePath() . DIRECTORY_SEPARATOR . 'css'); $themeCssFiles = urlencode(implode(',', $themeInfo['css'])); - $this->view->append('cssLinks', Init::$WEBROOT . '/css/css.php?f=' . $themeCssFiles . '&b=' . $themeCssBase . '&v=' . $jsVersionHash); + $this->view->append('cssLinks', Init::$WEBROOT . '/public/css/css.php?f=' . $themeCssFiles . '&b=' . $themeCssBase . '&v=' . $jsVersionHash); } // Cargar los recursos de los plugins foreach (PluginUtil::getLoadedPlugins() as $Plugin) { - $base = str_replace(Init::$SERVERROOT, '', $Plugin->getBase()); + $base = str_replace(BASE_PATH, '', $Plugin->getBase()); $jsResources = $Plugin->getJsResources(); $cssResources = $Plugin->getCssResources(); if (count($jsResources) > 0) { - $this->view->append('jsLinks', Init::$WEBROOT . '/js/js.php?f=' . urlencode(implode(',', $jsResources)) . '&b=' . urlencode($base . DIRECTORY_SEPARATOR . 'js') . '&v=' . $jsVersionHash); + $this->view->append('jsLinks', Init::$WEBROOT . '/public/js/js.php?f=' . urlencode(implode(',', $jsResources)) . '&b=' . urlencode($base . DIRECTORY_SEPARATOR . 'js') . '&v=' . $jsVersionHash); } if (count($cssResources) > 0) { - $this->view->append('cssLinks', Init::$WEBROOT . '/css/css.php?f=' . urlencode(implode(',', $cssResources)) . '&b=' . urlencode($base . DIRECTORY_SEPARATOR . 'css') . '&v=' . $jsVersionHash); + $this->view->append('cssLinks', Init::$WEBROOT . '/public/css/css.php?f=' . urlencode(implode(',', $cssResources)) . '&b=' . urlencode($base . DIRECTORY_SEPARATOR . 'css') . '&v=' . $jsVersionHash); } } } @@ -221,6 +220,12 @@ class MainController extends ControllerBase implements ActionsInterface $this->view->addTemplate('body-end'); } + public function indexAction() + { + $this->initialize(); + $this->getMain(); + } + /** * Obtener los datos para la mostrar la barra de sesión * @@ -232,18 +237,18 @@ class MainController extends ControllerBase implements ActionsInterface $userType = null; - if ($this->UserData->isUserIsAdminApp()) { + if ($this->userData->isUserIsAdminApp()) { $userType = $this->icons->getIconAppAdmin(); - } elseif ($this->UserData->isUserIsAdminAcc()) { + } elseif ($this->userData->isUserIsAdminAcc()) { $userType = $this->icons->getIconAccAdmin(); } $this->view->assign('userType', $userType); - $this->view->assign('userId', $this->UserData->getUserId()); - $this->view->assign('userLogin', mb_strtoupper($this->UserData->getUserLogin())); - $this->view->assign('userName', $this->UserData->getUserName() ?: mb_strtoupper($this->view->userLogin)); - $this->view->assign('userGroup', $this->UserData->getUsergroupName()); - $this->view->assign('showPassIcon', !(Config::getConfig()->isLdapEnabled() && $this->UserData->isUserIsLdap())); + $this->view->assign('userId', $this->userData->getUserId()); + $this->view->assign('userLogin', mb_strtoupper($this->userData->getUserLogin())); + $this->view->assign('userName', $this->userData->getUserName() ?: mb_strtoupper($this->view->userLogin)); + $this->view->assign('userGroup', $this->userData->getUsergroupName()); + $this->view->assign('showPassIcon', !($this->configData->isLdapEnabled() && $this->userData->isUserIsLdap())); $this->view->assign('userNotices', count(Notice::getItem()->getAllActiveForUser())); } @@ -302,7 +307,7 @@ class MainController extends ControllerBase implements ActionsInterface $this->view->append('actions', $ActionConfig); } - if (Acl::checkUserAccess(self::ACTION_EVL) && Checks::logIsEnabled()) { + if (Acl::checkUserAccess(self::ACTION_EVL) && $this->configData->isLogEnabled()) { $ActionEventlog = new DataGridAction(); $ActionEventlog->setId(self::ACTION_EVL); $ActionEventlog->setTitle(__('Registro de Eventos')); @@ -320,8 +325,8 @@ class MainController extends ControllerBase implements ActionsInterface { $this->setPage('login'); - if (Session::getLoggedOut() === true) { - Session::setLoggedOut(false); + if (SessionFactory::getLoggedOut() === true) { + SessionFactory::setLoggedOut(false); $this->view->assign('loggedOut', 1); } else { @@ -333,10 +338,10 @@ class MainController extends ControllerBase implements ActionsInterface $this->view->addTemplate('body-end'); $this->view->assign('useLayout', false); - $this->view->assign('mailEnabled', Checks::mailIsEnabled()); - $this->view->assign('updated', Session::getAppUpdated()); + $this->view->assign('mailEnabled', $this->configData->isMailEnabled()); + $this->view->assign('updated', SessionFactory::getAppUpdated()); - Session::setAppUpdated(false); + SessionFactory::setAppUpdated(false); $getParams = []; @@ -495,7 +500,7 @@ class MainController extends ControllerBase implements ActionsInterface $this->view->assign('hasUpdates', false); $this->view->assign('updateStatus', null); - if (Config::getConfig()->isCheckUpdates()) { + if ($this->configData->isCheckUpdates()) { $updates = Util::checkUpdates(); if (is_array($updates)) { @@ -511,7 +516,7 @@ class MainController extends ControllerBase implements ActionsInterface } } - if (Config::getConfig()->isChecknotices()) { + if ($this->configData->isChecknotices()) { $notices = Util::checkNotices(); $numNotices = count($notices); $noticesTitle = ''; @@ -533,7 +538,6 @@ class MainController extends ControllerBase implements ActionsInterface * Realizar las acciones del controlador * * @param mixed $type Tipo de acción - * @throws \phpmailer\phpmailerException */ public function doAction($type = null) { @@ -566,7 +570,7 @@ class MainController extends ControllerBase implements ActionsInterface $this->view->addTemplate('body-header'); - if (Checks::mailIsEnabled() || Request::analyze('f', 0) === 1) { + if ($this->configData->isMailEnabled() || Request::analyze('f', 0) === 1) { $this->view->addTemplate('passreset'); $this->view->assign('login', Request::analyze('login')); @@ -592,7 +596,6 @@ class MainController extends ControllerBase implements ActionsInterface * Obtener la vista para mostrar un enlace publicado * * @return bool - * @throws \phpmailer\phpmailerException * @throws \SP\Core\Exceptions\QueryException * @throws \SP\Core\Exceptions\ConstraintException * @throws \SP\Core\Exceptions\FileNotFoundException @@ -622,7 +625,7 @@ class MainController extends ControllerBase implements ActionsInterface $Message = new NoticeMessage(); $Message->setTitle(__('Enlace visualizado')); $Message->addDescription(sprintf('%s : %s', __('Cuenta'), $PublicLink->getItemId())); - $Message->addDescription(sprintf('%s : %s', __('Origen'), Checks::demoIsEnabled() ? '*.*.*.*' : HttpUtil::getClientAddress(true))); + $Message->addDescription(sprintf('%s : %s', __('Origen'), $this->configData->isDemoEnabled() ? '*.*.*.*' : HttpUtil::getClientAddress(true))); $Message->addDescription(sprintf('%s : %s', __('Agente'), Request::getRequestHeaders('HTTP_USER_AGENT'))); $Message->addDescription(sprintf('HTTPS : %s', Checks::httpsEnabled() ? 'ON' : 'OFF')); diff --git a/app/modules/web/Controllers/PassresetController.php b/app/modules/web/Controllers/PassresetController.php new file mode 100644 index 00000000..6bdce0eb --- /dev/null +++ b/app/modules/web/Controllers/PassresetController.php @@ -0,0 +1,69 @@ +. + */ + +namespace SP\Modules\Web\Controllers; + +use SP\Controller\ControllerBase; +use SP\Http\Request; +use SP\Modules\Web\Controllers\Helpers\LayoutHelper; + +/** + * Class PassresetController + * + * @package SP\Modules\Web\Controllers + */ +class PassresetController extends ControllerBase +{ + /** + * Password reset action + */ + public function indexAction() + { + $LayoutHelper = new LayoutHelper($this->view, $this->config, $this->session, $this->eventDispatcher); + $LayoutHelper->initBody(); + $LayoutHelper->setPage('passreset'); + + $this->view->addPartial('body-header'); + + if ($this->configData->isMailEnabled() || Request::analyze('f', 0) === 1) { + $this->view->addTemplate('passreset'); + + $this->view->assign('login', Request::analyze('login')); + $this->view->assign('email', Request::analyze('email')); + + $this->view->assign('action', Request::analyze('a')); + $this->view->assign('hash', Request::analyze('h')); + $this->view->assign('time', Request::analyze('t')); + + $this->view->assign('passReset', $this->view->action === 'passreset' && !empty($this->view->hash) && !empty($this->view->time)); + } else { + $this->showError(self::ERR_UNAVAILABLE, false); + } + + $this->view->addPartial('body-footer'); + $this->view->addPartial('body-end'); + + $this->view(); + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/SimpleControllerBase.php b/app/modules/web/Controllers/SimpleControllerBase.php new file mode 100644 index 00000000..ded87f4a --- /dev/null +++ b/app/modules/web/Controllers/SimpleControllerBase.php @@ -0,0 +1,93 @@ +. + */ + +namespace SP\Modules\Web\Controllers; + +use SP\Config\Config; +use SP\Core\Acl; +use SP\Core\Events\EventDispatcher; +use SP\Core\Session\Session; +use SP\Core\Traits\InjectableTrait; +use SP\Core\UI\Theme; +use SP\Storage\Database; + +/** + * Class SimpleControllerBase + * + * @package SP\Modules\Web\Controllers + */ +abstract class SimpleControllerBase +{ + use InjectableTrait; + + /** @var int Módulo a usar */ + protected $action; + /** @var string Nombre del controlador */ + protected $controllerName; + /** @var EventDispatcher */ + protected $eventDispatcher; + /** @var Config */ + protected $config; + /** @var Session */ + protected $session; + /** @var Database */ + protected $db; + /** @var Theme */ + protected $theme; + /** @var Acl */ + protected $acl; + + /** + * Constructor + */ + public function __construct() + { + $this->injectDependencies(); + + $class = static::class; + $this->controllerName = substr($class, strrpos($class, '\\') + 1, -strlen('Controller')); + + if (method_exists($this, 'initialize')) { + $this->initialize(); + } + } + + /** + * @param Config $config + * @param Session $session + * @param Database $db + * @param Theme $theme + * @param EventDispatcher $ev + * @param Acl $acl + */ + public function inject(Config $config, Session $session, Database $db, Theme $theme, EventDispatcher $ev, Acl $acl) + { + $this->config = $config; + $this->session = $session; + $this->db = $db; + $this->theme = $theme; + $this->eventDispatcher = $ev; + $this->acl = $acl; + } +} \ No newline at end of file diff --git a/app/modules/web/module.php b/app/modules/web/module.php new file mode 100644 index 00000000..9977044a --- /dev/null +++ b/app/modules/web/module.php @@ -0,0 +1,27 @@ +. + */ + +define('MODULE_PATH', __DIR__); +define('VIEW_PATH', MODULE_PATH . DIRECTORY_SEPARATOR . 'themes'); +define('PLUGINS_PATH', MODULE_PATH . DIRECTORY_SEPARATOR . 'plugins'); diff --git a/app/modules/web/plugins/.blank b/app/modules/web/plugins/.blank new file mode 100644 index 00000000..e69de29b diff --git a/inc/themes/material-blue/css/LICENSE b/app/modules/web/themes/material-blue/css/LICENSE similarity index 100% rename from inc/themes/material-blue/css/LICENSE rename to app/modules/web/themes/material-blue/css/LICENSE diff --git a/inc/themes/material-blue/css/Roboto_300.woff2 b/app/modules/web/themes/material-blue/css/Roboto_300.woff2 similarity index 100% rename from inc/themes/material-blue/css/Roboto_300.woff2 rename to app/modules/web/themes/material-blue/css/Roboto_300.woff2 diff --git a/inc/themes/material-blue/css/Roboto_400.woff2 b/app/modules/web/themes/material-blue/css/Roboto_400.woff2 similarity index 100% rename from inc/themes/material-blue/css/Roboto_400.woff2 rename to app/modules/web/themes/material-blue/css/Roboto_400.woff2 diff --git a/inc/themes/material-blue/css/Roboto_500.woff2 b/app/modules/web/themes/material-blue/css/Roboto_500.woff2 similarity index 100% rename from inc/themes/material-blue/css/Roboto_500.woff2 rename to app/modules/web/themes/material-blue/css/Roboto_500.woff2 diff --git a/inc/themes/material-blue/css/Roboto_600.woff2 b/app/modules/web/themes/material-blue/css/Roboto_600.woff2 similarity index 100% rename from inc/themes/material-blue/css/Roboto_600.woff2 rename to app/modules/web/themes/material-blue/css/Roboto_600.woff2 diff --git a/inc/themes/material-blue/css/_base.scss b/app/modules/web/themes/material-blue/css/_base.scss similarity index 97% rename from inc/themes/material-blue/css/_base.scss rename to app/modules/web/themes/material-blue/css/_base.scss index aa91fd41..b5fa041c 100644 --- a/inc/themes/material-blue/css/_base.scss +++ b/app/modules/web/themes/material-blue/css/_base.scss @@ -14,6 +14,7 @@ $color-bluegrey-fg: #607d8b; $color-blue-bg: #e3f2fd; $color-blue-fg: #2196f3; $color-grey: #555; +$public-path: '../../../../../../public'; @mixin box-shadow() { -webkit-box-shadow: 2px 2px 3px -3px rgba(0, 0, 0, 0.14); diff --git a/inc/themes/material-blue/css/_elements.scss b/app/modules/web/themes/material-blue/css/_elements.scss similarity index 100% rename from inc/themes/material-blue/css/_elements.scss rename to app/modules/web/themes/material-blue/css/_elements.scss diff --git a/inc/themes/material-blue/css/_login.scss b/app/modules/web/themes/material-blue/css/_login.scss similarity index 93% rename from inc/themes/material-blue/css/_login.scss rename to app/modules/web/themes/material-blue/css/_login.scss index 03879296..3ef3d97b 100644 --- a/inc/themes/material-blue/css/_login.scss +++ b/app/modules/web/themes/material-blue/css/_login.scss @@ -1,7 +1,7 @@ #login-container { width: 40em; margin: 0 auto; - background: transparent url("../imgs/logo_full_bg.png") no-repeat top left; + background: transparent url("../../../../public/images/logo_full_bg.png") no-repeat top left; background-size: auto 10em; #boxSpacer { height: 11em; diff --git a/inc/themes/material-blue/css/fonts.css b/app/modules/web/themes/material-blue/css/fonts.css similarity index 100% rename from inc/themes/material-blue/css/fonts.css rename to app/modules/web/themes/material-blue/css/fonts.css diff --git a/inc/themes/material-blue/css/fonts.min.css b/app/modules/web/themes/material-blue/css/fonts.min.css similarity index 100% rename from inc/themes/material-blue/css/fonts.min.css rename to app/modules/web/themes/material-blue/css/fonts.min.css diff --git a/inc/themes/material-blue/css/material-custom.css b/app/modules/web/themes/material-blue/css/material-custom.css similarity index 100% rename from inc/themes/material-blue/css/material-custom.css rename to app/modules/web/themes/material-blue/css/material-custom.css diff --git a/inc/themes/material-blue/css/material-custom.min.css b/app/modules/web/themes/material-blue/css/material-custom.min.css similarity index 100% rename from inc/themes/material-blue/css/material-custom.min.css rename to app/modules/web/themes/material-blue/css/material-custom.min.css diff --git a/inc/themes/material-blue/css/material.min.css b/app/modules/web/themes/material-blue/css/material.min.css similarity index 100% rename from inc/themes/material-blue/css/material.min.css rename to app/modules/web/themes/material-blue/css/material.min.css diff --git a/inc/themes/material-blue/css/mdl-datetimepicker.css b/app/modules/web/themes/material-blue/css/mdl-datetimepicker.css similarity index 100% rename from inc/themes/material-blue/css/mdl-datetimepicker.css rename to app/modules/web/themes/material-blue/css/mdl-datetimepicker.css diff --git a/inc/themes/material-blue/css/mdl-datetimepicker.css.map b/app/modules/web/themes/material-blue/css/mdl-datetimepicker.css.map similarity index 100% rename from inc/themes/material-blue/css/mdl-datetimepicker.css.map rename to app/modules/web/themes/material-blue/css/mdl-datetimepicker.css.map diff --git a/inc/themes/material-blue/css/mdl-datetimepicker.min.css b/app/modules/web/themes/material-blue/css/mdl-datetimepicker.min.css similarity index 100% rename from inc/themes/material-blue/css/mdl-datetimepicker.min.css rename to app/modules/web/themes/material-blue/css/mdl-datetimepicker.min.css diff --git a/inc/themes/material-blue/css/mdl-datetimepicker.scss b/app/modules/web/themes/material-blue/css/mdl-datetimepicker.scss similarity index 100% rename from inc/themes/material-blue/css/mdl-datetimepicker.scss rename to app/modules/web/themes/material-blue/css/mdl-datetimepicker.scss diff --git a/inc/themes/material-blue/css/mdl-jquery-modal-dialog.css b/app/modules/web/themes/material-blue/css/mdl-jquery-modal-dialog.css similarity index 100% rename from inc/themes/material-blue/css/mdl-jquery-modal-dialog.css rename to app/modules/web/themes/material-blue/css/mdl-jquery-modal-dialog.css diff --git a/inc/themes/material-blue/css/mdl-jquery-modal-dialog.css.map b/app/modules/web/themes/material-blue/css/mdl-jquery-modal-dialog.css.map similarity index 100% rename from inc/themes/material-blue/css/mdl-jquery-modal-dialog.css.map rename to app/modules/web/themes/material-blue/css/mdl-jquery-modal-dialog.css.map diff --git a/inc/themes/material-blue/css/mdl-jquery-modal-dialog.min.css b/app/modules/web/themes/material-blue/css/mdl-jquery-modal-dialog.min.css similarity index 100% rename from inc/themes/material-blue/css/mdl-jquery-modal-dialog.min.css rename to app/modules/web/themes/material-blue/css/mdl-jquery-modal-dialog.min.css diff --git a/inc/themes/material-blue/css/mdl-jquery-modal-dialog.scss b/app/modules/web/themes/material-blue/css/mdl-jquery-modal-dialog.scss similarity index 100% rename from inc/themes/material-blue/css/mdl-jquery-modal-dialog.scss rename to app/modules/web/themes/material-blue/css/mdl-jquery-modal-dialog.scss diff --git a/inc/themes/material-blue/css/search-card.css b/app/modules/web/themes/material-blue/css/search-card.css similarity index 100% rename from inc/themes/material-blue/css/search-card.css rename to app/modules/web/themes/material-blue/css/search-card.css diff --git a/inc/themes/material-blue/css/search-card.css.map b/app/modules/web/themes/material-blue/css/search-card.css.map similarity index 100% rename from inc/themes/material-blue/css/search-card.css.map rename to app/modules/web/themes/material-blue/css/search-card.css.map diff --git a/inc/themes/material-blue/css/search-card.min.css b/app/modules/web/themes/material-blue/css/search-card.min.css similarity index 100% rename from inc/themes/material-blue/css/search-card.min.css rename to app/modules/web/themes/material-blue/css/search-card.min.css diff --git a/inc/themes/material-blue/css/search-card.scss b/app/modules/web/themes/material-blue/css/search-card.scss similarity index 100% rename from inc/themes/material-blue/css/search-card.scss rename to app/modules/web/themes/material-blue/css/search-card.scss diff --git a/inc/themes/material-blue/css/search-grid.css b/app/modules/web/themes/material-blue/css/search-grid.css similarity index 100% rename from inc/themes/material-blue/css/search-grid.css rename to app/modules/web/themes/material-blue/css/search-grid.css diff --git a/inc/themes/material-blue/css/search-grid.css.map b/app/modules/web/themes/material-blue/css/search-grid.css.map similarity index 100% rename from inc/themes/material-blue/css/search-grid.css.map rename to app/modules/web/themes/material-blue/css/search-grid.css.map diff --git a/inc/themes/material-blue/css/search-grid.min.css b/app/modules/web/themes/material-blue/css/search-grid.min.css similarity index 100% rename from inc/themes/material-blue/css/search-grid.min.css rename to app/modules/web/themes/material-blue/css/search-grid.min.css diff --git a/inc/themes/material-blue/css/search-grid.scss b/app/modules/web/themes/material-blue/css/search-grid.scss similarity index 100% rename from inc/themes/material-blue/css/search-grid.scss rename to app/modules/web/themes/material-blue/css/search-grid.scss diff --git a/inc/themes/material-blue/css/selectize-custom.css b/app/modules/web/themes/material-blue/css/selectize-custom.css similarity index 100% rename from inc/themes/material-blue/css/selectize-custom.css rename to app/modules/web/themes/material-blue/css/selectize-custom.css diff --git a/inc/themes/material-blue/css/selectize-custom.css.map b/app/modules/web/themes/material-blue/css/selectize-custom.css.map similarity index 100% rename from inc/themes/material-blue/css/selectize-custom.css.map rename to app/modules/web/themes/material-blue/css/selectize-custom.css.map diff --git a/inc/themes/material-blue/css/selectize-custom.min.css b/app/modules/web/themes/material-blue/css/selectize-custom.min.css similarity index 100% rename from inc/themes/material-blue/css/selectize-custom.min.css rename to app/modules/web/themes/material-blue/css/selectize-custom.min.css diff --git a/inc/themes/material-blue/css/selectize-custom.scss b/app/modules/web/themes/material-blue/css/selectize-custom.scss similarity index 100% rename from inc/themes/material-blue/css/selectize-custom.scss rename to app/modules/web/themes/material-blue/css/selectize-custom.scss diff --git a/inc/themes/material-blue/css/selectize.custom.css b/app/modules/web/themes/material-blue/css/selectize.custom.css similarity index 100% rename from inc/themes/material-blue/css/selectize.custom.css rename to app/modules/web/themes/material-blue/css/selectize.custom.css diff --git a/inc/themes/material-blue/css/selectize.custom.min.css b/app/modules/web/themes/material-blue/css/selectize.custom.min.css similarity index 100% rename from inc/themes/material-blue/css/selectize.custom.min.css rename to app/modules/web/themes/material-blue/css/selectize.custom.min.css diff --git a/inc/themes/material-blue/css/styles-wiki.css b/app/modules/web/themes/material-blue/css/styles-wiki.css similarity index 100% rename from inc/themes/material-blue/css/styles-wiki.css rename to app/modules/web/themes/material-blue/css/styles-wiki.css diff --git a/inc/themes/material-blue/css/styles-wiki.css.map b/app/modules/web/themes/material-blue/css/styles-wiki.css.map similarity index 100% rename from inc/themes/material-blue/css/styles-wiki.css.map rename to app/modules/web/themes/material-blue/css/styles-wiki.css.map diff --git a/inc/themes/material-blue/css/styles-wiki.min.css b/app/modules/web/themes/material-blue/css/styles-wiki.min.css similarity index 100% rename from inc/themes/material-blue/css/styles-wiki.min.css rename to app/modules/web/themes/material-blue/css/styles-wiki.min.css diff --git a/inc/themes/material-blue/css/styles-wiki.scss b/app/modules/web/themes/material-blue/css/styles-wiki.scss similarity index 100% rename from inc/themes/material-blue/css/styles-wiki.scss rename to app/modules/web/themes/material-blue/css/styles-wiki.scss diff --git a/inc/themes/material-blue/css/styles.css b/app/modules/web/themes/material-blue/css/styles.css similarity index 99% rename from inc/themes/material-blue/css/styles.css rename to app/modules/web/themes/material-blue/css/styles.css index b6351968..6d755b90 100644 --- a/inc/themes/material-blue/css/styles.css +++ b/app/modules/web/themes/material-blue/css/styles.css @@ -966,7 +966,7 @@ fieldset.warning { margin-bottom: 30px; color: #607d8b; align-items: center; - background: url("../imgs/logo_full_bg.png") left no-repeat; + background: url("../../../../../../public/images/logo_full_bg.png") left no-repeat; background-size: auto 150px; height: 150px; } #actions #page-title { @@ -1040,7 +1040,7 @@ fieldset.warning { #login-container { width: 40em; margin: 0 auto; - background: transparent url("../imgs/logo_full_bg.png") no-repeat top left; + background: transparent url("../../../../public/images/logo_full_bg.png") no-repeat top left; background-size: auto 10em; } #login-container #boxSpacer { height: 11em; diff --git a/inc/themes/material-blue/css/styles.css.map b/app/modules/web/themes/material-blue/css/styles.css.map similarity index 77% rename from inc/themes/material-blue/css/styles.css.map rename to app/modules/web/themes/material-blue/css/styles.css.map index ca95580c..2d2fb8ed 100644 --- a/inc/themes/material-blue/css/styles.css.map +++ b/app/modules/web/themes/material-blue/css/styles.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "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", +"mappings": "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", "sources": ["_elements.scss","_base.scss","styles.scss","_login.scss"], "names": [], "file": "styles.css" diff --git a/inc/themes/material-blue/css/styles.min.css b/app/modules/web/themes/material-blue/css/styles.min.css similarity index 80% rename from inc/themes/material-blue/css/styles.min.css rename to app/modules/web/themes/material-blue/css/styles.min.css index 463dc916..cbbb3ced 100644 --- a/inc/themes/material-blue/css/styles.min.css +++ b/app/modules/web/themes/material-blue/css/styles.min.css @@ -1 +1 @@ -html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#555;font-size:12px;font-weight:normal;box-sizing:border-box}*{font-family:"Roboto Regular",Verdana,Tahoma,sans-serif;box-sizing:inherit}*:before,*:after{box-sizing:inherit}table{font-size:11px;border-spacing:0}table th{border-bottom:2px solid transparent;vertical-align:middle}table th .icon{width:24px;height:24px}table tr{height:20px}table tr.odd{background-color:#f9f9f9}table tr.even>td,table tr.odd>td{border-bottom:1px solid #d9d9d9 !important}table tr.even:hover,table tr.odd:hover{background-color:#e8ff99}table td{padding:3px}table td.txtCliente{font-weight:bold;text-align:center}form{font-size:11px;margin:0}input.inputImg,img.inputImg{background-color:transparent !important;width:24px !important;height:24px !important;border:0;vertical-align:middle;margin:0 .5em}input.txtFile{width:200px}input.txtLong{width:300px}textarea{width:350px}select.files{width:250px}input.spinner{width:5em}img{margin:0;padding:0;border:0;cursor:pointer}img.inputImgMini{background-color:transparent !important;width:16px !important;height:16px !important;margin:0 5px 0 5px;border:0;vertical-align:middle}i{cursor:pointer}form .form-field{display:flex;justify-content:space-between}form .form-field>label{min-width:12em;padding:.5em 0;font-size:16px;align-self:center}form .form-field>div{width:100%;align-self:center}a{text-decoration:none;color:#536dfe}a:visited{text-decoration:none;color:#536dfe}a:hover,a:active,a:focus{text-decoration:none;cursor:pointer}pre,code,samp,kbd{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;font-size:1em;direction:ltr;text-align:left;background-color:#fbfaf9;color:#333;box-shadow:inset 0 0 .3em #ccc;border-radius:2px}#nojs{width:80%;text-align:center;vertical-align:middle;margin:10px auto;padding:3px;background-color:#ef5350;color:white;font-weight:bold;font-size:14px}#wrap{height:auto !important;min-height:100%;width:100%;background-color:#f5f5f5}#wrap-loading{position:fixed;z-index:9999;top:50%;left:50%;padding:1em;background-color:rgba(255,255,255,0.8);display:none;border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}#wrap-loading.overlay-full{top:0;left:0;width:100%;height:100%;background-color:rgba(255,255,255,0.5)}#wrap-loading.overlay-full #loading{position:absolute;top:50%;left:50%}#wrap-loading.overlay-full #taskStatus{display:block}#wrap-loading #taskStatus{display:none;position:absolute;left:0;top:55%;width:100%;text-align:center;color:white;background-color:rgba(0,0,0,0.5);padding:1em 0}#container{margin:auto;width:100%}#container.login{padding-top:5%}#container.error,#container.install,#container.passreset{width:100%}#container .logo{height:64px}#container #actions-bar{z-index:100;display:flex;justify-content:space-between;position:fixed;border:0 none;top:0;left:0;width:100%;padding:1em 0;background-color:transparent}#container #actions-bar-icons{flex-grow:1;text-align:center}#container #actions-bar-logo{display:none;padding:0 .5em}#container #actions-bar-logo img{display:inline-block;width:50px;opacity:.75}#container #content{width:95%;margin:2em auto 8em auto}#container #content.public-link{width:70%;min-height:0;margin:5em auto}#content td.descField,#box-popup td.descField{text-align:right;padding-right:20px;width:25%;border-right:1px solid #d9d9d9;color:#999;font-size:12px;font-weight:bold}#content td.valField,#box-popup td.valField{padding-left:1em;width:100%}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:none;width:100%;color:#607d8b;font-size:12px}#content .pager{width:100%;margin-top:15px;padding:.5em;vertical-align:middle;font-size:11px;color:#999;background-color:#fcfcfc}#content .pager img{margin-left:5px;vertical-align:middle}#content .pager a{margin-left:5px;font-size:12px;color:#999}#content .pager>div{display:inline-block;width:49%}#content .pager .pager-left{text-align:left}#content .pager .pager-right{text-align:right}#content #title{width:50%;padding:7px;margin:auto;background-color:#d9d9d9;color:#fff;font-size:17px;letter-spacing:.3em;text-align:center}#content #title.titleNormal{background-color:#607d8b;color:#fff}#content .data-container{width:75%;margin:0 auto}#content fieldset.data{margin:2em auto}#content fieldset.data>legend{color:#607d8b;padding:0 .5em;font-size:1.5em}#content fieldset.data>div{display:none}#content fieldset.data>div table{width:100%}#content .data{width:100%;padding:10px;margin:0 auto;background-color:#fff;-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}#content .data #history-icon{position:relative;top:5em;right:2em}#content .data td{text-align:left}#content .data td.descField{text-align:right}#content .data select{min-width:210px}#content .data .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .dropzone{width:30em;padding:1em;border:2px dashed #26a69a;text-align:center}#content .data .dropzone img{vertical-align:middle}#content .data .file-upload{display:none}#content .data .account-permissions{width:100%}#content .data .account-permissions fieldset{border:1px solid #c9c9c9;padding:1em}#content .data .account-permissions legend{font-weight:bold;color:#999;padding:.2em 0}#content .data .account-permissions fieldset>span{font-weight:bold;color:#999;padding:.2em 0;display:inline-block;width:100px;text-align:right}#content span.tag{margin:0 3px 3px 0;padding:.2em;background:#5c6bc0;color:#fff;border:0 solid transparent;border-radius:3px !important;-moz-border-radius:3px !important;-webkit-border-radius:3px !important}#content .extra-info{margin-top:20px}#content #tabs fieldset{border:1px solid #c9c9c9}#content #tabs #frmConfig label{float:left}#content .tblConfig{margin-bottom:2em}#content .tblConfig td.descField{width:35%;font-size:11px;font-weight:bold}#content .tblConfig td.rowHeader{padding:5px 0 5px 0;background-color:#f5f5f5;text-align:center;font-weight:bold;border-top:15px solid #f9f9f9;border-bottom:3px solid #a9c1d7;letter-spacing:.5em;color:#696969}#content .tblConfig input.checkbox{width:15px;text-align:left;padding:0}#content .tblConfig .option-disabled{text-align:center;background-color:#fff8e1;color:#ffca28;font-weight:bold}#content h2{width:100%;height:1.5em;font-size:18px;color:white;background-color:#a9c1d7;margin:0;padding-top:.1em}#content .section{margin-top:2.5em;border-bottom:1px solid #d9d9d9;text-align:left;font-size:14px;font-weight:bold;color:#5c6bc0}#content .row_even>td{background-color:#f5f5f5}#content .row_odd>td{background-color:white}#content .data-header ul{list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{display:inline-block;padding:.2em .5em;font-weight:bold;letter-spacing:.2em;color:#fff;text-align:center}#content .data-header li a{color:#777}#content .data-header li img{float:right;width:24px;height:24px;vertical-align:middle}#content .data-header-minimal{border-bottom:1px solid #dfdfdf}#content .data-header-minimal ul{display:flex;flex-wrap:wrap;justify-content:flex-start;margin:0}#content .data-header-minimal li{display:inline-flex;min-width:10em;font-weight:normal;letter-spacing:normal}#content .data-header-minimal li a{color:#b9b9b9;padding:.3em .8em}#content .data-table{width:100%}#content .data-table td:first-of-type,#content .data-table th:first-of-type{width:5em}#content .data-table thead th{background-color:#607d8b;color:#fff}#content .data-table tbody td.cell-data{text-align:left}#content .data-table tbody td.cell-nodata{padding:0 .5em;text-align:left}#content .data-table tbody td.cell-actions{text-align:right}#content .data-table tbody td.cell-actions i{opacity:.5}#content .data-table tbody td.cell-actions i:hover{opacity:1}#content .data-rows ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0;background-color:#fcfcfc}#content .data-rows li{float:left;display:block;padding:1em;color:#696969;text-align:center;min-height:2em}#content .data-rows li.cell-nodata{padding:1em 0;min-height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;min-height:2em;padding:1em 0;text-align:left;background-color:#fcfcfc;width:15em}#content .data-rows li.cell-nodata img,#content .data-rows li.cell-actions img{width:24px;height:24px;margin:0 .5em}#content #resEventLog .data{width:100%}#content #resEventLog thead{text-align:center}#content #resEventLog tbody{width:100%;height:500px;overflow:auto}#content #resEventLog td{border-bottom:1px solid #d9d9d9}#content #resEventLog .cell{text-align:center}#content #resEventLog .cell-description{width:60%}#content #searchbox{background-color:#fcfcfc;vertical-align:middle;position:relative;height:auto;padding:.5em 1em;margin-bottom:2em}#content #searchbox form{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;text-align:left}#content #searchbox .search-filters>*{margin:0 .5em}#content #searchbox .search-filters .filter-buttons{display:inline-block}#content #searchbox .search-filters .filter-slider{width:10em}#content #searchbox .search-filters-tags{display:none;flex-grow:2}#content .btn-clear{opacity:.35;filter:alpha(opacity=35)}#content .btn-clear:hover{opacity:1;filter:alpha(opacity=100)}#content .actions-optional{display:none}#content .error{width:350px;padding:15px;margin:0 auto;text-align:center;font-size:16px;line-height:1.5em;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#box-popup .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .list-wrap ul,#box-popup .list-wrap ul{list-style-type:none;margin:0;padding:0}#content .data .list-wrap li,#box-popup .list-wrap li{display:flex;background:#f2f2f2;padding:.5em;font-size:1em;margin-bottom:.5em}#content .data .list-wrap li:hover,#box-popup .list-wrap li:hover{background:#e8eaf6;color:#000}#content .data .list-wrap div.files-item-info,#box-popup .list-wrap div.files-item-info{flex-grow:2}#content .data .list-wrap div.files-item-info img,#box-popup .list-wrap div.files-item-info img{margin:0 .5em}#content .data .list-wrap div.files-item-actions,#box-popup .list-wrap div.files-item-actions{padding:.3em 0}#box-popup{width:-webkit-min-content;width:-moz-min-content;width:min-content;min-width:50em;margin:5em auto;padding:0;background-color:#fff}#box-popup.box-password-view{width:-webkit-min-content;width:-moz-min-content;width:min-content;min-width:30em}#box-popup>h2{position:relative;width:100%;font-size:18px;color:#fff;background-color:#607d8b;margin:0;padding:.5em 0;line-height:1em}#box-popup>h2 .btn-popup-close{display:none;position:absolute;right:.5em;top:.2em}#box-popup>table{width:100%;padding-bottom:1em}#box-popup select{width:220px}#box-popup #resFancyAccion{display:none}#box-popup #resCheck{display:inline-block;width:80%;height:4em;padding:1em 0}#box-popup.image{background-color:transparent;max-width:100%;margin:0 auto;border-radius:0 !important;-moz-border-radius:0 !important;-webkit-border-radius:0 !important}#box-popup.image img{width:auto;margin:0 auto}#box-popup.image>div.title{background-color:#607d8b;color:#fff;padding:.5em}#box-popup.help{min-height:100px;background-color:#f5f5f5}#box-popup.help p{font-size:14px;text-align:justify;line-height:2em}#box-complexity>div{text-align:justify;line-height:1.5em;margin-top:1em}#debug{float:left;text-align:left}#debuginfo{width:100%;min-height:10em;padding:1em;background-color:#fff8e1;text-align:left;line-height:1.5em}#debuginfo H3{text-align:center}.popup-data{width:100%;min-width:400px;border:0;text-align:left;margin:0;padding:1em .5em}.popup-data .descField{min-width:100px}footer{display:flex;justify-content:space-between;position:fixed;bottom:0;z-index:100;width:100%;padding:.5em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:1em;-webkit-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);-moz-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14)}footer .footer-parts{display:flex;justify-content:space-between}footer #footer-left{width:50%;margin:0 1em}footer #footer-right{width:50%;margin:0 1em;justify-content:flex-end;text-align:right}footer #updates{min-width:10em;text-align:center;cursor:pointer}footer #status{margin:0 1em}footer #status>div{display:inline-block}footer #status .status-info{padding:.5em}footer #session{text-align:left;color:#999;font-size:.8em}footer a{color:#b9b9b9}footer a:visited{color:#b9b9b9}footer #project a:hover{color:#a9c1d7;border-bottom:1px solid #a9c1d7}footer #updates a:hover{color:#a9c1d7}footer img{border:0;width:16px;height:16px;vertical-align:middle}.round,.round5{border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}.midround{border-radius:0 0 10px 10px !important;-moz-border-radius:0 0 10px 10px !important;-webkit-border-radius:0 0 10px 10px !important}.midroundup{border-radius:10px 10px 0 0 !important;-moz-border-radius:10px 10px 0 0 !important;-webkit-border-radius:10px 10px 0 0 !important}.fullround{border-radius:50% !important;-moz-border-radius:50% !important;-webkit-border-radius:50% !important}.iconMini{width:16px !important;height:16px !important;vertical-align:middle}.hide{display:none !important}.btn-checks{padding:5px;margin:.2em 0;width:30em;border-bottom:1px solid #c9c9c9}.shadow{-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}.noRes{width:60%;padding:15px;background-color:#f9f9f9;color:#a9a9a9;border:#c9c9c9 1px solid;margin:20px auto;text-align:center;font-size:16px}.header-grey{background-color:#607d8b;color:#fff;min-height:2em}.no-background{background:none !important}.action-in-box{padding:1em;text-align:right}.action-in-box ul{list-style:none;margin:0;padding:0}.tab-data{margin:2em auto 0;width:75%}.item-actions{margin:1em auto}.tab-actions{margin:2em 0}.item-actions>ul,.tab-actions>ul{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;list-style:none;margin:0;padding:0}.item-actions>ul>li,.tab-actions>ul>li{width:auto;min-width:2em;margin-left:.5em}.item-actions>ul>li.datagrid-action-search,.tab-actions>ul>li.datagrid-action-search{min-width:5em}.item-actions>ul>li.datagrid-action-search form,.tab-actions>ul>li.datagrid-action-search form{width:100%}.fullWidth{max-width:100% !important}.filter-on{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;padding:.3em 1em}.global-on{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;padding:.3em 1em}.opacity50{filter:alpha(opacity=50);opacity:.5}.custom-combobox{position:relative;display:inline-block}.custom-combobox input{width:80%}.custom-combobox-toggle{position:absolute;top:0;bottom:0;margin-left:-1px;padding:0;*height:1.7em;*top:.1em}.custom-combobox-input{margin:0;padding:.3em}.passLevel{width:20px;height:20px;display:inline-block;position:relative;top:2px}.passLevel.strongest{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strongest:hover{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strong{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.strong:hover{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.good{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.good:hover{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.weak{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}.passLevel.weak:hover{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}#alert #alert-text{margin:15px auto;font-size:14px;font-weight:bold}#alert #alert-pass{width:50%;padding:10px;margin:15px auto;border:1px solid #c9c9c9;color:#555;font-weight:bold}.dialog-text,.dialog-user-text,.dialog-pass-text{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;padding:.5em;text-align:center;min-width:200px}.dialog-user-text{border-bottom:#d9d9d9 1px solid;color:#a9a9a9}.dialog-pass-text{border:transparent 1px solid;letter-spacing:.2em}.dialog-buttons{text-align:center;padding:.5em;border-top:1px solid #c9c9c9;line-height:2.5em}.dialog-clip-copy{color:#26a69a;background-color:#e0f2f1}.help-box{display:none;background-color:#fff !important;color:#607d8b}.help-box>*{font-weight:bold}.help-text{text-align:justify;line-height:1.5em;margin-top:1em}.tooltip{width:300px;max-width:300px;background-color:#777;color:#fff;z-index:101}.cursor-pointer{cursor:pointer}.password-actions{display:inline-block;width:12em}.password-actions>span,.password-actions i{margin-right:.6em}.custom-input-color{width:3em;height:1em;display:inline-block}.account-pass-image{height:32px;width:auto}.select-box{min-width:20em}fieldset.warning{padding:8px;border-radius:5px;color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}fieldset.warning legend{color:#ef5350 !important}fieldset.warning a{color:#ef5350 !important;font-weight:bold}#actions{width:100%;line-height:2em;margin-bottom:5em}#actions #logo{display:flex;width:100%;margin-bottom:30px;color:#607d8b;align-items:center;background:url("../imgs/logo_full_bg.png") left no-repeat;background-size:auto 150px;height:150px}#actions #page-title{width:100%;color:#607d8b;text-align:center}#actions #page-title h1{font-weight:bold;font-size:24px;letter-spacing:3px}#actions ul.errors{max-width:40vw;margin:0 auto;list-style:none;font-size:14px;text-align:left}#actions ul.errors>li{margin:1.5em auto;border-radius:3px;padding:1em .5em}#actions ul.errors>li.msg-critical{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}#actions ul.errors>li.msg-warning{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;color:#555}#actions ul.errors>li.msg-ok{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#actions ul.errors>li>p.hint{color:#555;font-size:12px}#actions ul.errors>li>p.hint i{margin-right:.5em}#actions form{width:450px;margin:0 auto;text-align:left}#actions form fieldset{margin-bottom:2em}#actions form fieldset legend{width:100%;color:#fff;font-size:14px;font-weight:bold;text-align:center;background-color:#607d8b;margin:1em 0;letter-spacing:.2em;padding:.2em 0}#actions div.buttons{margin-top:2em;text-align:center}.center{text-align:center !important}.right{text-align:right !important}.left{text-align:left !important}.opacity50{opacity:.5 !important}#login-container{width:40em;margin:0 auto;background:transparent url("../imgs/logo_full_bg.png") no-repeat top left;background-size:auto 10em}#login-container #boxSpacer{height:11em;background-color:transparent}#login-container #boxLogin{position:relative;margin:0 auto;width:100%;min-height:14em;padding:1em;background-color:#fff}#login-container #boxLogin #boxData{height:100%;min-height:14em;text-align:left;background-color:transparent}#login-container #boxLogin #boxData i{margin-right:.5em;opacity:.5}#login-container #boxLogin #boxData .extra-hidden{display:none}#login-container #boxLogin #boxButton{position:absolute;top:2em;right:2em}#login-container #boxLogin #boxActions{width:100%;text-align:right}#login-container #boxLogin #boxActions a{color:#c9c9c9}#login-container #boxLogout{margin-top:4em;width:100%}#login-container #boxLogout>div{margin:0 auto;width:250px;font-size:14px;padding:.5em;text-align:center;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#login-container #boxUpdated{width:350px;margin:3em auto;font-size:14px;text-align:center;padding:.5em;color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#login-container #demo-info{margin:3em auto;color:#c9c9c9;border-top:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:.5em}#login-container #demo-info ul{display:flex;justify-content:space-around;list-style:none}#login-container #demo-info ul li span{margin:0 2em}@media screen and (max-width:1000px){#content #searchbox .search-filters>*{margin:.5em 1em .5em 0}#content .data-container #title,#content .tab-data #title{width:90%}footer{display:none;justify-content:space-between;flex-wrap:wrap}footer .footer-parts{justify-content:space-between;flex-wrap:wrap}footer #footer-left,footer #footer-right{width:100%}footer .footer-parts>div{width:100%;padding:.5em 0}}@media screen and (max-width:600px){#content input,#box-popup input{width:100%}#content .mdl-textfield,#box-popup .mdl-textfield{width:100%}#content td.descField,#box-popup td.descField{display:none}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:block}#content #searchbox .mdl-textfield{width:90%}#content #searchbox .search-text{width:90%}#content #searchbox .search-filters .selectize-control{width:100%}#content .data-container,#content .tab-data{width:100%}#content .data-container #title,#content .tab-data #title{width:90%}#content .data-container .selectize-control,#content .tab-data .selectize-control{width:100%}#box-popup h2>.btn-popup-close{display:inline-block}.mdl-data-table{table-layout:fixed;width:100%}.table-responsive td,.table-responsive th{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.table-responsive .cell-actions i{display:block !important}} \ No newline at end of file +html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#555;font-size:12px;font-weight:normal;box-sizing:border-box}*{font-family:"Roboto Regular",Verdana,Tahoma,sans-serif;box-sizing:inherit}*:before,*:after{box-sizing:inherit}table{font-size:11px;border-spacing:0}table th{border-bottom:2px solid transparent;vertical-align:middle}table th .icon{width:24px;height:24px}table tr{height:20px}table tr.odd{background-color:#f9f9f9}table tr.even>td,table tr.odd>td{border-bottom:1px solid #d9d9d9 !important}table tr.even:hover,table tr.odd:hover{background-color:#e8ff99}table td{padding:3px}table td.txtCliente{font-weight:bold;text-align:center}form{font-size:11px;margin:0}input.inputImg,img.inputImg{background-color:transparent !important;width:24px !important;height:24px !important;border:0;vertical-align:middle;margin:0 .5em}input.txtFile{width:200px}input.txtLong{width:300px}textarea{width:350px}select.files{width:250px}input.spinner{width:5em}img{margin:0;padding:0;border:0;cursor:pointer}img.inputImgMini{background-color:transparent !important;width:16px !important;height:16px !important;margin:0 5px 0 5px;border:0;vertical-align:middle}i{cursor:pointer}form .form-field{display:flex;justify-content:space-between}form .form-field>label{min-width:12em;padding:.5em 0;font-size:16px;align-self:center}form .form-field>div{width:100%;align-self:center}a{text-decoration:none;color:#536dfe}a:visited{text-decoration:none;color:#536dfe}a:hover,a:active,a:focus{text-decoration:none;cursor:pointer}pre,code,samp,kbd{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;font-size:1em;direction:ltr;text-align:left;background-color:#fbfaf9;color:#333;box-shadow:inset 0 0 .3em #ccc;border-radius:2px}#nojs{width:80%;text-align:center;vertical-align:middle;margin:10px auto;padding:3px;background-color:#ef5350;color:white;font-weight:bold;font-size:14px}#wrap{height:auto !important;min-height:100%;width:100%;background-color:#f5f5f5}#wrap-loading{position:fixed;z-index:9999;top:50%;left:50%;padding:1em;background-color:rgba(255,255,255,0.8);display:none;border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}#wrap-loading.overlay-full{top:0;left:0;width:100%;height:100%;background-color:rgba(255,255,255,0.5)}#wrap-loading.overlay-full #loading{position:absolute;top:50%;left:50%}#wrap-loading.overlay-full #taskStatus{display:block}#wrap-loading #taskStatus{display:none;position:absolute;left:0;top:55%;width:100%;text-align:center;color:white;background-color:rgba(0,0,0,0.5);padding:1em 0}#container{margin:auto;width:100%}#container.login{padding-top:5%}#container.error,#container.install,#container.passreset{width:100%}#container .logo{height:64px}#container #actions-bar{z-index:100;display:flex;justify-content:space-between;position:fixed;border:0 none;top:0;left:0;width:100%;padding:1em 0;background-color:transparent}#container #actions-bar-icons{flex-grow:1;text-align:center}#container #actions-bar-logo{display:none;padding:0 .5em}#container #actions-bar-logo img{display:inline-block;width:50px;opacity:.75}#container #content{width:95%;margin:2em auto 8em auto}#container #content.public-link{width:70%;min-height:0;margin:5em auto}#content td.descField,#box-popup td.descField{text-align:right;padding-right:20px;width:25%;border-right:1px solid #d9d9d9;color:#999;font-size:12px;font-weight:bold}#content td.valField,#box-popup td.valField{padding-left:1em;width:100%}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:none;width:100%;color:#607d8b;font-size:12px}#content .pager{width:100%;margin-top:15px;padding:.5em;vertical-align:middle;font-size:11px;color:#999;background-color:#fcfcfc}#content .pager img{margin-left:5px;vertical-align:middle}#content .pager a{margin-left:5px;font-size:12px;color:#999}#content .pager>div{display:inline-block;width:49%}#content .pager .pager-left{text-align:left}#content .pager .pager-right{text-align:right}#content #title{width:50%;padding:7px;margin:auto;background-color:#d9d9d9;color:#fff;font-size:17px;letter-spacing:.3em;text-align:center}#content #title.titleNormal{background-color:#607d8b;color:#fff}#content .data-container{width:75%;margin:0 auto}#content fieldset.data{margin:2em auto}#content fieldset.data>legend{color:#607d8b;padding:0 .5em;font-size:1.5em}#content fieldset.data>div{display:none}#content fieldset.data>div table{width:100%}#content .data{width:100%;padding:10px;margin:0 auto;background-color:#fff;-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}#content .data #history-icon{position:relative;top:5em;right:2em}#content .data td{text-align:left}#content .data td.descField{text-align:right}#content .data select{min-width:210px}#content .data .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .dropzone{width:30em;padding:1em;border:2px dashed #26a69a;text-align:center}#content .data .dropzone img{vertical-align:middle}#content .data .file-upload{display:none}#content .data .account-permissions{width:100%}#content .data .account-permissions fieldset{border:1px solid #c9c9c9;padding:1em}#content .data .account-permissions legend{font-weight:bold;color:#999;padding:.2em 0}#content .data .account-permissions fieldset>span{font-weight:bold;color:#999;padding:.2em 0;display:inline-block;width:100px;text-align:right}#content span.tag{margin:0 3px 3px 0;padding:.2em;background:#5c6bc0;color:#fff;border:0 solid transparent;border-radius:3px !important;-moz-border-radius:3px !important;-webkit-border-radius:3px !important}#content .extra-info{margin-top:20px}#content #tabs fieldset{border:1px solid #c9c9c9}#content #tabs #frmConfig label{float:left}#content .tblConfig{margin-bottom:2em}#content .tblConfig td.descField{width:35%;font-size:11px;font-weight:bold}#content .tblConfig td.rowHeader{padding:5px 0 5px 0;background-color:#f5f5f5;text-align:center;font-weight:bold;border-top:15px solid #f9f9f9;border-bottom:3px solid #a9c1d7;letter-spacing:.5em;color:#696969}#content .tblConfig input.checkbox{width:15px;text-align:left;padding:0}#content .tblConfig .option-disabled{text-align:center;background-color:#fff8e1;color:#ffca28;font-weight:bold}#content h2{width:100%;height:1.5em;font-size:18px;color:white;background-color:#a9c1d7;margin:0;padding-top:.1em}#content .section{margin-top:2.5em;border-bottom:1px solid #d9d9d9;text-align:left;font-size:14px;font-weight:bold;color:#5c6bc0}#content .row_even>td{background-color:#f5f5f5}#content .row_odd>td{background-color:white}#content .data-header ul{list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{display:inline-block;padding:.2em .5em;font-weight:bold;letter-spacing:.2em;color:#fff;text-align:center}#content .data-header li a{color:#777}#content .data-header li img{float:right;width:24px;height:24px;vertical-align:middle}#content .data-header-minimal{border-bottom:1px solid #dfdfdf}#content .data-header-minimal ul{display:flex;flex-wrap:wrap;justify-content:flex-start;margin:0}#content .data-header-minimal li{display:inline-flex;min-width:10em;font-weight:normal;letter-spacing:normal}#content .data-header-minimal li a{color:#b9b9b9;padding:.3em .8em}#content .data-table{width:100%}#content .data-table td:first-of-type,#content .data-table th:first-of-type{width:5em}#content .data-table thead th{background-color:#607d8b;color:#fff}#content .data-table tbody td.cell-data{text-align:left}#content .data-table tbody td.cell-nodata{padding:0 .5em;text-align:left}#content .data-table tbody td.cell-actions{text-align:right}#content .data-table tbody td.cell-actions i{opacity:.5}#content .data-table tbody td.cell-actions i:hover{opacity:1}#content .data-rows ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0;background-color:#fcfcfc}#content .data-rows li{float:left;display:block;padding:1em;color:#696969;text-align:center;min-height:2em}#content .data-rows li.cell-nodata{padding:1em 0;min-height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;min-height:2em;padding:1em 0;text-align:left;background-color:#fcfcfc;width:15em}#content .data-rows li.cell-nodata img,#content .data-rows li.cell-actions img{width:24px;height:24px;margin:0 .5em}#content #resEventLog .data{width:100%}#content #resEventLog thead{text-align:center}#content #resEventLog tbody{width:100%;height:500px;overflow:auto}#content #resEventLog td{border-bottom:1px solid #d9d9d9}#content #resEventLog .cell{text-align:center}#content #resEventLog .cell-description{width:60%}#content #searchbox{background-color:#fcfcfc;vertical-align:middle;position:relative;height:auto;padding:.5em 1em;margin-bottom:2em}#content #searchbox form{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;text-align:left}#content #searchbox .search-filters>*{margin:0 .5em}#content #searchbox .search-filters .filter-buttons{display:inline-block}#content #searchbox .search-filters .filter-slider{width:10em}#content #searchbox .search-filters-tags{display:none;flex-grow:2}#content .btn-clear{opacity:.35;filter:alpha(opacity=35)}#content .btn-clear:hover{opacity:1;filter:alpha(opacity=100)}#content .actions-optional{display:none}#content .error{width:350px;padding:15px;margin:0 auto;text-align:center;font-size:16px;line-height:1.5em;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#box-popup .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .list-wrap ul,#box-popup .list-wrap ul{list-style-type:none;margin:0;padding:0}#content .data .list-wrap li,#box-popup .list-wrap li{display:flex;background:#f2f2f2;padding:.5em;font-size:1em;margin-bottom:.5em}#content .data .list-wrap li:hover,#box-popup .list-wrap li:hover{background:#e8eaf6;color:#000}#content .data .list-wrap div.files-item-info,#box-popup .list-wrap div.files-item-info{flex-grow:2}#content .data .list-wrap div.files-item-info img,#box-popup .list-wrap div.files-item-info img{margin:0 .5em}#content .data .list-wrap div.files-item-actions,#box-popup .list-wrap div.files-item-actions{padding:.3em 0}#box-popup{width:-webkit-min-content;width:-moz-min-content;width:min-content;min-width:50em;margin:5em auto;padding:0;background-color:#fff}#box-popup.box-password-view{width:-webkit-min-content;width:-moz-min-content;width:min-content;min-width:30em}#box-popup>h2{position:relative;width:100%;font-size:18px;color:#fff;background-color:#607d8b;margin:0;padding:.5em 0;line-height:1em}#box-popup>h2 .btn-popup-close{display:none;position:absolute;right:.5em;top:.2em}#box-popup>table{width:100%;padding-bottom:1em}#box-popup select{width:220px}#box-popup #resFancyAccion{display:none}#box-popup #resCheck{display:inline-block;width:80%;height:4em;padding:1em 0}#box-popup.image{background-color:transparent;max-width:100%;margin:0 auto;border-radius:0 !important;-moz-border-radius:0 !important;-webkit-border-radius:0 !important}#box-popup.image img{width:auto;margin:0 auto}#box-popup.image>div.title{background-color:#607d8b;color:#fff;padding:.5em}#box-popup.help{min-height:100px;background-color:#f5f5f5}#box-popup.help p{font-size:14px;text-align:justify;line-height:2em}#box-complexity>div{text-align:justify;line-height:1.5em;margin-top:1em}#debug{float:left;text-align:left}#debuginfo{width:100%;min-height:10em;padding:1em;background-color:#fff8e1;text-align:left;line-height:1.5em}#debuginfo H3{text-align:center}.popup-data{width:100%;min-width:400px;border:0;text-align:left;margin:0;padding:1em .5em}.popup-data .descField{min-width:100px}footer{display:flex;justify-content:space-between;position:fixed;bottom:0;z-index:100;width:100%;padding:.5em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:1em;-webkit-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);-moz-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14)}footer .footer-parts{display:flex;justify-content:space-between}footer #footer-left{width:50%;margin:0 1em}footer #footer-right{width:50%;margin:0 1em;justify-content:flex-end;text-align:right}footer #updates{min-width:10em;text-align:center;cursor:pointer}footer #status{margin:0 1em}footer #status>div{display:inline-block}footer #status .status-info{padding:.5em}footer #session{text-align:left;color:#999;font-size:.8em}footer a{color:#b9b9b9}footer a:visited{color:#b9b9b9}footer #project a:hover{color:#a9c1d7;border-bottom:1px solid #a9c1d7}footer #updates a:hover{color:#a9c1d7}footer img{border:0;width:16px;height:16px;vertical-align:middle}.round,.round5{border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}.midround{border-radius:0 0 10px 10px !important;-moz-border-radius:0 0 10px 10px !important;-webkit-border-radius:0 0 10px 10px !important}.midroundup{border-radius:10px 10px 0 0 !important;-moz-border-radius:10px 10px 0 0 !important;-webkit-border-radius:10px 10px 0 0 !important}.fullround{border-radius:50% !important;-moz-border-radius:50% !important;-webkit-border-radius:50% !important}.iconMini{width:16px !important;height:16px !important;vertical-align:middle}.hide{display:none !important}.btn-checks{padding:5px;margin:.2em 0;width:30em;border-bottom:1px solid #c9c9c9}.shadow{-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}.noRes{width:60%;padding:15px;background-color:#f9f9f9;color:#a9a9a9;border:#c9c9c9 1px solid;margin:20px auto;text-align:center;font-size:16px}.header-grey{background-color:#607d8b;color:#fff;min-height:2em}.no-background{background:none !important}.action-in-box{padding:1em;text-align:right}.action-in-box ul{list-style:none;margin:0;padding:0}.tab-data{margin:2em auto 0;width:75%}.item-actions{margin:1em auto}.tab-actions{margin:2em 0}.item-actions>ul,.tab-actions>ul{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;list-style:none;margin:0;padding:0}.item-actions>ul>li,.tab-actions>ul>li{width:auto;min-width:2em;margin-left:.5em}.item-actions>ul>li.datagrid-action-search,.tab-actions>ul>li.datagrid-action-search{min-width:5em}.item-actions>ul>li.datagrid-action-search form,.tab-actions>ul>li.datagrid-action-search form{width:100%}.fullWidth{max-width:100% !important}.filter-on{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;padding:.3em 1em}.global-on{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;padding:.3em 1em}.opacity50{filter:alpha(opacity=50);opacity:.5}.custom-combobox{position:relative;display:inline-block}.custom-combobox input{width:80%}.custom-combobox-toggle{position:absolute;top:0;bottom:0;margin-left:-1px;padding:0;*height:1.7em;*top:.1em}.custom-combobox-input{margin:0;padding:.3em}.passLevel{width:20px;height:20px;display:inline-block;position:relative;top:2px}.passLevel.strongest{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strongest:hover{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strong{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.strong:hover{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.good{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.good:hover{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.weak{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}.passLevel.weak:hover{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}#alert #alert-text{margin:15px auto;font-size:14px;font-weight:bold}#alert #alert-pass{width:50%;padding:10px;margin:15px auto;border:1px solid #c9c9c9;color:#555;font-weight:bold}.dialog-text,.dialog-user-text,.dialog-pass-text{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;padding:.5em;text-align:center;min-width:200px}.dialog-user-text{border-bottom:#d9d9d9 1px solid;color:#a9a9a9}.dialog-pass-text{border:transparent 1px solid;letter-spacing:.2em}.dialog-buttons{text-align:center;padding:.5em;border-top:1px solid #c9c9c9;line-height:2.5em}.dialog-clip-copy{color:#26a69a;background-color:#e0f2f1}.help-box{display:none;background-color:#fff !important;color:#607d8b}.help-box>*{font-weight:bold}.help-text{text-align:justify;line-height:1.5em;margin-top:1em}.tooltip{width:300px;max-width:300px;background-color:#777;color:#fff;z-index:101}.cursor-pointer{cursor:pointer}.password-actions{display:inline-block;width:12em}.password-actions>span,.password-actions i{margin-right:.6em}.custom-input-color{width:3em;height:1em;display:inline-block}.account-pass-image{height:32px;width:auto}.select-box{min-width:20em}fieldset.warning{padding:8px;border-radius:5px;color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}fieldset.warning legend{color:#ef5350 !important}fieldset.warning a{color:#ef5350 !important;font-weight:bold}#actions{width:100%;line-height:2em;margin-bottom:5em}#actions #logo{display:flex;width:100%;margin-bottom:30px;color:#607d8b;align-items:center;background:url("../../../../../../public/images/logo_full_bg.png") left no-repeat;background-size:auto 150px;height:150px}#actions #page-title{width:100%;color:#607d8b;text-align:center}#actions #page-title h1{font-weight:bold;font-size:24px;letter-spacing:3px}#actions ul.errors{max-width:40vw;margin:0 auto;list-style:none;font-size:14px;text-align:left}#actions ul.errors>li{margin:1.5em auto;border-radius:3px;padding:1em .5em}#actions ul.errors>li.msg-critical{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}#actions ul.errors>li.msg-warning{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;color:#555}#actions ul.errors>li.msg-ok{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#actions ul.errors>li>p.hint{color:#555;font-size:12px}#actions ul.errors>li>p.hint i{margin-right:.5em}#actions form{width:450px;margin:0 auto;text-align:left}#actions form fieldset{margin-bottom:2em}#actions form fieldset legend{width:100%;color:#fff;font-size:14px;font-weight:bold;text-align:center;background-color:#607d8b;margin:1em 0;letter-spacing:.2em;padding:.2em 0}#actions div.buttons{margin-top:2em;text-align:center}.center{text-align:center !important}.right{text-align:right !important}.left{text-align:left !important}.opacity50{opacity:.5 !important}#login-container{width:40em;margin:0 auto;background:transparent url("../../../../public/images/logo_full_bg.png") no-repeat top left;background-size:auto 10em}#login-container #boxSpacer{height:11em;background-color:transparent}#login-container #boxLogin{position:relative;margin:0 auto;width:100%;min-height:14em;padding:1em;background-color:#fff}#login-container #boxLogin #boxData{height:100%;min-height:14em;text-align:left;background-color:transparent}#login-container #boxLogin #boxData i{margin-right:.5em;opacity:.5}#login-container #boxLogin #boxData .extra-hidden{display:none}#login-container #boxLogin #boxButton{position:absolute;top:2em;right:2em}#login-container #boxLogin #boxActions{width:100%;text-align:right}#login-container #boxLogin #boxActions a{color:#c9c9c9}#login-container #boxLogout{margin-top:4em;width:100%}#login-container #boxLogout>div{margin:0 auto;width:250px;font-size:14px;padding:.5em;text-align:center;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#login-container #boxUpdated{width:350px;margin:3em auto;font-size:14px;text-align:center;padding:.5em;color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#login-container #demo-info{margin:3em auto;color:#c9c9c9;border-top:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:.5em}#login-container #demo-info ul{display:flex;justify-content:space-around;list-style:none}#login-container #demo-info ul li span{margin:0 2em}@media screen and (max-width:1000px){#content #searchbox .search-filters>*{margin:.5em 1em .5em 0}#content .data-container #title,#content .tab-data #title{width:90%}footer{display:none;justify-content:space-between;flex-wrap:wrap}footer .footer-parts{justify-content:space-between;flex-wrap:wrap}footer #footer-left,footer #footer-right{width:100%}footer .footer-parts>div{width:100%;padding:.5em 0}}@media screen and (max-width:600px){#content input,#box-popup input{width:100%}#content .mdl-textfield,#box-popup .mdl-textfield{width:100%}#content td.descField,#box-popup td.descField{display:none}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:block}#content #searchbox .mdl-textfield{width:90%}#content #searchbox .search-text{width:90%}#content #searchbox .search-filters .selectize-control{width:100%}#content .data-container,#content .tab-data{width:100%}#content .data-container #title,#content .tab-data #title{width:90%}#content .data-container .selectize-control,#content .tab-data .selectize-control{width:100%}#box-popup h2>.btn-popup-close{display:inline-block}.mdl-data-table{table-layout:fixed;width:100%}.table-responsive td,.table-responsive th{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.table-responsive .cell-actions i{display:block !important}} \ No newline at end of file diff --git a/inc/themes/material-blue/css/styles.scss b/app/modules/web/themes/material-blue/css/styles.scss similarity index 99% rename from inc/themes/material-blue/css/styles.scss rename to app/modules/web/themes/material-blue/css/styles.scss index 6dc3d992..24ac66eb 100644 --- a/inc/themes/material-blue/css/styles.scss +++ b/app/modules/web/themes/material-blue/css/styles.scss @@ -1030,7 +1030,7 @@ fieldset.warning { margin-bottom: 30px; color: $color-bluegrey-fg; align-items: center; - background: url("../imgs/logo_full_bg.png") left no-repeat; + background: url($public-path + "/images/logo_full_bg.png") left no-repeat; background-size: auto 150px; height: 150px; } diff --git a/inc/themes/material-blue/css/toastr.css b/app/modules/web/themes/material-blue/css/toastr.css similarity index 100% rename from inc/themes/material-blue/css/toastr.css rename to app/modules/web/themes/material-blue/css/toastr.css diff --git a/inc/themes/material-blue/css/toastr.css.map b/app/modules/web/themes/material-blue/css/toastr.css.map similarity index 100% rename from inc/themes/material-blue/css/toastr.css.map rename to app/modules/web/themes/material-blue/css/toastr.css.map diff --git a/inc/themes/material-blue/css/toastr.min.css b/app/modules/web/themes/material-blue/css/toastr.min.css similarity index 100% rename from inc/themes/material-blue/css/toastr.min.css rename to app/modules/web/themes/material-blue/css/toastr.min.css diff --git a/inc/themes/material-blue/css/toastr.scss b/app/modules/web/themes/material-blue/css/toastr.scss similarity index 100% rename from inc/themes/material-blue/css/toastr.scss rename to app/modules/web/themes/material-blue/css/toastr.scss diff --git a/inc/themes/material-blue/inc/Icons.php b/app/modules/web/themes/material-blue/inc/Icons.php similarity index 100% rename from inc/themes/material-blue/inc/Icons.php rename to app/modules/web/themes/material-blue/inc/Icons.php diff --git a/inc/themes/material-blue/index.php b/app/modules/web/themes/material-blue/index.php similarity index 98% rename from inc/themes/material-blue/index.php rename to app/modules/web/themes/material-blue/index.php index 2e0a8981..df2eed2f 100644 --- a/inc/themes/material-blue/index.php +++ b/app/modules/web/themes/material-blue/index.php @@ -23,7 +23,7 @@ * */ -$themeInfo = [ +return [ 'name' => 'Material Blue', 'creator' => 'nuxsmin', 'version' => '2.0', diff --git a/inc/themes/material-blue/js/LICENSE b/app/modules/web/themes/material-blue/js/LICENSE similarity index 100% rename from inc/themes/material-blue/js/LICENSE rename to app/modules/web/themes/material-blue/js/LICENSE diff --git a/inc/themes/material-blue/js/app-theme.js b/app/modules/web/themes/material-blue/js/app-theme.js similarity index 100% rename from inc/themes/material-blue/js/app-theme.js rename to app/modules/web/themes/material-blue/js/app-theme.js diff --git a/inc/themes/material-blue/js/app-theme.min.js b/app/modules/web/themes/material-blue/js/app-theme.min.js similarity index 100% rename from inc/themes/material-blue/js/app-theme.min.js rename to app/modules/web/themes/material-blue/js/app-theme.min.js diff --git a/inc/themes/material-blue/js/bootstrap-material-datetimepicker.js b/app/modules/web/themes/material-blue/js/bootstrap-material-datetimepicker.js similarity index 100% rename from inc/themes/material-blue/js/bootstrap-material-datetimepicker.js rename to app/modules/web/themes/material-blue/js/bootstrap-material-datetimepicker.js diff --git a/inc/themes/material-blue/js/bootstrap-material-datetimepicker.min.js b/app/modules/web/themes/material-blue/js/bootstrap-material-datetimepicker.min.js similarity index 100% rename from inc/themes/material-blue/js/bootstrap-material-datetimepicker.min.js rename to app/modules/web/themes/material-blue/js/bootstrap-material-datetimepicker.min.js diff --git a/inc/themes/material-blue/js/material.js b/app/modules/web/themes/material-blue/js/material.js similarity index 100% rename from inc/themes/material-blue/js/material.js rename to app/modules/web/themes/material-blue/js/material.js diff --git a/inc/themes/material-blue/js/material.min.js b/app/modules/web/themes/material-blue/js/material.min.js similarity index 100% rename from inc/themes/material-blue/js/material.min.js rename to app/modules/web/themes/material-blue/js/material.min.js diff --git a/inc/themes/material-blue/js/mdl-jquery-modal-dialog.js b/app/modules/web/themes/material-blue/js/mdl-jquery-modal-dialog.js similarity index 100% rename from inc/themes/material-blue/js/mdl-jquery-modal-dialog.js rename to app/modules/web/themes/material-blue/js/mdl-jquery-modal-dialog.js diff --git a/inc/themes/material-blue/js/mdl-jquery-modal-dialog.min.js b/app/modules/web/themes/material-blue/js/mdl-jquery-modal-dialog.min.js similarity index 100% rename from inc/themes/material-blue/js/mdl-jquery-modal-dialog.min.js rename to app/modules/web/themes/material-blue/js/mdl-jquery-modal-dialog.min.js diff --git a/inc/themes/material-blue/views/main/body-content.inc b/app/modules/web/themes/material-blue/views/_partials/body-content.inc similarity index 100% rename from inc/themes/material-blue/views/main/body-content.inc rename to app/modules/web/themes/material-blue/views/_partials/body-content.inc diff --git a/inc/themes/material-blue/views/main/body-end.inc b/app/modules/web/themes/material-blue/views/_partials/body-end.inc similarity index 100% rename from inc/themes/material-blue/views/main/body-end.inc rename to app/modules/web/themes/material-blue/views/_partials/body-end.inc diff --git a/inc/themes/material-blue/views/main/body-footer.inc b/app/modules/web/themes/material-blue/views/_partials/body-footer.inc similarity index 100% rename from inc/themes/material-blue/views/main/body-footer.inc rename to app/modules/web/themes/material-blue/views/_partials/body-footer.inc diff --git a/inc/themes/material-blue/views/main/body-header-menu.inc b/app/modules/web/themes/material-blue/views/_partials/body-header-menu.inc similarity index 100% rename from inc/themes/material-blue/views/main/body-header-menu.inc rename to app/modules/web/themes/material-blue/views/_partials/body-header-menu.inc diff --git a/inc/themes/material-blue/views/main/body-header.inc b/app/modules/web/themes/material-blue/views/_partials/body-header.inc similarity index 100% rename from inc/themes/material-blue/views/main/body-header.inc rename to app/modules/web/themes/material-blue/views/_partials/body-header.inc diff --git a/inc/themes/material-blue/views/main/body-start.inc b/app/modules/web/themes/material-blue/views/_partials/body-start.inc similarity index 100% rename from inc/themes/material-blue/views/main/body-start.inc rename to app/modules/web/themes/material-blue/views/_partials/body-start.inc diff --git a/inc/themes/material-blue/views/main/error-list.inc b/app/modules/web/themes/material-blue/views/_partials/error-list.inc similarity index 100% rename from inc/themes/material-blue/views/main/error-list.inc rename to app/modules/web/themes/material-blue/views/_partials/error-list.inc diff --git a/inc/SP/Config/ConfigUtil.php b/app/modules/web/themes/material-blue/views/_partials/error.inc similarity index 60% rename from inc/SP/Config/ConfigUtil.php rename to app/modules/web/themes/material-blue/views/_partials/error.inc index 19402672..62a56e1c 100644 --- a/inc/SP/Config/ConfigUtil.php +++ b/app/modules/web/themes/material-blue/views/_partials/error.inc @@ -22,30 +22,19 @@ * along with sysPass. If not, see . */ -namespace SP\Config; - /** - * Class ConfigUtil - * @package Config + * @var $icons \SP\Core\UI\ThemeIconsBase + * @var \SP\Core\Template $this */ -class ConfigUtil -{ - /** - * Adaptador para convertir una cadena de extensiones a un array - * - * @param $filesAllowedExts - * @return array - */ - public static function filesExtsAdapter(&$filesAllowedExts) - { - $exts = explode(',', $filesAllowedExts); +?> +
+ includePartial('error-list'); ?> - array_walk($exts, function (&$value) { - if (preg_match('/[^a-z0-9_-]+/i', $value)) { - $value = null; - } - }); - - return $exts; - } -} \ No newline at end of file +
+ +
+
diff --git a/inc/themes/material-blue/views/main/header.inc b/app/modules/web/themes/material-blue/views/_partials/header.inc similarity index 100% rename from inc/themes/material-blue/views/main/header.inc rename to app/modules/web/themes/material-blue/views/_partials/header.inc diff --git a/app/modules/web/themes/material-blue/views/_partials/sessionbar.inc b/app/modules/web/themes/material-blue/views/_partials/sessionbar.inc new file mode 100644 index 00000000..e69de29b diff --git a/inc/themes/material-blue/views/account/account-editpass.inc b/app/modules/web/themes/material-blue/views/account/account-editpass.inc similarity index 100% rename from inc/themes/material-blue/views/account/account-editpass.inc rename to app/modules/web/themes/material-blue/views/account/account-editpass.inc diff --git a/inc/themes/material-blue/views/account/account-link.inc b/app/modules/web/themes/material-blue/views/account/account-link.inc similarity index 100% rename from inc/themes/material-blue/views/account/account-link.inc rename to app/modules/web/themes/material-blue/views/account/account-link.inc diff --git a/inc/themes/material-blue/views/account/account-permissions.inc b/app/modules/web/themes/material-blue/views/account/account-permissions.inc similarity index 100% rename from inc/themes/material-blue/views/account/account-permissions.inc rename to app/modules/web/themes/material-blue/views/account/account-permissions.inc diff --git a/inc/themes/material-blue/views/account/account.inc b/app/modules/web/themes/material-blue/views/account/account.inc similarity index 97% rename from inc/themes/material-blue/views/account/account.inc rename to app/modules/web/themes/material-blue/views/account/account.inc index 6eb85fdd..45e8e155 100644 --- a/inc/themes/material-blue/views/account/account.inc +++ b/app/modules/web/themes/material-blue/views/account/account.inc @@ -63,7 +63,7 @@ value="id; ?>" id == $accountData->getAccountCustomerId()) ? 'selected' : ''; ?>>name; ?> - + id == $accountData->getAccountCategoryId()) ? 'selected' : ''; ?>>name; ?> - + data-sk="" - data-item-type="" + data-item-type="accountsUser" data-item-id="" data-selected-id="getAccountParentId() : ''; ?>"> diff --git a/inc/themes/material-blue/views/account/actions.inc b/app/modules/web/themes/material-blue/views/account/actions.inc similarity index 98% rename from inc/themes/material-blue/views/account/actions.inc rename to app/modules/web/themes/material-blue/views/account/actions.inc index 1939edf3..8bca383c 100644 --- a/inc/themes/material-blue/views/account/actions.inc +++ b/app/modules/web/themes/material-blue/views/account/actions.inc @@ -1,4 +1,5 @@ getIconViewPass()->getIcon(); ?> - +
  • - isShowEdit() && $actionId == \SP\Core\ActionsInterface::ACTION_ACC_VIEW && Checks::mailrequestIsEnabled()): ?> + isShowEdit() && $actionId == \SP\Core\ActionsInterface::ACTION_ACC_VIEW && $mailRequestEnabled): ?>
  • CONFIG FILE: -
    +
  • diff --git a/inc/themes/material-blue/views/common/errorfancy.inc b/app/modules/web/themes/material-blue/views/common/errorfancy.inc similarity index 100% rename from inc/themes/material-blue/views/common/errorfancy.inc rename to app/modules/web/themes/material-blue/views/common/errorfancy.inc diff --git a/inc/themes/material-blue/views/common/tabs-end.inc b/app/modules/web/themes/material-blue/views/common/tabs-end.inc similarity index 100% rename from inc/themes/material-blue/views/common/tabs-end.inc rename to app/modules/web/themes/material-blue/views/common/tabs-end.inc diff --git a/inc/themes/material-blue/views/common/tabs-start.inc b/app/modules/web/themes/material-blue/views/common/tabs-start.inc similarity index 100% rename from inc/themes/material-blue/views/common/tabs-start.inc rename to app/modules/web/themes/material-blue/views/common/tabs-start.inc diff --git a/inc/themes/material-blue/views/config/accounts.inc b/app/modules/web/themes/material-blue/views/config/accounts.inc similarity index 94% rename from inc/themes/material-blue/views/config/accounts.inc rename to app/modules/web/themes/material-blue/views/config/accounts.inc index 335c6249..230c6cb4 100644 --- a/inc/themes/material-blue/views/config/accounts.inc +++ b/app/modules/web/themes/material-blue/views/config/accounts.inc @@ -29,7 +29,7 @@ + value="getAccountCount(); ?>" required/> @@ -49,7 +49,7 @@ @@ -68,7 +68,7 @@ @@ -92,7 +92,7 @@ isAccountPassToImage() ? 'checked' : ''; ?>/> + isAccountPassToImage() ? 'checked' : ''; ?>/> @@ -112,7 +112,7 @@ isResultsAsCards() ? 'checked' : ''; ?>/> + isResultsAsCards() ? 'checked' : ''; ?>/> @@ -135,7 +135,7 @@ isAccountFullGroupAccess() ? 'checked' : ''; ?>/> + isAccountFullGroupAccess() ? 'checked' : ''; ?>/> @@ -170,7 +170,7 @@ isPublinksEnabled() ? 'checked' : ''; ?>/> + isPublinksEnabled() ? 'checked' : ''; ?>/> @@ -184,7 +184,7 @@ + value="getPublinksMaxTime() / 60; ?>"/> @@ -199,7 +199,7 @@ + value="getPublinksMaxViews(); ?>"/> @@ -220,7 +220,7 @@ isPublinksImageEnabled() ? 'checked' : ''; ?>/> + isPublinksImageEnabled() ? 'checked' : ''; ?>/> @@ -247,7 +247,7 @@ isFilesEnabled() ? 'checked' : ''; ?>/> + isFilesEnabled() ? 'checked' : ''; ?>/> @@ -275,7 +275,7 @@
    + value="getFilesAllowedExts()); ?>"/> @@ -298,7 +298,7 @@ + value="getFilesAllowedSize(); ?>"/> diff --git a/inc/themes/material-blue/views/config/backup.inc b/app/modules/web/themes/material-blue/views/config/backup.inc similarity index 100% rename from inc/themes/material-blue/views/config/backup.inc rename to app/modules/web/themes/material-blue/views/config/backup.inc diff --git a/inc/themes/material-blue/views/config/encryption.inc b/app/modules/web/themes/material-blue/views/config/encryption.inc similarity index 100% rename from inc/themes/material-blue/views/config/encryption.inc rename to app/modules/web/themes/material-blue/views/config/encryption.inc diff --git a/inc/themes/material-blue/views/config/general-auth.inc b/app/modules/web/themes/material-blue/views/config/general-auth.inc similarity index 90% rename from inc/themes/material-blue/views/config/general-auth.inc rename to app/modules/web/themes/material-blue/views/config/general-auth.inc index 72f25970..f72db714 100644 --- a/inc/themes/material-blue/views/config/general-auth.inc +++ b/app/modules/web/themes/material-blue/views/config/general-auth.inc @@ -9,7 +9,7 @@ @@ -21,7 +21,7 @@ isAuthBasicAutoLoginEnabled() ? 'checked' : ''; ?>/> + isAuthBasicAutoLoginEnabled() ? 'checked' : ''; ?>/> @@ -41,7 +41,7 @@
    + maxlength="128" value="getAuthBasicDomain(); ?>">
    @@ -66,7 +66,7 @@ + value="id; ?>" id === $ConfigData->getSsoDefaultGroup() ? 'selected' : ''; ?>>name; ?> @@ -90,7 +90,7 @@ + value="id; ?>" id === $ConfigData->getSsoDefaultProfile()) ? 'selected' : ''; ?>>name; ?> diff --git a/inc/themes/material-blue/views/config/general-events.inc b/app/modules/web/themes/material-blue/views/config/general-events.inc similarity index 88% rename from inc/themes/material-blue/views/config/general-events.inc rename to app/modules/web/themes/material-blue/views/config/general-events.inc index cd8d9826..04f90737 100644 --- a/inc/themes/material-blue/views/config/general-events.inc +++ b/app/modules/web/themes/material-blue/views/config/general-events.inc @@ -17,7 +17,7 @@ @@ -28,7 +28,7 @@ @@ -39,7 +39,7 @@ @@ -52,7 +52,7 @@
    + value="getSyslogServer(); ?>"/>
    @@ -66,7 +66,7 @@
    + value="getSyslogPort(); ?>"/>
    diff --git a/inc/themes/material-blue/views/config/general-proxy.inc b/app/modules/web/themes/material-blue/views/config/general-proxy.inc similarity index 94% rename from inc/themes/material-blue/views/config/general-proxy.inc rename to app/modules/web/themes/material-blue/views/config/general-proxy.inc index 64bb9232..900167e1 100644 --- a/inc/themes/material-blue/views/config/general-proxy.inc +++ b/app/modules/web/themes/material-blue/views/config/general-proxy.inc @@ -9,7 +9,7 @@ @@ -22,7 +22,7 @@
    + maxlength="128" value="getProxyServer(); ?>">
    @@ -36,7 +36,7 @@
    + maxlength="128" value="getProxyPort(); ?>">
    @@ -50,7 +50,7 @@
    + maxlength="128" value="getProxyUser(); ?>">
    @@ -64,7 +64,7 @@
    + maxlength="128" value="getProxyPass(); ?>">
    diff --git a/inc/themes/material-blue/views/config/general-site.inc b/app/modules/web/themes/material-blue/views/config/general-site.inc similarity index 91% rename from inc/themes/material-blue/views/config/general-site.inc rename to app/modules/web/themes/material-blue/views/config/general-site.inc index 56d03c54..f4643e70 100644 --- a/inc/themes/material-blue/views/config/general-site.inc +++ b/app/modules/web/themes/material-blue/views/config/general-site.inc @@ -26,7 +26,7 @@ @@ -49,7 +49,7 @@ class="select-box sel-chosen-ns" > $themeName): ?> + value='' getSiteTheme() === $themeDir) ? "SELECTED" : ""; ?>> @@ -62,7 +62,7 @@
    + value="getSessionTimeout(); ?>" required/>
    @@ -82,7 +82,7 @@ @@ -100,7 +100,7 @@ @@ -118,7 +118,7 @@ @@ -136,7 +136,7 @@ @@ -154,7 +154,7 @@ @@ -175,7 +175,7 @@ diff --git a/inc/themes/material-blue/views/config/general.inc b/app/modules/web/themes/material-blue/views/config/general.inc similarity index 100% rename from inc/themes/material-blue/views/config/general.inc rename to app/modules/web/themes/material-blue/views/config/general.inc diff --git a/inc/themes/material-blue/views/config/import.inc b/app/modules/web/themes/material-blue/views/config/import.inc similarity index 98% rename from inc/themes/material-blue/views/config/import.inc rename to app/modules/web/themes/material-blue/views/config/import.inc index f67040fa..822bffe3 100644 --- a/inc/themes/material-blue/views/config/import.inc +++ b/app/modules/web/themes/material-blue/views/config/import.inc @@ -1,5 +1,5 @@ +use SP\Core\SessionFactory; ?>
    @@ -28,7 +28,7 @@ use SP\Core\Session; ?> diff --git a/inc/themes/material-blue/views/config/info.inc b/app/modules/web/themes/material-blue/views/config/info.inc similarity index 100% rename from inc/themes/material-blue/views/config/info.inc rename to app/modules/web/themes/material-blue/views/config/info.inc diff --git a/inc/themes/material-blue/views/config/ldap.inc b/app/modules/web/themes/material-blue/views/config/ldap.inc similarity index 96% rename from inc/themes/material-blue/views/config/ldap.inc rename to app/modules/web/themes/material-blue/views/config/ldap.inc index 277b096d..3661c1ca 100644 --- a/inc/themes/material-blue/views/config/ldap.inc +++ b/app/modules/web/themes/material-blue/views/config/ldap.inc @@ -32,7 +32,7 @@ isLdapEnabled() ? 'checked' : ''; ?>/> + isLdapEnabled() ? 'checked' : ''; ?>/> @@ -52,7 +52,7 @@ isLdapAds() ? 'checked' : ''; ?>/> + isLdapAds() ? 'checked' : ''; ?>/> @@ -82,7 +82,7 @@
    + maxlength="128" value="getLdapServer(); ?>"/>
    @@ -112,7 +112,7 @@
    + maxlength="128" value="getLdapBindUser(); ?>"/>
    @@ -133,7 +133,7 @@
    + maxlength="128" value="getLdapBindPass(); ?>"/>
    @@ -163,7 +163,7 @@
    + maxlength="128" value="getLdapBase(); ?>"/>
    @@ -197,7 +197,7 @@
    + maxlength="128" value="getLdapGroup(); ?>"/>
    @@ -221,7 +221,7 @@ + value="id; ?>" id === $ConfigData->getLdapDefaultGroup() ? 'selected' : ''; ?>>name; ?> @@ -245,7 +245,7 @@ + value="id; ?>" id === $ConfigData->getLdapDefaultProfile()) ? 'selected' : ''; ?>>name; ?> diff --git a/inc/themes/material-blue/views/config/mail.inc b/app/modules/web/themes/material-blue/views/config/mail.inc similarity index 93% rename from inc/themes/material-blue/views/config/mail.inc rename to app/modules/web/themes/material-blue/views/config/mail.inc index d48d03b9..0ca3911c 100644 --- a/inc/themes/material-blue/views/config/mail.inc +++ b/app/modules/web/themes/material-blue/views/config/mail.inc @@ -17,7 +17,7 @@ isMailEnabled() ? 'checked' : ''; ?>/> + isMailEnabled() ? 'checked' : ''; ?>/> @@ -30,7 +30,7 @@
    + maxlength="128" value="getMailServer(); ?>"/>
    @@ -43,7 +43,7 @@
    + value="getMailPort(); ?>"/>
    @@ -54,7 +54,7 @@ @@ -67,7 +67,7 @@
    + maxlength="50" value="getMailUser(); ?>"/>
    @@ -80,7 +80,7 @@
    + maxlength="128" value="getMailPass(); ?>"/>
    @@ -96,7 +96,7 @@ + value="" getMailSecurity() == $security) ? 'selected' : ''; ?>> @@ -109,7 +109,7 @@
    + maxlength="128" value="getMailFrom(); ?>"/>
    @@ -129,7 +129,7 @@ diff --git a/inc/themes/material-blue/views/config/wiki.inc b/app/modules/web/themes/material-blue/views/config/wiki.inc similarity index 96% rename from inc/themes/material-blue/views/config/wiki.inc rename to app/modules/web/themes/material-blue/views/config/wiki.inc index 9684e8df..a6945aaa 100644 --- a/inc/themes/material-blue/views/config/wiki.inc +++ b/app/modules/web/themes/material-blue/views/config/wiki.inc @@ -26,7 +26,7 @@ isWikiEnabled() ? 'checked' : ''; ?>/> + isWikiEnabled() ? 'checked' : ''; ?>/> @@ -58,7 +58,7 @@
    + maxlength="255" value="getWikiSearchurl(); ?>">
    @@ -91,7 +91,7 @@
    + maxlength="255" value="getWikiPageurl(); ?>">
    @@ -115,7 +115,7 @@
    - + @@ -143,7 +143,7 @@ isDokuwikiEnabled() ? 'checked' : ''; ?>/> + isDokuwikiEnabled() ? 'checked' : ''; ?>/> @@ -171,7 +171,7 @@
    + maxlength="255" value="getDokuwikiUrl(); ?>"/>
    @@ -198,7 +198,7 @@
    + maxlength="255" value="getDokuwikiUrlBase(); ?>"/>
    @@ -219,7 +219,7 @@
    + maxlength="128" value="getDokuwikiUser(); ?>"/>
    @@ -232,7 +232,7 @@
    + maxlength="128" value="getDokuwikiPass(); ?>"/>
    @@ -253,7 +253,7 @@ + value="getDokuwikiNamespace(); ?>"/>
    diff --git a/inc/themes/material-blue/views/eventlog/eventlog.inc b/app/modules/web/themes/material-blue/views/eventlog/eventlog.inc similarity index 100% rename from inc/themes/material-blue/views/eventlog/eventlog.inc rename to app/modules/web/themes/material-blue/views/eventlog/eventlog.inc diff --git a/inc/themes/material-blue/views/grid/datagrid-nav-full.inc b/app/modules/web/themes/material-blue/views/grid/datagrid-nav-full.inc similarity index 100% rename from inc/themes/material-blue/views/grid/datagrid-nav-full.inc rename to app/modules/web/themes/material-blue/views/grid/datagrid-nav-full.inc diff --git a/inc/themes/material-blue/views/grid/datagrid-rows.inc b/app/modules/web/themes/material-blue/views/grid/datagrid-rows.inc similarity index 100% rename from inc/themes/material-blue/views/grid/datagrid-rows.inc rename to app/modules/web/themes/material-blue/views/grid/datagrid-rows.inc diff --git a/inc/themes/material-blue/views/grid/datagrid-table.inc b/app/modules/web/themes/material-blue/views/grid/datagrid-table.inc similarity index 100% rename from inc/themes/material-blue/views/grid/datagrid-table.inc rename to app/modules/web/themes/material-blue/views/grid/datagrid-table.inc diff --git a/inc/themes/material-blue/views/grid/datatabs-grid.inc b/app/modules/web/themes/material-blue/views/grid/datatabs-grid.inc similarity index 100% rename from inc/themes/material-blue/views/grid/datatabs-grid.inc rename to app/modules/web/themes/material-blue/views/grid/datatabs-grid.inc diff --git a/inc/themes/material-blue/views/itemshow/categories.inc b/app/modules/web/themes/material-blue/views/itemshow/categories.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/categories.inc rename to app/modules/web/themes/material-blue/views/itemshow/categories.inc diff --git a/inc/themes/material-blue/views/itemshow/customers.inc b/app/modules/web/themes/material-blue/views/itemshow/customers.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/customers.inc rename to app/modules/web/themes/material-blue/views/itemshow/customers.inc diff --git a/inc/themes/material-blue/views/itemshow/customfields.inc b/app/modules/web/themes/material-blue/views/itemshow/customfields.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/customfields.inc rename to app/modules/web/themes/material-blue/views/itemshow/customfields.inc diff --git a/inc/themes/material-blue/views/itemshow/groups.inc b/app/modules/web/themes/material-blue/views/itemshow/groups.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/groups.inc rename to app/modules/web/themes/material-blue/views/itemshow/groups.inc diff --git a/inc/themes/material-blue/views/itemshow/plugins.inc b/app/modules/web/themes/material-blue/views/itemshow/plugins.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/plugins.inc rename to app/modules/web/themes/material-blue/views/itemshow/plugins.inc diff --git a/inc/themes/material-blue/views/itemshow/profiles.inc b/app/modules/web/themes/material-blue/views/itemshow/profiles.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/profiles.inc rename to app/modules/web/themes/material-blue/views/itemshow/profiles.inc diff --git a/inc/themes/material-blue/views/itemshow/publiclinks.inc b/app/modules/web/themes/material-blue/views/itemshow/publiclinks.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/publiclinks.inc rename to app/modules/web/themes/material-blue/views/itemshow/publiclinks.inc diff --git a/inc/themes/material-blue/views/itemshow/tags.inc b/app/modules/web/themes/material-blue/views/itemshow/tags.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/tags.inc rename to app/modules/web/themes/material-blue/views/itemshow/tags.inc diff --git a/inc/themes/material-blue/views/itemshow/tokens.inc b/app/modules/web/themes/material-blue/views/itemshow/tokens.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/tokens.inc rename to app/modules/web/themes/material-blue/views/itemshow/tokens.inc diff --git a/inc/themes/material-blue/views/itemshow/users.inc b/app/modules/web/themes/material-blue/views/itemshow/users.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/users.inc rename to app/modules/web/themes/material-blue/views/itemshow/users.inc diff --git a/inc/themes/material-blue/views/itemshow/userspass.inc b/app/modules/web/themes/material-blue/views/itemshow/userspass.inc similarity index 100% rename from inc/themes/material-blue/views/itemshow/userspass.inc rename to app/modules/web/themes/material-blue/views/itemshow/userspass.inc diff --git a/inc/themes/material-blue/views/main/login.inc b/app/modules/web/themes/material-blue/views/login/login.inc similarity index 98% rename from inc/themes/material-blue/views/main/login.inc rename to app/modules/web/themes/material-blue/views/login/login.inc index 4b1ccb4c..b5c3462d 100644 --- a/inc/themes/material-blue/views/main/login.inc +++ b/app/modules/web/themes/material-blue/views/login/login.inc @@ -72,7 +72,7 @@
    - +
    diff --git a/inc/themes/material-blue/views/main/logout.inc b/app/modules/web/themes/material-blue/views/login/logout.inc similarity index 100% rename from inc/themes/material-blue/views/main/logout.inc rename to app/modules/web/themes/material-blue/views/login/logout.inc diff --git a/inc/themes/material-blue/views/main/install.inc b/app/modules/web/themes/material-blue/views/main/install.inc similarity index 100% rename from inc/themes/material-blue/views/main/install.inc rename to app/modules/web/themes/material-blue/views/main/install.inc diff --git a/inc/themes/material-blue/views/main/update.inc b/app/modules/web/themes/material-blue/views/main/update.inc similarity index 100% rename from inc/themes/material-blue/views/main/update.inc rename to app/modules/web/themes/material-blue/views/main/update.inc diff --git a/inc/themes/material-blue/views/main/upgrade.inc b/app/modules/web/themes/material-blue/views/main/upgrade.inc similarity index 100% rename from inc/themes/material-blue/views/main/upgrade.inc rename to app/modules/web/themes/material-blue/views/main/upgrade.inc diff --git a/inc/themes/material-blue/views/noticeshow/notices.inc b/app/modules/web/themes/material-blue/views/noticeshow/notices.inc similarity index 100% rename from inc/themes/material-blue/views/noticeshow/notices.inc rename to app/modules/web/themes/material-blue/views/noticeshow/notices.inc diff --git a/inc/themes/material-blue/views/main/passreset.inc b/app/modules/web/themes/material-blue/views/passreset/passreset.inc similarity index 100% rename from inc/themes/material-blue/views/main/passreset.inc rename to app/modules/web/themes/material-blue/views/passreset/passreset.inc diff --git a/inc/themes/material-blue/views/userpreferences/preferences-site.inc b/app/modules/web/themes/material-blue/views/userpreferences/preferences-site.inc similarity index 100% rename from inc/themes/material-blue/views/userpreferences/preferences-site.inc rename to app/modules/web/themes/material-blue/views/userpreferences/preferences-site.inc diff --git a/inc/themes/material-blue/views/wiki/wikipage.inc b/app/modules/web/themes/material-blue/views/wiki/wikipage.inc similarity index 100% rename from inc/themes/material-blue/views/wiki/wikipage.inc rename to app/modules/web/themes/material-blue/views/wiki/wikipage.inc diff --git a/app/temp/.blank b/app/temp/.blank new file mode 100644 index 00000000..e69de29b diff --git a/composer.json b/composer.json index 9961ecb5..3ced2863 100644 --- a/composer.json +++ b/composer.json @@ -22,14 +22,17 @@ "defuse/php-encryption": "~2.1", "phpmailer/phpmailer": "~6.0", "ademarre/binary-to-text-php": "dev-master", - "phpseclib/phpseclib": "~2.0" + "phpseclib/phpseclib": "~2.0", + "pimple/pimple": "v3.2.2", + "klein/klein": "v2.1.2" }, "autoload": { "psr-4": { - "SP\\": "inc/" + "SP\\": "lib/SP/", + "SP\\Modules\\Web\\": "app/modules/web/" } }, "config": { - "classmap-authoritative": true + "classmap-authoritative": false } } diff --git a/composer.lock b/composer.lock index 28204c38..2d90b5fe 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "a5cfc4b45a24e6a518c075b48dd49b74", + "content-hash": "ae3f225c6b3ff061f4b93887065ac822", "packages": [ { "name": "ademarre/binary-to-text-php", @@ -115,17 +115,73 @@ "time": "2017-05-18T21:28:48+00:00" }, { - "name": "paragonie/random_compat", - "version": "v2.0.10", + "name": "klein/klein", + "version": "v2.1.2", "source": { "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d" + "url": "https://github.com/klein/klein.php.git", + "reference": "6549676cc831b9417332b3d9485c64bbf7bac728" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/634bae8e911eefa89c1abfbf1b66da679ac8f54d", - "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d", + "url": "https://api.github.com/repos/klein/klein.php/zipball/6549676cc831b9417332b3d9485c64bbf7bac728", + "reference": "6549676cc831b9417332b3d9485c64bbf7bac728", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/php-code-coverage": "^2.2", + "phpunit/phpunit": "^4.8", + "squizlabs/php_codesniffer": "1.4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Klein\\": "src/Klein/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris O'Hara", + "email": "cohara87@gmail.com", + "homepage": "http://chris6f.com/", + "role": "Creator/Developer" + }, + { + "name": "Trevor Suarez", + "email": "rican7@gmail.com", + "homepage": "https://trevorsuarez.com/", + "role": "Contributor/Developer" + } + ], + "description": "A lightning fast router for PHP", + "homepage": "https://github.com/klein/klein.php", + "keywords": [ + "boilerplate", + "router", + "routing", + "sinatra" + ], + "time": "2017-02-01T23:08:58+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v2.0.11", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", "shasum": "" }, "require": { @@ -160,7 +216,7 @@ "pseudorandom", "random" ], - "time": "2017-03-13T16:27:32+00:00" + "time": "2017-09-27T21:40:39+00:00" }, { "name": "phpmailer/phpmailer", @@ -318,6 +374,105 @@ "x509" ], "time": "2017-06-05T06:31:10+00:00" + }, + { + "name": "pimple/pimple", + "version": "v3.2.2", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a", + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2017-07-23T07:32:15+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" } ], "packages-dev": [], diff --git a/inc/Base.php b/inc/Base.php deleted file mode 100644 index e799ec88..00000000 --- a/inc/Base.php +++ /dev/null @@ -1,53 +0,0 @@ -. - */ - -use SP\Core\Init; - -defined('APP_ROOT') || die(); - -// Please, notice that this file should be outside the webserver root. You can move it and then update this path -define('XML_CONFIG_FILE', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.xml'); - -define('BASE_DIR', __DIR__); -define('CONFIG_FILE', APP_ROOT . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'); -define('VENDOR_PATH', APP_ROOT . DIRECTORY_SEPARATOR . 'vendor'); -define('LOG_FILE', APP_ROOT . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'syspass.log'); -define('MODEL_PATH', BASE_DIR . DIRECTORY_SEPARATOR . 'SP'); -define('VIEW_PATH', BASE_DIR . DIRECTORY_SEPARATOR . 'themes'); -define('EXTENSIONS_PATH', BASE_DIR . DIRECTORY_SEPARATOR . 'Exts'); -define('PLUGINS_PATH', BASE_DIR . DIRECTORY_SEPARATOR . 'Plugins'); -define('LOCALES_PATH', BASE_DIR . DIRECTORY_SEPARATOR . 'locales'); -define('SQL_PATH', BASE_DIR . DIRECTORY_SEPARATOR . 'sql'); - -define('DEBUG', true); - -require VENDOR_PATH . DIRECTORY_SEPARATOR . 'autoload.php'; -require __DIR__ . DIRECTORY_SEPARATOR . 'SplClassLoader.php'; -require __DIR__ . DIRECTORY_SEPARATOR . 'BaseFunctions.php'; - -// Empezar a calcular la memoria utilizada -$memInit = memory_get_usage(); - -// Inicializar sysPass -Init::start(); \ No newline at end of file diff --git a/inc/BaseFunctions.php b/inc/BaseFunctions.php deleted file mode 100644 index 83b928d2..00000000 --- a/inc/BaseFunctions.php +++ /dev/null @@ -1,103 +0,0 @@ -. - */ - -/** - * Función para enviar mensajes al log de errores - * - * @param mixed $data - * @param bool $printLastCaller - */ -function debugLog($data, $printLastCaller = false) -{ - $useOwn = true; - $line = date('Y-m-d H:i:s') . ' - ' . print_r($data, true) . PHP_EOL; - - if (!error_log($line, 3, LOG_FILE)) { - $useOwn = false; - error_log(print_r($data, true)); - } - - if ($printLastCaller === true) { - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - $n = count($backtrace); - - for ($i = 1; $i <= $n - 1; $i++) { - $class = isset($backtrace[$i]['class']) ? $backtrace[$i]['class'] : ''; - $btLine = sprintf('Caller %d: %s\%s' . PHP_EOL, $i, $class, $backtrace[$i]['function']); - - if ($useOwn === true) { - error_log($btLine, 3, LOG_FILE); - } else { - error_log($btLine); - } - } - } -} - -/** - * Alias gettext function - * - * @param string $message - * @param bool $translate Si es necesario traducir - * @return string - */ -function __($message, $translate = true) -{ - return $translate === true && $message !== '' && mb_strlen($message) < 4096 ? gettext($message) : $message; -} - -/** - * Alias para obtener las locales de un dominio - * - * @param string $domain - * @param string $message - * @param bool $translate - * @return string - */ -function _t($domain, $message, $translate = true) -{ - return $translate === true && $message !== '' && mb_strlen($message) < 4096 ? dgettext($domain, $message) : $message; -} - -/** - * Capitalización de cadenas multi byte - * - * @param $string - * @return string - */ -function mb_ucfirst($string) -{ - return mb_strtoupper(mb_substr($string, 0, 1)); -} - -/** - * Devuelve el tiempo actual en coma flotante. - * Esta función se utiliza para calcular el tiempo de renderizado con coma flotante - * - * @returns float con el tiempo actual - */ -function getElapsedTime() -{ - return microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; -} \ No newline at end of file diff --git a/inc/themes/material-blue/views/main/error.inc b/inc/themes/material-blue/views/main/error.inc deleted file mode 100644 index 56e4f8aa..00000000 --- a/inc/themes/material-blue/views/main/error.inc +++ /dev/null @@ -1,16 +0,0 @@ - -
    - includeTemplate('error-list', 'main'); ?> - -
    - -
    -
    diff --git a/index.php b/index.php index 8625b831..9cb1039b 100644 --- a/index.php +++ b/index.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -22,16 +22,17 @@ * along with sysPass. If not, see . */ -use SP\Controller\MainController; use SP\Core\Init; -use SP\Core\Session; +use SP\Core\SessionFactory; +use SP\Modules\Web\Controllers\MainController; define('APP_ROOT', __DIR__); +define('APP_MODULE', 'web'); -require APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; -if (!Init::checkPostLoginActions() && Session::getAuthCompleted()) { - $Controller = new MainController(); - $Controller->getMain(); - $Controller->view(); -} \ No newline at end of file +//if (!Init::checkPostLoginActions() && Session::getAuthCompleted()) { +// $Controller = new MainController(); +// $Controller->getMain(); +// $Controller->view(); +//} \ No newline at end of file diff --git a/js/app-actions.min.js b/js/app-actions.min.js deleted file mode 100644 index 4f7f9776..00000000 --- a/js/app-actions.min.js +++ /dev/null @@ -1,45 +0,0 @@ -var $jscomp={scope:{},findInternal:function(c,d,k){c instanceof String&&(c=String(c));for(var f=c.length,g=0;g'+b+""),h=e.find("img");if(0===h.length)return l(a,b);h.hide();$.magnificPopup.open({items:{src:e,type:"inline"},callbacks:{open:function(){var a=this;h.on("click",function(){a.close()}); -setTimeout(function(){var a=c.resizeImage(h);e.css({backgroundColor:"#fff",width:a.width,height:"auto"});h.show("slow")},500)}}})},p={get:function(a){d.info("items:get");var b=a[0].selectize;b.clearOptions();b.load(function(e){var h=c.appRequests().getRequestOpts();h.url=f.updateItems;h.method="get";h.cache=!0;h.data={sk:a.data("sk"),itemType:a.data("item-type"),itemId:a.data("item-id")};c.appRequests().getActionCall(h,function(h){e(h.data);b.setValue(a.data("selected-id"),!0);c.appTriggers().updateFormHash()})})}, -update:function(a){d.info("items:update");var b=$("#"+a.data("item-dst"))[0].selectize;b.clearOptions();b.load(function(e){var b=c.appRequests().getRequestOpts();b.url=f.updateItems;b.method="get";b.data={sk:c.sk.get(),itemType:a.data("item-type")};c.appRequests().getActionCall(b,function(c){e(c.data)})})}},q={logout:function(){var a=window.location.search;c.redirect(0";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b=a.find("input[name='useTask']");var e=$("#taskStatus");e.empty().html(c.config().LANG[62]);if(0";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b=c.appRequests().getRequestOpts();b.url=f.account.save;b.data={itemId:a.data("item-id"), -actionId:a.data("action-id"),sk:c.sk.get()};c.appRequests().getActionCall(b,function(a){c.msg.out(a);m.search()})}}})},showpass:function(a){d.info("account:showpass");var b=a.data("parent-id"),e=c.appRequests().getRequestOpts();e.url=f.appMgmt.show;e.method="get";e.data={itemId:0==b?a.data("item-id"):b,actionId:a.data("action-id"),isHistory:a.data("history"),isLinked:0",e=a.data("selection"),h=[];if(e&&($(e).find(".is-selected").each(function(a,c){var b=$(this);h.push(b.data("item-id"))}),0===h.length))return;mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault();b=c.appRequests().getRequestOpts(); -b.url=f.appMgmt.save;b.data={itemId:e?h:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){c.msg.out(b);a.data("nextaction-id")&&g({actionId:a.data("nextaction-id"),itemId:a.data("activetab")})})}}})},save:function(a){d.info("appMgmt:save");var b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data=a.serialize();c.appRequests().getActionCall(b,function(b){c.msg.out(b);0===b.status&&(b=a.data("activetab"),!0===n.refreshTab&&void 0!== -b&&g({actionId:a.data("nextaction-id"),itemId:b}),$.magnificPopup.close())})},search:function(a){d.info("appMgmt:search");var b=$(a.data("target")),e=c.appRequests().getRequestOpts();e.url=f.appMgmt.search;e.method="get";e.data=a.serialize();c.appRequests().getActionCall(e,function(a){0===a.status?b.html(a.data.html):b.html(c.msg.html.error(a.description));c.sk.set(a.csrf)})},nav:function(a){d.info("appMgmt:nav");var b=$("#"+a.data("action-form"));b.find("[name='start']").val(a.data("start"));b.find("[name='count']").val(a.data("count")); -b.find("[name='sk']").val(c.sk.get());n.search(b)},ldapSync:function(a){d.info("appMgmt:ldapSync");var b='

    '+c.config().LANG[57]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data={actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1,ldap_loginattribute:$("#ldap_loginattribute").val(), -ldap_nameattribute:$("#ldap_nameattribute").val(),ldap_ads:$("#ldap_ads").prop("checked")};c.appRequests().getActionCall(b,function(a){c.msg.out(a)})}}})}};return{doAction:g,appMgmt:n,account:m,file:{view:function(a){d.info("file:view");var b=c.appRequests().getRequestOpts();b.url=f.file;b.type="html";b.data={fileId:a.data("item-id"),sk:c.sk.get(),actionId:a.data("action-id")};c.appRequests().getActionCall(b,function(b){void 0!==b.status&&1===b.status?c.msg.out(b):b?r(a,b):c.msg.error(c.config().LANG[14])})}, -download:function(a){d.info("file:download");a={fileId:a.data("item-id"),sk:c.sk.get(),actionId:a.data("action-id")};$.fileDownload(c.config().APP_ROOT+f.file,{httpMethod:"POST",data:a})},"delete":function(a){d.info("file:delete");var b='

    '+c.config().LANG[15]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b= -c.appRequests().getRequestOpts();b.url=f.file;b.data={fileId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get()};c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&(a=$("#list-account-files"),m.getfiles(a))})}}})}},checks:{ldap:function(a){d.info("checks:ldap");a=$(a.data("src"));a.find("[name='sk']").val(c.sk.get());var b=c.appRequests().getRequestOpts();b.url=f.checks;b.data=a.serialize();c.appRequests().getActionCall(b,function(a){c.msg.out(a);var b=$("#ldap-results"); -b.find(".list-wrap").html(c.appTheme().html.getList(a.data));b.show("slow")})},wiki:function(a){d.info("checks:wiki");a=$(a.data("src"));a.find("[name='sk']").val(c.sk.get());var b=c.appRequests().getRequestOpts();b.url=f.checks;b.data=a.serialize();c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&$("#dokuWikiResCheck").html(a.data)})}},config:{save:function(a){d.info("config:save");var b=c.appRequests().getRequestOpts();b.url=f.config.save;b.data=a.serialize();"masterpass"=== -a.data("type")&&(b.useFullLoading=!0);c.appRequests().getActionCall(b,function(b){c.msg.out(b);0===b.status&&(void 0!==a.data("nextaction-id")?g({actionId:a.data("nextaction-id"),itemId:a.data("activetab")}):void 0!==a.data("reload")&&setTimeout(function(){c.redirect("index.php")},2E3))})},masterpass:function(a){var b='

    '+c.config().LANG[59]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(b){b.preventDefault();c.msg.error(c.config().LANG[44]); -a.find(":input[type=password]").val("")}},positive:{title:c.config().LANG[43],onClick:function(b){b=a.find("input[name='useTask']");var e=$("#taskStatus");e.empty().html(c.config().LANG[62]);if(0";mdlDialog().show({text:e,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.appRequests().getActionCall(b,function(a){c.msg.out(a)})}},positive:{title:c.config().LANG[43],onClick:function(e){e.preventDefault(); -b.data.notify=1;c.appRequests().getActionCall(b,function(b){c.msg.out(b);g({actionId:a.data("nextaction-id"),itemId:a.data("item-id")})})}}})},refresh:function(a){d.info("link:refresh");var b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")},e=c.appRequests().getRequestOpts();e.url=f.link;e.data=b;c.appRequests().getActionCall(e,function(b){c.msg.out(b);0===b.status&&g({actionId:a.data("nextaction-id"),itemId:a.data("activetab")})})}},eventlog:{nav:function(a){if(void 0=== -a.data("start"))return!1;var b=c.appRequests().getRequestOpts();b.url=f.eventlog;b.method="get";b.type="html";b.data={actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1,start:a.data("start"),count:a.data("count"),current:a.data("current")};c.appRequests().getActionCall(b,function(a){$("#content").html(a);c.scrollUp()})},clear:function(a){var b='

    '+c.config().LANG[20]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault(); -c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault();b=c.appRequests().getRequestOpts();b.url=f.eventlog;b.method="get";b.data={clear:1,sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){c.msg.out(b);0==b.status&&g({actionId:a.data("nextaction-id")})})}}})}},ajaxUrl:f,plugin:{toggle:function(a){d.info("plugin:enable");a={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")};var b= -c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data=a;c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&setTimeout(function(){c.redirect("index.php")},2E3)})},reset:function(a){d.info("plugin:reset");var b='

    '+c.config().LANG[58]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault(); -b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")};var e=c.appRequests().getRequestOpts();e.url=f.appMgmt.save;e.data=b;c.appRequests().getActionCall(e,function(a){c.msg.out(a)})}}})}},notice:{check:function(a){d.info("notice:check");var b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get()},e=c.appRequests().getRequestOpts();e.url=f.appMgmt.save;e.data=b;c.appRequests().getActionCall(e,function(b){c.msg.out(b);0===b.status&&g({actionId:a.data("nextaction-id"), -itemId:a.data("activetab")})})},search:function(a){d.info("notice:search");var b=$(a.data("target")),e=c.appRequests().getRequestOpts();e.url=f.notice.search;e.method="get";e.data=a.serialize();c.appRequests().getActionCall(e,function(a){0===a.status?b.html(a.data.html):b.html(c.msg.html.error(a.description));c.sk.set(a.csrf)})},show:function(a){d.info("notice:show");var b=c.appRequests().getRequestOpts();b.url=f.notice.show;b.method="get";b.data={itemId:a.data("item-id"),actionId:a.data("action-id"), -activeTab:a.data("activetab"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){0!==b.status?c.msg.out(b):l(a,b.data.html)})}},wiki:{show:function(a){d.info("wiki:show");var b=c.appRequests().getRequestOpts();b.url=f.wiki.show;b.method="get";b.data={pageName:a.data("pagename"),actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){0!==b.status?c.msg.out(b):l(a,b.data.html)})}},items:p}}; diff --git a/js/zxcvbn-async.js b/js/zxcvbn-async.js deleted file mode 100644 index 9ecb0e29..00000000 --- a/js/zxcvbn-async.js +++ /dev/null @@ -1,30 +0,0 @@ -// cross-browser asynchronous script loading for zxcvbn. -// adapted from http://friendlybit.com/js/lazy-loading-asyncronous-javascript/ - -// You probably don't need this script; see README for bower/npm/requirejs setup -// instructions. - -// If you do want to manually include zxcvbn, you'll likely only need to change -// ZXCVBN_SRC to point to the correct relative path from your index.html. -// (this script assumes index.html and zxcvbn.js sit next to each other.) - -(function() { - var ZXCVBN_SRC = 'js/zxcvbn.min.js'; - - var async_load = function() { - var first, s; - s = document.createElement('script'); - s.src = ZXCVBN_SRC; - s.type = 'text/javascript'; - s.async = true; - first = document.getElementsByTagName('script')[0]; - return first.parentNode.insertBefore(s, first); - }; - - if (window.attachEvent != null) { - window.attachEvent('onload', async_load); - } else { - window.addEventListener('load', async_load, false); - } - -}).call(this); \ No newline at end of file diff --git a/js/zxcvbn-async.min.js b/js/zxcvbn-async.min.js deleted file mode 100644 index 889e959d..00000000 --- a/js/zxcvbn-async.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var c=function(){var b,a;a=document.createElement("script");a.src="js/zxcvbn.min.js";a.type="text/javascript";a.async=!0;b=document.getElementsByTagName("script")[0];return b.parentNode.insertBefore(a,b)};null!=window.attachEvent?window.attachEvent("onload",c):window.addEventListener("load",c,!1)}).call(this); diff --git a/lib/Base.php b/lib/Base.php new file mode 100644 index 00000000..4a7e7e1a --- /dev/null +++ b/lib/Base.php @@ -0,0 +1,106 @@ +. + */ + +use SP\Bootstrap; +use SP\Core\Dic\Container; + +defined('APP_ROOT') || die(); +defined('APP_MODULE') || define('APP_MODULE', 'web'); + +define('BASE_PATH', __DIR__); +define('APP_PATH', APP_ROOT . DIRECTORY_SEPARATOR . 'app'); + +// Please, notice that this file should be outside the webserver root. You can move it and then update this path +define('CONFIG_PATH', APP_PATH . DIRECTORY_SEPARATOR . 'config'); + +// Setup config files +define('XML_CONFIG_FILE', CONFIG_PATH . DIRECTORY_SEPARATOR . 'config.xml'); +define('CONFIG_FILE', CONFIG_PATH . DIRECTORY_SEPARATOR . 'config.php'); +define('LOG_FILE', CONFIG_PATH . DIRECTORY_SEPARATOR . 'syspass.log'); + +// Setup application paths +define('MODULES_PATH', APP_PATH . DIRECTORY_SEPARATOR . 'modules'); +define('LOCALES_PATH', APP_PATH . DIRECTORY_SEPARATOR . 'locales'); +define('BACKUP_PATH', APP_PATH . DIRECTORY_SEPARATOR . 'backup'); + +// Setup other paths +define('VENDOR_PATH', APP_ROOT . DIRECTORY_SEPARATOR . 'vendor'); +define('SQL_PATH', APP_ROOT . DIRECTORY_SEPARATOR . 'schemas'); +define('PUBLIC_PATH', APP_ROOT . DIRECTORY_SEPARATOR . 'public'); + +define('DEBUG', true); + +// Empezar a calcular la memoria utilizada +$memInit = memory_get_usage(); + +require VENDOR_PATH . DIRECTORY_SEPARATOR . 'autoload.php'; +require __DIR__ . DIRECTORY_SEPARATOR . 'SplClassLoader.php'; +require __DIR__ . DIRECTORY_SEPARATOR . 'BaseFunctions.php'; + +initModule(APP_MODULE); + +$dic = new Container(); + +$dic->share(\Klein\Klein::class); + +$dic->share(\SP\Core\Session\Session::class); + +$dic->share(\SP\Core\Acl::class, function ($dic) { + /** @var \SP\Core\Session\Session $session */ + /** @var \SP\Core\Dic\DicInterface $dic */ + $session = $dic->get(\SP\Core\Session\Session::class); + + return new \SP\Core\Acl($session); +}); + +$dic->share(\SP\Config\Config::class, function () { + return new SP\Config\Config(new \SP\Storage\XmlHandler(XML_CONFIG_FILE)); +}); + +$dic->share(\SP\Core\Language::class); + +$dic->share(\SP\Config\ConfigData::class, function ($dic) { + /** @var \SP\Config\Config $config */ + /** @var \SP\Core\Dic\DicInterface $dic */ + $config = $dic->get(\SP\Config\Config::class); + + return $config->getConfigData(); +}); + +$dic->share(\SP\Storage\Database::class, function () { + return new \SP\Storage\Database(new \SP\Storage\MySQLHandler()); +}); + +$dic->share(\SP\Core\UI\Theme::class, function () { + return new \SP\Core\UI\Theme(APP_MODULE); +}); + +$dic->share(\SP\Core\Events\EventDispatcher::class); + +$dic->add(\SP\Log\Log::class, function () { + return new SP\Log\Log(new \SP\Core\Messages\LogMessage()); +}); + +$Bootstrap = new Bootstrap(); +$Bootstrap->initialize(); \ No newline at end of file diff --git a/lib/BaseFunctions.php b/lib/BaseFunctions.php new file mode 100644 index 00000000..a0107dc6 --- /dev/null +++ b/lib/BaseFunctions.php @@ -0,0 +1,167 @@ +. + */ + +/** + * Función para enviar mensajes al log de errores + * + * @param mixed $data + * @param bool $printLastCaller + */ +function debugLog($data, $printLastCaller = false) +{ + $useOwn = true; + $line = date('Y-m-d H:i:s') . ' - ' . print_r($data, true) . PHP_EOL; + + if (!error_log($line, 3, LOG_FILE)) { + $useOwn = false; + error_log(print_r($data, true)); + } + + if ($printLastCaller === true) { + if ($useOwn === true) { + error_log(formatTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)), 3, LOG_FILE); + } else { + error_log(formatTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS))); + } + } +} + +/** + * @param $trace + * @return string + */ +function formatTrace($trace) +{ + $btLine = []; + $n = count($trace); + + for ($i = 1; $i <= $n - 1; $i++) { + $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : ''; + $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : ''; + $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 0; + + $btLine[] = sprintf('Caller %d: %s\%s (%s:%d)', $i, $class, $trace[$i]['function'], $file, $line); + } + + return implode(PHP_EOL, $btLine); +} + +/** + * Alias gettext function + * + * @param string $message + * @param bool $translate Si es necesario traducir + * @return string + */ +function __($message, $translate = true) +{ + return $translate === true && $message !== '' && mb_strlen($message) < 4096 ? gettext($message) : $message; +} + +/** + * Alias para obtener las locales de un dominio + * + * @param string $domain + * @param string $message + * @param bool $translate + * @return string + */ +function _t($domain, $message, $translate = true) +{ + return $translate === true && $message !== '' && mb_strlen($message) < 4096 ? dgettext($domain, $message) : $message; +} + +/** + * Capitalización de cadenas multi byte + * + * @param $string + * @return string + */ +function mb_ucfirst($string) +{ + return mb_strtoupper(mb_substr($string, 0, 1)); +} + +/** + * Devuelve el tiempo actual en coma flotante. + * Esta función se utiliza para calcular el tiempo de renderizado con coma flotante + * + * @returns float con el tiempo actual + */ +function getElapsedTime() +{ + return microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']; +} + +/** + * Inicializar módulo + * + * @param $module + */ +function initModule($module) +{ + $dir = dir(MODULES_PATH); + + while (false !== ($entry = $dir->read())) { + $moduleFile = MODULES_PATH . DIRECTORY_SEPARATOR . $entry . DIRECTORY_SEPARATOR . 'module.php'; + + if ($entry === $module && file_exists($moduleFile)) { + require $moduleFile; + } + } + + $dir->close(); +} + +/** + * @param Exception $exception + */ +function flattenExceptionBacktrace(\Exception $exception) { + $traceProperty = (new \ReflectionClass('Exception'))->getProperty('trace'); + $traceProperty->setAccessible(true); + $flatten = function(&$value, $key) { + if ($value instanceof \Closure) { + $closureReflection = new \ReflectionFunction($value); + $value = sprintf( + '(Closure at %s:%s)', + $closureReflection->getFileName(), + $closureReflection->getStartLine() + ); + } elseif (is_object($value)) { + $value = sprintf('object(%s)', get_class($value)); + } elseif (is_resource($value)) { + $value = sprintf('resource(%s)', get_resource_type($value)); + } + }; + do { + $trace = $traceProperty->getValue($exception); + foreach($trace as &$call) { + array_walk_recursive($call['args'], $flatten); + } + $traceProperty->setValue($exception, $trace); + } while($exception = $exception->getPrevious()); + $traceProperty->setAccessible(false); +} + +//set_exception_handler('\flattenExceptionBacktrace'); \ No newline at end of file diff --git a/inc/SP/Account/Account.php b/lib/SP/Account/Account.php similarity index 95% rename from inc/SP/Account/Account.php rename to lib/SP/Account/Account.php index e6ce2a44..5b807cee 100644 --- a/inc/SP/Account/Account.php +++ b/lib/SP/Account/Account.php @@ -29,14 +29,14 @@ use SP\Core\Crypt\Crypt; use SP\Core\Crypt\Session as CryptSession; use SP\Core\Exceptions\QueryException; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\DataModel\AccountData; use SP\DataModel\AccountExtData; use SP\DataModel\GroupAccountsData; use SP\Log\Log; use SP\Mgmt\Groups\GroupAccounts; use SP\Mgmt\Groups\GroupAccountsUtil; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -54,7 +54,7 @@ class Account extends AccountBase implements AccountInterface */ public function updateAccount() { - $Acl = Session::getAccountAcl($this->accountData->getAccountId()); + $Acl = $this->session->getAccountAcl($this->accountData->getAccountId()); // Guardamos una copia de la cuenta en el histórico AccountHistory::addHistory($this->accountData->getAccountId(), false); @@ -126,7 +126,7 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($this->accountData->getAccountId(), 'accountId'); $Data->setOnErrorMessage(__('Error al modificar la cuenta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return true; } @@ -169,10 +169,10 @@ class Account extends AccountBase implements AccountInterface $Data = new QueryData(); $Data->setQuery($query); $Data->addParam($id, 'id'); - $Data->addParam(Session::getUserData()->getUserId(), 'accountUserEditId'); + $Data->addParam($this->session->getUserData()->getUserId(), 'accountUserEditId'); $Data->setOnErrorMessage(__('Error al restaurar cuenta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return true; } @@ -195,7 +195,7 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($this->accountData->getAccountId()); /** @var AccountExtData|array $queryRes */ - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_CRITICAL, __('No se pudieron obtener los datos de la cuenta', false)); @@ -262,7 +262,7 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($this->accountData->getAccountKey(), 'accountKey'); $Data->addParam($this->accountData->getAccountNotes(), 'accountNotes'); $Data->addParam($this->accountData->getAccountUserId(), 'accountUserId'); - $Data->addParam($this->accountData->getAccountUserGroupId() ?: Session::getUserData()->getUserGroupId(), 'accountUserGroupId'); + $Data->addParam($this->accountData->getAccountUserGroupId() ?: $this->session->getUserData()->getUserGroupId(), 'accountUserGroupId'); $Data->addParam($this->accountData->getAccountUserId(), 'accountUserEditId'); $Data->addParam($this->accountData->getAccountOtherUserEdit(), 'accountOtherUserEdit'); $Data->addParam($this->accountData->getAccountOtherGroupEdit(), 'accountOtherGroupEdit'); @@ -272,9 +272,9 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($this->accountData->getAccountParentId(), 'accountParentId'); $Data->setOnErrorMessage(__('Error al crear la cuenta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->accountData->setAccountId(DB::$lastId); + $this->accountData->setAccountId(DbWrapper::$lastId); try { if (is_array($this->accountData->getAccountUserGroupsId())) { @@ -354,7 +354,7 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar la cuenta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() === 1; } @@ -376,7 +376,7 @@ class Account extends AccountBase implements AccountInterface $Data->setQuery($query); $Data->addParam($id ?: $this->accountData->getAccountId()); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -396,7 +396,7 @@ class Account extends AccountBase implements AccountInterface $Data->setQuery($query); $Data->addParam($id ?: $this->accountData->getAccountId()); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -436,7 +436,7 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($this->accountData->getAccountId(), 'accountId'); $Data->setOnErrorMessage(__('Error al actualizar la clave', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return true; } @@ -470,7 +470,7 @@ class Account extends AccountBase implements AccountInterface $this->accountData->setUsersId(UserAccounts::getUsersForAccount($this->accountData->getAccountId())); $this->accountData->setUserGroupsId(GroupAccountsUtil::getGroupsForAccount($this->accountData->getAccountId())); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -502,11 +502,13 @@ class Account extends AccountBase implements AccountInterface $Data->addParam($this->accountData->getAccountId()); /** @var AccountExtData|array $queryRes */ - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_CRITICAL, __('No se pudieron obtener los datos de la cuenta', false)); - } elseif (is_array($queryRes) && count($queryRes) === 0) { + } + + if (is_array($queryRes) && count($queryRes) === 0) { throw new SPException(SPException::SP_CRITICAL, __('La cuenta no existe', false)); } diff --git a/inc/SP/Account/AccountAcl.php b/lib/SP/Account/AccountAcl.php similarity index 76% rename from inc/SP/Account/AccountAcl.php rename to lib/SP/Account/AccountAcl.php index 715374a6..6b4be7dd 100644 --- a/inc/SP/Account/AccountAcl.php +++ b/lib/SP/Account/AccountAcl.php @@ -24,14 +24,15 @@ namespace SP\Account; -use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Acl; use SP\Core\ActionsInterface; -use SP\Core\Session; +use SP\Core\Session\Session; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\UserData; use SP\Mgmt\Groups\GroupUsers; +use SP\Storage\CacheableInterface; use SP\Util\ArrayUtil; -use SP\Util\Checks; /** * Class AccountAcl @@ -140,17 +141,33 @@ class AccountAcl * @var bool */ protected $compiled = false; + /** + * @var ConfigData; + */ + protected $configData; + /** + * @var Session + */ + protected $session; + /** + * @var Acl + */ + protected $acl; + + use InjectableTrait; /** * AccountAcl constructor. * * @param AccountBase $Account - * @param int $action + * @param int $action */ public function __construct(AccountBase $Account = null, $action) { + $this->injectDependencies(); + $this->action = $action; - $this->UserData = Session::getUserData(); + $this->UserData = $this->session->getUserData(); if (null !== $Account) { $this->Account = $Account; @@ -166,6 +183,18 @@ class AccountAcl unset($_SESSION['accountAcl']); } + /** + * @param ConfigData $configData + * @param Session $session + * @param Acl $acl + */ + public function inject(ConfigData $configData, Session $session, Acl $acl) + { + $this->configData = $configData; + $this->session = $session; + $this->acl = $acl; + } + /** * @return boolean */ @@ -190,7 +219,7 @@ class AccountAcl */ public function isShowFiles() { - return Checks::fileIsEnabled() && + return $this->configData->isFilesEnabled() && ($this->action === Acl::ACTION_ACC_EDIT || $this->action === Acl::ACTION_ACC_VIEW || $this->action === Acl::ACTION_ACC_VIEW_HISTORY) @@ -264,7 +293,7 @@ class AccountAcl */ public function isShowLink() { - return Checks::publicLinksIsEnabled() && $this->showLink; + return $this->configData->isPublinksEnabled() && $this->showLink; } /** @@ -302,7 +331,7 @@ class AccountAcl */ public function getStoredAcl() { - $sessionAcl = Session::getAccountAcl($this->accountId); + $sessionAcl = $this->session->getAccountAcl($this->accountId); if (null !== $sessionAcl && $sessionAcl->getAction() !== $this->action) { $sessionAcl->setAction($this->action); @@ -343,7 +372,6 @@ class AccountAcl public function updateAcl() { $this->makeAcl(); - $this->saveAcl(); return $this; } @@ -356,43 +384,43 @@ class AccountAcl $this->compileAccountAccess(); // Mostrar historial - $this->showHistory = Acl::checkUserAccess(Acl::ACTION_ACC_VIEW_HISTORY); + $this->showHistory = $this->acl->checkUserAccess(Acl::ACTION_ACC_VIEW_HISTORY); // Mostrar lista archivos - $this->showFiles = Acl::checkUserAccess(Acl::ACTION_ACC_FILES); + $this->showFiles = $this->acl->checkUserAccess(Acl::ACTION_ACC_FILES); // Mostrar acción de ver clave $this->showViewPass = $this->checkAccountAccess(Acl::ACTION_ACC_VIEW_PASS) - && Acl::checkUserAccess(Acl::ACTION_ACC_VIEW_PASS); + && $this->acl->checkUserAccess(Acl::ACTION_ACC_VIEW_PASS); // Mostrar acción de editar $this->showEdit = $this->checkAccountAccess(Acl::ACTION_ACC_EDIT) - && Acl::checkUserAccess(Acl::ACTION_ACC_EDIT) + && $this->acl->checkUserAccess(Acl::ACTION_ACC_EDIT) && !$this->Account->getAccountIsHistory(); // Mostrar acción de editar clave $this->showEditPass = $this->checkAccountAccess(Acl::ACTION_ACC_EDIT_PASS) - && Acl::checkUserAccess(Acl::ACTION_ACC_EDIT_PASS) + && $this->acl->checkUserAccess(Acl::ACTION_ACC_EDIT_PASS) && !$this->Account->getAccountIsHistory(); // Mostrar acción de eliminar $this->showDelete = $this->checkAccountAccess(Acl::ACTION_ACC_DELETE) - && Acl::checkUserAccess(Acl::ACTION_ACC_DELETE); + && $this->acl->checkUserAccess(Acl::ACTION_ACC_DELETE); // Mostrar acción de restaurar $this->showRestore = $this->checkAccountAccess(Acl::ACTION_ACC_EDIT) - && Acl::checkUserAccess(Acl::ACTION_ACC_EDIT); + && $this->acl->checkUserAccess(Acl::ACTION_ACC_EDIT); // Mostrar acción de enlace público - $this->showLink = Acl::checkUserAccess(Acl::ACTION_MGM_PUBLICLINKS_NEW); + $this->showLink = $this->acl->checkUserAccess(Acl::ACTION_MGM_PUBLICLINKS_NEW); // Mostrar acción de ver cuenta $this->showView = $this->checkAccountAccess(Acl::ACTION_ACC_VIEW) - && Acl::checkUserAccess(Acl::ACTION_ACC_VIEW); + && $this->acl->checkUserAccess(Acl::ACTION_ACC_VIEW); // Mostrar acción de copiar cuenta $this->showCopy = $this->checkAccountAccess(Acl::ACTION_ACC_COPY) - && Acl::checkUserAccess(Acl::ACTION_ACC_COPY); + && $this->acl->checkUserAccess(Acl::ACTION_ACC_COPY); } /** @@ -448,7 +476,7 @@ class AccountAcl // Consultar el grupo principal del usuario if ($groupId === $this->UserData->getUserGroupId() // o... permitir los grupos que no sean el principal del usuario? - || (Config::getConfig()->isAccountFullGroupAccess() + || ($this->configData->isAccountFullGroupAccess() // Comprobar si el usuario está vinculado desde los grupos secundarios de la cuenta && ArrayUtil::checkInObjectArray($groupsId, 'groupId', $groupId)) ) { @@ -484,19 +512,6 @@ class AccountAcl } } - /** - * Guardar la ACL - */ - protected function saveAcl() - { - $this->time = time(); - - // No guardar el objeto de la cuenta ni de usuario - unset($this->Account, $this->UserData); - - Session::setAccountAcl($this); - } - /** * @return boolean */ @@ -537,14 +552,14 @@ class AccountAcl */ public function isShowPermission() { - $UserProfile = Session::getUserProfile(); - $UserData = Session::getUserData(); + $userProfile = $this->session->getUserProfile(); + $userData = $this->session->getUserData(); - return $UserData->isUserIsAdminAcc() - || $UserData->isUserIsAdminApp() - || $UserProfile->isAccPermission() - || $UserProfile->isAccPrivateGroup() - || $UserProfile->isAccPrivate(); + return $userData->isUserIsAdminAcc() + || $userData->isUserIsAdminApp() + || $userProfile->isAccPermission() + || $userProfile->isAccPrivateGroup() + || $userProfile->isAccPrivate(); } /** @@ -562,4 +577,51 @@ class AccountAcl { return $this->accountId; } + + /** + * unserialize() checks for the presence of a function with the magic name __wakeup. + * If present, this function can reconstruct any resources that the object may have. + * The intended use of __wakeup is to reestablish any database connections that may have been lost during + * serialization and perform other reinitialization tasks. + * + * @return void + * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep + */ + public function __wakeup() + { + $this->injectDependencies(); + } + + /** + * serialize() checks if your class has a function with the magic name __sleep. + * If so, that function is executed prior to any serialization. + * It can clean up the object and is supposed to return an array with the names of all variables of that object that should be serialized. + * If the method doesn't return anything then NULL is serialized and E_NOTICE is issued. + * The intended use of __sleep is to commit pending data or perform similar cleanup tasks. + * Also, the function is useful if you have very large objects which do not need to be saved completely. + * + * @return string[] + * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep + */ + public function __sleep() + { + $this->time = time(); + + unset($this->Account, $this->UserData, $this->session, $this->dic, $this->acl, $this->configData); + + $props = []; + + foreach ((array)$this as $prop => $value) { + if ($prop !== "\0*\0configData" + && $prop !== "\0*\0dic" + && $prop !== "\0*\0Account" + && $prop !== "\0*\0UserData" + && $prop !== "\0*\0acl" + && $prop !== "\0*\0session") { + $props[] = $prop; + } + } + + return $props; + } } \ No newline at end of file diff --git a/inc/SP/Account/AccountBase.php b/lib/SP/Account/AccountBase.php similarity index 89% rename from inc/SP/Account/AccountBase.php rename to lib/SP/Account/AccountBase.php index d96b2ab3..b5573faf 100644 --- a/inc/SP/Account/AccountBase.php +++ b/lib/SP/Account/AccountBase.php @@ -24,6 +24,8 @@ namespace SP\Account; +use SP\Core\Session\Session; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\AccountData; use SP\DataModel\AccountExtData; use SP\DataModel\AccountHistoryData; @@ -35,6 +37,8 @@ defined('APP_ROOT') || die(); */ abstract class AccountBase { + use InjectableTrait; + /** * Tiempo de expiración de la caché de ACLde usuarios/grupos de cuentas */ @@ -43,6 +47,8 @@ abstract class AccountBase * @var AccountData|AccountExtData|AccountHistoryData */ protected $accountData; + /** @var Session */ + protected $session; /** * @var int Id de la cuenta padre. */ @@ -59,9 +65,19 @@ abstract class AccountBase */ public function __construct(AccountData $accountData = null) { + $this->injectDependencies(); + $this->accountData = (null !== $accountData) ? $accountData : new AccountData(); } + /** + * @param Session $session + */ + public function inject(Session $session) + { + $this->session = $session; + } + /** * @return int */ diff --git a/inc/SP/Account/AccountCrypt.php b/lib/SP/Account/AccountCrypt.php similarity index 82% rename from inc/SP/Account/AccountCrypt.php rename to lib/SP/Account/AccountCrypt.php index 9e96e8c5..d49d5757 100644 --- a/inc/SP/Account/AccountCrypt.php +++ b/lib/SP/Account/AccountCrypt.php @@ -25,18 +25,21 @@ namespace SP\Account; use Defuse\Crypto\Exception\CryptoException; +use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Crypt\Crypt; use SP\Core\Exceptions\QueryException; use SP\Core\Exceptions\SPException; use SP\Core\OldCrypt; -use SP\Core\Session; +use SP\Core\Session\Session; +use SP\Core\SessionFactory; use SP\Core\TaskFactory; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\AccountData; use SP\Log\Email; use SP\Log\Log; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; -use SP\Util\Checks; use SP\Util\Util; /** @@ -46,6 +49,45 @@ use SP\Util\Util; */ class AccountCrypt { + use InjectableTrait; + /** + * @var Config + */ + protected $config; + /** + * @var ConfigData + */ + protected $configData; + /** + * @var Session + */ + protected $session; + /** + * @var Log + */ + protected $log; + + /** + * AccountCrypt constructor. + */ + public function __construct() + { + $this->injectDependencies(); + } + + /** + * @param Config $config + * @param Log $log + * @param Session $session + */ + public function inject(Config $config, Log $log, Session $session) + { + $this->config = $config; + $this->configData = $config->getConfigData(); + $this->log = $log; + $this->session = $session; + } + /** * Actualiza las claves de todas las cuentas con la clave maestra actual * usando nueva encriptación. @@ -58,20 +100,18 @@ class AccountCrypt set_time_limit(0); $accountsOk = []; - $userId = Session::getUserData()->getUserId(); - $demoEnabled = Checks::demoIsEnabled(); + $userId = $this->session->getUserData()->getUserId(); $errorCount = 0; - $Log = new Log(); - $LogMessage = $Log->getLogMessage(); + $LogMessage = $this->log->getLogMessage(); $LogMessage->setAction(__('Actualizar Clave Maestra', false)); $LogMessage->addDescription(__('Inicio', false)); - $Log->writeLog(true); + $this->log->writeLog(true); if (!OldCrypt::checkCryptModule()) { $LogMessage->addDescription(__('Error en el módulo de encriptación', false)); - $Log->setLogLevel(Log::ERROR); - $Log->writeLog(); + $this->log->setLogLevel(Log::ERROR); + $this->log->writeLog(); return false; } @@ -80,8 +120,8 @@ class AccountCrypt if ($numAccounts === 0) { $LogMessage->addDescription(__('Error al obtener las claves de las cuentas', false)); - $Log->setLogLevel(Log::ERROR); - $Log->writeLog(); + $this->log->setLogLevel(Log::ERROR); + $this->log->writeLog(); return false; } @@ -95,13 +135,13 @@ class AccountCrypt foreach ($accountsPass as $account) { // No realizar cambios si está en modo demo - if ($demoEnabled) { + if ($this->configData->isDemoEnabled()) { $accountsOk[] = $account->account_id; continue; } if ($LogMessage->getDetailsCounter() >= 100) { - $Log->writeLog(false, true); + $this->log->writeLog(false, true); } if ($counter % 100 === 0) { @@ -152,7 +192,7 @@ class AccountCrypt $LogMessage->addDetails(__('Cuentas actualizadas', false), implode(',', $accountsOk)); $LogMessage->addDetails(__('Errores', false), $errorCount); - $Log->writeLog(); + $this->log->writeLog(); Email::sendEmail($LogMessage); @@ -173,7 +213,7 @@ class AccountCrypt $Data = new QueryData(); $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -188,23 +228,21 @@ class AccountCrypt set_time_limit(0); $accountsOk = []; - $userId = Session::getUserData()->getUserId(); - $demoEnabled = Checks::demoIsEnabled(); + $userId = $this->session->getUserData()->getUserId(); $errorCount = 0; - $Log = new Log(); - $LogMessage = $Log->getLogMessage(); + $LogMessage = $this->log->getLogMessage(); $LogMessage->setAction(__('Actualizar Clave Maestra', false)); $LogMessage->addDescription(__('Inicio', false)); - $Log->writeLog(true); + $this->log->writeLog(true); $accountsPass = $this->getAccountsPassData(); $numAccounts = count($accountsPass); if ($numAccounts === 0) { $LogMessage->addDescription(__('Error al obtener las claves de las cuentas', false)); - $Log->setLogLevel(Log::ERROR); - $Log->writeLog(); + $this->log->setLogLevel(Log::ERROR); + $this->log->writeLog(); return false; } @@ -218,11 +256,13 @@ class AccountCrypt foreach ($accountsPass as $account) { // No realizar cambios si está en modo demo - if ($demoEnabled) { + if ($this->configData->isDemoEnabled()) { $accountsOk[] = $account->account_id; continue; - } elseif ($LogMessage->getDetailsCounter() >= 100) { - $Log->writeLog(false, true); + } + + if ($LogMessage->getDetailsCounter() >= 100) { + $this->log->writeLog(false, true); } if ($counter % 100 === 0) { @@ -269,7 +309,7 @@ class AccountCrypt $LogMessage->addDetails(__('Cuentas actualizadas', false), implode(',', $accountsOk)); $LogMessage->addDetails(__('Errores', false), $errorCount); - $Log->writeLog(); + $this->log->writeLog(); Email::sendEmail($LogMessage); diff --git a/inc/SP/Account/AccountFavorites.php b/lib/SP/Account/AccountFavorites.php similarity index 94% rename from inc/SP/Account/AccountFavorites.php rename to lib/SP/Account/AccountFavorites.php index 20d9429d..ce1bde34 100644 --- a/inc/SP/Account/AccountFavorites.php +++ b/lib/SP/Account/AccountFavorites.php @@ -24,7 +24,7 @@ namespace SP\Account; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -49,7 +49,7 @@ class AccountFavorites $Data->setQuery($query); $Data->addParam($userId); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $favorites = []; @@ -78,7 +78,7 @@ class AccountFavorites $Data->addParam($userId); $Data->setOnErrorMessage(__('Error al añadir favorito', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); } /** @@ -100,6 +100,6 @@ class AccountFavorites $Data->addParam($userId); $Data->setOnErrorMessage(__('Error al eliminar favorito', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); } } \ No newline at end of file diff --git a/inc/SP/Account/AccountHistory.php b/lib/SP/Account/AccountHistory.php similarity index 97% rename from inc/SP/Account/AccountHistory.php rename to lib/SP/Account/AccountHistory.php index ad9b5ddb..01c44bd3 100644 --- a/inc/SP/Account/AccountHistory.php +++ b/lib/SP/Account/AccountHistory.php @@ -26,7 +26,7 @@ namespace SP\Account; use SP\Config\ConfigDB; use SP\Core\Exceptions\SPException; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -74,7 +74,7 @@ class AccountHistory extends AccountBase implements AccountInterface $arrHistory = []; - foreach (DB::getResultsArray($Data) as $history) { + foreach (DbWrapper::getResultsArray($Data) as $history) { // Comprobamos si la entrada en el historial es la primera (no tiene editor ni fecha de edición) if (empty($history->acchistory_dateEdit) || $history->acchistory_dateEdit === '0000-00-00 00:00:00') { $date = $history->acchistory_dateAdd . ' - ' . $history->user_add; @@ -188,7 +188,7 @@ class AccountHistory extends AccountBase implements AccountInterface $Data->setQuery($query . ' ' . $querySelect); $Data->setOnErrorMessage(__('Error al actualizar el historial', false)); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -207,7 +207,7 @@ class AccountHistory extends AccountBase implements AccountInterface $Data->setQuery($query); $Data->addParam($historyId); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_CRITICAL, __('No se pudieron obtener los datos de la cuenta', false), 0); @@ -236,7 +236,7 @@ class AccountHistory extends AccountBase implements AccountInterface $Data->addParam($newHash); $Data->addParam(ConfigDB::getValue('masterPwd')); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -258,7 +258,7 @@ class AccountHistory extends AccountBase implements AccountInterface $Data->addParam(null === $id ? $this->accountData->getAccountId() : $id); $Data->addParam(ConfigDB::getValue('masterPwd')); - return (DB::getResults($Data) !== false); + return (DbWrapper::getResults($Data) !== false); } /** @@ -285,7 +285,7 @@ class AccountHistory extends AccountBase implements AccountInterface $Data->addParam($AccountData->key, 'accountKey'); $Data->addParam($AccountData->hash, 'hash'); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -313,7 +313,7 @@ class AccountHistory extends AccountBase implements AccountInterface $Data->setMapClass($this->accountData); $Data->addParam($this->getId()); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -384,7 +384,7 @@ class AccountHistory extends AccountBase implements AccountInterface $Data->setMapClass($this->accountData); $Data->addParam($this->getId()); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_CRITICAL, __('No se pudieron obtener los datos de la cuenta', false)); @@ -451,7 +451,7 @@ class AccountHistory extends AccountBase implements AccountInterface $Data->addParam($this->isIsDelete(), 'isDelete'); $Data->addParam(ConfigDB::getValue('masterPwd'), 'masterPwd'); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -512,7 +512,7 @@ class AccountHistory extends AccountBase implements AccountInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar la cuenta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() === 1; } diff --git a/inc/SP/Account/AccountHistoryCrypt.php b/lib/SP/Account/AccountHistoryCrypt.php similarity index 84% rename from inc/SP/Account/AccountHistoryCrypt.php rename to lib/SP/Account/AccountHistoryCrypt.php index 0e8e160c..927585d6 100644 --- a/inc/SP/Account/AccountHistoryCrypt.php +++ b/lib/SP/Account/AccountHistoryCrypt.php @@ -25,15 +25,19 @@ namespace SP\Account; use Defuse\Crypto\Exception\CryptoException; +use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Crypt\Crypt; use SP\Core\Crypt\Hash; use SP\Core\Exceptions\QueryException; use SP\Core\Exceptions\SPException; use SP\Core\OldCrypt; +use SP\Core\SessionFactory; use SP\Core\TaskFactory; +use SP\Core\Traits\InjectableTrait; use SP\Log\Email; use SP\Log\Log; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Checks; use SP\Util\Util; @@ -45,6 +49,45 @@ use SP\Util\Util; */ class AccountHistoryCrypt { + use InjectableTrait; + /** + * @var Config + */ + protected $Config; + /** + * @var ConfigData + */ + protected $ConfigData; + /** + * @var SessionFactory + */ + protected $Session; + /** + * @var Log + */ + protected $Log; + + /** + * AccountCrypt constructor. + */ + public function __construct() + { + $this->injectDependencies(); + } + + /** + * @param Config $config + * @param Log $log + * @param SessionFactory $session + */ + public function inject(Config $config, Log $log, SessionFactory $session) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + $this->Log = $log; + $this->Session = $session; + } + /** * @var string */ @@ -62,19 +105,17 @@ class AccountHistoryCrypt set_time_limit(0); $accountsOk = []; - $demoEnabled = Checks::demoIsEnabled(); $errorCount = 0; - $Log = new Log(); - $LogMessage = $Log->getLogMessage(); + $LogMessage = $this->Log->getLogMessage(); $LogMessage->setAction(__('Actualizar Clave Maestra (H)', false)); $LogMessage->addDescription(__('Inicio', false)); - $Log->writeLog(true); + $this->Log->writeLog(true); if (!OldCrypt::checkCryptModule()) { $LogMessage->addDescription(__('Error en el módulo de encriptación', false)); - $Log->setLogLevel(Log::ERROR); - $Log->writeLog(); + $this->Log->setLogLevel(Log::ERROR); + $this->Log->writeLog(); return false; } @@ -83,8 +124,8 @@ class AccountHistoryCrypt if ($numAccounts === 0) { $LogMessage->addDescription(__('No se encontraron registros', false)); - $Log->setLogLevel(Log::ERROR); - $Log->writeLog(); + $this->Log->setLogLevel(Log::ERROR); + $this->Log->writeLog(); return true; } @@ -102,11 +143,13 @@ class AccountHistoryCrypt foreach ($accountsPass as $account) { // No realizar cambios si está en modo demo - if ($demoEnabled) { + if ($this->ConfigData->isDemoEnabled()) { $accountsOk[] = $account->acchistory_id; continue; - } elseif ($LogMessage->getDetailsCounter() >= 100) { - $Log->writeLog(false, true); + } + + if ($LogMessage->getDetailsCounter() >= 100) { + $this->Log->writeLog(false, true); } if ($counter % 100 === 0) { @@ -161,7 +204,7 @@ class AccountHistoryCrypt $LogMessage->addDetails(__('Cuentas actualizadas', false), implode(',', $accountsOk)); $LogMessage->addDetails(__('Errores', false), $errorCount); - $Log->writeLog(); + $this->Log->writeLog(); Email::sendEmail($LogMessage); @@ -182,7 +225,7 @@ class AccountHistoryCrypt $Data = new QueryData(); $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -197,22 +240,20 @@ class AccountHistoryCrypt set_time_limit(0); $accountsOk = []; - $demoEnabled = Checks::demoIsEnabled(); $errorCount = 0; - $Log = new Log(); - $LogMessage = $Log->getLogMessage(); + $LogMessage = $this->Log->getLogMessage(); $LogMessage->setAction(__('Actualizar Clave Maestra (H)', false)); $LogMessage->addDescription(__('Inicio', false)); - $Log->writeLog(true); + $this->Log->writeLog(true); $accountsPass = $this->getAccountsPassData(); $numAccounts = count($accountsPass); if ($numAccounts === 0) { $LogMessage->addDescription(__('No se encontraron registros', false)); - $Log->setLogLevel(Log::ERROR); - $Log->writeLog(); + $this->Log->setLogLevel(Log::ERROR); + $this->Log->writeLog(); return true; } @@ -230,11 +271,13 @@ class AccountHistoryCrypt foreach ($accountsPass as $account) { // No realizar cambios si está en modo demo - if ($demoEnabled) { + if ($this->ConfigData->isDemoEnabled()) { $accountsOk[] = $account->acchistory_id; continue; - } elseif ($LogMessage->getDetailsCounter() >= 100) { - $Log->writeLog(false, true); + } + + if ($LogMessage->getDetailsCounter() >= 100) { + $this->Log->writeLog(false, true); } if ($counter % 100 === 0) { @@ -287,7 +330,7 @@ class AccountHistoryCrypt $LogMessage->addDetails(__('Cuentas actualizadas', false), implode(',', $accountsOk)); $LogMessage->addDetails(__('Errores', false), $errorCount); - $Log->writeLog(); + $this->Log->writeLog(); Email::sendEmail($LogMessage); diff --git a/inc/SP/Account/AccountHistoryUtil.php b/lib/SP/Account/AccountHistoryUtil.php similarity index 89% rename from inc/SP/Account/AccountHistoryUtil.php rename to lib/SP/Account/AccountHistoryUtil.php index c972b301..1860ef00 100644 --- a/inc/SP/Account/AccountHistoryUtil.php +++ b/lib/SP/Account/AccountHistoryUtil.php @@ -24,9 +24,9 @@ namespace SP\Account; -use SP\Core\Session; +use SP\Core\Session\Session; use SP\DataModel\ItemSearchData; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -53,7 +53,7 @@ class AccountHistoryUtil $Data->setQuery($query); $Data->addParam($accountId); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); return is_object($queryRes) ? $queryRes : false; } @@ -74,7 +74,7 @@ class AccountHistoryUtil $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -102,9 +102,9 @@ class AccountHistoryUtil $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); @@ -114,12 +114,13 @@ class AccountHistoryUtil /** * Restaurar una cuenta desde el histórico. * - * @param $id int El Id del registro en el histórico - * @param $accountId + * @param $id int El Id del registro en el histórico + * @param $accountId + * @param Session $session * @return bool * @throws \SP\Core\Exceptions\SPException */ - public static function restoreFromHistory($id, $accountId) + public static function restoreFromHistory($id, $accountId, Session $session) { // Guardamos una copia de la cuenta en el histórico AccountHistory::addHistory($accountId, false); @@ -150,10 +151,10 @@ class AccountHistoryUtil $Data = new QueryData(); $Data->setQuery($query); $Data->addParam($id, 'id'); - $Data->addParam(Session::getUserData()->getUserId(), 'accountUserEditId'); + $Data->addParam($session->getUserData()->getUserId(), 'accountUserEditId'); $Data->setOnErrorMessage(__('Error al restaurar cuenta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return true; } diff --git a/inc/SP/Account/AccountInterface.php b/lib/SP/Account/AccountInterface.php similarity index 100% rename from inc/SP/Account/AccountInterface.php rename to lib/SP/Account/AccountInterface.php diff --git a/inc/SP/Account/AccountSearch.php b/lib/SP/Account/AccountSearch.php similarity index 83% rename from inc/SP/Account/AccountSearch.php rename to lib/SP/Account/AccountSearch.php index 7e60e984..f36d7d1b 100644 --- a/inc/SP/Account/AccountSearch.php +++ b/lib/SP/Account/AccountSearch.php @@ -24,15 +24,16 @@ namespace SP\Account; -use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Acl; -use SP\Core\Session; +use SP\Core\Session\Session; +use SP\Core\SessionFactory; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\AccountSearchData; use SP\Mgmt\Groups\GroupUtil; use SP\Mgmt\Users\User; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; -use SP\Util\Checks; use SP\Util\Filter; defined('APP_ROOT') || die(); @@ -80,7 +81,14 @@ class AccountSearch '673AB7', '3F51B5', ]; - + /** + * @var Session + */ + protected $session; + /** + * @var ConfigData + */ + protected $configData; /** * @var bool */ @@ -120,21 +128,35 @@ class AccountSearch /** * @var bool */ - private $sortViews = false; + private $sortViews; /** * @var bool */ private $searchFavorites = false; + use InjectableTrait; + /** * Constructor */ public function __construct() { - $userResultsPerPage = (Session::getSessionType() === Session::SESSION_INTERACTIVE) ? Session::getUserPreferences()->getResultsPerPage() : 0; + $this->injectDependencies(); - $this->limitCount = ($userResultsPerPage > 0) ? $userResultsPerPage : Config::getConfig()->getAccountCount(); - $this->sortViews = (Session::getSessionType() === Session::SESSION_INTERACTIVE) ? Session::getUserPreferences()->isSortViews() : false; + $userResultsPerPage = (SessionFactory::getSessionType() === SessionFactory::SESSION_INTERACTIVE) ? $this->session->getUserPreferences()->getResultsPerPage() : 0; + + $this->limitCount = ($userResultsPerPage > 0) ? $userResultsPerPage : $this->configData->getAccountCount(); + $this->sortViews = (SessionFactory::getSessionType() === SessionFactory::SESSION_INTERACTIVE) ? $this->session->getUserPreferences()->isSortViews() : false; + } + + /** + * @param ConfigData $configData + * @param Session $session + */ + public function inject(ConfigData $configData, Session $session) + { + $this->configData = $configData; + $this->session = $session; } /** @@ -302,12 +324,12 @@ class AccountSearch } // Variables de configuración - $maxTextLength = Checks::resultsCardsIsEnabled() ? 40 : 60; + $maxTextLength = $this->configData->isResultsAsCards() ? 40 : 60; $accountsData['count'] = self::$queryNumRows; - $accountLinkEnabled = Session::getUserPreferences()->isAccountLink() || Config::getConfig()->isAccountLink(); - $favorites = AccountFavorites::getFavorites(Session::getUserData()->getUserId()); + $accountLinkEnabled = $this->session->getUserPreferences()->isAccountLink() || $this->configData->isAccountLink(); + $favorites = AccountFavorites::getFavorites($this->session->getUserData()->getUserId()); foreach ($results as $AccountSearchData) { // Establecer los datos de la cuenta @@ -329,6 +351,8 @@ class AccountSearch // Obtener la ACL $Acl = $AccountAcl->getAcl(); + $this->session->setAccountAcl($Acl); + $AccountSearchItems->setTextMaxLength($maxTextLength); $AccountSearchItems->setColor($this->pickAccountColor($AccountSearchData->getAccountCustomerId())); $AccountSearchItems->setShowView($Acl->isShowView()); @@ -414,7 +438,7 @@ class AccountSearch if ($this->searchFavorites === true) { $arrayQueryJoin[] = 'INNER JOIN accFavorites ON (accfavorite_accountId = account_id AND accfavorite_userId = ?)'; - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam($this->session->getUserData()->getUserId()); } if (count($arrFilterCommon) > 0) { @@ -425,7 +449,7 @@ class AccountSearch $arrQueryWhere[] = '(' . implode(' AND ', $arrFilterSelect) . ')'; } - $arrQueryWhere = array_merge($arrQueryWhere, AccountUtil::getAccountFilterUser($Data, $this->globalSearch)); + $arrQueryWhere = array_merge($arrQueryWhere, AccountUtil::getAccountFilterUser($Data, $this->session, $this->globalSearch)); if ($this->limitCount > 0) { $queryLimit = '?, ?'; @@ -451,20 +475,17 @@ class AccountSearch $Data->setLimit($queryLimit); // Obtener el número total de cuentas visibles por el usuario - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); // Log::writeNewLog(__FUNCTION__, $Data->getQuery(), Log::DEBUG); // Log::writeNewLog(__FUNCTION__, print_r($Data->getParams(), true), Log::DEBUG); // Consulta de la búsqueda de cuentas - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); // Obtenemos el número de registros totales de la consulta sin contar el LIMIT self::$queryNumRows = $Data->getQueryNumRows(); - // Establecer el filtro de búsqueda en la sesión como un objeto - Session::setSearchFilters($this); - return $queryRes; } @@ -558,7 +579,7 @@ class AccountSearch [ 'type' => 'private', 'query' => '(account_isPrivate = 1 AND account_userId = ?) OR (account_isPrivateGroup = 1 AND account_userGroupId = ?)', - 'values' => [Session::getUserData()->getUserId(), Session::getUserData()->getUserGroupId()] + 'values' => [$this->session->getUserData()->getUserId(), $this->session->getUserData()->getUserGroupId()] ]; break; default: @@ -652,7 +673,7 @@ class AccountSearch */ private function pickAccountColor($id) { - $accountColor = Session::getAccountColor(); + $accountColor = SessionFactory::getAccountColor(); if (!is_array($accountColor) || !isset($accountColor, $accountColor[$id]) @@ -661,7 +682,7 @@ class AccountSearch $color = array_rand(self::$colors); $accountColor[$id] = '#' . self::$colors[$color]; - Session::setAccountColor($accountColor); + SessionFactory::setAccountColor($accountColor); } return $accountColor[$id]; @@ -687,4 +708,46 @@ class AccountSearch return $this; } + + /** + * unserialize() checks for the presence of a function with the magic name __wakeup. + * If present, this function can reconstruct any resources that the object may have. + * The intended use of __wakeup is to reestablish any database connections that may have been lost during + * serialization and perform other reinitialization tasks. + * + * @return void + * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep + */ + public function __wakeup() + { + $this->injectDependencies(); + } + + /** + * serialize() checks if your class has a function with the magic name __sleep. + * If so, that function is executed prior to any serialization. + * It can clean up the object and is supposed to return an array with the names of all variables of that object that should be serialized. + * If the method doesn't return anything then NULL is serialized and E_NOTICE is issued. + * The intended use of __sleep is to commit pending data or perform similar cleanup tasks. + * Also, the function is useful if you have very large objects which do not need to be saved completely. + * + * @return string[] + * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep + */ + public function __sleep() + { + unset($this->dic, $this->configData, $this->session); + + $props = []; + + foreach ((array)$this as $prop => $value) { + if ($prop !== "\0*\0configData" + && $prop !== "\0*\0dic" + && $prop !== "\0*\0session") { + $props[] = $prop; + } + } + + return $props; + } } \ No newline at end of file diff --git a/inc/SP/Account/AccountTags.php b/lib/SP/Account/AccountTags.php similarity index 95% rename from inc/SP/Account/AccountTags.php rename to lib/SP/Account/AccountTags.php index 1073d532..6cc3b73b 100644 --- a/inc/SP/Account/AccountTags.php +++ b/lib/SP/Account/AccountTags.php @@ -27,7 +27,7 @@ namespace SP\Account; use SP\Core\Exceptions\SPException; use SP\DataModel\AccountData; use SP\DataModel\AccountExtData; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -59,7 +59,7 @@ class AccountTags $Data->setUseKeyPair(true); $Data->addParam($accountData->getAccountId()); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -82,7 +82,7 @@ class AccountTags $Data->setUseKeyPair(true); $Data->addParam($id); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -117,7 +117,7 @@ class AccountTags $Data->addParam($tag); } - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -151,6 +151,6 @@ class AccountTags $Data->setQuery($query); $Data->setOnErrorMessage(__('Error al eliminar las etiquetas de la cuenta', false)); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } } \ No newline at end of file diff --git a/inc/SP/Account/AccountUtil.php b/lib/SP/Account/AccountUtil.php similarity index 81% rename from inc/SP/Account/AccountUtil.php rename to lib/SP/Account/AccountUtil.php index 18130cd7..8601d55d 100644 --- a/inc/SP/Account/AccountUtil.php +++ b/lib/SP/Account/AccountUtil.php @@ -24,11 +24,15 @@ namespace SP\Account; +use SP\Bootstrap; use SP\Config\Config; +use SP\Config\ConfigData; +use SP\Core\Dic\DicInterface; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\Session\Session; +use SP\Core\SessionFactory; use SP\DataModel\ItemSearchData; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -61,7 +65,7 @@ class AccountUtil $Data->setQuery($query); $Data->addParam($id); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { return false; @@ -88,7 +92,7 @@ class AccountUtil $Data->setQuery($query); $Data->addParam($accountId); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); if ($queryRes === false) { return false; @@ -127,7 +131,7 @@ class AccountUtil $Data->setQuery($query); try { - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } catch (SPException $e) { throw new SPException(SPException::SP_CRITICAL, __('No se pudieron obtener los datos de las cuentas', false)); } @@ -148,7 +152,7 @@ class AccountUtil $Data->setQuery($query); $Data->addParam($accountId); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); return is_object($queryRes) ? $queryRes->account_name : false; } @@ -169,7 +173,7 @@ class AccountUtil $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -197,9 +201,9 @@ class AccountUtil $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); @@ -209,10 +213,11 @@ class AccountUtil /** * Devolver las cuentas enlazadas * - * @param $accountId + * @param $accountId + * @param Session $session * @return array */ - public static function getLinkedAccounts($accountId) + public static function getLinkedAccounts($accountId, Session $session) { if ($accountId === 0) { return []; @@ -220,7 +225,7 @@ class AccountUtil $Data = new QueryData(); - $queryWhere = self::getAccountFilterUser($Data); + $queryWhere = self::getAccountFilterUser($Data, $session); $queryWhere[] = 'account_parentId = ?'; $Data->addParam($accountId); @@ -233,53 +238,57 @@ class AccountUtil $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** * Devuelve el filtro para la consulta SQL de cuentas que un usuario puede acceder * * @param QueryData $Data - * @param bool $useGlobalSearch + * @param Session $session + * @param bool $useGlobalSearch * @return array */ - public static function getAccountFilterUser(QueryData $Data, $useGlobalSearch = false) + public static function getAccountFilterUser(QueryData $Data, Session $session, $useGlobalSearch = false) { - if (!Session::getUserData()->isUserIsAdminApp() - && !Session::getUserData()->isUserIsAdminAcc() - && !($useGlobalSearch && Session::getUserProfile()->isAccGlobalSearch() && Config::getConfig()->isGlobalSearch()) + $ConfigData = $session->getConfig(); + $userData = $session->getUserData(); + + if (!$userData->isUserIsAdminApp() + && !$userData->isUserIsAdminAcc() + && !($useGlobalSearch && $session->getUserProfile()->isAccGlobalSearch() && $ConfigData->isGlobalSearch()) ) { // Filtro usuario y grupo $filterUser[] = 'account_userId = ?'; - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam($userData->getUserId()); $filterUser[] = 'account_userGroupId = ?'; - $Data->addParam(Session::getUserData()->getUserGroupId()); + $Data->addParam($userData->getUserGroupId()); // Filtro de cuenta en usuarios y grupos secundarios $filterUser[] = /** @lang SQL */ 'account_id IN (SELECT accuser_accountId AS accountId FROM accUsers WHERE accuser_accountId = account_id AND accuser_userId = ? UNION ALL SELECT accgroup_accountId AS accountId FROM accGroups WHERE accgroup_accountId = account_id AND accgroup_groupId = ?)'; - $Data->addParam(Session::getUserData()->getUserId()); - $Data->addParam(Session::getUserData()->getUserGroupId()); + $Data->addParam($userData->getUserId()); + $Data->addParam($userData->getUserGroupId()); // Filtro de grupo principal de cuenta en grupos que incluyen al usuario $filterUser[] = /** @lang SQL */ 'account_userGroupId IN (SELECT usertogroup_groupId FROM usrToGroups WHERE usertogroup_groupId = account_userGroupId AND usertogroup_userId = ?)'; - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam($userData->getUserId()); - if (Config::getConfig()->isAccountFullGroupAccess()) { + if ($ConfigData->isAccountFullGroupAccess()) { // Filtro de grupos secundarios en grupos que incluyen al usuario $filterUser[] = /** @lang SQL */ 'account_id = (SELECT accgroup_accountId AS accountId FROM accGroups INNER JOIN usrToGroups ON usertogroup_groupId = accgroup_groupId WHERE accgroup_accountId = account_id AND usertogroup_userId = ? LIMIT 1)'; - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam($userData->getUserId()); } $queryWhere[] = '(' . implode(' OR ', $filterUser) . ')'; } $queryWhere[] = '(account_isPrivate = 0 OR (account_isPrivate = 1 AND account_userId = ?))'; - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam($userData->getUserId()); $queryWhere[] = '(account_isPrivateGroup = 0 OR (account_isPrivateGroup = 1 AND account_userGroupId = ?))'; - $Data->addParam(Session::getUserData()->getUserGroupId()); + $Data->addParam($userData->getUserGroupId()); return $queryWhere; } @@ -287,14 +296,15 @@ class AccountUtil /** * Obtiene los datos de las cuentas visibles por el usuario * - * @param int $accountId Cuenta actual + * @param int $accountId Cuenta actual + * @param Session $session * @return array */ - public static function getAccountsForUser($accountId = 0) + public static function getAccountsForUser($accountId, Session $session) { $Data = new QueryData(); - $queryWhere = self::getAccountFilterUser($Data); + $queryWhere = self::getAccountFilterUser($Data, $session); if (!empty($accountId)) { $queryWhere[] = 'account_id <> ? AND (account_parentId = 0 OR account_parentId IS NULL)'; @@ -309,7 +319,7 @@ class AccountUtil $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -325,6 +335,6 @@ class AccountUtil $Data = new QueryData(); $Data->setQuery($query); - return (int)DB::getResults($Data)->num; + return (int)DbWrapper::getResults($Data)->num; } } \ No newline at end of file diff --git a/inc/SP/Account/AccountsSearchItem.php b/lib/SP/Account/AccountsSearchItem.php similarity index 93% rename from inc/SP/Account/AccountsSearchItem.php rename to lib/SP/Account/AccountsSearchItem.php index 28128c45..a5e595ec 100644 --- a/inc/SP/Account/AccountsSearchItem.php +++ b/lib/SP/Account/AccountsSearchItem.php @@ -27,6 +27,8 @@ namespace SP\Account; defined('APP_ROOT') || die(); use SP\Config\Config; +use SP\Config\ConfigData; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\AccountSearchData; use SP\Html\Html; use SP\Mgmt\Groups\GroupAccountsUtil; @@ -80,6 +82,12 @@ class AccountsSearchItem protected $showDelete = false; /** @var int */ protected $textMaxLength = 60; + /** + * @var ConfigData + */ + private $ConfigData; + + use InjectableTrait; /** * AccountsSearchItem constructor. @@ -88,9 +96,19 @@ class AccountsSearchItem */ public function __construct(AccountSearchData $AccountSearchData) { + $this->injectDependencies(); + $this->AccountSearchData = $AccountSearchData; } + /** + * @param ConfigData $configData + */ + public function inject(ConfigData $configData) + { + $this->ConfigData = $configData; + } + /** * @return boolean */ @@ -129,7 +147,7 @@ class AccountsSearchItem */ public function isShowCopyPass() { - return ($this->isShowViewPass() && !Checks::accountPassToImageIsEnabled()); + return ($this->isShowViewPass() && !$this->ConfigData->isAccountPassToImage()); } /** @@ -202,7 +220,7 @@ class AccountsSearchItem */ public function getCustomerLink() { - return self::$wikiEnabled ? Config::getConfig()->getWikiSearchurl() . $this->AccountSearchData->getCustomerName() : ''; + return self::$wikiEnabled ? $this->ConfigData->getWikiSearchurl() . $this->AccountSearchData->getCustomerName() : ''; } /** @@ -318,7 +336,7 @@ class AccountsSearchItem */ public function getNumFiles() { - return Checks::fileIsEnabled() ? $this->AccountSearchData->getNumFiles() : 0; + return $this->ConfigData->isFilesEnabled() ? $this->AccountSearchData->getNumFiles() : 0; } /** diff --git a/inc/SP/Account/UserAccounts.php b/lib/SP/Account/UserAccounts.php similarity index 95% rename from inc/SP/Account/UserAccounts.php rename to lib/SP/Account/UserAccounts.php index 38a8bade..879a79d9 100644 --- a/inc/SP/Account/UserAccounts.php +++ b/lib/SP/Account/UserAccounts.php @@ -25,7 +25,7 @@ namespace SP\Account; use SP\DataModel\UserData; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -88,7 +88,7 @@ class UserAccounts $Data->setQuery($query); $Data->setOnErrorMessage(__('Error al eliminar usuarios asociados a la cuenta', false)); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -134,7 +134,7 @@ class UserAccounts $Data->addParam($userId); } - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -154,7 +154,7 @@ class UserAccounts $users = []; - foreach (DB::getResultsArray($Data) as $user) { + foreach (DbWrapper::getResultsArray($Data) as $user) { $users[] = (int)$user->accuser_userId; } @@ -183,6 +183,6 @@ class UserAccounts $Data->setQuery($query); $Data->addParam($accountId); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Api/ApiBase.php b/lib/SP/Api/ApiBase.php similarity index 98% rename from inc/SP/Api/ApiBase.php rename to lib/SP/Api/ApiBase.php index 8fac01d1..29bc471e 100644 --- a/inc/SP/Api/ApiBase.php +++ b/lib/SP/Api/ApiBase.php @@ -31,7 +31,7 @@ use SP\Core\Crypt\Hash; use SP\Core\Crypt\Vault; use SP\Core\Exceptions\InvalidArgumentException; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\SessionUtil; use SP\DataModel\ApiTokenData; use SP\DataModel\UserLoginData; @@ -109,7 +109,7 @@ abstract class ApiBase implements ApiInterface $this->doAuth(); } - Session::setSessionType(Session::SESSION_API); + SessionFactory::setSessionType(SessionFactory::SESSION_API); $this->Log = new Log(); } diff --git a/inc/SP/Api/ApiInterface.php b/lib/SP/Api/ApiInterface.php similarity index 100% rename from inc/SP/Api/ApiInterface.php rename to lib/SP/Api/ApiInterface.php diff --git a/inc/SP/Api/ApiRequest.php b/lib/SP/Api/ApiRequest.php similarity index 100% rename from inc/SP/Api/ApiRequest.php rename to lib/SP/Api/ApiRequest.php diff --git a/inc/SP/Api/ApiUtil.php b/lib/SP/Api/ApiUtil.php similarity index 100% rename from inc/SP/Api/ApiUtil.php rename to lib/SP/Api/ApiUtil.php diff --git a/inc/SP/Api/SyspassApi.php b/lib/SP/Api/SyspassApi.php similarity index 100% rename from inc/SP/Api/SyspassApi.php rename to lib/SP/Api/SyspassApi.php diff --git a/inc/SP/Auth/Auth.php b/lib/SP/Auth/Auth.php similarity index 85% rename from inc/SP/Auth/Auth.php rename to lib/SP/Auth/Auth.php index ea4e543e..998552c6 100644 --- a/inc/SP/Auth/Auth.php +++ b/lib/SP/Auth/Auth.php @@ -31,8 +31,11 @@ use SP\Auth\Database\DatabaseAuthData; use SP\Auth\Ldap\LdapAuthData; use SP\Auth\Ldap\LdapMsAds; use SP\Auth\Ldap\LdapStd; +use SP\Bootstrap; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\SPException; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\UserLoginData; use SP\Util\Checks; @@ -47,6 +50,8 @@ defined('APP_ROOT') || die(); */ class Auth { + use InjectableTrait; + /** * @var array */ @@ -55,6 +60,14 @@ class Auth * @var UserLoginData */ protected $UserData; + /** + * @var Config + */ + protected $Config; + /** + * @var ConfigData + */ + protected $ConfigData; /** * Auth constructor. @@ -64,19 +77,30 @@ class Auth */ public function __construct(UserLoginData $UserData) { + $this->injectDependencies(); + $this->UserData = $UserData; - if (Checks::authBasicIsEnabled()) { + if ($this->ConfigData->isAuthBasicEnabled()) { $this->registerAuth('authBrowser'); } - if (Checks::ldapIsEnabled()) { + if ($this->ConfigData->isLdapEnabled()) { $this->registerAuth('authLdap'); } $this->registerAuth('authDatabase'); } + /** + * @param Config $config + */ + public function inject(Config $config) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + } + /** * Registrar un método de autentificación primarios * @@ -124,7 +148,10 @@ class Auth */ public function authLdap() { - $Ldap = Config::getConfig()->isLdapAds() ? new LdapMsAds() : new LdapStd(); + /** @var ConfigData $ConfigData */ + $ConfigData = Bootstrap::getDic()['configData']; + + $Ldap = $ConfigData->isLdapAds() ? new LdapMsAds() : new LdapStd(); $LdapAuthData = $Ldap->getLdapAuthData(); diff --git a/inc/SP/Auth/AuthDataBase.php b/lib/SP/Auth/AuthDataBase.php similarity index 100% rename from inc/SP/Auth/AuthDataBase.php rename to lib/SP/Auth/AuthDataBase.php diff --git a/inc/SP/Auth/AuthInterface.php b/lib/SP/Auth/AuthInterface.php similarity index 100% rename from inc/SP/Auth/AuthInterface.php rename to lib/SP/Auth/AuthInterface.php diff --git a/inc/SP/Auth/AuthResult.php b/lib/SP/Auth/AuthResult.php similarity index 100% rename from inc/SP/Auth/AuthResult.php rename to lib/SP/Auth/AuthResult.php diff --git a/inc/SP/Auth/AuthUtil.php b/lib/SP/Auth/AuthUtil.php similarity index 100% rename from inc/SP/Auth/AuthUtil.php rename to lib/SP/Auth/AuthUtil.php diff --git a/inc/SP/Auth/Browser/Browser.php b/lib/SP/Auth/Browser/Browser.php similarity index 81% rename from inc/SP/Auth/Browser/Browser.php rename to lib/SP/Auth/Browser/Browser.php index 6a31e4eb..09c7f85b 100644 --- a/inc/SP/Auth/Browser/Browser.php +++ b/lib/SP/Auth/Browser/Browser.php @@ -26,6 +26,8 @@ namespace SP\Auth\Browser; use SP\Auth\AuthInterface; use SP\Config\Config; +use SP\Config\ConfigData; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\UserLoginData; /** @@ -37,6 +39,28 @@ use SP\DataModel\UserLoginData; */ class Browser implements AuthInterface { + use InjectableTrait; + + /** @var ConfigData */ + protected $ConfigData; + + /** + * Browser constructor. + */ + public function __construct() + { + $this->injectDependencies(); + } + + /** + * @param Config $config + */ + public function inject(Config $config) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + } + /** * Autentificar al usuario * @@ -52,7 +76,7 @@ class Browser implements AuthInterface return $AuthData->setAuthenticated($this->checkServerAuthUser($UserData->getLogin())); } - if (Config::getConfig()->isAuthBasicAutoLoginEnabled()) { + if ($this->ConfigData->isAuthBasicAutoLoginEnabled()) { $authUser = Browser::getServerAuthUser(); $authPass = $this->getAuthPass(); @@ -77,7 +101,7 @@ class Browser implements AuthInterface */ public function isAuthGranted() { - return Config::getConfig()->isAuthBasicAutoLoginEnabled(); + return $this->ConfigData->isAuthBasicAutoLoginEnabled(); } /** @@ -88,13 +112,13 @@ class Browser implements AuthInterface */ public function checkServerAuthUser($login) { - $domain = Config::getConfig()->getAuthBasicDomain(); + $domain = $this->ConfigData->getAuthBasicDomain(); if (!empty($domain)) { - $login = Browser::getServerAuthUser() . '@' . $domain; + $login = self::getServerAuthUser() . '@' . $domain; } - $authUser = Browser::getServerAuthUser(); + $authUser = self::getServerAuthUser(); return $authUser === null ?: $authUser === $login; } diff --git a/inc/SP/Auth/Browser/BrowserAuthData.php b/lib/SP/Auth/Browser/BrowserAuthData.php similarity index 100% rename from inc/SP/Auth/Browser/BrowserAuthData.php rename to lib/SP/Auth/Browser/BrowserAuthData.php diff --git a/inc/SP/Auth/Database/Database.php b/lib/SP/Auth/Database/Database.php similarity index 97% rename from inc/SP/Auth/Database/Database.php rename to lib/SP/Auth/Database/Database.php index 6a894acc..2b17b0a6 100644 --- a/inc/SP/Auth/Database/Database.php +++ b/lib/SP/Auth/Database/Database.php @@ -52,7 +52,6 @@ class Database implements AuthInterface * @param UserLoginData $UserData Datos del usuario * @return DatabaseAuthData * @throws \SP\Core\Exceptions\SPException - * @throws \phpmailer\phpmailerException */ public function authenticate(UserLoginData $UserData) { @@ -73,7 +72,6 @@ class Database implements AuthInterface * * @return bool * @throws \SP\Core\Exceptions\SPException - * @throws \phpmailer\phpmailerException */ protected function authUser() { diff --git a/inc/SP/Auth/Database/DatabaseAuthData.php b/lib/SP/Auth/Database/DatabaseAuthData.php similarity index 100% rename from inc/SP/Auth/Database/DatabaseAuthData.php rename to lib/SP/Auth/Database/DatabaseAuthData.php diff --git a/inc/SP/Auth/Ldap/LdapAuthData.php b/lib/SP/Auth/Ldap/LdapAuthData.php similarity index 100% rename from inc/SP/Auth/Ldap/LdapAuthData.php rename to lib/SP/Auth/Ldap/LdapAuthData.php diff --git a/inc/SP/Auth/Ldap/LdapBase.php b/lib/SP/Auth/Ldap/LdapBase.php similarity index 96% rename from inc/SP/Auth/Ldap/LdapBase.php rename to lib/SP/Auth/Ldap/LdapBase.php index 2a097ec5..d0e3a71f 100644 --- a/inc/SP/Auth/Ldap/LdapBase.php +++ b/lib/SP/Auth/Ldap/LdapBase.php @@ -26,8 +26,10 @@ namespace SP\Auth\Ldap; use SP\Auth\AuthInterface; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\SPException; use SP\Core\Messages\LogMessage; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\UserLoginData; use SP\Log\Log; @@ -101,15 +103,31 @@ abstract class LdapBase implements LdapInterface, AuthInterface */ protected $LogMessage; + use InjectableTrait; + + /** @var ConfigData */ + protected $ConfigData; + /** * LdapBase constructor. */ public function __construct() { + $this->injectDependencies(); + $this->LdapAuthData = new LdapAuthData(); $this->LogMessage = new LogMessage(); } + /** + * @param Config $config + */ + public function inject(Config $config) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + } + /** * Indica si es requerida para acceder a la aplicación * @@ -173,7 +191,7 @@ abstract class LdapBase implements LdapInterface, AuthInterface protected function connect() { // Habilitar la traza si el modo debug está habilitado - if (Config::getConfig()->isDebug()) { + if ($this->ConfigData->isDebug()) { @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); } @@ -464,12 +482,12 @@ abstract class LdapBase implements LdapInterface, AuthInterface */ public function checkParams() { - $this->searchBase = Config::getConfig()->getLdapBase(); + $this->searchBase = $this->ConfigData->getLdapBase(); $this->server = $this->pickServer(); $this->serverPort = $this->getServerPort(); - $this->bindDn = Config::getConfig()->getLdapBindUser(); - $this->bindPass = Config::getConfig()->getLdapBindPass(); - $this->group = Config::getConfig()->getLdapGroup(); + $this->bindDn = $this->ConfigData->getLdapBindUser(); + $this->bindPass = $this->ConfigData->getLdapBindPass(); + $this->group = $this->ConfigData->getLdapGroup(); if (!$this->searchBase || !$this->server || !$this->bindDn || !$this->bindPass) { $this->LogMessage->setAction(__FUNCTION__); diff --git a/inc/SP/Auth/Ldap/LdapInterface.php b/lib/SP/Auth/Ldap/LdapInterface.php similarity index 100% rename from inc/SP/Auth/Ldap/LdapInterface.php rename to lib/SP/Auth/Ldap/LdapInterface.php diff --git a/inc/SP/Auth/Ldap/LdapMsAds.php b/lib/SP/Auth/Ldap/LdapMsAds.php similarity index 98% rename from inc/SP/Auth/Ldap/LdapMsAds.php rename to lib/SP/Auth/Ldap/LdapMsAds.php index 9b2842e4..43cb8f9f 100644 --- a/inc/SP/Auth/Ldap/LdapMsAds.php +++ b/lib/SP/Auth/Ldap/LdapMsAds.php @@ -62,7 +62,7 @@ class LdapMsAds extends LdapBase */ protected function pickServer() { - $server = Config::getConfig()->getLdapServer(); + $server = $this->ConfigData->getLdapServer(); if (preg_match('/[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}/', $server)) { return $server; diff --git a/inc/SP/Auth/Ldap/LdapStd.php b/lib/SP/Auth/Ldap/LdapStd.php similarity index 98% rename from inc/SP/Auth/Ldap/LdapStd.php rename to lib/SP/Auth/Ldap/LdapStd.php index e79564ea..8348037a 100644 --- a/inc/SP/Auth/Ldap/LdapStd.php +++ b/lib/SP/Auth/Ldap/LdapStd.php @@ -61,7 +61,7 @@ class LdapStd extends LdapBase */ protected function pickServer() { - return Config::getConfig()->getLdapServer(); + return $this->ConfigData->getLdapServer(); } /** diff --git a/inc/SP/Auth/Ldap/LdapUtil.php b/lib/SP/Auth/Ldap/LdapUtil.php similarity index 100% rename from inc/SP/Auth/Ldap/LdapUtil.php rename to lib/SP/Auth/Ldap/LdapUtil.php diff --git a/lib/SP/Bootstrap.php b/lib/SP/Bootstrap.php new file mode 100644 index 00000000..44e8aa08 --- /dev/null +++ b/lib/SP/Bootstrap.php @@ -0,0 +1,824 @@ +. + */ + +namespace SP; + +use Defuse\Crypto\Exception\CryptoException; +use Klein\Klein; +use PHPMailer\PHPMailer\Exception; +use RuntimeException; +use SP\Account\AccountAcl; +use SP\Auth\Browser\Browser; +use SP\Config\Config; +use SP\Config\ConfigData; +use SP\Config\ConfigUtil; +use SP\Core\Session\Session; +use SP\Modules\Web\Controllers\MainController; +use SP\Core\Crypt\CryptSessionHandler; +use SP\Core\Crypt\SecureKeyCookie; +use SP\Core\Dic\DicInterface; +use SP\Core\Exceptions\SPException; +use SP\Core\Language; +use SP\Core\Plugin\PluginUtil; +use SP\Core\SessionFactory; +use SP\Core\SessionUtil; +use SP\Core\Template; +use SP\Core\Traits\InjectableTrait; +use SP\Core\UI\Theme; +use SP\Core\Upgrade\Upgrade; +use SP\Http\JsonResponse; +use SP\Http\Request; +use SP\Log\Email; +use SP\Log\Log; +use SP\Mgmt\Profiles\Profile; +use SP\Core\Exceptions\ConfigException; +use SP\Storage\DBUtil; +use SP\Util\Checks; +use SP\Util\HttpUtil; +use SP\Util\Json; +use SP\Util\Util; +use SP\Core\Crypt\Session as CryptSession; + +defined('APP_ROOT') || die(); + +/** + * Class Bootstrap + * + * @package SP + */ +class Bootstrap +{ + use InjectableTrait; + + /** + * @var string The installation path on the server (e.g. /srv/www/syspass) + */ + public static $SERVERROOT = ''; + + /** + * @var string The current request path relative to the sysPass root (e.g. files/index.php) + */ + public static $WEBROOT = ''; + + /** + * @var string The full URL to reach sysPass (e.g. https://sub.example.com/syspass/) + */ + public static $WEBURI = ''; + + /** + * @var bool True if sysPass has been updated. Only for notices. + */ + public static $UPDATED = false; + /** + * @var int + */ + public static $LOCK = 0; + /** + * @var string + */ + private static $SUBURI = ''; + /** + * @var bool Indica si la versión de PHP es correcta + */ + private static $checkPhpVersion; + /** + * @var bool Indica si el script requiere inicialización + */ + private static $checkInitSourceInclude; + /** + * @var string + */ + private static $sourceScript; + /** + * @var Upgrade + */ + protected $upgrade; + /** + * @var Session + */ + protected $session; + /** + * @var Theme + */ + protected $theme; + /** + * @var Klein + */ + protected $router; + /** + * @var Config + */ + private $config; + /** + * @var ConfigData + */ + private $configData; + + /** + * Bootstrap constructor. + */ + public function __construct() + { + $this->injectDependencies(); + } + + /** + * @return DicInterface + */ + public static function getDic() + { + global $dic; + + return $dic; + } + + /** + * Comprobar si hay que ejecutar acciones de URL después de realizar login. + * + * @return bool + */ + public function checkPostLoginActions() + { + $action = Request::analyze('a'); + + if ($action === '') { + return false; + } + + $Controller = new MainController(); + $Controller->doAction('postlogin.' . $action); + + return false; + } + + /** + * @param Config $config + * @param Upgrade $upgrade + * @param Session $session + * @param Theme $theme + * @param Klein $router + */ + public function inject(Config $config, Upgrade $upgrade, Session $session, Theme $theme, Klein $router) + { + $this->config = $config; + $this->configData = $config->getConfigData(); + $this->upgrade = $upgrade; + $this->session = $session; + $this->theme = $theme; + $this->router = $router; + } + + /** + * Comprueba que la aplicación esté instalada + * Esta función comprueba si la aplicación está instalada. Si no lo está, redirige al instalador. + */ + private function checkInstalled() + { + // Redirigir al instalador si no está instalada + if (!$this->configData->isInstalled()) { + if (self::$SUBURI !== '/index.php') { + // FIXME + $this->router->response()->redirect('index.php?r=install'); + + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; + + $url = $protocol . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . self::$WEBROOT . '/index.php'; + header("Location: $url"); + exit(); + } + + if ($this->session->getAuthCompleted()) { + session_destroy(); + + $this->initialize(); + return; + } + + // Comprobar si sysPass está instalada o en modo mantenimiento + $Controller = new MainController(); + $Controller->getInstaller(); + $Controller->view(); + exit(); + } + } + + /** + * Inicializar la aplicación + * + * @throws \Psr\Container\ContainerExceptionInterface + */ + public function initialize() + { + self::$checkPhpVersion = Checks::checkPhpVersion(); + self::$checkInitSourceInclude = $this->checkInitSourceInclude(); + + if (date_default_timezone_get() === 'UTC') { + date_default_timezone_set('UTC'); + } + + $this->initRouter(); + + // Inicializar autentificación + $this->initAuth(); + + // Inicializar logging + $this->initLogging(); + + // Cargar las extensiones +// self::loadExtensions(); + + // Establecer el lenguaje por defecto + Language::setLocales('en_US'); + + // Establecer las rutas de la aplicación + $this->initPaths(); + + if (!self::$checkPhpVersion && !self::$checkInitSourceInclude) { + self::initError( + __('Versión de PHP requerida >= ') . ' 5.6.0 <= 7.0', + __('Actualice la versión de PHP para que la aplicación funcione correctamente')); + } + + // Comprobar la configuración + $this->initConfig(); + + // Iniciar la sesión de PHP + $this->initSession($this->configData->isEncryptSession()); + + // Volver a cargar la configuración si se recarga la página + if (!Request::checkReload()) { + // Cargar la configuración + $this->config->loadConfig(); + + // Cargar el lenguaje + Language::setLanguage(); + } else { + // Cargar la configuración + $this->config->loadConfig(true); + + // Restablecer el idioma y el tema visual + Language::setLanguage(true); + $this->theme->initTheme(true); + + if ($this->session->isLoggedIn()) { + // Recargar los permisos del perfil de usuario + $this->session->setUserProfile(Profile::getItem()->getById($this->session->getUserData()->getUserProfileId())); + // Reset de los datos de ACL de cuentas + AccountAcl::resetData(); + } + } + + // Comprobar si es necesario cambiar a HTTPS + HttpUtil::checkHttps(); + + // Comprobar si es necesario inicialización + if (self::$checkInitSourceInclude || + ((defined('IS_INSTALLER') || defined('IS_UPGRADE')) && Checks::isAjax()) + ) { + return; + } + + // Comprobar si está instalado + $this->checkInstalled(); + + // Comprobar si el modo mantenimiento está activado + $this->checkMaintenanceMode(); + + // Comprobar si la Base de datos existe + if (!DBUtil::checkDatabaseExist()) { + self::initError(__('Error en la verificación de la base de datos')); + } + + // Comprobar si es necesario actualizar componentes + $this->checkUpgrade(); + + // Inicializar la sesión + $this->initUserSession(); + + // Cargar los plugins + PluginUtil::loadPlugins(); + + // Comprobar acciones en URL + $this->checkPreLoginActions(); + + if ($this->session->isLoggedIn() && $this->session->getAuthCompleted() === true) { + $AuthBrowser = new Browser(); + + // Comprobar si se ha identificado mediante el servidor web y el usuario coincide + if ($AuthBrowser->checkServerAuthUser($this->session->getUserData()->getUserLogin()) === false + && $AuthBrowser->checkServerAuthUser($this->session->getUserData()->getUserSsoLogin()) === false + ) { + $this->goLogout(); + } + } + + $this->router->dispatch(); + + + // El usuario no está logado y no es una petición, redirigir al login +// $this->goLogin(); + } + + /** + * Comprobar el archivo que realiza el include necesita inicialización. + * + * @returns bool + */ + private function checkInitSourceInclude() + { + self::$sourceScript = pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_BASENAME); + $skipInit = ['js.php', 'css.php', 'api.php', 'ajax_getEnvironment.php', 'ajax_task.php']; + + return in_array(self::$sourceScript, $skipInit, true); + } + + /** + * Inicializar router + */ + protected function initRouter() + { + // Update request when we have a subdirectory +// $_SERVER['REQUEST_URI'] = self::$WEBROOT; + + $self = $this; + + // Manejar URLs con módulo indicado + $this->router->respond(['GET', 'POST'], + '/index.php', + function ($request, $response, $service) use ($self) { + + $self->router->onError(function ($router, $err_msg, $type, $err) { + debugLog('Routing error: ' . $err_msg); + + /** @var Exception|\Throwable $err */ + debugLog('Routing error: ' . formatTrace($err->getTrace())); + }); + + try { + /** @var \Klein\Request $request */ + $route = filter_var($request->param('r', 'index/index'), FILTER_SANITIZE_STRING); + + if (!preg_match('/(?P[a-zA-Z]+)(\/(?P[a-zA-Z]+))?(\/(?P\d+))*/', $route, $components)) { + throw new RuntimeException("Oops, invalid route\n"); + } + + $controller = $components['controller']; + $method = isset($components['method']) ? $components['method'] . 'Action' : 'indexAction'; + $id = isset($components['id']) ? (int)$components['id'] : 0; + + $controllerClass = 'SP\\Modules\\' . ucfirst(APP_MODULE) . '\\Controllers\\' . ucfirst($controller) . 'Controller'; + + if (class_exists($controllerClass)) { + $callableMethod = [new $controllerClass, $method]; + + if (!is_callable($callableMethod)) { + throw new RuntimeException("Oops, it looks like this content doesn't exist...\n"); + } + + debugLog('Routing call: ' . $controllerClass . '::' . $method . '::' . $id); + + return $callableMethod($id); + } + + throw new RuntimeException("Oops, it looks like this content doesn't exist...\n"); + } catch (RuntimeException $e) { + debugLog($e->getMessage(), true); + + return $e->getMessage(); + } + } + ); + + // Manejar URLs que no empiecen por '/admin' +// $this->Router->respond('GET', '!@^/(admin|public|service)', +// function ($request, $response) { +// /** @var Response $response */ +// $response->redirect('index.php'); +// } +// ); + } + + /** + * Establecer variables de autentificación + */ + private function initAuth() + { + // Copiar la cabecera http de autentificación para apache+php-fcgid + if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) { + $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION']; + } + + // Establecer las cabeceras de autentificación para apache+php-cgi + if (isset($_SERVER['HTTP_AUTHORIZATION']) + && preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches) + ) { + list($name, $password) = explode(':', base64_decode($matches[1]), 2); + $_SERVER['PHP_AUTH_USER'] = strip_tags($name); + $_SERVER['PHP_AUTH_PW'] = strip_tags($password); + } + + // Establecer las cabeceras de autentificación para que apache+php-cgi funcione si la variable es renombrada por apache + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) + && preg_match('/Basic\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches) + ) { + list($name, $password) = explode(':', base64_decode($matches[1]), 2); + $_SERVER['PHP_AUTH_USER'] = strip_tags($name); + $_SERVER['PHP_AUTH_PW'] = strip_tags($password); + } + } + + /** + * Establecer el nivel de logging + */ + public function initLogging() + { + // Establecer el modo debug si una sesión de xdebug está activa + if (isset($_COOKIE['XDEBUG_SESSION']) && !defined('DEBUG')) { + define('DEBUG', true); + } + + if (defined('DEBUG') && DEBUG) { + error_reporting(E_ALL); + ini_set('display_errors', 'On'); + } else { + error_reporting(E_ALL & ~(E_DEPRECATED | E_STRICT | E_NOTICE)); + ini_set('display_errors', 'Off'); + } + + if (!file_exists(LOG_FILE) && touch(LOG_FILE) && chmod(LOG_FILE, 0600)) { + debugLog('Setup log file: ' . LOG_FILE); + } + } + + /** + * Establecer las rutas de la aplicación. + * Esta función establece las rutas del sistema de archivos y web de la aplicación. + * La variables de clase definidas son $SERVERROOT, $WEBROOT y $SUBURI + */ + private function initPaths() + { + // Calcular los directorios raíz +// $dir = substr(__DIR__, 0, strpos(__DIR__, str_replace('\\', '/', __NAMESPACE__)) - 1); +// self::$SERVERROOT = substr($dir, 0, strripos($dir, DIRECTORY_SEPARATOR)); + + self::$SERVERROOT = dirname(BASE_PATH); + + self::$SUBURI = str_replace("\\", '/', substr(realpath($_SERVER['SCRIPT_FILENAME']), strlen(self::$SERVERROOT))); + + $scriptName = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; + + if (substr($scriptName, -1) === '/') { + $scriptName .= 'index.php'; + // Asegurar que suburi sigue las mismas reglas que scriptName + if (substr(self::$SUBURI, -9) !== 'index.php') { + if (substr(self::$SUBURI, -1) !== '/') { + self::$SUBURI .= '/'; + } + self::$SUBURI .= 'index.php'; + } + } + + $pos = strpos($scriptName, self::$SUBURI); + + if ($pos === false) { + $pos = strpos($scriptName, '?'); + } + + self::$WEBROOT = substr($scriptName, 0, $pos); + + if (self::$WEBROOT !== '' && self::$WEBROOT[0] !== '/') { + self::$WEBROOT = '/' . self::$WEBROOT; + } + + self::$WEBURI = HttpUtil::getHttpHost() . self::$WEBROOT; + } + + /** + * Devuelve un error utilizando la plantilla de error o en formato JSON + * + * @param string $message con la descripción del error + * @param string $hint opcional, con una ayuda sobre el error + * @param bool $headers + */ + public static function initError($message, $hint = '', $headers = false) + { + debugLog(__FUNCTION__); + debugLog(__($message)); + debugLog(__($hint)); + + if (Checks::isJson()) { + $JsonResponse = new JsonResponse(); + $JsonResponse->setDescription($message); + $JsonResponse->addMessage($hint); + Json::returnJson($JsonResponse); + } elseif ($headers === true) { + header('HTTP/1.1 503 Service Temporarily Unavailable'); + header('Status: 503 Service Temporarily Unavailable'); + header('Retry-After: 120'); + } + + SessionUtil::cleanSession(); + + $Tpl = new Template(); + $Tpl->append('errors', ['type' => SPException::SP_CRITICAL, 'description' => __($message), 'hint' => __($hint)]); + + $Controller = new MainController($Tpl, 'error', !Checks::isAjax()); + $Controller->getError(); + } + + /** + * Cargar la configuración + */ + private function initConfig() + { + // Comprobar si es una versión antigua + $this->checkConfigVersion(); + + try { + if (!self::$checkInitSourceInclude) { + ConfigUtil::checkConfigDir(); + } + } catch (ConfigException $e) { + self::initError($e->getMessage(), $e->getHint()); + } + } + + /** + * Comprobar la versión de configuración y actualizarla + */ + private function checkConfigVersion() + { + $appVersion = Util::getVersionStringNormalized(); + + if (file_exists(CONFIG_FILE) && $this->upgrade->upgradeOldConfigFile($appVersion)) { + $this->logConfigUpgrade($appVersion); + + self::$UPDATED = true; + + return; + } + + $configVersion = Upgrade::fixVersionNumber($this->configData->getConfigVersion()); + + if ($this->configData->isInstalled() + && Util::checkVersion($configVersion, Util::getVersionArrayNormalized()) + && $this->upgrade->needConfigUpgrade($configVersion) + && $this->upgrade->upgradeConfig($configVersion) + ) { + $this->logConfigUpgrade($appVersion); + + self::$UPDATED = true; + } + } + + /** + * Registrar la actualización de la configuración + * + * @param $version + */ + private function logConfigUpgrade($version) + { + $Log = new Log(); + $LogMessage = $Log->getLogMessage(); + $LogMessage->setAction(__('Actualización', false)); + $LogMessage->addDescription(__('Actualización de versión realizada.', false)); + $LogMessage->addDetails(__('Versión', false), $version); + $LogMessage->addDetails(__('Tipo', false), 'config'); + $Log->writeLog(); + + Email::sendEmail($LogMessage); + } + + /** + * Iniciar la sesión PHP + * + * @param bool $encrypt Encriptar la sesión de PHP + */ + private function initSession($encrypt = false) + { + // Evita que javascript acceda a las cookies de sesion de PHP + ini_set('session.cookie_httponly', '1'); + ini_set('session.save_handler', 'files'); + + if ($encrypt === true) { + $Key = SecureKeyCookie::getKey(); + + if ($Key !== false && self::$checkPhpVersion) { + session_set_save_handler(new CryptSessionHandler($Key), true); + } + } + + // Si la sesión no puede ser iniciada, devolver un error 500 + if (session_start() === false) { + Log::writeNewLog(__('Sesión', false), __('La sesión no puede ser inicializada', false)); + + header('HTTP/1.1 500 Internal Server Error'); + + self::initError(__('La sesión no puede ser inicializada'), __('Consulte con el administrador')); + } + } + + /** + * Comprobar si el modo mantenimiento está activado + * Esta función comprueba si el modo mantenimiento está activado. + * Devuelve un error 503 y un reintento de 120s al cliente. + * + * @param bool $check sólo comprobar si está activado el modo + * @return bool + */ + public function checkMaintenanceMode($check = false) + { + if ($this->configData->isMaintenance()) { + self::$LOCK = Util::getAppLock(); + + if ($check === true + || Checks::isAjax() + || Request::analyze('nodbupgrade', 0) === 1 + || (Request::analyze('a') === 'upgrade' && Request::analyze('type') !== '') + || (self::$LOCK > 0 && $this->session->isLoggedIn() && self::$LOCK === $this->session->getUserData()->getUserId()) + ) { + return true; + } + + self::initError(__('Aplicación en mantenimiento'), __('En breve estará operativa')); + } + + return false; + } + + /** + * Comprobar si es necesario actualizar componentes + * + * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException + */ + private function checkUpgrade() + { + return self::$SUBURI === '/index.php' + && ($this->upgrade->checkDbVersion() || $this->upgrade->checkAppVersion()); + } + + /** + * Inicializar la sesión de usuario + * + */ + private function initUserSession() + { + $lastActivity = SessionFactory::getLastActivity(); + $inMaintenance = $this->configData->isMaintenance(); + + // Timeout de sesión + if ($lastActivity > 0 + && !$inMaintenance + && (time() - $lastActivity) > $this->getSessionLifeTime() + ) { + if (isset($_COOKIE[session_name()])) { + setcookie(session_name(), '', time() - 42000, '/'); + } + + $this->wrLogoutInfo(); + + SessionUtil::restart(); + return; + } + + $sidStartTime = SessionFactory::getSidStartTime(); + + // Regenerar el Id de sesión periódicamente para evitar fijación + if ($sidStartTime === 0) { + // Intentar establecer el tiempo de vida de la sesión en PHP + @ini_set('session.gc_maxlifetime', $this->getSessionLifeTime()); + + SessionFactory::setSidStartTime(time()); + SessionFactory::setStartActivity(time()); + } else if (!$inMaintenance + && time() - $sidStartTime > 120 + && $this->session->getUserData()->getUserId() > 0 + ) { + try { + CryptSession::reKey(); + + // Recargar los permisos del perfil de usuario + $this->session->setUserProfile(Profile::getItem()->getById($this->session->getUserData()->getUserProfileId())); + } catch (CryptoException $e) { + debugLog($e->getMessage()); + + SessionUtil::restart(); + return; + } + } + + SessionFactory::setLastActivity(time()); + } + + /** + * Obtener el timeout de sesión desde la configuración. + * + * @return int con el tiempo en segundos + */ + private function getSessionLifeTime() + { + $timeout = SessionFactory::getSessionTimeout(); + + if (null === $timeout) { + $configTimeout = $this->configData->getSessionTimeout(); + SessionFactory::setSessionTimeout($configTimeout); + + return $configTimeout; + } + + return $timeout; + } + + /** + * Escribir la información de logout en el registro de eventos. + */ + private function wrLogoutInfo() + { + $inactiveTime = abs(round((time() - SessionFactory::getLastActivity()) / 60, 2)); + $totalTime = abs(round((time() - SessionFactory::getStartActivity()) / 60, 2)); + + $Log = new Log(); + $LogMessage = $Log->getLogMessage(); + $LogMessage->setAction(__('Finalizar sesión', false)); + $LogMessage->addDetails(__('Usuario', false), $this->session->getUserData()->getUserLogin()); + $LogMessage->addDetails(__('Tiempo inactivo', false), $inactiveTime . ' min.'); + $LogMessage->addDetails(__('Tiempo total', false), $totalTime . ' min.'); + $Log->writeLog(); + } + + /** + * Comprobar si hay que ejecutar acciones de URL antes de presentar la pantalla de login. + * + * @return bool + */ + public function checkPreLoginActions() + { + $action = Request::analyze('a'); + + if ($action === '') { + return false; + } + + $Controller = new MainController(); + $Controller->doAction('prelogin.' . $action); + + return true; + } + + /** + * Deslogar el usuario actual y eliminar la información de sesión. + */ + private function goLogout() + { + $this->wrLogoutInfo(); + + SessionUtil::cleanSession(); + + SessionFactory::setLoggedOut(true); + + $Controller = new MainController(); + $Controller->getLogout(); + } + + /** + * Comprobar si es necesario cerrar la sesión + */ + private function checkLogout() + { + if (Request::analyze('logout', false, true)) { + $this->goLogout(); + } + } + + /** + * Mostrar la página de login + */ + private function goLogin() + { + SessionUtil::cleanSession(); + + $Controller = new MainController(); + $Controller->getLogin(); + } +} \ No newline at end of file diff --git a/inc/SP/Config/Config.php b/lib/SP/Config/Config.php similarity index 51% rename from inc/SP/Config/Config.php rename to lib/SP/Config/Config.php index 981b1e48..e0b0f3dd 100644 --- a/inc/SP/Config/Config.php +++ b/lib/SP/Config/Config.php @@ -25,8 +25,11 @@ namespace SP\Config; use ReflectionObject; -use SP\Core\DiFactory; -use SP\Core\Session; +use SP\Core\Exceptions\ConfigException; +use SP\Core\Session\Session; +use SP\Core\SessionFactory; +use SP\Core\Traits\InjectableTrait; +use SP\Storage\FileStorageInterface; defined('APP_ROOT') || die(); @@ -35,14 +38,88 @@ defined('APP_ROOT') || die(); */ class Config { - /** - * @var ConfigData - */ - private static $Config; + use InjectableTrait; + /** * @var bool */ private static $configLoaded = false; + /** + * @var ConfigData + */ + private $configData; + /** + * @var FileStorageInterface + */ + private $fileStorage; + /** + * @var Session + */ + private $session; + + /** + * Config constructor. + * + * @param FileStorageInterface $fileStorage + * @throws \SP\Core\Exceptions\ConfigException + */ + public function __construct(FileStorageInterface $fileStorage) + { + $this->injectDependencies(); + + $this->fileStorage = $fileStorage; + + if (!self::$configLoaded) { + $this->configData = new ConfigData(); + + $this->loadConfigFile(); + + self::$configLoaded = true; + } + } + + /** + * Cargar el archivo de configuración + * + * @return ConfigData + * @throws \SP\Core\Exceptions\ConfigException + */ + public function loadConfigFile() + { + ConfigUtil::checkConfigDir(); + + try { + // Mapear el array de elementos de configuración con las propieades de la clase configData + $items = $this->fileStorage->load('config')->getItems(); + $Reflection = new ReflectionObject($this->configData); + + foreach ($Reflection->getProperties() as $property) { + $property->setAccessible(true); + + if (isset($items[$property->getName()])) { + $property->setValue($this->configData, $items[$property->getName()]); + } + + $property->setAccessible(false); + } + } catch (\Exception $e) { + debugLog($e->getMessage()); + + throw new ConfigException(ConfigException::SP_CRITICAL, $e->getMessage(), '', $e->getCode(), $e); + } + + return $this->configData; + } + + /** + * Obtener la configuración o devolver una nueva + * + * @return ConfigData + * @deprecated + */ + public static function getConfig() + { + } /** * Cargar la configuración desde el archivo @@ -50,31 +127,31 @@ class Config * @param bool $reload * @return ConfigData */ - public static function loadConfig($reload = false) + public function loadConfig($reload = false) { if ($reload === false && self::$configLoaded) { - return self::$Config; + return $this->configData; } - $ConfigData = Session::getConfig(); + $ConfigData = $this->session->getConfig(); if ($reload === true || !is_object($ConfigData) - || time() >= (Session::getConfigTime() + $ConfigData->getSessionTimeout() / 2) + || time() >= ($this->session->getConfigTime() + $ConfigData->getSessionTimeout() / 2) ) { - self::saveConfigInSession(); + $this->saveConfigInSession(); } - return self::$Config; + return $this->configData; } /** * Guardar la configuración en la sesión */ - private static function saveConfigInSession() + private function saveConfigInSession() { - Session::setConfig(self::$Config); - Session::setConfigTime(time()); + $this->session->setConfig($this->configData); + $this->session->setConfigTime(time()); } /** @@ -83,92 +160,52 @@ class Config * @param ConfigData $Config * @param bool $backup */ - public static function saveConfig(ConfigData $Config = null, $backup = true) + public function saveConfig(ConfigData $Config = null, $backup = true) { - $ConfigData = null === $Config ? self::getConfig() : $Config; + $ConfigData = null === $Config ? $this->configData : $Config; $ConfigData->setConfigDate(time()); - $ConfigData->setConfigSaver(Session::getUserData()->getUserLogin()); + $ConfigData->setConfigSaver($this->session->getUserData()->getUserLogin()); $ConfigData->setConfigHash(); - DiFactory::getConfigStorage()->setItems($ConfigData); - DiFactory::getConfigStorage()->save('config'); + $this->fileStorage->setItems($ConfigData); + $this->fileStorage->save('config'); if ($backup) { - self::backupToDB(); + $this->backupToDB(); } } - /** - * Obtener la configuración o devolver una nueva - * - * @return ConfigData - */ - public static function getConfig() - { - if (self::$configLoaded) { - return self::$Config; - } - - $ConfigData = Session::getConfig(); - - self::$Config = $ConfigData instanceof ConfigData ? $ConfigData : self::loadConfigFile(); - self::$configLoaded = true; - - self::saveConfigInSession(); - - return self::$Config; - } - - /** - * Cargar el archivo de configuración - * - * @return ConfigData - */ - private static function loadConfigFile() - { - self::$Config = new ConfigData(); - - if (!file_exists(XML_CONFIG_FILE)) { - return self::$Config; - } - - try { - // Mapear el array de elementos de configuración con las propieades de la clase ConfigData - $items = DiFactory::getConfigStorage()->load('config')->getItems(); - $Reflection = new ReflectionObject(self::$Config); - - foreach ($Reflection->getProperties() as $property) { - $property->setAccessible(true); - - if (isset($items[$property->getName()])) { - $property->setValue(self::$Config, $items[$property->getName()]); - } - - $property->setAccessible(false); - } - } catch (\Exception $e) { - debugLog($e->getMessage()); - } - - return self::$Config; - } - /** * Realizar un backup de la configuración en la BD */ - private static function backupToDB() + private function backupToDB() { - $config = json_encode(self::getConfig()); - ConfigDB::setValue('config_backup', $config, true, true); + ConfigDB::setValue('config_backup', json_encode($this->configData), true, true); ConfigDB::setValue('config_backupdate', time()); } + /** + * @return ConfigData + */ + public function getConfigData() + { + return $this->configData; + } + + /** + * @param Session $session + */ + public function inject(Session $session) + { + $this->session = $session; + } + /** * Restaurar la configuración desde la BD * * @return array */ - private static function restoreBackupFromDB() + private function restoreBackupFromDB() { $configBackup = ConfigDB::getValue('config_backup'); diff --git a/inc/SP/Config/ConfigDB.php b/lib/SP/Config/ConfigDB.php similarity index 96% rename from inc/SP/Config/ConfigDB.php rename to lib/SP/Config/ConfigDB.php index 98167509..bec6c3ab 100644 --- a/inc/SP/Config/ConfigDB.php +++ b/lib/SP/Config/ConfigDB.php @@ -27,7 +27,7 @@ namespace SP\Config; use SP\Core\Exceptions\SPException; use SP\Log\Email; use SP\Log\Log; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -61,7 +61,7 @@ class ConfigDB implements ConfigInterface $Data->setUseKeyPair(true); $Data->setQuery($query); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { return false; @@ -96,7 +96,7 @@ class ConfigDB implements ConfigInterface $Data->addParam($value, 'value'); try { - DB::getQuery($Data); + DbWrapper::getQuery($Data); } catch (SPException $e) { return false; } @@ -137,7 +137,7 @@ class ConfigDB implements ConfigInterface $Data->addParam($value, 'valuedup'); try { - DB::getQuery($Data); + DbWrapper::getQuery($Data); } catch (SPException $e) { return false; } @@ -202,7 +202,7 @@ class ConfigDB implements ConfigInterface $Data->setQuery($query); $Data->addParam($param, 'param'); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { return false; @@ -227,6 +227,6 @@ class ConfigDB implements ConfigInterface $Data->setQuery($query); $Data->addParam($param, 'param'); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } } \ No newline at end of file diff --git a/inc/SP/Config/ConfigData.php b/lib/SP/Config/ConfigData.php similarity index 99% rename from inc/SP/Config/ConfigData.php rename to lib/SP/Config/ConfigData.php index d6384b77..a3ee7890 100644 --- a/inc/SP/Config/ConfigData.php +++ b/lib/SP/Config/ConfigData.php @@ -27,7 +27,7 @@ namespace SP\Config; use JsonSerializable; /** - * Class ConfigData + * Class configData * * @package SP\Config */ diff --git a/inc/SP/Config/ConfigInterface.php b/lib/SP/Config/ConfigInterface.php similarity index 100% rename from inc/SP/Config/ConfigInterface.php rename to lib/SP/Config/ConfigInterface.php diff --git a/lib/SP/Config/ConfigUtil.php b/lib/SP/Config/ConfigUtil.php new file mode 100644 index 00000000..e93ea93d --- /dev/null +++ b/lib/SP/Config/ConfigUtil.php @@ -0,0 +1,87 @@ +. + */ + +namespace SP\Config; + +use SP\Core\Exceptions\ConfigException; +use SP\Util\Checks; + +/** + * Class ConfigUtil + * + * @package Config + */ +class ConfigUtil +{ + /** + * Adaptador para convertir una cadena de extensiones a un array + * + * @param $filesAllowedExts + * @return array + */ + public static function filesExtsAdapter(&$filesAllowedExts) + { + $exts = explode(',', $filesAllowedExts); + + array_walk($exts, function (&$value) { + if (preg_match('/[^a-z0-9_-]+/i', $value)) { + $value = null; + } + }); + + return $exts; + } + + /** + * Comprobar el archivo de configuración. + * Esta función comprueba que el archivo de configuración exista y los permisos sean correctos. + * + * @throws \SP\Core\Exceptions\ConfigException + */ + public static function checkConfigDir() + { + if (!is_dir(APP_ROOT . DIRECTORY_SEPARATOR . 'config')) { + clearstatcache(); + + throw new ConfigException(ConfigException::SP_CRITICAL, __('El directorio "/config" no existe', false)); + } + + if (!is_writable(APP_ROOT . DIRECTORY_SEPARATOR . 'config')) { + clearstatcache(); + + throw new ConfigException(ConfigException::SP_CRITICAL, __('No es posible escribir en el directorio "config"', false)); + } + + $configPerms = decoct(fileperms(APP_ROOT . DIRECTORY_SEPARATOR . 'config') & 0777); + + if ($configPerms !== '750' && !Checks::checkIsWindows()) { + clearstatcache(); + + throw new ConfigException( + ConfigException::SP_ERROR, + __('Los permisos del directorio "/config" son incorrectos', false), + __('Actual:', false) . ' ' . $configPerms . ' - ' . __('Necesario: 750', false)); + } + } +} \ No newline at end of file diff --git a/inc/SP/Controller/AccountController.php b/lib/SP/Controller/AccountController.php similarity index 90% rename from inc/SP/Controller/AccountController.php rename to lib/SP/Controller/AccountController.php index 4f6892b8..bc43981a 100644 --- a/inc/SP/Controller/AccountController.php +++ b/lib/SP/Controller/AccountController.php @@ -37,7 +37,7 @@ use SP\Core\ActionsInterface; use SP\Core\Crypt\Crypt; use SP\Core\Exceptions\SPException; use SP\Core\Init; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\SessionUtil; use SP\Core\Template; use SP\DataModel\AccountExtData; @@ -93,9 +93,9 @@ class AccountController extends ControllerBase implements ActionsInterface $this->setId($accountId); - $this->view->assign('changesHash', ''); - $this->view->assign('chkUserEdit', ''); - $this->view->assign('chkGroupEdit', ''); + $this->view->assign('changesHash'); + $this->view->assign('chkUserEdit'); + $this->view->assign('chkGroupEdit'); $this->view->assign('gotData', $this->isGotData()); $this->view->assign('isView', false); $this->view->assign('sk', SessionUtil::getSessionKey(true)); @@ -141,13 +141,13 @@ class AccountController extends ControllerBase implements ActionsInterface $Account->incrementViewCounter($PublicLinkData->getItemId()); $Account->incrementDecryptCounter($PublicLinkData->getItemId()); - $key = Config::getConfig()->getPasswordSalt() . $PublicLinkData->getLinkHash(); + $key = $this->configData->getPasswordSalt() . $PublicLinkData->getLinkHash(); $securedKey = Crypt::unlockSecuredKey($PublicLinkData->getPassIV(), $key); /** @var AccountExtData $AccountData */ $AccountData = unserialize(Crypt::decrypt($PublicLinkData->getData(), $securedKey, $key)); - $this->view->assign('useImage', Config::getConfig()->isPublinksImageEnabled() || Config::getConfig()->isAccountPassToImage()); + $this->view->assign('useImage', $this->configData->isPublinksImageEnabled() || $this->configData->isAccountPassToImage()); $accountPass = $this->view->useImage ? ImageUtil::convertText($AccountData->getAccountPass()) : $AccountData->getAccountPass(); @@ -169,35 +169,35 @@ class AccountController extends ControllerBase implements ActionsInterface switch ($type) { case ActionsInterface::ACTION_ACC_NEW: $this->getNewAccount(); - $this->EventDispatcher->notifyEvent('show.account.new', $this); + $this->eventDispatcher->notifyEvent('show.account.new', $this); break; case ActionsInterface::ACTION_ACC_COPY: $this->getCopyAccount(); - $this->EventDispatcher->notifyEvent('show.account.copy', $this); + $this->eventDispatcher->notifyEvent('show.account.copy', $this); break; case ActionsInterface::ACTION_ACC_EDIT: $this->getEditAccount(); - $this->EventDispatcher->notifyEvent('show.account.edit', $this); + $this->eventDispatcher->notifyEvent('show.account.edit', $this); break; case ActionsInterface::ACTION_ACC_EDIT_PASS: $this->getEditPassAccount(); - $this->EventDispatcher->notifyEvent('show.account.editpass', $this); + $this->eventDispatcher->notifyEvent('show.account.editpass', $this); break; case ActionsInterface::ACTION_ACC_VIEW: $this->getViewAccount(); - $this->EventDispatcher->notifyEvent('show.account.view', $this); + $this->eventDispatcher->notifyEvent('show.account.view', $this); break; case ActionsInterface::ACTION_ACC_VIEW_HISTORY: $this->getViewHistoryAccount(); - $this->EventDispatcher->notifyEvent('show.account.viewhistory', $this); + $this->eventDispatcher->notifyEvent('show.account.viewhistory', $this); break; case ActionsInterface::ACTION_ACC_DELETE: $this->getDeleteAccount(); - $this->EventDispatcher->notifyEvent('show.account.delete', $this); + $this->eventDispatcher->notifyEvent('show.account.delete', $this); break; case ActionsInterface::ACTION_ACC_REQUEST: $this->getRequestAccountAccess(); - $this->EventDispatcher->notifyEvent('show.account.request', $this); + $this->eventDispatcher->notifyEvent('show.account.request', $this); break; } } catch (SPException $e) { @@ -227,7 +227,7 @@ class AccountController extends ControllerBase implements ActionsInterface ] ); - Session::setLastAcountId(0); + SessionFactory::setLastAcountId(0); $this->setCommonData(); } @@ -244,19 +244,25 @@ class AccountController extends ControllerBase implements ActionsInterface $Acl = new AccountAcl($this->Account, $this->getAction()); $this->AccountAcl = $Acl; - if (!Acl::checkUserAccess($this->getAction())) { + if (!$this->acl->checkUserAccess($this->getAction())) { $this->showError(self::ERR_PAGE_NO_PERMISSION); return false; - } elseif (!UserPass::checkUserUpdateMPass($this->UserData->getUserId())) { + } + + if (!UserPass::checkUserUpdateMPass($this->userData->getUserId())) { $this->showError(self::ERR_UPDATE_MPASS); return false; - } elseif ($this->id > 0) { + } + + if ($this->id > 0) { $this->AccountAcl = $Acl->getAcl(); if (!$this->AccountAcl->checkAccountAccess()) { $this->showError(self::ERR_ACCOUNT_NO_PERMISSION); return false; } + + SessionFactory::setAccountAcl($this->AccountAcl); } return true; @@ -278,12 +284,12 @@ class AccountController extends ControllerBase implements ActionsInterface $this->view->assign('accountTagsJson', Json::getJson(array_keys($this->getAccount()->getAccountData()->getTags()))); $this->view->assign('historyData', AccountHistory::getAccountList($this->AccountData->getAccountId())); $this->view->assign('isModified', strtotime($this->AccountData->getAccountDateEdit()) !== false); - $this->view->assign('maxFileSize', round(Config::getConfig()->getFilesAllowedSize() / 1024, 1)); - $this->view->assign('filesAllowedExts', implode(',', Config::getConfig()->getFilesAllowedExts())); + $this->view->assign('maxFileSize', round($this->configData->getFilesAllowedSize() / 1024, 1)); + $this->view->assign('filesAllowedExts', implode(',', $this->configData->getFilesAllowedExts())); $PublicLinkData = PublicLink::getItem()->getHashForItem($this->getId()); - $publicLinkUrl = (Checks::publicLinksIsEnabled() && $PublicLinkData ? Init::$WEBURI . '/index.php?h=' . $PublicLinkData->getPublicLinkHash() . '&a=link' : null); + $publicLinkUrl = ($this->configData->isPublinksEnabled() && $PublicLinkData ? Init::$WEBURI . '/index.php?h=' . $PublicLinkData->getPublicLinkHash() . '&a=link' : null); $this->view->assign('publicLinkUrl', $publicLinkUrl); $this->view->assign('publicLinkId', $PublicLinkData ? $PublicLinkData->getPublicLinkId() : 0); @@ -301,8 +307,10 @@ class AccountController extends ControllerBase implements ActionsInterface $this->view->assign('otherGroups', Group::getItem()->getItemsForSelect()); $this->view->assign('otherGroupsJson', Json::getJson($this->view->otherGroups)); $this->view->assign('tagsJson', Json::getJson(Tag::getItem()->getItemsForSelect())); - $this->view->assign('allowPrivate', $this->UserProfileData->isAccPrivate()); - $this->view->assign('allowPrivateGroup', $this->UserProfileData->isAccPrivateGroup()); + $this->view->assign('allowPrivate', $this->userProfileData->isAccPrivate()); + $this->view->assign('allowPrivateGroup', $this->userProfileData->isAccPrivateGroup()); + $this->view->assign('mailRequestEnabled', $this->configData->isMailRequestsEnabled()); + $this->view->assign('passToImageEnabled', $this->configData->isAccountPassToImage()); $this->view->assign('otherAccounts', AccountUtil::getAccountsForUser($this->getId())); $this->view->assign('linkedAccounts', AccountUtil::getLinkedAccounts($this->getId())); diff --git a/inc/SP/Controller/AccountSearchController.php b/lib/SP/Controller/AccountSearchController.php similarity index 93% rename from inc/SP/Controller/AccountSearchController.php rename to lib/SP/Controller/AccountSearchController.php index f2eb7900..56a74006 100644 --- a/inc/SP/Controller/AccountSearchController.php +++ b/lib/SP/Controller/AccountSearchController.php @@ -28,10 +28,9 @@ defined('APP_ROOT') || die(); use SP\Account\AccountSearch; use SP\Account\AccountsSearchItem; -use SP\Config\Config; use SP\Core\ActionsInterface; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\SessionUtil; use SP\Core\Template; use SP\Html\DataGrid\DataGrid; @@ -46,7 +45,6 @@ use SP\Http\Request; use SP\Mgmt\Categories\Category; use SP\Mgmt\Customers\Customer; use SP\Mgmt\Tags\Tag; -use SP\Util\Checks; /** * Clase encargada de obtener los datos para presentar la búsqueda @@ -62,7 +60,7 @@ class AccountSearchController extends ControllerBase implements ActionsInterface */ private $filterOn = false; /** @var string */ - private $sk = ''; + private $sk; /** @var int */ private $sortKey = 0; /** @var string */ @@ -98,11 +96,11 @@ class AccountSearchController extends ControllerBase implements ActionsInterface */ private function setVars() { - $this->view->assign('isAdmin', $this->UserData->isUserIsAdminApp() || $this->UserData->isUserIsAdminAcc()); - $this->view->assign('showGlobalSearch', Config::getConfig()->isGlobalSearch() && $this->UserProfileData->isAccGlobalSearch()); + $this->view->assign('isAdmin', $this->userData->isUserIsAdminApp() || $this->userData->isUserIsAdminAcc()); + $this->view->assign('showGlobalSearch', $this->configData->isGlobalSearch() && $this->userProfileData->isAccGlobalSearch()); // Obtener el filtro de búsqueda desde la sesión - $filters = Session::getSearchFilters(); + $filters = SessionFactory::getSearchFilters(); // Comprobar si la búsqueda es realizada desde el formulario // de lo contrario, se recupera la información de filtros de la sesión @@ -174,22 +172,22 @@ class AccountSearchController extends ControllerBase implements ActionsInterface || $this->view->searchFavorites || $Search->isSortViews()); - $UserPreferences = Session::getUserPreferences(); + $UserPreferences = SessionFactory::getUserPreferences(); AccountsSearchItem::$accountLink = $UserPreferences->isAccountLink(); AccountsSearchItem::$topNavbar = $UserPreferences->isTopNavbar(); AccountsSearchItem::$optionalActions = $UserPreferences->isOptionalActions(); - AccountsSearchItem::$wikiEnabled = Checks::wikiIsEnabled(); - AccountsSearchItem::$dokuWikiEnabled = Checks::dokuWikiIsEnabled(); - AccountsSearchItem::$isDemoMode = Checks::demoIsEnabled(); + AccountsSearchItem::$wikiEnabled = $this->configData->isWikiEnabled(); + AccountsSearchItem::$dokuWikiEnabled = $this->configData->isDokuwikiEnabled(); + AccountsSearchItem::$isDemoMode = $this->configData->isDemoEnabled(); if (AccountsSearchItem::$wikiEnabled) { $wikiFilter = array_map(function ($value) { return preg_quote($value, '/'); - }, Config::getConfig()->getWikiFilter()); + }, $this->configData->getWikiFilter()); $this->view->assign('wikiFilter', implode('|', $wikiFilter)); - $this->view->assign('wikiPageUrl', Config::getConfig()->getWikiPageurl()); + $this->view->assign('wikiPageUrl', $this->configData->getWikiPageurl()); } $Grid = $this->getGrid(); @@ -197,6 +195,10 @@ class AccountSearchController extends ControllerBase implements ActionsInterface $Grid->updatePager(); $Grid->setTime(round(microtime() - $this->queryTimeStart, 5)); + + // Establecer el filtro de búsqueda en la sesión como un objeto + SessionFactory::setSearchFilters($Search->save()); + $this->view->assign('data', $Grid); } @@ -310,9 +312,9 @@ class AccountSearchController extends ControllerBase implements ActionsInterface $GridPager->setFilterOn($this->filterOn); $GridPager->setSourceAction(new DataGridActionSearch(self::ACTION_ACC_SEARCH)); - $UserPreferences = Session::getUserPreferences(); + $UserPreferences = SessionFactory::getUserPreferences(); - $showOptionalActions = $UserPreferences->isOptionalActions() || $UserPreferences->isResultsAsCards() || ($UserPreferences->getUserId() === 0 && Checks::resultsCardsIsEnabled()); + $showOptionalActions = $UserPreferences->isOptionalActions() || $UserPreferences->isResultsAsCards() || ($UserPreferences->getUserId() === 0 && $this->configData->isResultsAsCards()); $Grid = new DataGrid(); $Grid->setId('gridSearch'); @@ -397,7 +399,7 @@ class AccountSearchController extends ControllerBase implements ActionsInterface $this->getSearchBox(); $this->getSearch(); - $this->EventDispatcher->notifyEvent('show.account.search', $this); + $this->eventDispatcher->notifyEvent('show.account.search', $this); } catch (SPException $e) { $this->showError(self::ERR_EXCEPTION); } diff --git a/inc/SP/Controller/ChecksController.php b/lib/SP/Controller/ChecksController.php similarity index 100% rename from inc/SP/Controller/ChecksController.php rename to lib/SP/Controller/ChecksController.php diff --git a/inc/SP/Controller/ConfigActionController.php b/lib/SP/Controller/ConfigActionController.php similarity index 96% rename from inc/SP/Controller/ConfigActionController.php rename to lib/SP/Controller/ConfigActionController.php index 400cc0a4..5b599a8f 100644 --- a/inc/SP/Controller/ConfigActionController.php +++ b/lib/SP/Controller/ConfigActionController.php @@ -38,8 +38,9 @@ use SP\Core\Exceptions\SPException; use SP\Core\Init; use SP\Core\Messages\LogMessage; use SP\Core\Messages\NoticeMessage; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\TaskFactory; +use SP\Core\Traits\InjectableTrait; use SP\Core\XmlExport; use SP\Http\Request; use SP\Import\Import; @@ -49,7 +50,7 @@ use SP\Log\Log; use SP\Mgmt\CustomFields\CustomFieldsUtil; use SP\Mgmt\Users\UserPass; use SP\Mgmt\Users\UserUtil; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Util\Checks; use SP\Util\Json; use SP\Util\Util; @@ -62,20 +63,15 @@ use SP\Util\Util; class ConfigActionController implements ItemControllerInterface { use RequestControllerTrait; - - /** - * @var ConfigData - */ - private $ConfigData; + use InjectableTrait; /** * ConfigActionController constructor. */ public function __construct() { + $this->injectDependencies(); $this->init(); - - $this->ConfigData = Config::getConfig(); } /** @@ -256,14 +252,14 @@ class ConfigActionController implements ItemControllerInterface protected function saveConfig() { try { - if (Checks::demoIsEnabled()) { + if ($this->ConfigData->isDemoEnabled()) { $this->JsonResponse->setDescription(__('Ey, esto es una DEMO!!', false)); return; } - Config::saveConfig($this->ConfigData); + $this->Config->saveConfig($this->ConfigData); - if (Config::getConfig()->isMaintenance()) { + if ($this->ConfigData->isMaintenance()) { Util::lockApp(false); } elseif (Init::$LOCK > 0) { Util::unlockApp(false); @@ -516,7 +512,7 @@ class ConfigActionController implements ItemControllerInterface $confirmPassChange = Request::analyze('confirmPassChange', 0, false, 1); $noAccountPassChange = Request::analyze('chkNoAccountChange', 0, false, 1); - if (!UserPass::checkUserUpdateMPass(Session::getUserData()->getUserId())) { + if (!UserPass::checkUserUpdateMPass(SessionFactory::getUserData()->getUserId())) { $this->JsonResponse->setDescription(__('Clave maestra actualizada', false)); $this->JsonResponse->addMessage(__('Reinicie la sesión para cambiarla', false)); $this->JsonResponse->setStatus(100); @@ -548,7 +544,7 @@ class ConfigActionController implements ItemControllerInterface return; } - if (Checks::demoIsEnabled()) { + if ($this->ConfigData->isDemoEnabled()) { $this->JsonResponse->setDescription(__('Ey, esto es una DEMO!!', false)); return; } @@ -556,7 +552,7 @@ class ConfigActionController implements ItemControllerInterface if (!$noAccountPassChange) { Util::lockApp(); - if (!DB::beginTransaction()) { + if (!DbWrapper::beginTransaction()) { $this->JsonResponse->setDescription(__('No es posible iniciar una transacción', false)); return; } @@ -566,7 +562,7 @@ class ConfigActionController implements ItemControllerInterface $Account = new AccountCrypt(); if (!$Account->updatePass($currentMasterPass, $newMasterPass)) { - DB::rollbackTransaction(); + DbWrapper::rollbackTransaction(); TaskFactory::endTask(); @@ -577,7 +573,7 @@ class ConfigActionController implements ItemControllerInterface $AccountHistory = new AccountHistoryCrypt(); if (!$AccountHistory->updatePass($currentMasterPass, $newMasterPass)) { - DB::rollbackTransaction(); + DbWrapper::rollbackTransaction(); TaskFactory::endTask(); @@ -586,7 +582,7 @@ class ConfigActionController implements ItemControllerInterface } if (!CustomFieldsUtil::updateCustomFieldsCrypt($currentMasterPass, $newMasterPass)) { - DB::rollbackTransaction(); + DbWrapper::rollbackTransaction(); TaskFactory::endTask(); @@ -594,7 +590,7 @@ class ConfigActionController implements ItemControllerInterface return; } - if (!DB::endTransaction()) { + if (!DbWrapper::endTransaction()) { TaskFactory::endTask(); $this->JsonResponse->setDescription(__('No es posible finalizar una transacción', false)); @@ -632,7 +628,7 @@ class ConfigActionController implements ItemControllerInterface */ protected function masterPassRefreshAction() { - if (Checks::demoIsEnabled()) { + if ($this->ConfigData->isDemoEnabled()) { $this->JsonResponse->setDescription(__('Ey, esto es una DEMO!!', false)); return; } @@ -702,14 +698,14 @@ class ConfigActionController implements ItemControllerInterface */ protected function importAction() { - if (Checks::demoIsEnabled()) { + if ($this->ConfigData->isDemoEnabled()) { $this->JsonResponse->setDescription(__('Ey, esto es una DEMO!!', false)); return; } $ImportParams = new ImportParams(); - $ImportParams->setDefaultUser(Request::analyze('import_defaultuser', Session::getUserData()->getUserId())); - $ImportParams->setDefaultGroup(Request::analyze('import_defaultgroup', Session::getUserData()->getUserGroupId())); + $ImportParams->setDefaultUser(Request::analyze('import_defaultuser', SessionFactory::getUserData()->getUserId())); + $ImportParams->setDefaultGroup(Request::analyze('import_defaultgroup', SessionFactory::getUserData()->getUserGroupId())); $ImportParams->setImportPwd(Request::analyzeEncrypted('importPwd')); $ImportParams->setImportMasterPwd(Request::analyzeEncrypted('importMasterPwd')); $ImportParams->setCsvDelimiter(Request::analyze('csvDelimiter')); @@ -752,12 +748,14 @@ class ConfigActionController implements ItemControllerInterface */ protected function backupAction() { - if (Checks::demoIsEnabled()) { + if ($this->ConfigData->isDemoEnabled()) { $this->JsonResponse->setDescription(__('Ey, esto es una DEMO!!', false)); return; } - if (!Backup::doBackup()) { + $Backup = new Backup(); + + if (!$Backup->doBackup()) { $this->JsonResponse->setDescription(__('Error al realizar el backup', false)); $this->JsonResponse->addMessage(__('Revise el registro de eventos para más detalles', false)); return; diff --git a/inc/SP/Controller/ConfigController.php b/lib/SP/Controller/ConfigController.php similarity index 91% rename from inc/SP/Controller/ConfigController.php rename to lib/SP/Controller/ConfigController.php index 7326ed99..c44c8f5c 100644 --- a/inc/SP/Controller/ConfigController.php +++ b/lib/SP/Controller/ConfigController.php @@ -37,7 +37,7 @@ use SP\Core\DiFactory; use SP\Core\Init; use SP\Core\Language; use SP\Core\Plugin\PluginUtil; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\SessionUtil; use SP\Core\Task; use SP\Core\Template; @@ -59,10 +59,6 @@ class ConfigController extends ControllerBase implements ActionsInterface * @var int */ private $tabIndex = 0; - /** - * @var ConfigData - */ - private $Config; /** * @var array */ @@ -77,14 +73,13 @@ class ConfigController extends ControllerBase implements ActionsInterface { parent::__construct($template); - $this->Config = Config::getConfig(); $this->configDB = ConfigDB::readConfig(); $this->view->assign('tabs', []); $this->view->assign('sk', SessionUtil::getSessionKey(true)); - $this->view->assign('isDemoMode', Checks::demoIsEnabled() && !$this->UserData->isUserIsAdminApp()); - $this->view->assign('isDisabled', (Checks::demoIsEnabled() && !$this->UserData->isUserIsAdminApp()) ? 'disabled' : ''); - $this->view->assign('Config', $this->Config); + $this->view->assign('isDemoMode', $this->configData->isDemoEnabled() && !$this->userData->isUserIsAdminApp()); + $this->view->assign('isDisabled', ($this->configData->isDemoEnabled() && !$this->userData->isUserIsAdminApp()) ? 'disabled' : ''); + $this->view->assign('ConfigData', $this->configData); } /** @@ -106,7 +101,7 @@ class ConfigController extends ControllerBase implements ActionsInterface $this->getImportTab(); $this->getInfoTab(); - $this->EventDispatcher->notifyEvent('show.config', $this); + $this->eventDispatcher->notifyEvent('show.config', $this); $this->view->addTemplate('tabs-end', 'common'); } @@ -127,7 +122,7 @@ class ConfigController extends ControllerBase implements ActionsInterface $this->view->addTemplate('general'); $this->view->assign('langsAvailable', Language::getAvailableLanguages()); - $this->view->assign('themesAvailable', DiFactory::getTheme()->getThemesAvailable()); + $this->view->assign('themesAvailable', $this->theme->getThemesAvailable()); $this->view->assign('actionId', $this->getAction(), 'config'); $this->view->append('tabs', ['title' => __('General')]); @@ -253,7 +248,7 @@ class ConfigController extends ControllerBase implements ActionsInterface $this->view->assign('tempMasterPassTime', isset($this->configDB['tempmaster_passtime']) ? $this->configDB['tempmaster_passtime'] : 0); $this->view->assign('tempMasterMaxTime', isset($this->configDB['tempmaster_maxtime']) ? $this->configDB['tempmaster_maxtime'] : 0); $this->view->assign('tempMasterAttempts', isset($this->configDB['tempmaster_attempts']) ? sprintf('%d/%d', $this->configDB['tempmaster_attempts'], CryptMasterPass::MAX_ATTEMPTS) : 0); - $this->view->assign('tempMasterPass', Session::getTemporaryMasterPass()); + $this->view->assign('tempMasterPass', SessionFactory::getTemporaryMasterPass()); $this->view->assign('groups', Group::getItem()->getItemsForSelect()); $this->view->append('tabs', ['title' => __('Encriptación')]); @@ -278,10 +273,10 @@ class ConfigController extends ControllerBase implements ActionsInterface $this->view->assign('siteName', Util::getAppInfo('appname')); $this->view->assign('backupDir', Init::$SERVERROOT . '/backup'); $this->view->assign('backupPath', Init::$WEBROOT . '/backup'); - $this->view->assign('isAdminApp', $this->UserData->isUserIsAdminApp()); + $this->view->assign('isAdminApp', $this->userData->isUserIsAdminApp()); - $backupHash = $this->Config->getBackupHash(); - $exportHash = $this->Config->getExportHash(); + $backupHash = $this->configData->getBackupHash(); + $exportHash = $this->configData->getExportHash(); $backupFile = $this->view->siteName . '-' . $backupHash . '.tar.gz'; @@ -356,10 +351,10 @@ class ConfigController extends ControllerBase implements ActionsInterface $this->view->addTemplate('info'); $this->view->assign('dbInfo', DBUtil::getDBinfo()); - $this->view->assign('dbName', $this->Config->getDbName() . '@' . $this->Config->getDbHost()); + $this->view->assign('dbName', $this->configData->getDbName() . '@' . $this->configData->getDbHost()); $this->view->assign('configBackupDate', date('r', $this->configDB['config_backupdate'])); $this->view->assign('plugins', PluginUtil::getLoadedPlugins()); - $this->view->assign('locale', Language::$localeStatus ?: sprintf('%s (%s)', Config::getConfig()->getSiteLang(), __('No instalado'))); + $this->view->assign('locale', Language::$localeStatus ?: sprintf('%s (%s)', $this->configData->getSiteLang(), __('No instalado'))); $this->view->assign('securedSession', CryptSessionHandler::$isSecured); $this->view->append('tabs', ['title' => __('Información')]); diff --git a/inc/SP/Controller/ControllerBase.php b/lib/SP/Controller/ControllerBase.php similarity index 60% rename from inc/SP/Controller/ControllerBase.php rename to lib/SP/Controller/ControllerBase.php index 58906c00..446587cc 100644 --- a/inc/SP/Controller/ControllerBase.php +++ b/lib/SP/Controller/ControllerBase.php @@ -26,17 +26,25 @@ namespace SP\Controller; defined('APP_ROOT') || die(); +use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Acl; -use SP\Core\DiFactory; -use SP\Core\Events\EventDispatcherInterface; +use SP\Core\Events\EventDispatcher; use SP\Core\Exceptions\FileNotFoundException; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\Session\Session; use SP\Core\Template; +use SP\Core\Traits\InjectableTrait; +use SP\Core\UI\Theme; use SP\Core\UI\ThemeIconsBase; use SP\DataModel\ProfileData; use SP\DataModel\UserData; use SP\Http\JsonResponse; +use SP\Http\Request; +use SP\Storage\Database; +use SP\Util\Checks; +use SP\Util\Json; +use SP\Util\Util; /** * Clase base para los controladores @@ -53,50 +61,39 @@ abstract class ControllerBase const ERR_OPERATION_NO_PERMISSION = 4; const ERR_EXCEPTION = 5; - /** - * Instancia del motor de plantillas a utilizar - * - * @var Template - */ - public $view; - /** - * Módulo a usar - * - * @var int - */ + + /** @var Template Instancia del motor de plantillas a utilizar */ + protected $view; + /** @var int Módulo a usar */ protected $action; - /** - * Instancia de los iconos del tema visual - * - * @var ThemeIconsBase - */ + /** @var ThemeIconsBase Instancia de los iconos del tema visual */ protected $icons; - /** - * Nombre del controlador - * - * @var string - */ + /** @var string Nombre del controlador */ protected $controllerName; - /** - * @var JsonResponse - */ - protected $Json; - /** - * @var UserData - */ - protected $UserData; - /** - * @var ProfileData - */ - protected $UserProfileData; - /** - * @var EventDispatcherInterface - */ - protected $EventDispatcher; - /** - * @var bool - */ + /** @var JsonResponse */ + protected $jsonResponse; + /** @var UserData */ + protected $userData; + /** @var ProfileData */ + protected $userProfileData; + /** @var EventDispatcher */ + protected $eventDispatcher; + /** @var bool */ protected $loggedIn = false; + /** @var ConfigData */ + protected $configData; + /** @var Config */ + protected $config; + /** @var Session */ + protected $session; + /** @var Database */ + protected $db; + /** @var Theme */ + protected $theme; + /** @var Acl */ + protected $acl; + + use InjectableTrait; /** * Constructor @@ -105,16 +102,21 @@ abstract class ControllerBase */ public function __construct(Template $template = null) { - $class = get_called_class(); + $this->injectDependencies(); + + $class = static::class; $this->controllerName = substr($class, strrpos($class, '\\') + 1, -strlen('Controller')); $this->view = null === $template ? $this->getTemplate() : $template; $this->view->setBase(strtolower($this->controllerName)); - $this->icons = DiFactory::getTheme()->getIcons(); - $this->EventDispatcher = DiFactory::getEventDispatcher(); + $this->icons = $this->theme->getIcons(); $this->setViewVars(); + + if (method_exists($this, 'initialize')) { + $this->initialize(); + } } /** @@ -122,20 +124,54 @@ abstract class ControllerBase * * @param null $template string con el nombre de la plantilla * @return Template + * @throws \Psr\Container\ContainerExceptionInterface */ protected function getTemplate($template = null) { return new Template($template); } + /** + * Set view variables + */ private function setViewVars() { - $this->UserData = Session::getUserData(); - $this->UserProfileData = Session::getUserProfile(); + $this->userData = $this->session->getUserData(); + $this->userProfileData = $this->session->getUserProfile(); $this->view->assign('timeStart', $_SERVER['REQUEST_TIME_FLOAT']); $this->view->assign('icons', $this->icons); - $this->view->assign('SessionUserData', $this->UserData); + $this->view->assign('SessionUserData', $this->userData); + + $this->view->assign('actionId', Request::analyze('actionId', 0)); + $this->view->assign('id', Request::analyze('itemId', 0)); + $this->view->assign('activeTabId', Request::analyze('itemId', 0)); + $this->view->assign('queryTimeStart', microtime()); + $this->view->assign('userId', $this->userData->getUserId()); + $this->view->assign('userGroupId', $this->userData->getUserGroupId()); + $this->view->assign('userIsAdminApp', $this->userData->isUserIsAdminApp()); + $this->view->assign('userIsAdminAcc', $this->userData->isUserIsAdminAcc()); + $this->view->assign('themeUri', $this->view->getTheme()->getThemeUri()); + $this->view->assign('isDemo', $this->configData->isDemoEnabled()); + } + + /** + * @param Config $config + * @param Session $session + * @param Database $db + * @param Theme $theme + * @param EventDispatcher $ev + * @param Acl $acl + */ + public function inject(Config $config, Session $session, Database $db, Theme $theme, EventDispatcher $ev, Acl $acl) + { + $this->config = $config; + $this->configData = $config->getConfigData(); + $this->session = $session; + $this->db = $db; + $this->theme = $theme; + $this->eventDispatcher = $ev; + $this->acl = $acl; } /** @@ -165,7 +201,11 @@ abstract class ControllerBase echo $this->view->render(); } catch (FileNotFoundException $e) { debugLog($e->getMessage(), true); + + echo $e->getMessage(); } + + die(); } /** @@ -177,6 +217,8 @@ abstract class ControllerBase return $this->view->render(); } catch (FileNotFoundException $e) { debugLog($e->getMessage(), true); + + echo $e->getMessage(); } } @@ -194,71 +236,6 @@ abstract class ControllerBase $this->view->assign('memEnd', memory_get_usage() / 1000); } - /** - * @return JsonResponse - */ - public function getJson() - { - return $this->Json; - } - - /** - * @param JsonResponse $Json - */ - public function setJson(JsonResponse $Json) - { - $this->Json = $Json; - } - - /** - * @return UserData - */ - public function getUserData() - { - return $this->UserData; - } - - /** - * @return ProfileData - */ - public function getUserProfileData() - { - return $this->UserProfileData; - } - - /** - * @return ThemeIconsBase - */ - public function getIcons() - { - return $this->icons; - } - - /** - * @return string - */ - public function getControllerName() - { - return $this->controllerName; - } - - /** - * @return bool - */ - public function isLoggedIn() - { - return $this->loggedIn; - } - - /** - * @param bool $loggedIn - */ - public function setLoggedIn($loggedIn) - { - $this->loggedIn = (bool)$loggedIn; - $this->view->assign('loggedIn', $this->loggedIn); - } - /** * Establecer la plantilla de error con el código indicado. * @@ -266,7 +243,7 @@ abstract class ControllerBase * @param bool $reset * @param bool $fancy */ - public function showError($type, $reset = true, $fancy = false) + public function showError($type, $reset = true) { $errorsTypes = [ self::ERR_UNAVAILABLE => ['txt' => __('Opción no disponible'), 'hint' => __('Consulte con el administrador')], @@ -281,18 +258,14 @@ abstract class ControllerBase $this->view->resetTemplates(); } - if ($fancy) { - $this->view->addTemplate('errorfancy'); - } else { - $this->view->addTemplate('error', 'main'); - } + $this->view->addPartial('error'); $this->view->append('errors', [ 'type' => SPException::SP_WARNING, 'description' => $errorsTypes[$type]['txt'], - 'hint' => $errorsTypes[$type]['hint']] - ); + 'hint' => $errorsTypes[$type]['hint'] + ]); } /** @@ -300,7 +273,37 @@ abstract class ControllerBase * * @param mixed $type Tipo de acción */ - public abstract function doAction($type = null); + public function doAction($type = null) + { + + } + + /** + * Comprobar si el usuario está logado. + */ + public function checkLoggedIn() + { + if (!$this->session->isLoggedIn()) { + if (Checks::isJson()) { + $jsonResponse = new JsonResponse(); + $jsonResponse->setDescription(__('La sesión no se ha iniciado o ha caducado', false)); + $jsonResponse->setStatus(10); + + Json::returnJson($jsonResponse); + } else { + Util::logout(); + } + } + } + + /** + * @param bool $loggedIn + */ + protected function setLoggedIn($loggedIn) + { + $this->loggedIn = (bool)$loggedIn; + $this->view->assign('loggedIn', $this->loggedIn); + } /** * Establecer la instancia del motor de plantillas a utilizar. @@ -326,6 +329,6 @@ abstract class ControllerBase $checkAction = $action; } - return Session::getUserData()->isUserIsAdminApp() || Acl::checkUserAccess($checkAction); + return $this->session->getUserData()->isUserIsAdminApp() || $this->acl->checkUserAccess($checkAction); } } \ No newline at end of file diff --git a/inc/SP/Controller/EventlogController.php b/lib/SP/Controller/EventlogController.php similarity index 96% rename from inc/SP/Controller/EventlogController.php rename to lib/SP/Controller/EventlogController.php index 587279f4..51a313ee 100644 --- a/inc/SP/Controller/EventlogController.php +++ b/lib/SP/Controller/EventlogController.php @@ -77,7 +77,7 @@ class EventlogController extends ControllerBase implements ActionsInterface $this->checkClear(); $this->getEventlog(); - $this->EventDispatcher->notifyEvent('show.eventlog', $this); + $this->eventDispatcher->notifyEvent('show.eventlog', $this); } /** @@ -125,7 +125,7 @@ class EventlogController extends ControllerBase implements ActionsInterface $GridActionSearch->setOnSubmitFunction('eventlog/search'); $this->view->assign('rowClass', 'row_even'); - $this->view->assign('isDemoMode', Checks::demoIsEnabled() || !$this->UserData->isUserIsAdminApp()); + $this->view->assign('isDemoMode', $this->configData->isDemoEnabled() || !$this->userData->isUserIsAdminApp()); $this->view->assign('limitStart', $this->limitStart); $this->view->assign('events', Log::getEvents($this->limitStart, self::MAX_ROWS)); diff --git a/inc/SP/Controller/GridItemsSearchController.php b/lib/SP/Controller/GridItemsSearchController.php similarity index 100% rename from inc/SP/Controller/GridItemsSearchController.php rename to lib/SP/Controller/GridItemsSearchController.php diff --git a/inc/SP/Controller/GridTabControllerBase.php b/lib/SP/Controller/GridTabControllerBase.php similarity index 96% rename from inc/SP/Controller/GridTabControllerBase.php rename to lib/SP/Controller/GridTabControllerBase.php index d734c421..35615ab4 100644 --- a/inc/SP/Controller/GridTabControllerBase.php +++ b/lib/SP/Controller/GridTabControllerBase.php @@ -56,7 +56,7 @@ abstract class GridTabControllerBase extends ControllerBase { parent::__construct($template); - $this->view->assign('isDemo', Checks::demoIsEnabled()); + $this->view->assign('isDemo', $this->configData->isDemoEnabled()); $this->view->assign('sk', SessionUtil::getSessionKey(true)); } diff --git a/inc/SP/Controller/Grids/GridBase.php b/lib/SP/Controller/Grids/GridBase.php similarity index 80% rename from inc/SP/Controller/Grids/GridBase.php rename to lib/SP/Controller/Grids/GridBase.php index ba3ab923..6d822a20 100644 --- a/inc/SP/Controller/Grids/GridBase.php +++ b/lib/SP/Controller/Grids/GridBase.php @@ -25,9 +25,12 @@ namespace SP\Controller\Grids; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\ActionsInterface; use SP\Core\DiFactory; use SP\Core\SessionUtil; +use SP\Core\Traits\InjectableTrait; +use SP\Core\UI\Theme; use SP\Core\UI\ThemeIconsBase; use SP\Html\DataGrid\DataGridActionSearch; use SP\Html\DataGrid\DataGridPager; @@ -39,6 +42,8 @@ use SP\Html\DataGrid\DataGridPager; */ abstract class GridBase implements ActionsInterface { + use InjectableTrait; + /** * @var ThemeIconsBase */ @@ -55,14 +60,34 @@ abstract class GridBase implements ActionsInterface * @var bool */ protected $filter = false; + /** + * @var ConfigData + */ + protected $ConfigData; + /** + * @var Theme + */ + protected $Theme; /** * Grids constructor. */ public function __construct() { + $this->injectDependencies(); + $this->sk = SessionUtil::getSessionKey(); - $this->icons = DiFactory::getTheme()->getIcons(); + $this->icons = $this->Theme->getIcons(); + } + + /** + * @param ConfigData $configData + * @param Theme $theme + */ + public function inject(ConfigData $configData, Theme $theme) + { + $this->ConfigData = $configData; + $this->Theme = $theme; } /** @@ -77,7 +102,7 @@ abstract class GridBase implements ActionsInterface $GridPager->setSourceAction($sourceAction); $GridPager->setOnClickFunction('appMgmt/nav'); $GridPager->setLimitStart(0); - $GridPager->setLimitCount(Config::getConfig()->getAccountCount()); + $GridPager->setLimitCount($this->ConfigData->getAccountCount()); $GridPager->setIconPrev($this->icons->getIconNavPrev()); $GridPager->setIconNext($this->icons->getIconNavNext()); $GridPager->setIconFirst($this->icons->getIconNavFirst()); diff --git a/inc/SP/Controller/Grids/Items.php b/lib/SP/Controller/Grids/Items.php similarity index 99% rename from inc/SP/Controller/Grids/Items.php rename to lib/SP/Controller/Grids/Items.php index ea7f6d1e..b12c5b1c 100644 --- a/inc/SP/Controller/Grids/Items.php +++ b/lib/SP/Controller/Grids/Items.php @@ -521,7 +521,7 @@ class Items extends GridBase $Grid->setDataActions($GridActionNew); if (Acl::checkUserAccess(ActionsInterface::ACTION_CFG_IMPORT) - && Config::getConfig()->isLdapEnabled() + && $this->ConfigData->isLdapEnabled() ) { $GridActionLdapSync = new DataGridAction(); $GridActionLdapSync->setId(self::ACTION_USR_SYNC_LDAP); diff --git a/inc/SP/Controller/Grids/Notices.php b/lib/SP/Controller/Grids/Notices.php similarity index 98% rename from inc/SP/Controller/Grids/Notices.php rename to lib/SP/Controller/Grids/Notices.php index bf032c17..5e50c456 100644 --- a/inc/SP/Controller/Grids/Notices.php +++ b/lib/SP/Controller/Grids/Notices.php @@ -26,7 +26,7 @@ namespace SP\Controller\Grids; defined('APP_ROOT') || die(); -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Html\DataGrid\DataGridAction; use SP\Html\DataGrid\DataGridActionSearch; use SP\Html\DataGrid\DataGridActionType; @@ -47,7 +47,7 @@ class Notices extends GridBase */ public function getNoticesGrid() { - $isAdminApp = Session::getUserData()->isUserIsAdminApp(); + $isAdminApp = SessionFactory::getUserData()->isUserIsAdminApp(); // Grid Header $GridHeaders = new DataGridHeader(); diff --git a/inc/SP/Controller/ItemActionController.php b/lib/SP/Controller/ItemActionController.php similarity index 98% rename from inc/SP/Controller/ItemActionController.php rename to lib/SP/Controller/ItemActionController.php index f4f94993..be93aa7b 100644 --- a/inc/SP/Controller/ItemActionController.php +++ b/lib/SP/Controller/ItemActionController.php @@ -32,7 +32,8 @@ use SP\Account\AccountUtil; use SP\Auth\AuthUtil; use SP\Core\ActionsInterface; use SP\Core\Messages\LogMessage; -use SP\Core\Session; +use SP\Core\SessionFactory; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\CustomFieldData; use SP\DataModel\NoticeData; use SP\DataModel\PluginData; @@ -78,6 +79,7 @@ use SP\Util\Util; */ class ItemActionController implements ItemControllerInterface { + use InjectableTrait; use RequestControllerTrait; /** @@ -92,6 +94,7 @@ class ItemActionController implements ItemControllerInterface */ public function __construct() { + $this->injectDependencies(); $this->init(); } @@ -920,7 +923,7 @@ class ItemActionController implements ItemControllerInterface switch ($this->actionId) { case ActionsInterface::ACTION_ACC_NEW: case ActionsInterface::ACTION_ACC_COPY: - $Form->getItemData()->setAccountUserId(Session::getUserData()->getUserId()); + $Form->getItemData()->setAccountUserId(SessionFactory::getUserData()->getUserId()); $Account->createAccount(); @@ -1053,7 +1056,7 @@ class ItemActionController implements ItemControllerInterface */ protected function favoriteAction() { - $userId = Session::getUserData()->getUserId(); + $userId = SessionFactory::getUserData()->getUserId(); switch ($this->actionId) { case ActionsInterface::ACTION_ACC_FAVORITES_ADD: @@ -1167,8 +1170,8 @@ class ItemActionController implements ItemControllerInterface $users = [$account->account_userId, $account->account_userEditId]; } - $requestUsername = Session::getUserData()->getUserName(); - $requestLogin = Session::getUserData()->getUserLogin(); + $requestUsername = SessionFactory::getUserData()->getUserName(); + $requestLogin = SessionFactory::getUserData()->getUserLogin(); $this->LogMessage->setAction(__('Solicitud de Modificación de Cuenta', false)); $this->LogMessage->addDetails(__('Solicitante', false), sprintf('%s (%s)', $requestUsername, $requestLogin)); @@ -1177,7 +1180,7 @@ class ItemActionController implements ItemControllerInterface $this->LogMessage->addDetails(__('Descripción', false), $description); // Enviar por correo si está disponible - if (Checks::mailrequestIsEnabled()) { + if ($this->ConfigData->isMailRequestsEnabled()) { $recipients = []; foreach ($users as $user) { diff --git a/inc/SP/Controller/ItemControllerInterface.php b/lib/SP/Controller/ItemControllerInterface.php similarity index 100% rename from inc/SP/Controller/ItemControllerInterface.php rename to lib/SP/Controller/ItemControllerInterface.php diff --git a/inc/SP/Controller/ItemListController.php b/lib/SP/Controller/ItemListController.php similarity index 96% rename from inc/SP/Controller/ItemListController.php rename to lib/SP/Controller/ItemListController.php index d49c2b81..1aebc8f4 100644 --- a/inc/SP/Controller/ItemListController.php +++ b/lib/SP/Controller/ItemListController.php @@ -33,6 +33,7 @@ use SP\Controller\Grids\Items; use SP\Core\ActionsInterface; use SP\Core\Exceptions\SPException; use SP\Core\Template; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\ItemSearchData; use SP\Http\Request; use SP\Mgmt\ApiTokens\ApiTokenSearch; @@ -74,7 +75,7 @@ class ItemListController extends GridTabControllerBase implements ActionsInterfa parent::__construct($template); $ItemSearchData = new ItemSearchData(); - $ItemSearchData->setLimitCount(Config::getConfig()->getAccountCount()); + $ItemSearchData->setLimitCount($this->configData->getAccountCount()); $this->ItemSearchData = $ItemSearchData; } @@ -116,7 +117,7 @@ class ItemListController extends GridTabControllerBase implements ActionsInterfa $this->getTags(); $this->getPluginsList(); - $this->EventDispatcher->notifyEvent('show.itemlist.accounts', $this); + $this->eventDispatcher->notifyEvent('show.itemlist.accounts', $this); } elseif ($type === self::TYPE_ACCESSES) { $this->getUsersList(); $this->getGroupsList(); @@ -124,7 +125,7 @@ class ItemListController extends GridTabControllerBase implements ActionsInterfa $this->getAPITokensList(); $this->getPublicLinksList(); - $this->EventDispatcher->notifyEvent('show.itemlist.accesses', $this); + $this->eventDispatcher->notifyEvent('show.itemlist.accesses', $this); } } catch (SPException $e) { $this->showError(self::ERR_EXCEPTION); @@ -206,7 +207,7 @@ class ItemListController extends GridTabControllerBase implements ActionsInterfa */ public function getFiles() { - if (!Checks::fileIsEnabled()) { + if (!$this->configData->isFilesEnabled()) { return; } @@ -390,7 +391,7 @@ class ItemListController extends GridTabControllerBase implements ActionsInterfa */ public function getPublicLinksList() { - if (!Checks::publicLinksIsEnabled()) { + if (!$this->configData->isPublinksEnabled()) { return; } diff --git a/inc/SP/Controller/ItemSearchController.php b/lib/SP/Controller/ItemSearchController.php similarity index 99% rename from inc/SP/Controller/ItemSearchController.php rename to lib/SP/Controller/ItemSearchController.php index 92aa5fb7..8169f184 100644 --- a/inc/SP/Controller/ItemSearchController.php +++ b/lib/SP/Controller/ItemSearchController.php @@ -87,7 +87,7 @@ class ItemSearchController extends GridItemsSearchController implements ActionsI { $this->ItemSearchData->setSeachString(Request::analyze('search')); $this->ItemSearchData->setLimitStart(Request::analyze('start', 0)); - $this->ItemSearchData->setLimitCount(Request::analyze('count', Config::getConfig()->getAccountCount())); + $this->ItemSearchData->setLimitCount(Request::analyze('count', $this->configData->getAccountCount())); } /** @@ -97,7 +97,7 @@ class ItemSearchController extends GridItemsSearchController implements ActionsI */ public function doAction($type = null) { - $this->view->assign('isDemo', Checks::demoIsEnabled()); + $this->view->assign('isDemo', $this->configData->isDemoEnabled()); $this->view->assign('sk', SessionUtil::getSessionKey(true)); $this->view->assign('index', $this->activeTab); diff --git a/inc/SP/Controller/ItemShowController.php b/lib/SP/Controller/ItemShowController.php similarity index 97% rename from inc/SP/Controller/ItemShowController.php rename to lib/SP/Controller/ItemShowController.php index 3a9c8cb6..1b94064c 100644 --- a/inc/SP/Controller/ItemShowController.php +++ b/lib/SP/Controller/ItemShowController.php @@ -35,7 +35,7 @@ use SP\Core\Crypt\Crypt; use SP\Core\Crypt\Session as CryptSession; use SP\Core\Exceptions\ItemException; use SP\Core\Plugin\PluginUtil; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\SessionUtil; use SP\Core\Template; use SP\DataModel\AccountExtData; @@ -103,7 +103,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite $this->init(); - $this->view->assign('isDemo', Checks::demoIsEnabled()); + $this->view->assign('isDemo', $this->configData->isDemoEnabled()); $this->view->assign('sk', SessionUtil::getSessionKey(true)); $this->view->assign('itemId', $this->itemId); $this->view->assign('activeTab', $this->activeTab); @@ -266,7 +266,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite $this->view->assign('user', $this->itemId ? User::getItem()->getById($this->itemId) : new UserData()); $this->view->assign('isDisabled', $this->view->actionId === self::ACTION_USR_USERS_VIEW ? 'disabled' : ''); $this->view->assign('isReadonly', $this->view->isDisabled ? 'readonly' : ''); - $this->view->assign('isUseSSO', Config::getConfig()->isAuthBasicAutoLoginEnabled()); + $this->view->assign('isUseSSO', $this->configData->isAuthBasicAutoLoginEnabled()); $this->view->assign('groups', Group::getItem()->getItemsForSelect()); $this->view->assign('profiles', Profile::getItem()->getItemsForSelect()); @@ -296,7 +296,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite $this->setAction(self::ACTION_USR_USERS_EDITPASS); // Comprobar si el usuario a modificar es distinto al de la sesión - if ($this->itemId !== Session::getUserData()->getUserId() && !$this->checkAccess()) { + if ($this->itemId !== SessionFactory::getUserData()->getUserId() && !$this->checkAccess()) { return; } @@ -518,7 +518,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite throw new ItemException(__('No tiene permisos para acceder a esta cuenta', false)); } - if (!UserPass::checkUserUpdateMPass(Session::getUserData()->getUserId())) { + if (!UserPass::checkUserUpdateMPass(SessionFactory::getUserData()->getUserId())) { throw new ItemException(__('Clave maestra actualizada') . '
    ' . __('Reinicie la sesión para cambiarla')); } @@ -537,7 +537,7 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite $Log->writeLog(); } - $useImage = (int)Checks::accountPassToImageIsEnabled(); + $useImage = $this->configData->isAccountPassToImage(); if (!$useImage) { $pass = $isFull ? htmlentities(trim($accountClearPass)) : trim($accountClearPass); diff --git a/inc/SP/Controller/ItemsController.php b/lib/SP/Controller/ItemsController.php similarity index 100% rename from inc/SP/Controller/ItemsController.php rename to lib/SP/Controller/ItemsController.php diff --git a/inc/SP/Controller/LoginController.php b/lib/SP/Controller/LoginController.php similarity index 93% rename from inc/SP/Controller/LoginController.php rename to lib/SP/Controller/LoginController.php index 866660cb..0761f79f 100644 --- a/inc/SP/Controller/LoginController.php +++ b/lib/SP/Controller/LoginController.php @@ -42,8 +42,10 @@ use SP\Core\Exceptions\SPException; use SP\Core\Init; use SP\Core\Language; use SP\Core\Messages\LogMessage; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\SessionUtil; +use SP\Core\Traits\InjectableTrait; +use SP\Core\UI\Theme; use SP\DataModel\TrackData; use SP\DataModel\UserLoginData; use SP\DataModel\UserPassRecoverData; @@ -60,7 +62,6 @@ use SP\Mgmt\Users\UserPassRecover; use SP\Mgmt\Users\UserPreferences; use SP\Mgmt\Users\UserSSO; use SP\Mgmt\Users\UserUtil; -use SP\Util\Checks; use SP\Util\HttpUtil; use SP\Util\Json; use SP\Util\Util; @@ -72,6 +73,8 @@ use SP\Util\Util; */ class LoginController { + use InjectableTrait; + /** * Estados */ @@ -99,18 +102,45 @@ class LoginController * @var LogMessage */ protected $LogMessage; + /** + * @var $ConfigData + */ + protected $ConfigData; + /** + * @var Config + */ + protected $Config; + /** + * @var Theme + */ + protected $Theme; /** * LoginController constructor. */ public function __construct() { - $this->jsonResponse = new JsonResponse(); + $this->injectDependencies(); + $this->UserData = new UserLoginData(); - $this->LogMessage = new LogMessage(); $this->LogMessage->setAction(__('Inicio sesión', false)); } + /** + * @param Config $config + * @param SessionFactory $session + * @param JsonResponse $jsonResponse + * @param LogMessage $logMessage + */ + public function inject(Config $config, SessionFactory $session, JsonResponse $jsonResponse, LogMessage $logMessage, Theme $theme) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + $this->jsonResponse = $jsonResponse; + $this->LogMessage = $logMessage; + $this->Theme = $theme; + } + /** * Ejecutar las acciones de login * @@ -165,7 +195,7 @@ class LoginController $forward = Request::getRequestHeaders('X-Forwarded-For'); if ($forward) { - $this->LogMessage->addDetails('X-Forwarded-For', Checks::demoIsEnabled() ? '***' : $forward); + $this->LogMessage->addDetails('X-Forwarded-For', $this->ConfigData->isDemoEnabled() ? '***' : $forward); } $Log->writeLog(); @@ -381,17 +411,17 @@ class LoginController */ protected function loadUserPreferences() { - if (Checks::demoIsEnabled()) { - Session::setUserPreferences(new UserPreferencesData()); + if ($this->ConfigData->isDemoEnabled()) { + SessionFactory::setUserPreferences(new UserPreferencesData()); } else { - Session::setUserPreferences($this->UserData->getUserPreferences()); + SessionFactory::setUserPreferences($this->UserData->getUserPreferences()); } Language::setLanguage(true); - DiFactory::getTheme()->initTheme(true); + $this->Theme->initTheme(true); - Session::setSessionType(Session::SESSION_INTERACTIVE); - Session::setAuthCompleted(true); + SessionFactory::setSessionType(SessionFactory::SESSION_INTERACTIVE); + SessionFactory::setAuthCompleted(true); DiFactory::getEventDispatcher()->notifyEvent('login.preferences', $this); } @@ -563,7 +593,7 @@ class LoginController $this->LogMessage->addDetails(__('Tipo', false), __FUNCTION__); - if (Config::getConfig()->isAuthBasicAutoLoginEnabled()) { + if ($this->ConfigData->isAuthBasicAutoLoginEnabled()) { try { if (!UserSSO::getItem($this->UserData)->checkUserInDB($this->UserData->getLogin())) { UserSSO::getItem()->add(); diff --git a/inc/SP/Controller/MainActionController.php b/lib/SP/Controller/MainActionController.php similarity index 78% rename from inc/SP/Controller/MainActionController.php rename to lib/SP/Controller/MainActionController.php index c19c685f..218ec30a 100644 --- a/inc/SP/Controller/MainActionController.php +++ b/lib/SP/Controller/MainActionController.php @@ -25,9 +25,11 @@ namespace SP\Controller; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\ValidationException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\TaskFactory; +use SP\Core\Traits\InjectableTrait; use SP\Core\Upgrade\Upgrade; use SP\Http\JsonResponse; use SP\Http\Request; @@ -42,6 +44,34 @@ use SP\Util\Util; */ class MainActionController { + use InjectableTrait; + + /** + * @var ConfigData + */ + protected $ConfigData; + /** + * @var Config + */ + protected $Config; + + /** + * MainActionController constructor. + */ + public function __construct() + { + $this->injectDependencies(); + } + + /** + * @param Config $config + */ + public function inject(Config $config) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + } + /** * Realizar acción * @@ -61,7 +91,7 @@ class MainActionController $JsonResponse = new JsonResponse(); $JsonResponse->setAction(__('Actualización', false)); - if (Request::analyze('h') !== Config::getConfig()->getUpgradeKey()) { + if (Request::analyze('h') !== $this->ConfigData->getUpgradeKey()) { throw new ValidationException(__('Código de seguridad incorrecto', false)); } elseif (Request::analyze('chkConfirm', false, false, true) === false) { throw new ValidationException(__('Es necesario confirmar la actualización', false)); @@ -98,23 +128,21 @@ class MainActionController */ private function upgrade($version, $type) { - Upgrade::doUpgrade($version); + $Upgrade = new Upgrade(); + $Upgrade->doUpgrade($version); TaskFactory::endTask(); - $Config = Config::getConfig(); - $Config->setMaintenance(false); - $Config->setUpgradeKey(''); + $this->ConfigData->setMaintenance(false); + $this->ConfigData->setUpgradeKey(''); $appVersion = Util::getVersionStringNormalized(); - $Config->setConfigVersion($appVersion); + $this->ConfigData->setConfigVersion($appVersion); - Config::saveConfig($Config); + $this->Config->saveConfig(); - Config::loadConfig(true); - - Session::setAppUpdated(); + SessionFactory::setAppUpdated(); $Log = new Log(); $LogMessage = $Log->getLogMessage(); diff --git a/inc/SP/Controller/NoticeShowController.php b/lib/SP/Controller/NoticeShowController.php similarity index 97% rename from inc/SP/Controller/NoticeShowController.php rename to lib/SP/Controller/NoticeShowController.php index 7e9d6a22..326ce272 100644 --- a/inc/SP/Controller/NoticeShowController.php +++ b/lib/SP/Controller/NoticeShowController.php @@ -64,7 +64,7 @@ class NoticeShowController extends ControllerBase implements ActionsInterface, I $this->init(); - $this->view->assign('isDemo', Checks::demoIsEnabled()); + $this->view->assign('isDemo', $this->configData->isDemoEnabled()); $this->view->assign('sk', SessionUtil::getSessionKey(true)); $this->view->assign('itemId', $this->itemId); $this->view->assign('activeTab', $this->activeTab); @@ -126,7 +126,7 @@ class NoticeShowController extends ControllerBase implements ActionsInterface, I $this->view->assign('isDisabled', ($this->view->isDemo || $this->view->actionId === self::ACTION_NOT_USER_VIEW) ? 'disabled' : ''); $this->view->assign('isReadonly', $this->view->isDisabled ? 'readonly' : ''); - if ($this->UserData->isUserIsAdminApp()){ + if ($this->userData->isUserIsAdminApp()){ $this->view->assign('users', User::getItem()->getItemsForSelect()); } diff --git a/inc/SP/Controller/NoticesController.php b/lib/SP/Controller/NoticesController.php similarity index 97% rename from inc/SP/Controller/NoticesController.php rename to lib/SP/Controller/NoticesController.php index 708fee5a..c3e3d774 100644 --- a/inc/SP/Controller/NoticesController.php +++ b/lib/SP/Controller/NoticesController.php @@ -47,7 +47,7 @@ class NoticesController extends GridTabControllerBase implements ActionsInterfac $this->useTabs(); $this->getUserNotices(); - $this->EventDispatcher->notifyEvent('show.itemlist.notices', $this); + $this->eventDispatcher->notifyEvent('show.itemlist.notices', $this); } catch (SPException $e) { $this->showError(self::ERR_EXCEPTION); } diff --git a/inc/SP/Controller/NoticesSearchController.php b/lib/SP/Controller/NoticesSearchController.php similarity index 97% rename from inc/SP/Controller/NoticesSearchController.php rename to lib/SP/Controller/NoticesSearchController.php index f31f59d2..aa644343 100644 --- a/inc/SP/Controller/NoticesSearchController.php +++ b/lib/SP/Controller/NoticesSearchController.php @@ -75,7 +75,7 @@ class NoticesSearchController extends GridItemsSearchController implements Actio { $this->ItemSearchData->setSeachString(Request::analyze('search')); $this->ItemSearchData->setLimitStart(Request::analyze('start', 0)); - $this->ItemSearchData->setLimitCount(Request::analyze('count', Config::getConfig()->getAccountCount())); + $this->ItemSearchData->setLimitCount(Request::analyze('count', $this->configData->getAccountCount())); } /** @@ -86,7 +86,7 @@ class NoticesSearchController extends GridItemsSearchController implements Actio */ public function doAction($type = null) { - $this->view->assign('isDemo', Checks::demoIsEnabled()); + $this->view->assign('isDemo', $this->configData->isDemoEnabled()); $this->view->assign('sk', SessionUtil::getSessionKey(true)); $this->view->assign('index', $this->activeTab); diff --git a/inc/SP/Controller/RequestControllerTrait.php b/lib/SP/Controller/RequestControllerTrait.php similarity index 74% rename from inc/SP/Controller/RequestControllerTrait.php rename to lib/SP/Controller/RequestControllerTrait.php index 488cb768..b27c598f 100644 --- a/inc/SP/Controller/RequestControllerTrait.php +++ b/lib/SP/Controller/RequestControllerTrait.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -24,9 +24,12 @@ namespace SP\Controller; -use SP\Core\Init; +use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Messages\LogMessage; +use SP\Core\Session\Session; use SP\Core\SessionUtil; +use SP\Core\Traits\InjectableTrait; use SP\Http\JsonResponse; use SP\Http\Request; use SP\Util\Checks; @@ -40,6 +43,8 @@ use SP\Util\Util; */ trait RequestControllerTrait { + use InjectableTrait; + /** * @var int */ @@ -64,6 +69,23 @@ trait RequestControllerTrait * @var LogMessage */ protected $LogMessage; + /** @var Session */ + protected $session; + /** @var Config */ + protected $Config; + /** @var ConfigData */ + protected $ConfigData; + + /** + * @param Session $session + * @param Config $config + */ + final public function inject(Session $session, Config $config) + { + $this->session = $session; + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + } /** * inicializar las propiedades @@ -72,6 +94,8 @@ trait RequestControllerTrait */ protected function init() { + $this->injectDependencies(); + $this->JsonResponse = new JsonResponse(); $this->checkSession(); @@ -79,15 +103,31 @@ trait RequestControllerTrait $this->preActionChecks(); } + /** + * Comprobar si la sesión está activa + */ + protected function checkSession() + { + if (!$this->session->isLoggedIn()) { + if (Checks::isJson()) { + $this->JsonResponse->setDescription(__('La sesión no se ha iniciado o ha caducado', false)); + $this->JsonResponse->setStatus(10); + Json::returnJson($this->JsonResponse); + } else { + Util::logout(); + } + } + } + /** * Analizar la petición HTTP y establecer las propiedades del elemento */ protected function analyzeRequest() { $this->sk = Request::analyze('sk'); - $this->actionId = Request::analyze('actionId', 0); - $this->itemId = Request::analyze('itemId', 0); - $this->activeTab = Request::analyze('activeTab', 0); +// $this->actionId = Request::analyze('actionId', 0); +// $this->itemId = Request::analyze('itemId', 0); +// $this->activeTab = Request::analyze('activeTab', 0); } /** @@ -95,7 +135,7 @@ trait RequestControllerTrait */ protected function preActionChecks() { - if (!$this->sk || !$this->actionId || !SessionUtil::checkSessionKey($this->sk)) { + if (!$this->sk || !SessionUtil::checkSessionKey($this->sk)) { $this->invalidAction(); } } @@ -108,20 +148,4 @@ trait RequestControllerTrait $this->JsonResponse->setDescription(__('Acción Inválida', false)); Json::returnJson($this->JsonResponse); } - - /** - * Comprobar si la sesión está activa - */ - protected function checkSession() - { - if (!Init::isLoggedIn()) { - if (Checks::isJson()) { - $this->JsonResponse->setDescription(__('La sesión no se ha iniciado o ha caducado', false)); - $this->JsonResponse->setStatus(10); - Json::returnJson($this->JsonResponse); - } else { - Util::logout(); - } - } - } } \ No newline at end of file diff --git a/inc/SP/Controller/TabControllerBase.php b/lib/SP/Controller/TabControllerBase.php similarity index 100% rename from inc/SP/Controller/TabControllerBase.php rename to lib/SP/Controller/TabControllerBase.php diff --git a/inc/SP/Controller/TabsInterface.php b/lib/SP/Controller/TabsInterface.php similarity index 100% rename from inc/SP/Controller/TabsInterface.php rename to lib/SP/Controller/TabsInterface.php diff --git a/inc/SP/Controller/TaskController.php b/lib/SP/Controller/TaskController.php similarity index 100% rename from inc/SP/Controller/TaskController.php rename to lib/SP/Controller/TaskController.php diff --git a/inc/SP/Controller/UserPreferencesController.php b/lib/SP/Controller/UserPreferencesController.php similarity index 91% rename from inc/SP/Controller/UserPreferencesController.php rename to lib/SP/Controller/UserPreferencesController.php index 42fb3c21..dc43f967 100644 --- a/inc/SP/Controller/UserPreferencesController.php +++ b/lib/SP/Controller/UserPreferencesController.php @@ -62,7 +62,7 @@ class UserPreferencesController extends TabControllerBase implements ActionsInte $this->view->assign('tabs', []); $this->view->assign('sk', SessionUtil::getSessionKey(true)); - $this->userId = $this->UserData->getUserId(); + $this->userId = $this->userData->getUserId(); $this->userPrefs = UserPreferences::getItem()->getById($this->userId); } @@ -78,10 +78,10 @@ class UserPreferencesController extends TabControllerBase implements ActionsInte $this->view->assign('userId', $this->userId); $this->view->assign('langsAvailable', Language::getAvailableLanguages()); $this->view->assign('currentLang', $this->userPrefs->getLang()); - $this->view->assign('themesAvailable', DiFactory::getTheme()->getThemesAvailable()); - $this->view->assign('currentTheme', $this->userPrefs->getTheme() ?: Config::getConfig()->getSiteTheme()); + $this->view->assign('themesAvailable', $this->theme->getThemesAvailable()); + $this->view->assign('currentTheme', $this->userPrefs->getTheme() ?: $this->configData->getSiteTheme()); $this->view->assign('chkAccountLink', $this->userPrefs->isAccountLink() ? 'checked="checked"' : ''); - $this->view->assign('resultsPerPage', $this->userPrefs->getResultsPerPage() ?: Config::getConfig()->getAccountCount()); + $this->view->assign('resultsPerPage', $this->userPrefs->getResultsPerPage() ?: $this->configData->getAccountCount()); $this->view->assign('chkSortViews', $this->userPrefs->isSortViews() ? 'checked="checked"' : ''); $this->view->assign('chkTopNavbar', $this->userPrefs->isTopNavbar() ? 'checked="checked"' : ''); $this->view->assign('chkOptionalActions', $this->userPrefs->isOptionalActions() ? 'checked="checked"' : ''); @@ -102,7 +102,7 @@ class UserPreferencesController extends TabControllerBase implements ActionsInte $this->getPreferencesTab(); - $this->EventDispatcher->notifyEvent('user.preferences', $this); + $this->eventDispatcher->notifyEvent('user.preferences', $this); $this->view->addTemplate('tabs-end', 'common'); } diff --git a/inc/SP/Controller/WikiController.php b/lib/SP/Controller/WikiController.php similarity index 90% rename from inc/SP/Controller/WikiController.php rename to lib/SP/Controller/WikiController.php index ed6335c3..0d9a6c44 100644 --- a/inc/SP/Controller/WikiController.php +++ b/lib/SP/Controller/WikiController.php @@ -29,7 +29,7 @@ defined('APP_ROOT') || die(); use SP\Config\Config; use SP\Core\ActionsInterface; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Core\SessionUtil; use SP\Core\Template; use SP\Http\Request; @@ -58,8 +58,8 @@ class WikiController extends ControllerBase implements ActionsInterface $this->init(); $this->view->assign('sk', SessionUtil::getSessionKey(true)); - $this->view->assign('isDemoMode', Checks::demoIsEnabled() && !Session::getUserData()->isUserIsAdminApp()); - $this->view->assign('isDisabled', (Checks::demoIsEnabled() && !Session::getUserData()->isUserIsAdminApp()) ? 'DISABLED' : ''); + $this->view->assign('isDemoMode', $this->configData->isDemoEnabled() && !SessionFactory::getUserData()->isUserIsAdminApp()); + $this->view->assign('isDisabled', ($this->configData->isDemoEnabled() && !SessionFactory::getUserData()->isUserIsAdminApp()) ? 'DISABLED' : ''); } /** @@ -103,7 +103,7 @@ class WikiController extends ControllerBase implements ActionsInterface $pageInfo = ''; $headerData = ''; $pageSearch = ''; - $wikiUrlBase = Config::getConfig()->getDokuwikiUrlBase(); + $wikiUrlBase = $this->configData->getDokuwikiUrlBase(); try { $DokuWikiApi = new DokuWikiApi(); diff --git a/inc/SP/Core/Acl.php b/lib/SP/Core/Acl.php similarity index 77% rename from inc/SP/Core/Acl.php rename to lib/SP/Core/Acl.php index 968009f8..eee3ed8f 100644 --- a/inc/SP/Core/Acl.php +++ b/lib/SP/Core/Acl.php @@ -25,6 +25,7 @@ namespace SP\Core; +use SP\Core\Session\Session; use SP\Log\Log; defined('APP_ROOT') || die(); @@ -34,19 +35,93 @@ defined('APP_ROOT') || die(); */ class Acl implements ActionsInterface { + /** + * @var + */ + protected static $actionsInfo; /** * @var int */ protected $actionId; + /** + * @var Session + */ + private $session; /** * Acl constructor. * - * @param int $actionId + * @param Session $session + * @param int $actionId */ - public function __construct($actionId = null) + public function __construct(Session $session, $actionId = null) { $this->actionId = $actionId; + $this->session = $session; + + $this->setActionsInfo(); + } + + /** + * Set actions info + */ + protected function setActionsInfo() + { + self::$actionsInfo = [ + self::ACTION_ACC_SEARCH => ['acc_search', __('Buscar Cuentas'), 'route' => 'account/search'], + self::ACTION_ACC_VIEW => ['acc_view', __('Ver Cuenta'), 'route' => 'account/view'], + self::ACTION_ACC_COPY => ['acc_copy', __('Copiar Cuenta'), 'route' => 'account/copy'], + self::ACTION_ACC_NEW => ['acc_new', __('Nueva Cuenta'), 'route' => 'account/create'], + self::ACTION_ACC_EDIT => ['acc_edit', __('Editar Cuenta'), 'route' => 'account/edit'], + self::ACTION_ACC_EDIT_PASS => ['acc_editpass', __('Editar Clave de Cuenta'), 'route' => 'account/editPass'], + self::ACTION_ACC_VIEW_HISTORY => ['acc_viewhist', __('Ver Historial'), 'route' => 'account/viewHistory'], + self::ACTION_ACC_VIEW_PASS => ['acc_viewpass', __('Ver Clave'), 'route' => 'account/viewPass'], + self::ACTION_ACC_DELETE => ['acc_delete', __('Eliminar Cuenta'), 'route' => 'account/delete'], + self::ACTION_ACC_FILES => ['acc_files', __('Archivos'), 'route' => 'account/files'], + self::ACTION_ACC_REQUEST => ['acc_request', __('Peticiones'), 'route' => 'account/request'], + self::ACTION_MGM => ['mgm', __('Gestión Aplicación'), 'route' => ''], + self::ACTION_MGM_CATEGORIES => ['mgm_categories', __('Gestión Categorías'), 'route' => 'category/index'], + self::ACTION_MGM_CATEGORIES_SEARCH => ['mgm_categories_search', __('Buscar Categorías'), 'route' => 'category/search'], + self::ACTION_MGM_CATEGORIES_NEW => ['mgm_categories_add', __('Añadir Categoría')], + self::ACTION_MGM_CATEGORIES_EDIT => ['mgm_categories_edit', __('Editar Categoría')], + self::ACTION_MGM_CATEGORIES_DELETE => ['mgm_categories_delete', __('Eliminar Categoría')], + self::ACTION_MGM_CUSTOMERS => ['mgm_customers', __('Gestión Clientes')], + self::ACTION_MGM_CUSTOMERS_SEARCH => ['mgm_customers', __('Buscar Clientes')], + self::ACTION_MGM_CUSTOMERS_NEW => ['mgm_customers_add', __('Añadir Cliente')], + self::ACTION_MGM_CUSTOMERS_EDIT => ['mgm_customers_edit', __('Editar Cliente')], + self::ACTION_MGM_CUSTOMERS_DELETE => ['mgm_customers_delete', __('Eliminar Cliente')], + self::ACTION_MGM_CUSTOMFIELDS => ['mgm_customfields', __('Gestión Campos Personalizados')], + self::ACTION_MGM_APITOKENS => ['mgm_apitokens', __('Gestión Autorizaciones API')], + self::ACTION_MGM_FILES => ['mgm_files', __('Gestión de Archivos')], + self::ACTION_MGM_ACCOUNTS => ['mgm_accounts', __('Gestión de Cuentas')], + self::ACTION_MGM_TAGS => ['mgm_tags', __('Gestión de Etiquetas')], + self::ACTION_USR => ['usr', __('Gestión Usuarios')], + self::ACTION_USR_USERS => ['usr_users', __('Gestión Usuarios')], + self::ACTION_USR_GROUPS => ['usr_groups', __('Gestión Grupos')], + self::ACTION_USR_PROFILES => ['usr_profiles', __('Gestión Perfiles')], + self::ACTION_CFG => ['cfg', __('Configuración')], + self::ACTION_CFG_GENERAL => ['cfg_general', __('Configuración General')], + self::ACTION_CFG_ENCRYPTION => ['cfg_encryption', __('Encriptación')], + self::ACTION_CFG_BACKUP => ['cfg_backup', __('Copia de Seguridad')], + self::ACTION_CFG_EXPORT => ['cfg_export', __('Exportar')], + self::ACTION_CFG_IMPORT => ['cfg_import', __('Importar')], + self::ACTION_EVL => ['cfg_evl', __('Log de Eventos')] + ]; + } + + /** + * Returns action route + * + * @param $action + * @return string + */ + public static function getActionRoute($action) + { + if (isset(self::$actionsInfo[$action])) { + return self::$actionsInfo[$action]['route']; + } + + return ''; } /** @@ -59,18 +134,21 @@ class Acl implements ActionsInterface * @param int $userId opcional, con el Id del usuario * @return bool */ - public static function checkUserAccess($action, $userId = 0) + public function checkUserAccess($action, $userId = 0) { + $curUserProfile = $this->session->getUserProfile(); + // Comprobamos si la cache de permisos está inicializada - if (!is_object(Session::getUserProfile())) { + if (!is_object($curUserProfile)) { // error_log('ACL_CACHE_MISS'); return false; } - $curUserIsAdminApp = Session::getUserData()->isUserIsAdminApp(); - $curUserIsAdminAcc = Session::getUserData()->isUserIsAdminAcc(); - $curUserProfile = Session::getUserProfile(); - $curUserId = Session::getUserData()->getUserId(); + $userData = $this->session->getUserData(); + + $curUserId = $userData->getUserId(); + $curUserIsAdminApp = $userData->isUserIsAdminApp(); + $curUserIsAdminAcc = $userData->isUserIsAdminAcc(); if ($curUserIsAdminApp) { return true; @@ -161,7 +239,7 @@ class Acl implements ActionsInterface $Log = new Log(); $Log->getLogMessage() ->setAction(__FUNCTION__) - ->addDetails(__('Acceso denegado', false), self::getActionName($action, false, false)); + ->addDetails(__('Acceso denegado', false), self::getActionInfo($action, false, false)); $Log->setLogLevel(Log::NOTICE); $Log->writeLog(); @@ -176,57 +254,16 @@ class Acl implements ActionsInterface * @param bool $translate * @return string */ - public static function getActionName($action, $shortName = false, $translate = true) + public static function getActionInfo($action, $shortName = false, $translate = true) { - $actionName = [ - self::ACTION_ACC_SEARCH => ['acc_search', __('Buscar Cuentas', $translate)], - self::ACTION_ACC_VIEW => ['acc_view', __('Ver Cuenta', $translate)], - self::ACTION_ACC_COPY => ['acc_copy', __('Copiar Cuenta', $translate)], - self::ACTION_ACC_NEW => ['acc_new', __('Nueva Cuenta', $translate)], - self::ACTION_ACC_EDIT => ['acc_edit', __('Editar Cuenta', $translate)], - self::ACTION_ACC_EDIT_PASS => ['acc_editpass', __('Editar Clave de Cuenta', $translate)], - self::ACTION_ACC_VIEW_HISTORY => ['acc_viewhist', __('Ver Historial', $translate)], - self::ACTION_ACC_VIEW_PASS => ['acc_viewpass', __('Ver Clave', $translate)], - self::ACTION_ACC_DELETE => ['acc_delete', __('Eliminar Cuenta', $translate)], - self::ACTION_ACC_FILES => ['acc_files', __('Archivos', $translate)], - self::ACTION_ACC_REQUEST => ['acc_request', __('Peticiones', $translate)], - self::ACTION_MGM => ['mgm', __('Gestión Aplicación', $translate)], - self::ACTION_MGM_CATEGORIES => ['mgm_categories', __('Gestión Categorías', $translate)], - self::ACTION_MGM_CATEGORIES_SEARCH => ['mgm_categories_search', __('Buscar Categorías', $translate)], - self::ACTION_MGM_CATEGORIES_NEW => ['mgm_categories_add', __('Añadir Categoría', $translate)], - self::ACTION_MGM_CATEGORIES_EDIT => ['mgm_categories_edit', __('Editar Categoría', $translate)], - self::ACTION_MGM_CATEGORIES_DELETE => ['mgm_categories_delete', __('Eliminar Categoría', $translate)], - self::ACTION_MGM_CUSTOMERS => ['mgm_customers', __('Gestión Clientes', $translate)], - self::ACTION_MGM_CUSTOMERS_SEARCH => ['mgm_customers', __('Buscar Clientes', $translate)], - self::ACTION_MGM_CUSTOMERS_NEW => ['mgm_customers_add', __('Añadir Cliente', $translate)], - self::ACTION_MGM_CUSTOMERS_EDIT => ['mgm_customers_edit', __('Editar Cliente', $translate)], - self::ACTION_MGM_CUSTOMERS_DELETE => ['mgm_customers_delete', __('Eliminar Cliente', $translate)], - self::ACTION_MGM_CUSTOMFIELDS => ['mgm_customfields', __('Gestión Campos Personalizados', $translate)], - self::ACTION_MGM_APITOKENS => ['mgm_apitokens', __('Gestión Autorizaciones API', $translate)], - self::ACTION_MGM_FILES => ['mgm_files', __('Gestión de Archivos', $translate)], - self::ACTION_MGM_ACCOUNTS => ['mgm_accounts', __('Gestión de Cuentas', $translate)], - self::ACTION_MGM_TAGS => ['mgm_tags', __('Gestión de Etiquetas', $translate)], - self::ACTION_USR => ['usr', __('Gestión Usuarios', $translate)], - self::ACTION_USR_USERS => ['usr_users', __('Gestión Usuarios', $translate)], - self::ACTION_USR_GROUPS => ['usr_groups', __('Gestión Grupos', $translate)], - self::ACTION_USR_PROFILES => ['usr_profiles', __('Gestión Perfiles', $translate)], - self::ACTION_CFG => ['cfg', __('Configuración', $translate)], - self::ACTION_CFG_GENERAL => ['cfg_general', __('Configuración General', $translate)], - self::ACTION_CFG_ENCRYPTION => ['cfg_encryption', __('Encriptación', $translate)], - self::ACTION_CFG_BACKUP => ['cfg_backup', __('Copia de Seguridad', $translate)], - self::ACTION_CFG_EXPORT => ['cfg_export', __('Exportar', $translate)], - self::ACTION_CFG_IMPORT => ['cfg_import', __('Importar', $translate)], - self::ACTION_EVL => ['cfg_evl', __('Log de Eventos', $translate)] - ]; - - if (!isset($actionName[$action])) { + if (!isset(self::$actionsInfo[$action])) { return $action; } if ($shortName) { - return $actionName[$action][0]; + return self::$actionsInfo[$action][0]; } - return $actionName[$action][1]; + return self::$actionsInfo[$action][1]; } } \ No newline at end of file diff --git a/inc/SP/Core/ActionsInterface.php b/lib/SP/Core/ActionsInterface.php similarity index 100% rename from inc/SP/Core/ActionsInterface.php rename to lib/SP/Core/ActionsInterface.php diff --git a/inc/SP/Core/Backup.php b/lib/SP/Core/Backup.php similarity index 74% rename from inc/SP/Core/Backup.php rename to lib/SP/Core/Backup.php index d55e8b47..54a56cfe 100644 --- a/inc/SP/Core/Backup.php +++ b/lib/SP/Core/Backup.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -25,10 +25,12 @@ namespace SP\Core; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\SPException; +use SP\Core\Traits\InjectableTrait; use SP\Log\Email; use SP\Log\Log; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\DBUtil; use SP\Storage\QueryData; use SP\Util\Checks; @@ -41,6 +43,25 @@ defined('APP_ROOT') || die(); */ class Backup { + use InjectableTrait; + + /** + * @var ConfigData + */ + protected $ConfigData; + /** + * @var Config + */ + protected $Config; + + /** + * Backup constructor. + */ + public function __construct() + { + $this->injectDependencies(); + } + /** * Realizar backup de la BBDD y aplicación. * @@ -48,29 +69,27 @@ class Backup * @throws \phpmailer\phpmailerException * @throws \SP\Core\Exceptions\SPException */ - public static function doBackup() + public function doBackup() { $Log = new Log(); $LogMessage = $Log->getLogMessage(); $LogMessage->setAction(__('Realizar Backup', false)); $siteName = Util::getAppInfo('appname'); - $backupDir = Init::$SERVERROOT; // Generar hash unico para evitar descargas no permitidas $backupUniqueHash = sha1(uniqid('sysPassBackup', true)); - Config::getConfig()->setBackupHash($backupUniqueHash); - Config::saveConfig(); + $this->ConfigData->setBackupHash($backupUniqueHash); + $this->Config->saveConfig(); - $backupDstDir = $backupDir . DIRECTORY_SEPARATOR . 'backup'; - $bakFileApp = $backupDstDir . DIRECTORY_SEPARATOR . $siteName . '-' . $backupUniqueHash . '.tar'; - $bakFileDB = $backupDstDir . DIRECTORY_SEPARATOR . $siteName . '_db-' . $backupUniqueHash . '.sql'; + $bakFileApp = BACKUP_PATH . DIRECTORY_SEPARATOR . $siteName . '-' . $backupUniqueHash . '.tar'; + $bakFileDB = BACKUP_PATH . DIRECTORY_SEPARATOR . $siteName . '_db-' . $backupUniqueHash . '.sql'; try { - self::checkBackupDir($backupDstDir); - self::deleteOldBackups($backupDstDir); - self::backupTables('*', $bakFileDB); - self::backupApp($bakFileApp); + $this->checkBackupDir(); + $this->deleteOldBackups(); + $this->backupTables('*', $bakFileDB); + $this->backupApp($bakFileApp); } catch (\Exception $e) { $LogMessage->addDescription(__('Error al realizar el backup', false)); $LogMessage->addDetails($e->getCode(), $e->getMessage()); @@ -92,18 +111,21 @@ class Backup /** * Comprobar y crear el directorio de backups. * - * @param string $backupDir ruta del directorio de backup * @throws SPException * @return bool */ - private static function checkBackupDir($backupDir) + private function checkBackupDir() { - if (@mkdir($backupDir, 0750) === false && is_dir($backupDir) === false) { - throw new SPException(SPException::SP_CRITICAL, sprintf(__('No es posible crear el directorio de backups ("%s")'), $backupDir)); + if (@mkdir(BACKUP_PATH, 0750) === false && is_dir(BACKUP_PATH) === false) { + throw new SPException( + SPException::SP_ERROR, + sprintf(__('No es posible crear el directorio de backups ("%s")'),BACKUP_PATH)); } - if (!is_writable($backupDir)) { - throw new SPException(SPException::SP_CRITICAL, __('Compruebe los permisos del directorio de backups', false)); + if (!is_writable(BACKUP_PATH)) { + throw new SPException( + SPException::SP_ERROR, + __('Compruebe los permisos del directorio de backups', false)); } return true; @@ -111,13 +133,11 @@ class Backup /** * Eliminar las copias de seguridad anteriores - * - * @param string $backupDir El directorio de backups */ - private static function deleteOldBackups($backupDir) + private function deleteOldBackups() { - array_map('unlink', glob($backupDir . DIRECTORY_SEPARATOR . '*.tar.gz')); - array_map('unlink', glob($backupDir . DIRECTORY_SEPARATOR . '*.sql')); + array_map('unlink', glob(BACKUP_PATH . DIRECTORY_SEPARATOR . '*.tar.gz')); + array_map('unlink', glob(BACKUP_PATH . DIRECTORY_SEPARATOR . '*.sql')); } /** @@ -129,9 +149,9 @@ class Backup * @throws SPException * @return bool */ - private static function backupTables($tables = '*', $backupFile) + private function backupTables($tables = '*', $backupFile) { - $dbname = Config::getConfig()->getDbName(); + $dbname = $this->ConfigData->getDbName(); try { $handle = fopen($backupFile, 'w'); @@ -161,7 +181,7 @@ class Backup $Data->setQuery('SHOW CREATE TABLE ' . $tableName); // Consulta para crear la tabla - $txtCreate = DB::getResults($Data); + $txtCreate = DbWrapper::getResults($Data); if (isset($txtCreate->{'Create Table'})) { $sqlOut = '-- ' . PHP_EOL; @@ -194,7 +214,7 @@ class Backup $Data->setQuery('SELECT * FROM `' . $tableName . '`'); // Consulta para obtener los registros de la tabla - $queryRes = DB::getResultsRaw($Data); + $queryRes = DbWrapper::getResultsRaw($Data); $numColumns = $queryRes->columnCount(); @@ -242,15 +262,19 @@ class Backup * @throws SPException * @return bool */ - private static function backupApp($backupFile) + private function backupApp($backupFile) { if (!class_exists(\PharData::class)) { if (Checks::checkIsWindows()) { - throw new SPException(SPException::SP_CRITICAL, __('Esta operación sólo es posible en entornos Linux', false)); + throw new SPException( + SPException::SP_ERROR, + __('Esta operación sólo es posible en entornos Linux', false)); } - if (!self::backupAppLegacyLinux($backupFile)) { - throw new SPException(SPException::SP_CRITICAL, __('Error al realizar backup en modo compatibilidad', false)); + if (!$this->backupAppLegacyLinux($backupFile)) { + throw new SPException( + SPException::SP_ERROR, + __('Error al realizar backup en modo compatibilidad', false)); } return true; @@ -264,7 +288,7 @@ class Backup } $archive = new \PharData($backupFile); - $archive->buildFromDirectory(Init::$SERVERROOT,'/^(?!backup).*$/'); + $archive->buildFromDirectory(Init::$SERVERROOT, '/^(?!backup).*$/'); $archive->compress(\Phar::GZ); unlink($backupFile); @@ -281,15 +305,22 @@ class Backup * @param string $backupFile nombre del archivo de backup * @return int Con el código de salida del comando ejecutado */ - private static function backupAppLegacyLinux($backupFile) + private function backupAppLegacyLinux($backupFile) { $compressedFile = $backupFile . '.gz'; - $backupDir = Init::$SERVERROOT; - $bakDstDir = $backupDir . '/backup'; - $command = 'tar czf ' . $compressedFile . ' ' . $backupDir . ' --exclude "' . $bakDstDir . '" 2>&1'; + $command = 'tar czf ' . $compressedFile . ' ' . BASE_PATH . ' --exclude "' . BACKUP_PATH . '" 2>&1'; exec($command, $resOut, $resBakApp); return $resBakApp; } + + /** + * @param Config $config + */ + public function inject(Config $config) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + } } \ No newline at end of file diff --git a/inc/SP/Core/Crypt/Cookie.php b/lib/SP/Core/Crypt/Cookie.php similarity index 100% rename from inc/SP/Core/Crypt/Cookie.php rename to lib/SP/Core/Crypt/Cookie.php diff --git a/inc/SP/Core/Crypt/Crypt.php b/lib/SP/Core/Crypt/Crypt.php similarity index 100% rename from inc/SP/Core/Crypt/Crypt.php rename to lib/SP/Core/Crypt/Crypt.php diff --git a/inc/SP/Core/Crypt/CryptSessionHandler.php b/lib/SP/Core/Crypt/CryptSessionHandler.php similarity index 100% rename from inc/SP/Core/Crypt/CryptSessionHandler.php rename to lib/SP/Core/Crypt/CryptSessionHandler.php diff --git a/inc/SP/Core/Crypt/Hash.php b/lib/SP/Core/Crypt/Hash.php similarity index 100% rename from inc/SP/Core/Crypt/Hash.php rename to lib/SP/Core/Crypt/Hash.php diff --git a/inc/SP/Core/Crypt/SecureKeyCookie.php b/lib/SP/Core/Crypt/SecureKeyCookie.php similarity index 100% rename from inc/SP/Core/Crypt/SecureKeyCookie.php rename to lib/SP/Core/Crypt/SecureKeyCookie.php diff --git a/inc/SP/Core/Crypt/Session.php b/lib/SP/Core/Crypt/Session.php similarity index 97% rename from inc/SP/Core/Crypt/Session.php rename to lib/SP/Core/Crypt/Session.php index 63e73fdc..eace6386 100644 --- a/inc/SP/Core/Crypt/Session.php +++ b/lib/SP/Core/Crypt/Session.php @@ -24,7 +24,7 @@ namespace SP\Core\Crypt; -use SP\Core\Session as CoreSession; +use SP\Core\SessionFactory as CoreSession; /** * Class Session diff --git a/inc/SP/Core/Crypt/Vault.php b/lib/SP/Core/Crypt/Vault.php similarity index 98% rename from inc/SP/Core/Crypt/Vault.php rename to lib/SP/Core/Crypt/Vault.php index a708b765..3fcb8f6c 100644 --- a/inc/SP/Core/Crypt/Vault.php +++ b/lib/SP/Core/Crypt/Vault.php @@ -24,7 +24,7 @@ namespace SP\Core\Crypt; -use SP\Core\Session as CoreSession; +use SP\Core\SessionFactory as CoreSession; use SP\Core\SessionUtil; /** diff --git a/inc/SP/Core/CryptMasterPass.php b/lib/SP/Core/CryptMasterPass.php similarity index 98% rename from inc/SP/Core/CryptMasterPass.php rename to lib/SP/Core/CryptMasterPass.php index fc5f2257..d676bc9a 100644 --- a/inc/SP/Core/CryptMasterPass.php +++ b/lib/SP/Core/CryptMasterPass.php @@ -72,7 +72,7 @@ class CryptMasterPass } // Guardar la clave temporal hasta que finalice la sesión - Session::setTemporaryMasterPass($randomKey); + SessionFactory::setTemporaryMasterPass($randomKey); return $randomKey; } diff --git a/inc/SP/Core/CryptPKI.php b/lib/SP/Core/CryptPKI.php similarity index 84% rename from inc/SP/Core/CryptPKI.php rename to lib/SP/Core/CryptPKI.php index 04ca189a..78091029 100644 --- a/inc/SP/Core/CryptPKI.php +++ b/lib/SP/Core/CryptPKI.php @@ -27,7 +27,7 @@ namespace SP\Core; defined('APP_ROOT') || die(); use phpseclib\Crypt\RSA; -use phpseclib\Exception\FileNotFoundException; +use SP\Core\Exceptions\FileNotFoundException; use SP\Core\Exceptions\SPException; use SP\Log\Log; @@ -57,7 +57,7 @@ class CryptPKI */ private function getPublicKeyFile() { - return Init::$SERVERROOT . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'pubkey.pem'; + return APP_ROOT . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'pubkey.pem'; } /** @@ -67,7 +67,7 @@ class CryptPKI */ private function getPrivateKeyFile() { - return Init::$SERVERROOT . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'key.pem'; + return APP_ROOT . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'key.pem'; } /** @@ -91,7 +91,7 @@ class CryptPKI * * @param string $data los datos a encriptar * @return string - * @throws \phpseclib\Exception\FileNotFoundException + * @throws \SP\Core\Exceptions\FileNotFoundException */ public function encryptRSA($data) { @@ -106,7 +106,7 @@ class CryptPKI * Devuelve la clave pública desde el archivo * * @return string - * @throws \phpseclib\Exception\FileNotFoundException + * @throws \SP\Core\Exceptions\FileNotFoundException */ public function getPublicKey() { @@ -115,7 +115,7 @@ class CryptPKI if (!file_exists($file)) { Log::writeNewLog(__FUNCTION__, __('El archivo de clave no existe', false), Log::NOTICE); - throw new FileNotFoundException(__('El archivo de clave no existe')); + throw new FileNotFoundException(SPException::SP_ERROR, __('El archivo de clave no existe')); } return file_get_contents($file); @@ -126,7 +126,7 @@ class CryptPKI * * @param string $data los datos a desencriptar * @return string - * @throws \phpseclib\Exception\FileNotFoundException + * @throws \SP\Core\Exceptions\FileNotFoundException */ public function decryptRSA($data) { @@ -141,7 +141,7 @@ class CryptPKI * Devuelve la clave privada desde el archivo * * @return string - * @throws \phpseclib\Exception\FileNotFoundException + * @throws \SP\Core\Exceptions\FileNotFoundException */ private function getPrivateKey() { @@ -150,7 +150,7 @@ class CryptPKI if (!file_exists($file)) { Log::writeNewLog(__FUNCTION__, __('El archivo de clave no existe', false), Log::NOTICE); - throw new FileNotFoundException(__('El archivo de clave no existe')); + throw new FileNotFoundException(SPException::SP_ERROR, __('El archivo de clave no existe')); } return file_get_contents($file); diff --git a/inc/SP/Core/DiFactory.php b/lib/SP/Core/DiFactory.php similarity index 86% rename from inc/SP/Core/DiFactory.php rename to lib/SP/Core/DiFactory.php index 4f332b07..30522479 100644 --- a/inc/SP/Core/DiFactory.php +++ b/lib/SP/Core/DiFactory.php @@ -68,7 +68,7 @@ class DiFactory * * @return FileStorageInterface */ - public static final function getConfigStorage() + final public static function getConfigStorage() { if (!self::$ConfigFactory instanceof FileStorageInterface) { self::$ConfigFactory = new XmlHandler(XML_CONFIG_FILE); @@ -82,7 +82,7 @@ class DiFactory * * @return DBStorageInterface */ - public static final function getDBStorage() + final public static function getDBStorage() { if (!self::$DBFactory instanceof DBStorageInterface) { self::$DBFactory = new MySQLHandler(); @@ -98,7 +98,7 @@ class DiFactory * @param mixed $itemData Los datos del elemento * @return ItemBaseInterface */ - public static final function getItem($caller, $itemData = null) + final public static function getItem($caller, $itemData = null) { // error_log(count(self::$ItemFactory) . '-' . (memory_get_usage() / 1000)); @@ -117,26 +117,12 @@ class DiFactory return self::$ItemFactory[$caller]; } - /** - * Devuelve el manejador para el tema visual - * - * @return ThemeInterface - */ - public static final function getTheme() - { - if (!self::$ThemeFactory instanceof Theme) { - self::$ThemeFactory = new Theme(); - } - - return self::$ThemeFactory; - } - /** * Devuelve el manejador de eventos * * @return EventDispatcherInterface */ - public static final function getEventDispatcher() + final public static function getEventDispatcher() { if (!self::$EventDispatcher instanceof EventDispatcher) { self::$EventDispatcher = new EventDispatcher(); diff --git a/lib/SP/Core/Dic/Container.php b/lib/SP/Core/Dic/Container.php new file mode 100644 index 00000000..18feae57 --- /dev/null +++ b/lib/SP/Core/Dic/Container.php @@ -0,0 +1,185 @@ +. + */ + +namespace SP\Core\Dic; + +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; +use ReflectionMethod; + +/** + * Class Dic + * + * @package SP\Core\Dic + */ +final class Container implements DicInterface +{ + /** + * @var array Shared objects + */ + private $shared = []; + /** + * @var array Factory objects + */ + private $factory = []; + + /** + * Store shared object + * + * @param string $name + * @param callable $callable + * @internal param callable|string $class + */ + public function share($name, $callable = null) + { + $this->shared[$name] = $callable; + } + + /** + * Store factory object + * + * @param string $name + * @param callable $callable + * @internal param callable|string $class + */ + public function add($name, $callable = null) + { + $this->factory[$name] = $callable; + } + + /** + * Inject object + * + * @param $context + * @return mixed + * @throws \Psr\Container\ContainerExceptionInterface + */ + public function inject($context) + { + try { + $reflectionMethod = new ReflectionMethod($context, 'inject'); + $methodParams = $reflectionMethod->getParameters(); + + $params = []; + + if (!count($methodParams)) { + return false; + } + + foreach ($methodParams as $key => $methodParam) { + if ($methodParam->getClass()) { + $className = $methodParam->getClass()->getName(); + + if ($this->has($className)) { + $params[$key] = $this->get($className); + } else { + $params[$key] = new $className; + } + } else { + $params[$key] = null; + } + } + + return $reflectionMethod->invokeArgs($context, $params); + } catch (\ReflectionException $e) { + throw new ContainerException($e->getMessage(), $e->getCode(), $e); + } + } + + /** + * Returns true if the container can return an entry for the given identifier. + * Returns false otherwise. + * + * `has($id)` returning true does not mean that `get($id)` will not throw an exception. + * It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`. + * + * @param string $id Identifier of the entry to look for. + * + * @return bool + */ + public function has($id) + { + return array_key_exists($id, $this->shared) || array_key_exists($id, $this->factory); + } + + /** + * Finds an entry of the container by its identifier and returns it. + * + * @param string $id Identifier of the entry to look for. + * + * @throws NotFoundExceptionInterface No entry was found for **this** identifier. + * @throws ContainerExceptionInterface Error while retrieving the entry. + * + * @return mixed Entry. + */ + public function get($id) + { + if (array_key_exists($id, $this->factory)) { + return $this->getFactoryObject($id); + } + + if (array_key_exists($id, $this->shared)) { + return $this->getSharedObject($id); + } + + throw new NotFoundException(sprintf('Object not found (%s)', $id)); + } + + /** + * @param $id + * @return mixed + * @throws ContainerExceptionInterface + */ + private function getFactoryObject($id) + { + if (is_callable($this->factory[$id])) { + return $this->factory[$id]($this); + } + + if (class_exists($id)) { + return new $id(); + } + + throw new ContainerException(sprintf('Invalid class (%s)', $id)); + } + + /** + * @param $id + * @return mixed + */ + private function getSharedObject($id) + { + if (get_class($this->shared[$id]) === $id) { + return $this->shared[$id]; + } + + if (is_callable($this->shared[$id])) { + $this->shared[$id] = $this->shared[$id]($this); + } elseif (class_exists($id)) { + $this->shared[$id] = new $id(); + } + + return $this->shared[$id]; + } +} \ No newline at end of file diff --git a/ajax/ajax_doLogin.php b/lib/SP/Core/Dic/ContainerException.php similarity index 74% rename from ajax/ajax_doLogin.php rename to lib/SP/Core/Dic/ContainerException.php index ef7495f9..c3946f70 100644 --- a/ajax/ajax_doLogin.php +++ b/lib/SP/Core/Dic/ContainerException.php @@ -22,14 +22,18 @@ * along with sysPass. If not, see . */ -use SP\Controller\LoginController; -use SP\Http\Request; +namespace SP\Core\Dic; -define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +use Exception; +use Psr\Container\ContainerExceptionInterface; -Request::checkReferer('GET'); +/** + * Class ContainerException + * + * @package SP\Core\Dic + */ +class ContainerException extends Exception implements ContainerExceptionInterface +{ -$Controller = new LoginController(); -$Controller->doLogin(); \ No newline at end of file +} \ No newline at end of file diff --git a/lib/SP/Core/Dic/DicInterface.php b/lib/SP/Core/Dic/DicInterface.php new file mode 100644 index 00000000..eac904ef --- /dev/null +++ b/lib/SP/Core/Dic/DicInterface.php @@ -0,0 +1,60 @@ +. + */ + +namespace SP\Core\Dic; + +use Psr\Container\ContainerInterface; + +/** + * Interface DicInterface + * + * @package SP\Core\Dic + */ +interface DicInterface extends ContainerInterface +{ + /** + * Store shared object + * + * @param string $name + * @param callable $callable + * @return + */ + public function share($name, $callable = null); + + /** + * Store factory object + * + * @param string $name + * @param callable $callable + */ + public function add($name, $callable = null); + + /** + * Inject object + * + * @param $context + * @return mixed + */ + public function inject($context); +} \ No newline at end of file diff --git a/lib/SP/Core/Dic/NotFoundException.php b/lib/SP/Core/Dic/NotFoundException.php new file mode 100644 index 00000000..63f33646 --- /dev/null +++ b/lib/SP/Core/Dic/NotFoundException.php @@ -0,0 +1,38 @@ +. + */ + +namespace SP\Core\Dic; + +use Exception; +use Psr\Container\NotFoundExceptionInterface; + +/** + * Class NotFoundException + * + * @package SP\Core\Dic + */ +class NotFoundException extends Exception implements NotFoundExceptionInterface +{ + +} \ No newline at end of file diff --git a/inc/SP/Core/Events/EventDispatcher.php b/lib/SP/Core/Events/EventDispatcher.php similarity index 100% rename from inc/SP/Core/Events/EventDispatcher.php rename to lib/SP/Core/Events/EventDispatcher.php diff --git a/inc/SP/Core/Events/EventDispatcherBase.php b/lib/SP/Core/Events/EventDispatcherBase.php similarity index 95% rename from inc/SP/Core/Events/EventDispatcherBase.php rename to lib/SP/Core/Events/EventDispatcherBase.php index 93ec1739..85545ed0 100644 --- a/inc/SP/Core/Events/EventDispatcherBase.php +++ b/lib/SP/Core/Events/EventDispatcherBase.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -77,7 +77,7 @@ abstract class EventDispatcherBase implements EventDispatcherInterface $observerClass = get_class($observer); if (!array_key_exists($observerClass, $this->observers)) { - throw new InvalidClassException(__('Observador no inicializado')); + throw new InvalidClassException(SPException::SP_ERROR, __('Observador no inicializado')); } unset($this->observers[$observerClass]); diff --git a/inc/SP/Core/Events/EventDispatcherInterface.php b/lib/SP/Core/Events/EventDispatcherInterface.php similarity index 100% rename from inc/SP/Core/Events/EventDispatcherInterface.php rename to lib/SP/Core/Events/EventDispatcherInterface.php diff --git a/inc/SP/Core/Events/EventReceiver.php b/lib/SP/Core/Events/EventReceiver.php similarity index 100% rename from inc/SP/Core/Events/EventReceiver.php rename to lib/SP/Core/Events/EventReceiver.php diff --git a/inc/SP/Core/Exceptions/AuthException.php b/lib/SP/Core/Exceptions/AuthException.php similarity index 100% rename from inc/SP/Core/Exceptions/AuthException.php rename to lib/SP/Core/Exceptions/AuthException.php diff --git a/lib/SP/Core/Exceptions/ConfigException.php b/lib/SP/Core/Exceptions/ConfigException.php new file mode 100644 index 00000000..536637ca --- /dev/null +++ b/lib/SP/Core/Exceptions/ConfigException.php @@ -0,0 +1,35 @@ +. + */ + +namespace SP\Core\Exceptions; + +/** + * Class ConfigException + * + * @package SP\Core\Exceptions + */ +class ConfigException extends SPException +{ + +} \ No newline at end of file diff --git a/inc/SP/Core/Exceptions/ConstraintException.php b/lib/SP/Core/Exceptions/ConstraintException.php similarity index 100% rename from inc/SP/Core/Exceptions/ConstraintException.php rename to lib/SP/Core/Exceptions/ConstraintException.php diff --git a/inc/SP/Core/Exceptions/FileNotFoundException.php b/lib/SP/Core/Exceptions/FileNotFoundException.php similarity index 100% rename from inc/SP/Core/Exceptions/FileNotFoundException.php rename to lib/SP/Core/Exceptions/FileNotFoundException.php diff --git a/inc/SP/Core/Exceptions/InvalidArgumentException.php b/lib/SP/Core/Exceptions/InvalidArgumentException.php similarity index 100% rename from inc/SP/Core/Exceptions/InvalidArgumentException.php rename to lib/SP/Core/Exceptions/InvalidArgumentException.php diff --git a/inc/SP/Core/Exceptions/InvalidClassException.php b/lib/SP/Core/Exceptions/InvalidClassException.php similarity index 100% rename from inc/SP/Core/Exceptions/InvalidClassException.php rename to lib/SP/Core/Exceptions/InvalidClassException.php diff --git a/inc/SP/Core/Exceptions/ItemException.php b/lib/SP/Core/Exceptions/ItemException.php similarity index 100% rename from inc/SP/Core/Exceptions/ItemException.php rename to lib/SP/Core/Exceptions/ItemException.php diff --git a/inc/SP/Core/Exceptions/QueryException.php b/lib/SP/Core/Exceptions/QueryException.php similarity index 100% rename from inc/SP/Core/Exceptions/QueryException.php rename to lib/SP/Core/Exceptions/QueryException.php diff --git a/inc/SP/Core/Exceptions/SPException.php b/lib/SP/Core/Exceptions/SPException.php similarity index 100% rename from inc/SP/Core/Exceptions/SPException.php rename to lib/SP/Core/Exceptions/SPException.php diff --git a/inc/SP/Core/Exceptions/ValidationException.php b/lib/SP/Core/Exceptions/ValidationException.php similarity index 100% rename from inc/SP/Core/Exceptions/ValidationException.php rename to lib/SP/Core/Exceptions/ValidationException.php diff --git a/inc/SP/Core/Init.php b/lib/SP/Core/Init.php similarity index 89% rename from inc/SP/Core/Init.php rename to lib/SP/Core/Init.php index 40db89a4..720355b9 100644 --- a/inc/SP/Core/Init.php +++ b/lib/SP/Core/Init.php @@ -28,7 +28,7 @@ use Defuse\Crypto\Exception\CryptoException; use SP\Account\AccountAcl; use SP\Auth\Browser\Browser; use SP\Config\Config; -use SP\Controller\MainController; +use SP\Modules\Web\Controllers\MainController; use SP\Core\Crypt\CryptSessionHandler; use SP\Core\Crypt\SecureKeyCookie; use SP\Core\Crypt\Session as CryptSession; @@ -40,6 +40,7 @@ use SP\Http\Request; use SP\Log\Email; use SP\Log\Log; use SP\Mgmt\Profiles\Profile; +use SP\Mgmt\Users\UserUtil; use SP\Storage\DBUtil; use SP\Util\Checks; use SP\Util\HttpUtil; @@ -159,9 +160,9 @@ class Init Language::setLanguage(true); DiFactory::getTheme()->initTheme(true); - if (self::isLoggedIn() === true) { + if (CryptSession::isLoggedIn() === true) { // Recargar los permisos del perfil de usuario - Session::setUserProfile(Profile::getItem()->getById(Session::getUserData()->getUserProfileId())); + SessionFactory::setUserProfile(Profile::getItem()->getById(SessionFactory::getUserData()->getUserProfileId())); // Reset de los datos de ACL de cuentas AccountAcl::resetData(); } @@ -198,7 +199,7 @@ class Init self::initSession(); // Cargar los plugins - self::loadPlugins(); + CryptSession::loadPlugins(); // Comprobar acciones en URL self::checkPreLoginActions(); @@ -208,12 +209,12 @@ class Init return; } - if (self::isLoggedIn() === true && Session::getAuthCompleted() === true) { + if (CryptSession::isLoggedIn() === true && SessionFactory::getAuthCompleted() === true) { $AuthBrowser = new Browser(); // Comprobar si se ha identificado mediante el servidor web y el usuario coincide - if ($AuthBrowser->checkServerAuthUser(Session::getUserData()->getUserLogin()) === false - && $AuthBrowser->checkServerAuthUser(Session::getUserData()->getUserSsoLogin()) === false + if ($AuthBrowser->checkServerAuthUser(SessionFactory::getUserData()->getUserLogin()) === false + && $AuthBrowser->checkServerAuthUser(SessionFactory::getUserData()->getUserSsoLogin()) === false ) { self::goLogout(); } @@ -307,12 +308,12 @@ class Init $PhpMailerLoader->setPrepend(false); $PhpMailerLoader->register(); - $ExtsLoader = new \SplClassLoader('Exts', BASE_DIR); + $ExtsLoader = new \SplClassLoader('Exts', BASE_PATH); $ExtsLoader->setFileExtension('.class.php'); $ExtsLoader->setPrepend(false); $ExtsLoader->register(); - $PluginsLoader = new \SplClassLoader('Plugins', BASE_DIR); + $PluginsLoader = new \SplClassLoader('Plugins', BASE_PATH); $PluginsLoader->setFileExtension('.class.php'); $PluginsLoader->setPrepend(false); $PluginsLoader->register(); @@ -329,7 +330,7 @@ class Init // $dir = substr(__DIR__, 0, strpos(__DIR__, str_replace('\\', '/', __NAMESPACE__)) - 1); // self::$SERVERROOT = substr($dir, 0, strripos($dir, DIRECTORY_SEPARATOR)); - self::$SERVERROOT = dirname(BASE_DIR); + self::$SERVERROOT = dirname(BASE_PATH); self::$SUBURI = str_replace("\\", '/', substr(realpath($_SERVER['SCRIPT_FILENAME']), strlen(self::$SERVERROOT))); @@ -514,18 +515,6 @@ class Init } } - /** - * Comprobar si el usuario está logado. - * - * @returns bool - */ - public static function isLoggedIn() - { - return (DiFactory::getDBStorage()->getDbStatus() === 0 - && Session::getUserData()->getUserLogin() - && is_object(Session::getUserPreferences())); - } - /** * Comprueba que la aplicación esté instalada * Esta función comprueba si la aplicación está instalada. Si no lo está, redirige al instalador. @@ -545,7 +534,7 @@ class Init exit(); } - if (Session::getAuthCompleted()) { + if (SessionFactory::getAuthCompleted()) { session_destroy(); self::start(); @@ -577,7 +566,7 @@ class Init || Checks::isAjax() || Request::analyze('nodbupgrade', 0) === 1 || (Request::analyze('a') === 'upgrade' && Request::analyze('type') !== '') - || (self::$LOCK > 0 && self::isLoggedIn() && self::$LOCK === Session::getUserData()->getUserId()) + || (self::$LOCK > 0 && Util::isLoggedIn() && self::$LOCK === SessionFactory::getUserData()->getUserId()) ) { return true; } @@ -607,7 +596,7 @@ class Init SessionUtil::cleanSession(); - Session::setLoggedOut(true); + SessionFactory::setLoggedOut(true); $Controller = new MainController(); $Controller->getLogout(); @@ -618,13 +607,13 @@ class Init */ private static function wrLogoutInfo() { - $inactiveTime = abs(round((time() - Session::getLastActivity()) / 60, 2)); - $totalTime = abs(round((time() - Session::getStartActivity()) / 60, 2)); + $inactiveTime = abs(round((time() - SessionFactory::getLastActivity()) / 60, 2)); + $totalTime = abs(round((time() - SessionFactory::getStartActivity()) / 60, 2)); $Log = new Log(); $LogMessage = $Log->getLogMessage(); $LogMessage->setAction(__('Finalizar sesión', false)); - $LogMessage->addDetails(__('Usuario', false), Session::getUserData()->getUserLogin()); + $LogMessage->addDetails(__('Usuario', false), SessionFactory::getUserData()->getUserLogin()); $LogMessage->addDetails(__('Tiempo inactivo', false), $inactiveTime . ' min.'); $LogMessage->addDetails(__('Tiempo total', false), $totalTime . ' min.'); $Log->writeLog(); @@ -655,7 +644,7 @@ class Init */ private static function initSession() { - $lastActivity = Session::getLastActivity(); + $lastActivity = SessionFactory::getLastActivity(); $inMaintenance = Config::getConfig()->isMaintenance(); // Timeout de sesión @@ -673,24 +662,24 @@ class Init return; } - $sidStartTime = Session::getSidStartTime(); + $sidStartTime = SessionFactory::getSidStartTime(); // Regenerar el Id de sesión periódicamente para evitar fijación if ($sidStartTime === 0) { // Intentar establecer el tiempo de vida de la sesión en PHP @ini_set('session.gc_maxlifetime', self::getSessionLifeTime()); - Session::setSidStartTime(time()); - Session::setStartActivity(time()); + SessionFactory::setSidStartTime(time()); + SessionFactory::setStartActivity(time()); } else if (!$inMaintenance && time() - $sidStartTime > 120 - && Session::getUserData()->getUserId() > 0 + && SessionFactory::getUserData()->getUserId() > 0 ) { try { CryptSession::reKey(); // Recargar los permisos del perfil de usuario - Session::setUserProfile(Profile::getItem()->getById(Session::getUserData()->getUserProfileId())); + SessionFactory::setUserProfile(Profile::getItem()->getById(SessionFactory::getUserData()->getUserProfileId())); } catch (CryptoException $e) { debugLog($e->getMessage()); @@ -699,7 +688,7 @@ class Init } } - Session::setLastActivity(time()); + SessionFactory::setLastActivity(time()); } /** @@ -709,11 +698,11 @@ class Init */ private static function getSessionLifeTime() { - $timeout = Session::getSessionTimeout(); + $timeout = SessionFactory::getSessionTimeout(); if (null === $timeout) { $configTimeout = Config::getConfig()->getSessionTimeout(); - Session::setSessionTimeout($configTimeout); + SessionFactory::setSessionTimeout($configTimeout); return $configTimeout; } @@ -721,28 +710,6 @@ class Init return $timeout; } - /** - * Cargar los Plugins disponibles - * - * @throws \SP\Core\Exceptions\SPException - */ - public static function loadPlugins() - { - $PluginsLoader = new \SplClassLoader('Plugins', BASE_DIR); - $PluginsLoader->register(); - - foreach (PluginUtil::getPlugins() as $plugin) { - $Plugin = PluginUtil::loadPlugin($plugin); - - if ($Plugin !== false) { - DiFactory::getEventDispatcher()->attach($Plugin); - } - } - - Session::setPluginsLoaded(PluginUtil::getLoadedPlugins()); - Session::setPluginsDisabled(PluginUtil::getDisabledPlugins()); - } - /** * Comprobar si hay que ejecutar acciones de URL antes de presentar la pantalla de login. * diff --git a/inc/SP/Core/Installer.php b/lib/SP/Core/Installer.php similarity index 90% rename from inc/SP/Core/Installer.php rename to lib/SP/Core/Installer.php index 5fbe836f..93adae9a 100644 --- a/inc/SP/Core/Installer.php +++ b/lib/SP/Core/Installer.php @@ -33,6 +33,7 @@ use SP\Config\ConfigDB; use SP\Core\Crypt\Hash; use SP\Core\Exceptions\InvalidArgumentException; use SP\Core\Exceptions\SPException; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\GroupData; use SP\DataModel\InstallData; use SP\DataModel\ProfileData; @@ -51,11 +52,17 @@ defined('APP_ROOT') || die(); */ class Installer { + use InjectableTrait; + /** * Versión y número de compilación de sysPass */ const VERSION = [2, 2, 0]; const BUILD = 17050101; + /** + * @var Config + */ + protected $Config; /** * @var PDO Instancia de conexión a la BD */ @@ -67,7 +74,7 @@ class Installer /** * @var ConfigData */ - private $Config; + private $ConfigData; /** * Installer constructor. @@ -76,6 +83,8 @@ class Installer */ public function __construct(InstallData $InstallData) { + $this->injectDependencies(); + $this->InstallData = $InstallData; } @@ -89,11 +98,9 @@ class Installer { $this->checkData(); - $this->Config = Config::getConfig(); - // Generate a random salt that is used to salt the local user passwords - $this->Config->setPasswordSalt(Util::generateRandomBytes(30)); - $this->Config->setConfigVersion(Util::getVersionStringNormalized()); + $this->ConfigData->setPasswordSalt(Util::generateRandomBytes(30)); + $this->ConfigData->setConfigVersion(Util::getVersionStringNormalized()); if (preg_match('/unix:(.*)/', $this->InstallData->getDbHost(), $match)) { $this->InstallData->setDbSocket($match[1]); @@ -112,13 +119,13 @@ class Installer } // Set DB connection info - $this->Config->setDbHost($this->InstallData->getDbHost()); - $this->Config->setDbSocket($this->InstallData->getDbSocket()); - $this->Config->setDbPort($this->InstallData->getDbPort()); - $this->Config->setDbName($this->InstallData->getDbName()); + $this->ConfigData->setDbHost($this->InstallData->getDbHost()); + $this->ConfigData->setDbSocket($this->InstallData->getDbSocket()); + $this->ConfigData->setDbPort($this->InstallData->getDbPort()); + $this->ConfigData->setDbName($this->InstallData->getDbName()); // Set site config - $this->Config->setSiteLang($this->InstallData->getSiteLang()); + $this->ConfigData->setSiteLang($this->InstallData->getSiteLang()); $this->connectDatabase(); $this->setupMySQLDatabase(); @@ -127,8 +134,8 @@ class Installer ConfigDB::setValue('version', Util::getVersionStringNormalized()); - $this->Config->setInstalled(true); - Config::saveConfig($this->Config); + $this->ConfigData->setInstalled(true); + $this->Config->saveConfig($this->ConfigData); return true; } @@ -143,42 +150,58 @@ class Installer SPException::SP_CRITICAL, __('Indicar nombre de usuario admin', false), __('Usuario admin para acceso a la aplicación', false)); - } elseif (!$this->InstallData->getAdminPass()) { + } + + if (!$this->InstallData->getAdminPass()) { throw new InvalidArgumentException( SPException::SP_CRITICAL, __('Indicar la clave de admin', false), __('Clave del usuario admin de la aplicación', false)); - } elseif (!$this->InstallData->getMasterPassword()) { + } + + if (!$this->InstallData->getMasterPassword()) { throw new InvalidArgumentException( SPException::SP_CRITICAL, __('Indicar la clave maestra', false), __('Clave maestra para encriptar las claves', false)); - } elseif (strlen($this->InstallData->getMasterPassword()) < 11) { + } + + if (strlen($this->InstallData->getMasterPassword()) < 11) { throw new InvalidArgumentException( SPException::SP_CRITICAL, __('Clave maestra muy corta', false), __('La longitud de la clave maestra ha de ser mayor de 11 caracteres', false)); - } elseif (!$this->InstallData->getDbAdminUser()) { + } + + if (!$this->InstallData->getDbAdminUser()) { throw new InvalidArgumentException( SPException::SP_CRITICAL, __('Indicar el usuario de la BBDD', false), __('Usuario con permisos de administrador de la Base de Datos', false)); - } elseif (!$this->InstallData->getDbAdminPass()) { + } + + if (!$this->InstallData->getDbAdminPass()) { throw new InvalidArgumentException( SPException::SP_CRITICAL, __('Indicar la clave de la BBDD'), __('Clave del usuario administrador de la Base de Datos')); - } elseif (!$this->InstallData->getDbName()) { + } + + if (!$this->InstallData->getDbName()) { throw new InvalidArgumentException( SPException::SP_CRITICAL, __('Indicar el nombre de la BBDD', false), __('Nombre para la BBDD de la aplicación pej. syspass', false)); - } elseif (substr_count($this->InstallData->getDbName(), '.') >= 1) { + } + + if (substr_count($this->InstallData->getDbName(), '.') >= 1) { throw new InvalidArgumentException( SPException::SP_CRITICAL, __('El nombre de la BBDD no puede contener "."', false), __('Elimine los puntos del nombre de la Base de Datos', false)); - } elseif (!$this->InstallData->getDbHost()) { + } + + if (!$this->InstallData->getDbHost()) { throw new InvalidArgumentException( SPException::SP_CRITICAL, __('Indicar el servidor de la BBDD', false), @@ -234,7 +257,7 @@ class Installer // Si no existe el usuario, se intenta crear if ((int)$sth->fetchColumn() === 0 // Se comprueba si el nuevo usuario es distinto del creado en otra instalación - && $this->InstallData->getDbUser() != $this->Config->getDbUser() + && $this->InstallData->getDbUser() != $this->ConfigData->getDbUser() ) { $this->createDBUser(); } @@ -245,12 +268,12 @@ class Installer } // Guardar el nuevo usuario/clave de conexión a la BD - $this->Config->setDbUser($this->InstallData->getDbUser()); - $this->Config->setDbPass($this->InstallData->getDbPass()); + $this->ConfigData->setDbUser($this->InstallData->getDbUser()); + $this->ConfigData->setDbPass($this->InstallData->getDbPass()); } else { // Guardar el usuario/clave de conexión a la BD - $this->Config->setDbUser($this->InstallData->getDbAdminUser()); - $this->Config->setDbPass($this->InstallData->getDbAdminPass()); + $this->ConfigData->setDbUser($this->InstallData->getDbAdminUser()); + $this->ConfigData->setDbPass($this->InstallData->getDbAdminPass()); } try { @@ -495,4 +518,13 @@ class Installer __('Informe al desarrollador', false)); } } + + /** + * @param Config $config + */ + public function inject(Config $config) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + } } \ No newline at end of file diff --git a/inc/SP/Core/ItemsTypeInterface.php b/lib/SP/Core/ItemsTypeInterface.php similarity index 100% rename from inc/SP/Core/ItemsTypeInterface.php rename to lib/SP/Core/ItemsTypeInterface.php diff --git a/inc/SP/Core/Language.php b/lib/SP/Core/Language.php similarity index 79% rename from inc/SP/Core/Language.php rename to lib/SP/Core/Language.php index 1ef4f880..4185f991 100644 --- a/inc/SP/Core/Language.php +++ b/lib/SP/Core/Language.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -25,6 +25,9 @@ namespace SP\Core; use SP\Config\Config; +use SP\Config\ConfigData; +use SP\Core\Session\Session; +use SP\Core\Traits\InjectableTrait; use SP\Http\Request; defined('APP_ROOT') || die(); @@ -36,6 +39,8 @@ defined('APP_ROOT') || die(); */ class Language { + use InjectableTrait; + /** * Lenguaje del usuario * @@ -60,6 +65,30 @@ class Language * @var bool */ protected static $appSet = false; + /** + * @var ConfigData + */ + protected $configData; + /** @var Session */ + protected $session; + + /** + * Language constructor. + */ + public function __construct() + { + $this->injectDependencies(); + } + + /** + * @param Session $session + * @param Config $config + */ + public function inject(Session $session, Config $config) + { + $this->session = $session; + $this->configData = $config->getConfigData(); + } /** * Establecer el lenguaje a utilizar @@ -68,7 +97,7 @@ class Language */ public static function setLanguage($force = false) { - $lang = Session::getLocale(); + $lang = SessionFactory::getLocale(); if (empty($lang) || $force === true) { $Language = new Language(); @@ -78,7 +107,7 @@ class Language $lang = self::$userLang ?: self::$globalLang; - Session::setLocale($lang); + SessionFactory::setLocale($lang); } @@ -92,7 +121,7 @@ class Language */ private function getUserLang() { - return (Session::getUserData()->getUserId() > 0) ? Session::getUserPreferences()->getLang() : ''; + return ($this->session->getUserData()->getUserId() > 0) ? $this->session->getUserPreferences()->getLang() : ''; } /** @@ -102,7 +131,7 @@ class Language private function getGlobalLang() { $browserLang = $this->getBrowserLang(); - $configLang = Config::getConfig()->getSiteLang(); + $configLang = $this->configData->getSiteLang(); // Establecer a en_US si no existe la traducción o no es español if (!$configLang @@ -128,9 +157,9 @@ class Language if ($lang) { return str_replace('-', '_', substr($lang, 0, 5)); - } else { - return ''; } + + return ''; } /** @@ -190,10 +219,10 @@ class Language /** * Establecer el lenguaje global para las traducciones */ - public static function setAppLocales() + public function setAppLocales() { - if (Config::getConfig()->getSiteLang() !== Session::getLocale()) { - self::setLocales(Config::getConfig()->getSiteLang()); + if ($this->configData->getSiteLang() !== SessionFactory::getLocale()) { + self::setLocales($this->configData->getSiteLang()); self::$appSet = true; } } @@ -201,10 +230,10 @@ class Language /** * Restablecer el lenguaje global para las traducciones */ - public static function unsetAppLocales() + public function unsetAppLocales() { if (self::$appSet === true) { - self::setLocales(Session::getLocale()); + self::setLocales(SessionFactory::getLocale()); self::$appSet = false; } } diff --git a/inc/SP/Core/Messages/LogMessage.php b/lib/SP/Core/Messages/LogMessage.php similarity index 100% rename from inc/SP/Core/Messages/LogMessage.php rename to lib/SP/Core/Messages/LogMessage.php diff --git a/inc/SP/Core/Messages/MessageBase.php b/lib/SP/Core/Messages/MessageBase.php similarity index 100% rename from inc/SP/Core/Messages/MessageBase.php rename to lib/SP/Core/Messages/MessageBase.php diff --git a/inc/SP/Core/Messages/MessageInterface.php b/lib/SP/Core/Messages/MessageInterface.php similarity index 100% rename from inc/SP/Core/Messages/MessageInterface.php rename to lib/SP/Core/Messages/MessageInterface.php diff --git a/inc/SP/Core/Messages/NoticeMessage.php b/lib/SP/Core/Messages/NoticeMessage.php similarity index 100% rename from inc/SP/Core/Messages/NoticeMessage.php rename to lib/SP/Core/Messages/NoticeMessage.php diff --git a/inc/SP/Core/Messages/TaskMessage.php b/lib/SP/Core/Messages/TaskMessage.php similarity index 100% rename from inc/SP/Core/Messages/TaskMessage.php rename to lib/SP/Core/Messages/TaskMessage.php diff --git a/inc/SP/Core/OldCrypt.php b/lib/SP/Core/OldCrypt.php similarity index 96% rename from inc/SP/Core/OldCrypt.php rename to lib/SP/Core/OldCrypt.php index 46281b1f..3757436a 100644 --- a/inc/SP/Core/OldCrypt.php +++ b/lib/SP/Core/OldCrypt.php @@ -24,7 +24,9 @@ namespace SP\Core; +use SP\Bootstrap; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\SPException; use SP\Util\Checks; @@ -61,12 +63,15 @@ class OldCrypt */ public static function makeHashSalt($salt = null, $random = true) { + /** @var ConfigData $ConfigData */ + $ConfigData = Bootstrap::getDic()['configData']; + if ($random === true) { $salt = bin2hex(self::getIV()); } elseif ($salt !== null && strlen($salt) < 22) { - $salt .= Config::getConfig()->getPasswordSalt(); + $salt .= $ConfigData->getPasswordSalt(); } elseif ($salt === null) { - $salt = Config::getConfig()->getPasswordSalt(); + $salt = $ConfigData->getPasswordSalt(); } return '$2y$07$' . substr($salt, 0, 22) . '$'; diff --git a/inc/SP/Core/Plugin/PluginBase.php b/lib/SP/Core/Plugin/PluginBase.php similarity index 100% rename from inc/SP/Core/Plugin/PluginBase.php rename to lib/SP/Core/Plugin/PluginBase.php diff --git a/inc/SP/Core/Plugin/PluginDataStore.php b/lib/SP/Core/Plugin/PluginDataStore.php similarity index 100% rename from inc/SP/Core/Plugin/PluginDataStore.php rename to lib/SP/Core/Plugin/PluginDataStore.php diff --git a/inc/SP/Core/Plugin/PluginInterface.php b/lib/SP/Core/Plugin/PluginInterface.php similarity index 100% rename from inc/SP/Core/Plugin/PluginInterface.php rename to lib/SP/Core/Plugin/PluginInterface.php diff --git a/inc/SP/Core/Plugin/PluginUtil.php b/lib/SP/Core/Plugin/PluginUtil.php similarity index 87% rename from inc/SP/Core/Plugin/PluginUtil.php rename to lib/SP/Core/Plugin/PluginUtil.php index 2657cb02..387ff7ab 100644 --- a/inc/SP/Core/Plugin/PluginUtil.php +++ b/lib/SP/Core/Plugin/PluginUtil.php @@ -25,8 +25,9 @@ namespace SP\Core\Plugin; use ReflectionClass; +use SP\Core\DiFactory; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\DataModel\PluginData; use SP\Log\Log; use SP\Mgmt\Plugins\Plugin; @@ -90,7 +91,7 @@ class PluginUtil { $name = ucfirst($name); - if (in_array($name, Session::getPluginsDisabled(), true)) { + if (in_array($name, SessionFactory::getPluginsDisabled(), true)) { return false; } @@ -217,4 +218,26 @@ class PluginUtil return self::$enabledPlugins; } + + /** + * Cargar los Plugins disponibles + * + * @throws \SP\Core\Exceptions\SPException + */ + public static function loadPlugins() + { + $PluginsLoader = new \SplClassLoader('Plugins', PLUGINS_PATH); + $PluginsLoader->register(); + + foreach (PluginUtil::getPlugins() as $plugin) { + $Plugin = PluginUtil::loadPlugin($plugin); + + if ($Plugin !== false) { + DiFactory::getEventDispatcher()->attach($Plugin); + } + } + + SessionFactory::setPluginsLoaded(PluginUtil::getLoadedPlugins()); + SessionFactory::setPluginsDisabled(PluginUtil::getDisabledPlugins()); + } } \ No newline at end of file diff --git a/lib/SP/Core/Session/Session.php b/lib/SP/Core/Session/Session.php new file mode 100644 index 00000000..710a6a3b --- /dev/null +++ b/lib/SP/Core/Session/Session.php @@ -0,0 +1,259 @@ +. + */ + +namespace SP\Core\Session; + +use SP\Account\AccountAcl; +use SP\Account\AccountSearch; +use SP\Config\ConfigData; +use SP\DataModel\ProfileData; +use SP\DataModel\UserData; +use SP\DataModel\UserPreferencesData; +use SP\Mgmt\Users\UserPreferences; + +/** + * Class Session + * + * @package SP\Core\Session + */ +class Session +{ + /** + * Devuelve el tema visual utilizado en sysPass + * + * @return string + */ + public function getTheme() + { + return $this->getSessionKey('theme'); + } + + /** + * Devolver una variable de sesión + * + * @param string $key + * @param mixed $default + * @return mixed + */ + protected function getSessionKey($key, $default = '') + { + if (isset($_SESSION[$key])) { + return is_numeric($default) ? (int)$_SESSION[$key] : $_SESSION[$key]; + } + + return $default; + } + + /** + * Establece el tema visual utilizado en sysPass + * + * @param $theme string El tema visual a utilizar + */ + public function setTheme($theme) + { + $this->setSessionKey('theme', $theme); + } + + /** + * Establecer una variable de sesión + * + * @param string $key El nombre de la variable + * @param mixed $value El valor de la variable + */ + protected function setSessionKey($key, $value) + { + $_SESSION[$key] = $value; + } + + /** + * Devolver la configuración + * + * @return ConfigData + */ + public function getConfig() + { + return $this->getSessionKey('config'); + } + + /** + * Establecer la configuración + * + * @param ConfigData $config + */ + public function setConfig(ConfigData $config) + { + $this->setSessionKey('config', $config); + } + + /** + * Establecer la hora de carga de la configuración + * + * @param $time + */ + public function setConfigTime($time) + { + $this->setSessionKey('configTime', $time); + } + + /** + * Devolver la hora de carga de la configuración + * + * @return int + */ + public function getConfigTime() + { + return $this->getSessionKey('configTime'); + } + + /** + * Establece los datos del usuario en la sesión. + * + * @param UserData $UserData + */ + public function setUserData(UserData $UserData = null) + { + $this->setSessionKey('userData', $UserData); + } + + /** + * Obtiene el objeto de perfil de usuario de la sesión. + * + * @return ProfileData + */ + public function getUserProfile() + { + return $this->getSessionKey('usrprofile'); + } + + /** + * Establece el objeto de perfil de usuario en la sesión. + * + * @param ProfileData $ProfileData + */ + public function setUserProfile(ProfileData $ProfileData) + { + $this->setSessionKey('usrprofile', $ProfileData); + } + + /** + * @return AccountSearch + */ + public function getSearchFilters() + { + return $this->getSessionKey('searchFilters', new AccountSearch()); + } + + /** + * @param AccountSearch $searchFilters + */ + public function setSearchFilters(AccountSearch $searchFilters) + { + $this->setSessionKey('searchFilters', $searchFilters); + } + + /** + * Establece el objeto de preferencias de usuario en la sesión. + * + * @param UserPreferencesData|UserPreferences $preferences + */ + public function setUserPreferences(UserPreferencesData $preferences) + { + $this->setSessionKey('userpreferences', $preferences); + } + + /** + * Establecer la ACL de una cuenta + * + * @param AccountAcl $AccountAcl + */ + public function setAccountAcl(AccountAcl $AccountAcl) + { + $_SESSION['accountAcl'][$AccountAcl->getAccountId()] = $AccountAcl; + } + + /** + * Devolver la ACL de una cuenta + * + * @param $accountId + * + * @return null|AccountAcl + */ + public function getAccountAcl($accountId) + { + if (isset($_SESSION['accountAcl'][$accountId])) { + return $_SESSION['accountAcl'][$accountId]; + } + + return null; + } + + /** + * Returns if user is logged in + * + * @return bool + */ + public function isLoggedIn() + { + return $this->getUserData()->getUserLogin() + && is_object($this->getUserPreferences()); + } + + /** + * Devuelve los datos del usuario en la sesión. + * + * @return UserData + */ + public function getUserData() + { + return $this->getSessionKey('userData', new UserData()); + } + + /** + * Obtiene el objeto de preferencias de usuario de la sesión. + * + * @return UserPreferencesData + */ + public function getUserPreferences() + { + return $this->getSessionKey('userpreferences'); + } + + /** + * Establecer si el usuario está completamente autorizado + * + * @param $bool + */ + public function setAuthCompleted($bool) + { + $this->setSessionKey('authCompleted', (bool)$bool); + } + + /** + * Devolver si el usuario está completamente logeado + */ + public function getAuthCompleted() + { + return $this->getSessionKey('authCompleted', false); + } +} \ No newline at end of file diff --git a/inc/SP/Core/Session.php b/lib/SP/Core/SessionFactory.php similarity index 79% rename from inc/SP/Core/Session.php rename to lib/SP/Core/SessionFactory.php index a94ed6cf..180155fc 100644 --- a/inc/SP/Core/Session.php +++ b/lib/SP/Core/SessionFactory.php @@ -38,7 +38,7 @@ defined('APP_ROOT') || die(); /** * Clase para manejar la variable de sesion */ -class Session +class SessionFactory { /** * Tipos de sesión @@ -122,42 +122,6 @@ class Session return $default; } - /** - * Obtiene el objeto de perfil de usuario de la sesión. - * - * @return ProfileData - */ - public static function getUserProfile() - { - return self::getSessionKey('usrprofile'); - } - - /** - * Establece el objeto de perfil de usuario en la sesión. - * - * @param ProfileData $ProfileData - */ - public static function setUserProfile(ProfileData $ProfileData) - { - self::setSessionKey('usrprofile', $ProfileData); - } - - /** - * @return AccountSearch - */ - public static function getSearchFilters() - { - return self::getSessionKey('searchFilters', new AccountSearch()); - } - - /** - * @param AccountSearch $searchFilters - */ - public static function setSearchFilters(AccountSearch $searchFilters) - { - self::setSessionKey('searchFilters', $searchFilters); - } - /** * Establece si se ha comprobado si hay actualizaciones * @@ -318,26 +282,6 @@ class Session self::setSessionKey('lastAccountId', $id); } - /** - * Devuelve el tema visual utilizado en sysPass - * - * @return string - */ - public static function getTheme() - { - return self::getSessionKey('theme'); - } - - /** - * Establece el tema visual utilizado en sysPass - * - * @param $theme string El tema visual a utilizar - */ - public static function setTheme($theme) - { - self::setSessionKey('theme', $theme); - } - /** * Devolver la clave pública * @@ -378,26 +322,6 @@ class Session return self::getSessionKey('locale'); } - /** - * Obtiene el objeto de preferencias de usuario de la sesión. - * - * @return UserPreferencesData - */ - public static function getUserPreferences() - { - return self::getSessionKey('userpreferences'); - } - - /** - * Establece el objeto de preferencias de usuario en la sesión. - * - * @param UserPreferencesData|UserPreferences $preferences - */ - public static function setUserPreferences(UserPreferencesData $preferences) - { - self::setSessionKey('userpreferences', $preferences); - } - /** * Devolver la clave maestra temporal * @@ -498,46 +422,6 @@ class Session self::setSessionKey('sessiontype', $type); } - /** - * Devolver la configuración - * - * @return ConfigData - */ - public static function getConfig() - { - return self::getSessionKey('config'); - } - - /** - * Establecer la configuración - * - * @param ConfigData $config - */ - public static function setConfig(ConfigData $config) - { - self::setSessionKey('config', $config); - } - - /** - * Establecer la hora de carga de la configuración - * - * @param $time - */ - public static function setConfigTime($time) - { - self::setSessionKey('configTime', $time); - } - - /** - * Devolver la hora de carga de la configuración - * - * @return int - */ - public static function getConfigTime() - { - return self::getSessionKey('configTime'); - } - /** * Establecer los plugins cargados * @@ -582,50 +466,6 @@ class Session unset($_SESSION[$key]); } - /** - * Establecer si el usuario está completamente autorizado - * - * @param $bool - */ - public static function setAuthCompleted($bool) - { - self::setSessionKey('authCompleted', (bool)$bool); - } - - /** - * Devolver si el usuario está completamente logeado - */ - public static function getAuthCompleted() - { - return self::getSessionKey('authCompleted', false); - } - - /** - * Establecer la ACL de una cuenta - * - * @param AccountAcl $AccountAcl - */ - public static function setAccountAcl(AccountAcl $AccountAcl) - { - $_SESSION['accountAcl'][$AccountAcl->getAccountId()] = $AccountAcl; - } - - /** - * Devolver la ACL de una cuenta - * - * @param $accountId - * - * @return null|AccountAcl - */ - public static function getAccountAcl($accountId) - { - if (isset($_SESSION['accountAcl'][$accountId])) { - return $_SESSION['accountAcl'][$accountId]; - } - - return null; - } - /** * Establece si se ha actulizado la aplicación * @@ -707,4 +547,24 @@ class Session { self::setSessionKey('loggedout', $loggedout); } + + /** + * Establecer la hora de carga de la configuración + * + * @param $time + */ + public function setConfigTime($time) + { + self::setSessionKey('configTime', $time); + } + + /** + * Devolver la hora de carga de la configuración + * + * @return int + */ + public function getConfigTime() + { + return self::getSessionKey('configTime'); + } } \ No newline at end of file diff --git a/inc/SP/Core/SessionUtil.php b/lib/SP/Core/SessionUtil.php similarity index 80% rename from inc/SP/Core/SessionUtil.php rename to lib/SP/Core/SessionUtil.php index 71bd6cd6..2c566ef3 100644 --- a/inc/SP/Core/SessionUtil.php +++ b/lib/SP/Core/SessionUtil.php @@ -24,8 +24,10 @@ namespace SP\Core; -use SP\Config\Config; +use SP\Bootstrap; +use SP\Config\ConfigData; use SP\Core\Crypt\Session as CryptSession; +use SP\Core\Session\Session; use SP\DataModel\UserData; use SP\Mgmt\Profiles\Profile; @@ -42,29 +44,30 @@ class SessionUtil * Establece las variables de sesión del usuario. * * @param UserData $UserData + * @param Session $session */ - public static function loadUserSession(UserData $UserData) + public static function loadUserSession(UserData $UserData, Session $session) { - Session::setUserData($UserData); - Session::setUserProfile(Profile::getItem()->getById($UserData->getUserProfileId())); + $session->setUserData($UserData); + $session->setUserProfile(Profile::getItem()->getById($UserData->getUserProfileId())); } /** * Establecer la clave pública RSA en la sessión * - * @throws \phpseclib\Exception\FileNotFoundException * @throws \SP\Core\Exceptions\SPException */ public static function loadPublicKey() { $CryptPKI = new CryptPKI(); - Session::setPublicKey($CryptPKI->getPublicKey()); + SessionFactory::setPublicKey($CryptPKI->getPublicKey()); } /** * Desencriptar la clave maestra de la sesión. * * @return string con la clave maestra + * @throws \Defuse\Crypto\Exception\CryptoException * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException * @throws \Defuse\Crypto\Exception\BadFormatException */ @@ -79,19 +82,24 @@ class SessionUtil * * @param bool $new si es necesrio regenerar el hash * @return string con el hash de verificación + * @throws \Psr\Container\ContainerExceptionInterface */ public static function getSessionKey($new = false) { - // Generamos un nuevo hash si es necesario y lo guardamos en la sesión - if ($new === true || null === Session::getSecurityKey()) { - $hash = sha1(time() . Config::getConfig()->getPasswordSalt()); + // FIXME + /** @var ConfigData $ConfigData */ + $ConfigData = Bootstrap::getDic()->get(ConfigData::class); - Session::setSecurityKey($hash); + // Generamos un nuevo hash si es necesario y lo guardamos en la sesión + if ($new === true || null === SessionFactory::getSecurityKey()) { + $hash = sha1(time() . $ConfigData->getPasswordSalt()); + + SessionFactory::setSecurityKey($hash); return $hash; } - return Session::getSecurityKey(); + return SessionFactory::getSecurityKey(); } /** @@ -102,7 +110,7 @@ class SessionUtil */ public static function checkSessionKey($key) { - return (null !== Session::getSecurityKey() && Session::getSecurityKey() === $key); + return (null !== SessionFactory::getSecurityKey() && SessionFactory::getSecurityKey() === $key); } /** @@ -148,7 +156,7 @@ class SessionUtil public static function regenerate() { session_regenerate_id(true); - Session::setSidStartTime(time()); + SessionFactory::setSidStartTime(time()); } /** diff --git a/inc/SP/Core/Task.php b/lib/SP/Core/Task.php similarity index 100% rename from inc/SP/Core/Task.php rename to lib/SP/Core/Task.php diff --git a/inc/SP/Core/TaskFactory.php b/lib/SP/Core/TaskFactory.php similarity index 100% rename from inc/SP/Core/TaskFactory.php rename to lib/SP/Core/TaskFactory.php diff --git a/inc/SP/Core/Template.php b/lib/SP/Core/Template.php similarity index 89% rename from inc/SP/Core/Template.php rename to lib/SP/Core/Template.php index 61ea347c..7f852a35 100644 --- a/inc/SP/Core/Template.php +++ b/lib/SP/Core/Template.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -29,6 +29,8 @@ defined('APP_ROOT') || die(); use InvalidArgumentException; use SP\Core\Exceptions\FileNotFoundException; use SP\Core\Exceptions\SPException; +use SP\Core\Traits\InjectableTrait; +use SP\Core\UI\Theme; use SP\Core\UI\ThemeInterface; /** @@ -42,10 +44,12 @@ use SP\Core\UI\ThemeInterface; */ class Template { + use InjectableTrait; + /** * @var ThemeInterface */ - protected $Theme; + protected $theme; /** * @var array Variable con los archivos de plantilla a cargar */ @@ -63,8 +67,10 @@ class Template * @param null $file Archivo de plantilla a añadir * @param array $vars Variables a inicializar */ - public function __construct($file = null, array $vars = array()) + public function __construct($file = null, array $vars = []) { + $this->injectDependencies(); + if (null !== $file) { $this->addTemplate($file); } @@ -72,8 +78,6 @@ class Template if (!empty($vars)) { $this->setVars($vars); } - - $this->Theme = DiFactory::getTheme(); } /** @@ -119,7 +123,7 @@ class Template $template .= '.inc'; } - $file = ($useBase === false) ? $this->Theme->getViewsPath() . DIRECTORY_SEPARATOR . $template : $template; + $file = ($useBase === false) ? $this->theme->getViewsPath() . DIRECTORY_SEPARATOR . $template : $template; if (!is_readable($file)) { debugLog(sprintf(__('No es posible obtener la plantilla "%s" : %s'), $file, $template)); @@ -152,6 +156,35 @@ class Template } } + /** + * @param Theme $theme + */ + public function inject(Theme $theme) + { + $this->theme = $theme; + } + + /** + * Add partial template + * + * @param $partial + */ + public function addPartial($partial) + { + $this->addTemplate($partial, '_partials'); + } + + /** + * Añadir una nueva plantilla dentro de una plantilla + * + * @param string $file Con el nombre del archivo de plantilla + * @return bool + */ + public function includePartial($file) + { + $this->includeTemplate($file, '_partials'); + } + /** * Añadir una nueva plantilla dentro de una plantilla * @@ -325,4 +358,12 @@ class Template { $this->base = $base; } + + /** + * @return ThemeInterface + */ + public function getTheme() + { + return $this->theme; + } } \ No newline at end of file diff --git a/lib/SP/Core/Traits/InjectableTrait.php b/lib/SP/Core/Traits/InjectableTrait.php new file mode 100644 index 00000000..548d92bd --- /dev/null +++ b/lib/SP/Core/Traits/InjectableTrait.php @@ -0,0 +1,50 @@ +. + */ + +namespace SP\Core\Traits; + +use SP\Bootstrap; +use SP\Core\Dic\Container; + +/** + * Trait InjectTrait + * + * @package SP\Core\Traits + */ +trait InjectableTrait +{ + /** + * @var Container + */ + protected $dic; + + protected function injectDependencies() + { + $this->dic = Bootstrap::getDic(); + + if (method_exists($this, 'inject')) { + $this->dic->inject($this); + } + } +} \ No newline at end of file diff --git a/inc/SP/Core/UI/Theme.php b/lib/SP/Core/UI/Theme.php similarity index 72% rename from inc/SP/Core/UI/Theme.php rename to lib/SP/Core/UI/Theme.php index 93071f94..be0ae250 100644 --- a/inc/SP/Core/UI/Theme.php +++ b/lib/SP/Core/UI/Theme.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -24,9 +24,13 @@ namespace SP\Core\UI; +use Pimple\Container; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Init; -use SP\Core\Session; +use SP\Core\Session\Session; +use SP\Core\SessionFactory; +use SP\Core\Traits\InjectableTrait; use Theme\Icons; defined('APP_ROOT') || die(); @@ -38,6 +42,8 @@ defined('APP_ROOT') || die(); */ class Theme implements ThemeInterface { + use InjectableTrait; + /** * @var string */ @@ -62,14 +68,32 @@ class Theme implements ThemeInterface * @var ThemeIconsInterface */ protected $icons; + /** + * @var ConfigData + */ + protected $configData; + /** + * @var Session + */ + protected $session; + /** + * @var string + */ + protected $module; /** * Theme constructor. + * + * @param $module */ - public function __construct() + public function __construct($module) { - $this->initTheme(); - $this->initIcons(); + $this->injectDependencies(); + + if (is_dir(VIEW_PATH)) { + $this->initTheme(); + $this->initIcons(); + } } /** @@ -80,15 +104,15 @@ class Theme implements ThemeInterface */ public function initTheme($force = false) { - $this->themeName = Session::getTheme(); + $this->themeName = $this->session->getTheme(); if (empty($this->themeName) || $force === true) { $this->themeName = $this->getUserTheme() ?: $this->getGlobalTheme(); - Session::setTheme($this->themeName); + $this->session->setTheme($this->themeName); } - $this->themeUri = Init::$WEBURI . '/inc/themes/' . $this->themeName; - $this->themePath = DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $this->themeName; + $this->themeUri = Init::$WEBURI . '/app/modules/' . $this->module . 'themes' . $this->themeName; + $this->themePath = str_replace(APP_ROOT, '', VIEW_PATH) . DIRECTORY_SEPARATOR . $this->themeName; $this->themePathFull = VIEW_PATH . DIRECTORY_SEPARATOR . $this->themeName; $this->viewsPath = $this->themePathFull . DIRECTORY_SEPARATOR . 'views'; } @@ -100,7 +124,7 @@ class Theme implements ThemeInterface */ protected function getUserTheme() { - return (Session::getUserData()->getUserId() > 0) ? Session::getUserPreferences()->getTheme() : ''; + return ($this->session->getUserData()->getUserId() > 0) ? $this->session->getUserPreferences()->getTheme() : ''; } /** @@ -108,9 +132,7 @@ class Theme implements ThemeInterface */ protected function getGlobalTheme() { - $this->themeName = Config::getConfig()->getSiteTheme(); - - return $this->themeName; + return $this->configData->getSiteTheme(); } /** @@ -123,7 +145,7 @@ class Theme implements ThemeInterface $iconsClass = $this->themePathFull . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Icons.php'; if (file_exists($iconsClass)) { - include_once $iconsClass; + require $iconsClass; $this->icons = new Icons(); } @@ -131,6 +153,16 @@ class Theme implements ThemeInterface return $this->icons; } + /** + * @param Config $config + * @param Session $session + */ + public function inject(Config $config, Session $session) + { + $this->configData = $config->getConfigData(); + $this->session = $session; + } + /** * Obtener los temas disponibles desde el directorio de temas * @@ -143,11 +175,11 @@ class Theme implements ThemeInterface $themesDirs = dir(VIEW_PATH); while (false !== ($themeDir = $themesDirs->read())) { - if ($themeDir != '.' && $themeDir != '..') { - $themeFile = VIEW_PATH . DIRECTORY_SEPARATOR . $themeDir . DIRECTORY_SEPARATOR . 'index.php'; + if ($themeDir !== '.' && $themeDir !== '..') { + $themeFile = $this->themePathFull . DIRECTORY_SEPARATOR . 'index.php'; if (file_exists($themeFile)) { - include $themeFile; + $themeInfo = require $themeFile; $themesAvailable[$themeDir] = $themeInfo['name']; } @@ -173,13 +205,12 @@ class Theme implements ThemeInterface public function getThemeInfo() { $themeFile = $this->themePathFull . DIRECTORY_SEPARATOR . 'index.php'; - $themeInfo = array(); if (file_exists($themeFile)) { - include $themeFile; + return include $themeFile; } - return $themeInfo; + return []; } /** diff --git a/inc/SP/Core/UI/ThemeIconsBase.php b/lib/SP/Core/UI/ThemeIconsBase.php similarity index 100% rename from inc/SP/Core/UI/ThemeIconsBase.php rename to lib/SP/Core/UI/ThemeIconsBase.php diff --git a/inc/SP/Core/UI/ThemeIconsInterface.php b/lib/SP/Core/UI/ThemeIconsInterface.php similarity index 100% rename from inc/SP/Core/UI/ThemeIconsInterface.php rename to lib/SP/Core/UI/ThemeIconsInterface.php diff --git a/inc/SP/Core/UI/ThemeInterface.php b/lib/SP/Core/UI/ThemeInterface.php similarity index 98% rename from inc/SP/Core/UI/ThemeInterface.php rename to lib/SP/Core/UI/ThemeInterface.php index 485f61f2..de22d818 100644 --- a/inc/SP/Core/UI/ThemeInterface.php +++ b/lib/SP/Core/UI/ThemeInterface.php @@ -73,7 +73,7 @@ interface ThemeInterface public function getThemeName(); /** - * @return ThemeIconsInterface + * @return ThemeIconsBase */ public function getIcons(); diff --git a/inc/SP/Core/Upgrade/Account.php b/lib/SP/Core/Upgrade/Account.php similarity index 88% rename from inc/SP/Core/Upgrade/Account.php rename to lib/SP/Core/Upgrade/Account.php index 01538346..648cbd3a 100644 --- a/inc/SP/Core/Upgrade/Account.php +++ b/lib/SP/Core/Upgrade/Account.php @@ -26,7 +26,7 @@ namespace SP\Core\Upgrade; use SP\Core\Exceptions\SPException; use SP\Core\TaskFactory; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -48,26 +48,26 @@ class Account TaskFactory::sendTaskMessage(); try { - DB::beginTransaction(); + DbWrapper::beginTransaction(); $Data = new QueryData(); $query = /** @lang SQL */ 'DELETE FROM accUsers WHERE accuser_accountId NOT IN (SELECT account_id FROM accounts) OR accuser_accountId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'DELETE FROM accGroups WHERE accgroup_accountId NOT IN (SELECT account_id FROM accounts) OR accgroup_accountId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - DB::endTransaction(); + DbWrapper::endTransaction(); return true; } catch (SPException $e) { - DB::rollbackTransaction(); + DbWrapper::rollbackTransaction(); return false; } diff --git a/inc/SP/Core/Upgrade/Category.php b/lib/SP/Core/Upgrade/Category.php similarity index 89% rename from inc/SP/Core/Upgrade/Category.php rename to lib/SP/Core/Upgrade/Category.php index bedc5c3a..012ac8d3 100644 --- a/inc/SP/Core/Upgrade/Category.php +++ b/lib/SP/Core/Upgrade/Category.php @@ -26,7 +26,7 @@ namespace SP\Core\Upgrade; use SP\Core\Exceptions\SPException; use SP\Core\TaskFactory; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -49,7 +49,7 @@ class Category TaskFactory::sendTaskMessage(); try { - DB::beginTransaction(); + DbWrapper::beginTransaction(); if ($categoryId === 0) { $categoryId = self::createOrphanCategory(); @@ -62,19 +62,19 @@ class Category 'UPDATE accHistory SET acchistory_categoryId = ? WHERE acchistory_categoryId NOT IN (SELECT category_id FROM categories ORDER BY category_id) OR acchistory_categoryId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'UPDATE accounts SET account_categoryId = ? WHERE account_categoryId NOT IN (SELECT category_id FROM categories ORDER BY category_id) OR account_categoryId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - DB::endTransaction(); + DbWrapper::endTransaction(); return true; } catch (SPException $e) { - DB::rollbackTransaction(); + DbWrapper::rollbackTransaction(); return false; } @@ -96,8 +96,8 @@ class Category $Data->setQuery($query); $Data->setOnErrorMessage(__('Error al crear la categoría', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - return DB::getLastId(); + return DbWrapper::getLastId(); } } \ No newline at end of file diff --git a/inc/SP/Core/Upgrade/Check.php b/lib/SP/Core/Upgrade/Check.php similarity index 97% rename from inc/SP/Core/Upgrade/Check.php rename to lib/SP/Core/Upgrade/Check.php index dc85ab3c..22d88244 100644 --- a/inc/SP/Core/Upgrade/Check.php +++ b/lib/SP/Core/Upgrade/Check.php @@ -24,7 +24,7 @@ namespace SP\Core\Upgrade; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -58,6 +58,6 @@ class Check $Data = new QueryData(); $Data->setQuery($query); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } } \ No newline at end of file diff --git a/inc/SP/Core/Upgrade/Crypt.php b/lib/SP/Core/Upgrade/Crypt.php similarity index 96% rename from inc/SP/Core/Upgrade/Crypt.php rename to lib/SP/Core/Upgrade/Crypt.php index 7f6f2b95..127ca6cb 100644 --- a/inc/SP/Core/Upgrade/Crypt.php +++ b/lib/SP/Core/Upgrade/Crypt.php @@ -33,7 +33,7 @@ use SP\Core\Exceptions\SPException; use SP\Log\Log; use SP\Mgmt\CustomFields\CustomFieldsUtil; use SP\Mgmt\Users\UserMigrate; -use SP\Storage\DB; +use SP\Storage\DbWrapper; /** * Class Crypt @@ -54,7 +54,7 @@ class Crypt try { AccountHistoryCrypt::$currentMPassHash = ConfigDB::getValue('masterPwd'); - if (!DB::beginTransaction()) { + if (!DbWrapper::beginTransaction()) { throw new SPException(SPException::SP_ERROR, __('No es posible iniciar una transacción', false)); } @@ -66,7 +66,7 @@ class Crypt self::migrateCustomFields($masterPass); UserMigrate::setMigrateUsers(); - if (!DB::endTransaction()) { + if (!DbWrapper::endTransaction()) { throw new SPException(SPException::SP_ERROR, __('No es posible finalizar una transacción', false)); } @@ -74,7 +74,7 @@ class Crypt return true; } catch (\Exception $e) { - if (DB::rollbackTransaction()) { + if (DbWrapper::rollbackTransaction()) { debugLog('Rollback: ' . __METHOD__); } diff --git a/inc/SP/Core/Upgrade/Customer.php b/lib/SP/Core/Upgrade/Customer.php similarity index 89% rename from inc/SP/Core/Upgrade/Customer.php rename to lib/SP/Core/Upgrade/Customer.php index b3bec748..72ff410f 100644 --- a/inc/SP/Core/Upgrade/Customer.php +++ b/lib/SP/Core/Upgrade/Customer.php @@ -26,7 +26,7 @@ namespace SP\Core\Upgrade; use SP\Core\Exceptions\SPException; use SP\Core\TaskFactory; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -49,7 +49,7 @@ class Customer TaskFactory::sendTaskMessage(); try { - DB::beginTransaction(); + DbWrapper::beginTransaction(); if ($customerId === 0) { $customerId = self::createOrphanCustomer(); @@ -62,19 +62,19 @@ class Customer 'UPDATE accHistory SET acchistory_customerId = ? WHERE acchistory_customerId NOT IN (SELECT customer_id FROM customers ORDER BY customer_id) OR acchistory_customerId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'UPDATE accounts SET account_customerId = ? WHERE account_customerId NOT IN (SELECT customer_id FROM customers ORDER BY customer_id) OR account_customerId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - DB::endTransaction(); + DbWrapper::endTransaction(); return true; } catch (SPException $e) { - DB::rollbackTransaction(); + DbWrapper::rollbackTransaction(); return false; } @@ -97,8 +97,8 @@ class Customer $Data->setQuery($query); $Data->setOnErrorMessage(__('Error al crear el cliente', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - return DB::getLastId(); + return DbWrapper::getLastId(); } } \ No newline at end of file diff --git a/inc/SP/Core/Upgrade/Group.php b/lib/SP/Core/Upgrade/Group.php similarity index 89% rename from inc/SP/Core/Upgrade/Group.php rename to lib/SP/Core/Upgrade/Group.php index 8404fed8..4c406f79 100644 --- a/inc/SP/Core/Upgrade/Group.php +++ b/lib/SP/Core/Upgrade/Group.php @@ -26,7 +26,7 @@ namespace SP\Core\Upgrade; use SP\Core\Exceptions\SPException; use SP\Core\TaskFactory; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -52,7 +52,7 @@ class Group TaskFactory::sendTaskMessage(); try { - DB::beginTransaction(); + DbWrapper::beginTransaction(); if ($groupId === 0){ $groupId = self::$orphanGroupId ?: self::createOrphanGroup(); @@ -65,32 +65,32 @@ class Group 'UPDATE accounts SET account_userGroupId = ? WHERE account_userGroupId NOT IN (SELECT usergroup_id FROM usrGroups ORDER BY usergroup_id) OR account_userGroupId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'UPDATE accHistory SET acchistory_userGroupId = ? WHERE acchistory_userGroupId NOT IN (SELECT usergroup_id FROM usrGroups ORDER BY usergroup_id) OR acchistory_userGroupId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'UPDATE usrData SET user_groupId = ? WHERE user_groupId NOT IN (SELECT usergroup_id FROM usrGroups ORDER BY usergroup_id) OR user_groupId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'DELETE FROM usrToGroups WHERE usertogroup_groupId NOT IN (SELECT usergroup_id FROM usrGroups ORDER BY usergroup_id) OR usertogroup_groupId IS NULL'; $Data->setQuery($query); $Data->setParams([]); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - DB::endTransaction(); + DbWrapper::endTransaction(); return true; } catch (SPException $e) { - DB::rollbackTransaction(); + DbWrapper::rollbackTransaction(); return false; } @@ -114,9 +114,9 @@ class Group $Data->setQuery($query); $Data->setOnErrorMessage(__('Error al crear el grupo', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - self::$orphanGroupId = DB::getLastId(); + self::$orphanGroupId = DbWrapper::getLastId(); return self::$orphanGroupId; } diff --git a/inc/SP/Core/Upgrade/Profile.php b/lib/SP/Core/Upgrade/Profile.php similarity index 90% rename from inc/SP/Core/Upgrade/Profile.php rename to lib/SP/Core/Upgrade/Profile.php index ffe8db8a..eba41566 100644 --- a/inc/SP/Core/Upgrade/Profile.php +++ b/lib/SP/Core/Upgrade/Profile.php @@ -27,7 +27,7 @@ namespace SP\Core\Upgrade; use SP\Core\Exceptions\SPException; use SP\Core\TaskFactory; use SP\DataModel\ProfileData; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -54,7 +54,7 @@ class Profile TaskFactory::$Message->setMessage(__('Actualizando IDs de perfil')); TaskFactory::sendTaskMessage(); - DB::beginTransaction(); + DbWrapper::beginTransaction(); if ($profileId === 0){ $profileId = self::$orphanProfileId ?: self::createOrphanProfile(); @@ -65,13 +65,13 @@ class Profile $Data->setQuery($query); $Data->addParam($profileId); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - DB::endTransaction(); + DbWrapper::endTransaction(); return true; } catch (SPException $e) { - DB::rollbackTransaction(); + DbWrapper::rollbackTransaction(); return false; } @@ -96,9 +96,9 @@ class Profile $Data->addParam(serialize(new ProfileData())); $Data->setOnErrorMessage(__('Error al crear perfil', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - self::$orphanProfileId = DB::getLastId(); + self::$orphanProfileId = DbWrapper::getLastId(); return self::$orphanProfileId; } diff --git a/inc/SP/Core/Upgrade/Upgrade.php b/lib/SP/Core/Upgrade/Upgrade.php similarity index 80% rename from inc/SP/Core/Upgrade/Upgrade.php rename to lib/SP/Core/Upgrade/Upgrade.php index b92fff02..9d022a5c 100644 --- a/inc/SP/Core/Upgrade/Upgrade.php +++ b/lib/SP/Core/Upgrade/Upgrade.php @@ -31,8 +31,9 @@ use SP\Config\ConfigDB; use SP\Controller\MainActionController; use SP\Core\Exceptions\SPException; use SP\Core\Init; -use SP\Core\Session as CoreSession; +use SP\Core\SessionFactory as CoreSession; use SP\Core\TaskFactory; +use SP\Core\Traits\InjectableTrait; use SP\Core\Upgrade\User as UserUpgrade; use SP\Http\Request; use SP\Log\Email; @@ -42,7 +43,7 @@ use SP\Mgmt\Profiles\ProfileUtil; use SP\Mgmt\Users\User; use SP\Mgmt\Users\UserMigrate; use SP\Mgmt\Users\UserPreferencesUtil; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Util; @@ -53,6 +54,8 @@ defined('APP_ROOT') || die(); */ class Upgrade { + use InjectableTrait; + /** * @var array Versiones actualizables */ @@ -65,6 +68,27 @@ class Upgrade */ private static $currentDbVersion; + /** + * @var Config + */ + protected $Config; + /** + * @var ConfigData + */ + protected $ConfigData; + /** + * @var Log + */ + protected $Log; + + /** + * Upgrade constructor. + */ + public function __construct() + { + $this->injectDependencies(); + } + /** * Inicia el proceso de actualización de la BBDD. * @@ -72,19 +96,19 @@ class Upgrade * @return bool * @throws SPException */ - public static function doUpgrade($version) + public function doUpgrade($version) { self::$currentDbVersion = self::fixVersionNumber(ConfigDB::getValue('version')); foreach (self::$dbUpgrade as $dbVersion) { if (Util::checkVersion($version, $dbVersion)) { - if (self::auxPreDbUpgrade($dbVersion) === false) { + if ($this->auxPreDbUpgrade($dbVersion) === false) { throw new SPException(SPException::SP_CRITICAL, __('Error al aplicar la actualización auxiliar', false), __('Compruebe el registro de eventos para más detalles', false)); } - if (self::upgradeDB($dbVersion) === false) { + if ($this->upgradeDB($dbVersion) === false) { throw new SPException(SPException::SP_CRITICAL, __('Error al aplicar la actualización de la Base de Datos', false), __('Compruebe el registro de eventos para más detalles', false)); @@ -94,7 +118,7 @@ class Upgrade foreach (self::$appUpgrade as $appVersion) { if (Util::checkVersion($version, $appVersion) - && self::appUpgrades($appVersion) === false + && $this->appUpgrades($appVersion) === false ) { throw new SPException(SPException::SP_CRITICAL, __('Error al aplicar la actualización de la aplicación', false), @@ -104,7 +128,7 @@ class Upgrade foreach (self::$auxUpgrade as $auxVersion) { if (Util::checkVersion($version, $auxVersion) - && self::auxUpgrades($auxVersion) === false + && $this->auxUpgrades($auxVersion) === false ) { throw new SPException(SPException::SP_CRITICAL, __('Error al aplicar la actualización auxiliar', false), @@ -140,13 +164,13 @@ class Upgrade * @param $version * @return bool */ - private static function auxPreDbUpgrade($version) + private function auxPreDbUpgrade($version) { switch ($version) { case '130.16011001': debugLog(__FUNCTION__ . ': ' . $version); - return self::upgradeDB('130.00000000'); + return $this->upgradeDB('130.00000000'); case '130.16100601': debugLog(__FUNCTION__ . ': ' . $version); @@ -168,14 +192,13 @@ class Upgrade * @param int $version con la versión a actualizar * @returns bool */ - private static function upgradeDB($version) + private function upgradeDB($version) { - $Log = new Log(); - $LogMessage = $Log->getLogMessage(); + $LogMessage = $this->Log->getLogMessage(); $LogMessage->setAction(__('Actualizar BBDD', false)); $LogMessage->addDetails(__('Versión', false), $version); - $queries = self::getQueriesFromFile($version); + $queries = $this->getQueriesFromFile($version); if (count($queries) === 0 || Util::checkVersion(self::$currentDbVersion, $version) === false) { $LogMessage->addDescription(__('No es necesario actualizar la Base de Datos.', false)); @@ -196,12 +219,12 @@ class Upgrade foreach ($queries as $query) { try { $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); } catch (SPException $e) { $LogMessage->addDescription(__('Error al aplicar la actualización de la Base de Datos', false)); $LogMessage->addDetails('ERROR', sprintf('%s (%s)', $e->getMessage(), $e->getCode())); - $Log->setLogLevel(Log::ERROR); - $Log->writeLog(); + $this->Log->setLogLevel(Log::ERROR); + $this->Log->writeLog(); Email::sendEmail($LogMessage); return false; @@ -213,7 +236,7 @@ class Upgrade self::$currentDbVersion = $version; $LogMessage->addDescription(__('Actualización de la Base de Datos realizada correctamente.', false)); - $Log->writeLog(); + $this->Log->writeLog(); Email::sendEmail($LogMessage); @@ -226,7 +249,7 @@ class Upgrade * @param $filename * @return array|bool */ - private static function getQueriesFromFile($filename) + private function getQueriesFromFile($filename) { $file = SQL_PATH . DIRECTORY_SEPARATOR . str_replace('.', '', $filename) . '.sql'; @@ -252,14 +275,14 @@ class Upgrade * @return bool * @throws \SP\Core\Exceptions\SPException */ - private static function appUpgrades($version) + private function appUpgrades($version) { switch ($version) { case '210.17022601': $dbResult = true; if (Util::checkVersion(self::$currentDbVersion, $version)) { - $dbResult = self::upgradeDB($version); + $dbResult = $this->upgradeDB($version); } $masterPass = Request::analyzeEncrypted('masterkey'); @@ -285,7 +308,7 @@ class Upgrade * @param $version int El número de versión * @return bool */ - private static function auxUpgrades($version) + private function auxUpgrades($version) { try { switch ($version) { @@ -319,7 +342,7 @@ class Upgrade * @param int $version con el número de versión actual * @returns bool */ - public static function needConfigUpgrade($version) + public function needConfigUpgrade($version) { return Util::checkVersion($version, self::$cfgUpgrade); } @@ -330,10 +353,9 @@ class Upgrade * @param int $version El número de versión * @return bool */ - public static function upgradeConfig($version) + public function upgradeConfig($version) { $count = 0; - $Config = Config::getConfig(); foreach (self::$cfgUpgrade as $upgradeVersion) { if (Util::checkVersion($version, $upgradeVersion)) { @@ -341,9 +363,9 @@ class Upgrade case '200.17011202': debugLog(__FUNCTION__ . ': ' . $version); - $Config->setSiteTheme('material-blue'); - $Config->setConfigVersion($upgradeVersion); - Config::saveConfig($Config, false); + $this->ConfigData->setSiteTheme('material-blue'); + $this->ConfigData->setConfigVersion($upgradeVersion); + $this->Config->saveConfig(null, false); $count++; break; } @@ -359,31 +381,33 @@ class Upgrade * @param $version * @return bool */ - public static function upgradeOldConfigFile($version) + public function upgradeOldConfigFile($version) { - $Log = new Log(); - $LogMessage = $Log->getLogMessage(); + $LogMessage = $this->Log->getLogMessage(); $LogMessage->setAction(__('Actualizar Configuración', false)); - $Config = new ConfigData(); - // Include the file, save the data from $CONFIG include CONFIG_FILE; if (isset($CONFIG) && is_array($CONFIG)) { + + $paramMapper = function ($mapFrom, $mapTo) use ($CONFIG, $LogMessage) { + if (isset($CONFIG[$mapFrom])) { + $LogMessage->addDetails(__('Parámetro', false), $mapFrom); + $this->ConfigData->{$mapTo}($CONFIG[$mapFrom]); + } + }; + foreach (self::getConfigParams() as $mapTo => $mapFrom) { - if (method_exists($Config, $mapTo)) { + if (method_exists($this->ConfigData, $mapTo)) { if (is_array($mapFrom)) { + /** @var array $mapFrom */ foreach ($mapFrom as $param) { - if (isset($CONFIG[$param])) { - $LogMessage->addDetails(__('Parámetro', false), $param); - $Config->$mapTo($CONFIG[$param]); - } + $paramMapper($mapFrom, $param); } } else { if (isset($CONFIG[$mapFrom])) { - $LogMessage->addDetails(__('Parámetro', false), $mapFrom); - $Config->$mapTo($CONFIG[$mapFrom]); + $paramMapper($mapFrom, $mapTo); } } } @@ -394,21 +418,22 @@ class Upgrade try { - $Config->setSiteTheme('material-blue'); - $Config->setConfigVersion($version); - Config::saveConfig($Config, false); + $this->ConfigData->setSiteTheme('material-blue'); + $this->ConfigData->setConfigVersion($version); + $this->Config->saveConfig(null, false); + rename(CONFIG_FILE, $oldFile); $LogMessage->addDetails(__('Versión', false), $version); - $Log->setLogLevel(Log::NOTICE); - $Log->writeLog(); + $this->Log->setLogLevel(Log::NOTICE); + $this->Log->writeLog(); return true; } catch (\Exception $e) { $LogMessage->addDescription(__('Error al actualizar la configuración', false)); $LogMessage->addDetails(__('Archivo', false), $oldFile); - $Log->setLogLevel(Log::ERROR); - $Log->writeLog(); + $this->Log->setLogLevel(Log::ERROR); + $this->Log->writeLog(); } // We are here...wrong @@ -483,7 +508,7 @@ class Upgrade * * @return int|false */ - public static function checkDbVersion() + public function checkDbVersion() { $appVersion = Util::getVersionStringNormalized(); $databaseVersion = self::fixVersionNumber(ConfigDB::getValue('version')); @@ -493,7 +518,7 @@ class Upgrade && Util::checkVersion($databaseVersion, self::$dbUpgrade) ) { if (!Init::checkMaintenanceMode(true)) { - self::setUpgradeKey('db'); + $this->setUpgradeKey('db'); } else { $Controller = new MainActionController(); $Controller->doAction($databaseVersion); @@ -509,33 +534,37 @@ class Upgrade * Establecer la key de actualización * * @param string $type Tipo de actualización + * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException */ - private static function setUpgradeKey($type) + private function setUpgradeKey($type) { - $upgradeKey = Config::getConfig()->getUpgradeKey(); + $upgradeKey = $this->ConfigData->getUpgradeKey(); if (empty($upgradeKey)) { - Config::getConfig()->setUpgradeKey(Util::generateRandomBytes(32)); + $this->ConfigData->setUpgradeKey(Util::generateRandomBytes(32)); } - Config::getConfig()->setMaintenance(true); - Config::saveConfig(null, false); + $this->ConfigData->setMaintenance(true); + $this->Config->saveConfig(null, false); - Init::initError(__('La aplicación necesita actualizarse'), sprintf(__('Si es un administrador pulse en el enlace: %s'), '' . __('Actualizar') . '')); + Init::initError( + __('La aplicación necesita actualizarse'), + sprintf(__('Si es un administrador pulse en el enlace: %s'), '' . __('Actualizar') . '')); } /** * Comrpueba y actualiza la versión de la aplicación. * * @return int|false + * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException */ - public static function checkAppVersion() + public function checkAppVersion() { - $appVersion = self::fixVersionNumber(Config::getConfig()->getConfigVersion()); + $appVersion = self::fixVersionNumber($this->ConfigData->getConfigVersion()); if (Util::checkVersion($appVersion, self::$appUpgrade)) { if (!Init::checkMaintenanceMode(true)) { - self::setUpgradeKey('app'); + $this->setUpgradeKey('app'); } else { $Controller = new MainActionController(); $Controller->doAction($appVersion); @@ -546,4 +575,15 @@ class Upgrade return false; } + + /** + * @param Config $config + * @param Log $log + */ + public function inject(Config $config, Log $log) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + $this->Log = $log; + } } \ No newline at end of file diff --git a/inc/SP/Core/Upgrade/User.php b/lib/SP/Core/Upgrade/User.php similarity index 90% rename from inc/SP/Core/Upgrade/User.php rename to lib/SP/Core/Upgrade/User.php index 2685ddd3..4a88c57c 100644 --- a/inc/SP/Core/Upgrade/User.php +++ b/lib/SP/Core/Upgrade/User.php @@ -30,7 +30,7 @@ use SP\Core\OldCrypt; use SP\Core\TaskFactory; use SP\DataModel\UserLoginData; use SP\Mgmt\Users\UserPass; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -53,12 +53,12 @@ class User TaskFactory::sendTaskMessage(); try { - DB::beginTransaction(); + DbWrapper::beginTransaction(); $Data = new QueryData(); $Data->setQuery('SELECT user_id FROM usrData ORDER BY user_id'); - $users = DB::getResultsArray($Data); + $users = DbWrapper::getResultsArray($Data); $paramsIn = trim(str_repeat(',?', count($users)), ','); @@ -78,49 +78,49 @@ class User 'UPDATE accounts SET account_userId = ? WHERE account_userId NOT IN (' . $paramsIn . ') OR account_userId IS NULL '; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'UPDATE accounts SET account_userEditId = ? WHERE account_userEditId NOT IN (' . $paramsIn . ') OR account_userEditId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'UPDATE accHistory SET acchistory_userId = ? WHERE acchistory_userId NOT IN (' . $paramsIn . ') OR acchistory_userId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'UPDATE accHistory SET acchistory_userEditId = ? WHERE acchistory_userEditId NOT IN (' . $paramsIn . ') OR acchistory_userEditId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'DELETE FROM usrPassRecover WHERE userpassr_userId <> ? AND userpassr_userId NOT IN (' . $paramsIn . ')'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'DELETE FROM usrToGroups WHERE usertogroup_userId <> ? AND usertogroup_userId NOT IN (' . $paramsIn . ') OR usertogroup_userId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'DELETE FROM accUsers WHERE accuser_userId <> ? AND accuser_userId NOT IN (' . $paramsIn . ') OR accuser_userId IS NULL'; $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - DB::endTransaction(); + DbWrapper::endTransaction(); return true; } catch (SPException $e) { - DB::rollbackTransaction(); + DbWrapper::rollbackTransaction(); return false; } @@ -155,9 +155,9 @@ class User $Data->addParam($profileId); $Data->setOnErrorMessage(__('Error al crear el usuario', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - return DB::getLastId(); + return DbWrapper::getLastId(); } /** diff --git a/inc/SP/Core/XmlExport.php b/lib/SP/Core/XmlExport.php similarity index 95% rename from inc/SP/Core/XmlExport.php rename to lib/SP/Core/XmlExport.php index a675b1cb..8f66d21e 100644 --- a/inc/SP/Core/XmlExport.php +++ b/lib/SP/Core/XmlExport.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -28,9 +28,11 @@ use Defuse\Crypto\Exception\CryptoException; use SP\Account\AccountTags; use SP\Account\AccountUtil; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Crypt\Crypt; use SP\Core\Crypt\Hash; use SP\Core\Exceptions\SPException; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\CategoryData; use SP\Log\Email; use SP\Log\Log; @@ -48,6 +50,15 @@ defined('APP_ROOT') || die(); */ class XmlExport { + use InjectableTrait; + /** + * @var ConfigData + */ + protected $ConfigData; + /** + * @var Config + */ + protected $Config; /** * @var \DOMDocument */ @@ -78,6 +89,8 @@ class XmlExport */ public function __construct() { + $this->injectDependencies(); + $this->xml = new \DOMDocument('1.0', 'UTF-8'); } @@ -89,7 +102,7 @@ class XmlExport */ public static function doExport($pass = null) { - $xml = new XmlExport(); + $xml = new self(); if (null !== $pass && !empty($pass)) { $xml->setExportPass($pass); @@ -136,8 +149,8 @@ class XmlExport { // Generar hash unico para evitar descargas no permitidas $exportUniqueHash = sha1(uniqid('sysPassExport', true)); - Config::getConfig()->setExportHash($exportUniqueHash); - Config::saveConfig(); + $this->ConfigData->setExportHash($exportUniqueHash); + $this->Config->saveConfig(); $this->exportFile = $this->exportDir . DIRECTORY_SEPARATOR . Util::getAppInfo('appname') . '-' . $exportUniqueHash . '.xml'; } @@ -238,10 +251,10 @@ class XmlExport $metaGenerator = $this->xml->createElement('Generator', 'sysPass'); $metaVersion = $this->xml->createElement('Version', Util::getVersionStringNormalized()); $metaTime = $this->xml->createElement('Time', time()); - $metaUser = $this->xml->createElement('User', Session::getUserData()->getUserLogin()); - $metaUser->setAttribute('id', Session::getUserData()->getUserId()); - $metaGroup = $this->xml->createElement('Group', Session::getUserData()->getUsergroupName()); - $metaGroup->setAttribute('id', Session::getUserData()->getUserGroupId()); + $metaUser = $this->xml->createElement('User', SessionFactory::getUserData()->getUserLogin()); + $metaUser->setAttribute('id', SessionFactory::getUserData()->getUserId()); + $metaGroup = $this->xml->createElement('Group', SessionFactory::getUserData()->getUsergroupName()); + $metaGroup->setAttribute('id', SessionFactory::getUserData()->getUserGroupId()); $nodeMeta->appendChild($metaGenerator); $nodeMeta->appendChild($metaVersion); @@ -546,4 +559,13 @@ class XmlExport throw new SPException(SPException::SP_WARNING, $e->getMessage(), __FUNCTION__); } } + + /** + * @param Config $config + */ + public function inject(Config $config) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + } } \ No newline at end of file diff --git a/inc/SP/DataModel/AccountData.php b/lib/SP/DataModel/AccountData.php similarity index 100% rename from inc/SP/DataModel/AccountData.php rename to lib/SP/DataModel/AccountData.php diff --git a/inc/SP/DataModel/AccountExtData.php b/lib/SP/DataModel/AccountExtData.php similarity index 100% rename from inc/SP/DataModel/AccountExtData.php rename to lib/SP/DataModel/AccountExtData.php diff --git a/inc/SP/DataModel/AccountHistoryData.php b/lib/SP/DataModel/AccountHistoryData.php similarity index 100% rename from inc/SP/DataModel/AccountHistoryData.php rename to lib/SP/DataModel/AccountHistoryData.php diff --git a/inc/SP/DataModel/AccountSearchData.php b/lib/SP/DataModel/AccountSearchData.php similarity index 100% rename from inc/SP/DataModel/AccountSearchData.php rename to lib/SP/DataModel/AccountSearchData.php diff --git a/inc/SP/DataModel/ApiTokenData.php b/lib/SP/DataModel/ApiTokenData.php similarity index 100% rename from inc/SP/DataModel/ApiTokenData.php rename to lib/SP/DataModel/ApiTokenData.php diff --git a/inc/SP/DataModel/CategoryData.php b/lib/SP/DataModel/CategoryData.php similarity index 100% rename from inc/SP/DataModel/CategoryData.php rename to lib/SP/DataModel/CategoryData.php diff --git a/inc/SP/DataModel/CustomFieldBaseData.php b/lib/SP/DataModel/CustomFieldBaseData.php similarity index 100% rename from inc/SP/DataModel/CustomFieldBaseData.php rename to lib/SP/DataModel/CustomFieldBaseData.php diff --git a/inc/SP/DataModel/CustomFieldData.php b/lib/SP/DataModel/CustomFieldData.php similarity index 100% rename from inc/SP/DataModel/CustomFieldData.php rename to lib/SP/DataModel/CustomFieldData.php diff --git a/inc/SP/DataModel/CustomFieldDefData.php b/lib/SP/DataModel/CustomFieldDefData.php similarity index 100% rename from inc/SP/DataModel/CustomFieldDefData.php rename to lib/SP/DataModel/CustomFieldDefData.php diff --git a/inc/SP/DataModel/CustomerData.php b/lib/SP/DataModel/CustomerData.php similarity index 100% rename from inc/SP/DataModel/CustomerData.php rename to lib/SP/DataModel/CustomerData.php diff --git a/inc/SP/DataModel/DataModelBase.php b/lib/SP/DataModel/DataModelBase.php similarity index 100% rename from inc/SP/DataModel/DataModelBase.php rename to lib/SP/DataModel/DataModelBase.php diff --git a/inc/SP/DataModel/DataModelInterface.php b/lib/SP/DataModel/DataModelInterface.php similarity index 100% rename from inc/SP/DataModel/DataModelInterface.php rename to lib/SP/DataModel/DataModelInterface.php diff --git a/inc/SP/DataModel/FileData.php b/lib/SP/DataModel/FileData.php similarity index 100% rename from inc/SP/DataModel/FileData.php rename to lib/SP/DataModel/FileData.php diff --git a/inc/SP/DataModel/FileExtData.php b/lib/SP/DataModel/FileExtData.php similarity index 100% rename from inc/SP/DataModel/FileExtData.php rename to lib/SP/DataModel/FileExtData.php diff --git a/inc/SP/DataModel/GroupAccountsData.php b/lib/SP/DataModel/GroupAccountsData.php similarity index 98% rename from inc/SP/DataModel/GroupAccountsData.php rename to lib/SP/DataModel/GroupAccountsData.php index 1bf26f14..6a0efa79 100644 --- a/inc/SP/DataModel/GroupAccountsData.php +++ b/lib/SP/DataModel/GroupAccountsData.php @@ -99,6 +99,6 @@ class GroupAccountsData extends DataModelBase */ public function addGroup($group) { - $this->groups[] = intval($group); + $this->groups[] = (int)$group; } } \ No newline at end of file diff --git a/inc/SP/DataModel/GroupData.php b/lib/SP/DataModel/GroupData.php similarity index 100% rename from inc/SP/DataModel/GroupData.php rename to lib/SP/DataModel/GroupData.php diff --git a/inc/SP/DataModel/GroupUsersData.php b/lib/SP/DataModel/GroupUsersData.php similarity index 98% rename from inc/SP/DataModel/GroupUsersData.php rename to lib/SP/DataModel/GroupUsersData.php index 1a8b43e7..a2b7ebfe 100644 --- a/inc/SP/DataModel/GroupUsersData.php +++ b/lib/SP/DataModel/GroupUsersData.php @@ -99,6 +99,6 @@ class GroupUsersData extends DataModelBase */ public function addUser($user) { - $this->users[] = intval($user); + $this->users[] = (int)$user; } } \ No newline at end of file diff --git a/inc/SP/DataModel/InstallData.php b/lib/SP/DataModel/InstallData.php similarity index 100% rename from inc/SP/DataModel/InstallData.php rename to lib/SP/DataModel/InstallData.php diff --git a/inc/SP/DataModel/ItemSearchData.php b/lib/SP/DataModel/ItemSearchData.php similarity index 100% rename from inc/SP/DataModel/ItemSearchData.php rename to lib/SP/DataModel/ItemSearchData.php diff --git a/inc/SP/DataModel/NoticeData.php b/lib/SP/DataModel/NoticeData.php similarity index 100% rename from inc/SP/DataModel/NoticeData.php rename to lib/SP/DataModel/NoticeData.php diff --git a/inc/SP/DataModel/PluginData.php b/lib/SP/DataModel/PluginData.php similarity index 100% rename from inc/SP/DataModel/PluginData.php rename to lib/SP/DataModel/PluginData.php diff --git a/inc/SP/DataModel/ProfileBaseData.php b/lib/SP/DataModel/ProfileBaseData.php similarity index 100% rename from inc/SP/DataModel/ProfileBaseData.php rename to lib/SP/DataModel/ProfileBaseData.php diff --git a/inc/SP/DataModel/ProfileData.php b/lib/SP/DataModel/ProfileData.php similarity index 100% rename from inc/SP/DataModel/ProfileData.php rename to lib/SP/DataModel/ProfileData.php diff --git a/inc/SP/DataModel/PublicLinkBaseData.php b/lib/SP/DataModel/PublicLinkBaseData.php similarity index 100% rename from inc/SP/DataModel/PublicLinkBaseData.php rename to lib/SP/DataModel/PublicLinkBaseData.php diff --git a/inc/SP/DataModel/PublicLinkData.php b/lib/SP/DataModel/PublicLinkData.php similarity index 100% rename from inc/SP/DataModel/PublicLinkData.php rename to lib/SP/DataModel/PublicLinkData.php diff --git a/inc/SP/DataModel/PublicLinkListData.php b/lib/SP/DataModel/PublicLinkListData.php similarity index 100% rename from inc/SP/DataModel/PublicLinkListData.php rename to lib/SP/DataModel/PublicLinkListData.php diff --git a/inc/SP/DataModel/TagData.php b/lib/SP/DataModel/TagData.php similarity index 100% rename from inc/SP/DataModel/TagData.php rename to lib/SP/DataModel/TagData.php diff --git a/inc/SP/DataModel/TrackData.php b/lib/SP/DataModel/TrackData.php similarity index 100% rename from inc/SP/DataModel/TrackData.php rename to lib/SP/DataModel/TrackData.php diff --git a/inc/SP/DataModel/UserData.php b/lib/SP/DataModel/UserData.php similarity index 100% rename from inc/SP/DataModel/UserData.php rename to lib/SP/DataModel/UserData.php diff --git a/inc/SP/DataModel/UserLoginData.php b/lib/SP/DataModel/UserLoginData.php similarity index 100% rename from inc/SP/DataModel/UserLoginData.php rename to lib/SP/DataModel/UserLoginData.php diff --git a/inc/SP/DataModel/UserPassData.php b/lib/SP/DataModel/UserPassData.php similarity index 100% rename from inc/SP/DataModel/UserPassData.php rename to lib/SP/DataModel/UserPassData.php diff --git a/inc/SP/DataModel/UserPassRecoverData.php b/lib/SP/DataModel/UserPassRecoverData.php similarity index 100% rename from inc/SP/DataModel/UserPassRecoverData.php rename to lib/SP/DataModel/UserPassRecoverData.php diff --git a/inc/SP/DataModel/UserPreferencesData.php b/lib/SP/DataModel/UserPreferencesData.php similarity index 100% rename from inc/SP/DataModel/UserPreferencesData.php rename to lib/SP/DataModel/UserPreferencesData.php diff --git a/inc/SP/Forms/AccountForm.php b/lib/SP/Forms/AccountForm.php similarity index 95% rename from inc/SP/Forms/AccountForm.php rename to lib/SP/Forms/AccountForm.php index c21a5757..3f6efd69 100644 --- a/inc/SP/Forms/AccountForm.php +++ b/lib/SP/Forms/AccountForm.php @@ -26,7 +26,7 @@ namespace SP\Forms; use SP\Core\ActionsInterface; use SP\Core\Exceptions\ValidationException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\DataModel\AccountData; use SP\DataModel\AccountExtData; use SP\Http\Request; @@ -87,7 +87,7 @@ class AccountForm extends FormBase implements FormInterface $this->AccountData->setAccountLogin(Request::analyze('login')); $this->AccountData->setAccountUrl(Request::analyze('url')); $this->AccountData->setAccountNotes(Request::analyze('notes')); - $this->AccountData->setAccountUserEditId(Session::getUserData()->getUserId()); + $this->AccountData->setAccountUserEditId(SessionFactory::getUserData()->getUserId()); $this->AccountData->setAccountOtherUserEdit(Request::analyze('userEditEnabled', 0, false, 1)); $this->AccountData->setAccountOtherGroupEdit(Request::analyze('groupEditEnabled', 0, false, 1)); $this->AccountData->setAccountPass(Request::analyzeEncrypted('pass')); @@ -117,7 +117,7 @@ class AccountForm extends FormBase implements FormInterface // Cambiar el grupo principal si el usuario es Admin if ($accountMainGroupId !== 0 - && (Session::getUserData()->isUserIsAdminApp() || Session::getUserData()->isUserIsAdminAcc()) + && (SessionFactory::getUserData()->isUserIsAdminApp() || SessionFactory::getUserData()->isUserIsAdminAcc()) ) { $this->AccountData->setAccountUserGroupId($accountMainGroupId); } diff --git a/inc/SP/Forms/ApiTokenForm.php b/lib/SP/Forms/ApiTokenForm.php similarity index 100% rename from inc/SP/Forms/ApiTokenForm.php rename to lib/SP/Forms/ApiTokenForm.php diff --git a/inc/SP/Forms/CategoryForm.php b/lib/SP/Forms/CategoryForm.php similarity index 100% rename from inc/SP/Forms/CategoryForm.php rename to lib/SP/Forms/CategoryForm.php diff --git a/inc/SP/Forms/CustomFieldDefForm.php b/lib/SP/Forms/CustomFieldDefForm.php similarity index 100% rename from inc/SP/Forms/CustomFieldDefForm.php rename to lib/SP/Forms/CustomFieldDefForm.php diff --git a/inc/SP/Forms/CustomerForm.php b/lib/SP/Forms/CustomerForm.php similarity index 100% rename from inc/SP/Forms/CustomerForm.php rename to lib/SP/Forms/CustomerForm.php diff --git a/inc/SP/Forms/FormBase.php b/lib/SP/Forms/FormBase.php similarity index 70% rename from inc/SP/Forms/FormBase.php rename to lib/SP/Forms/FormBase.php index 99659bc9..64c0d6b2 100644 --- a/inc/SP/Forms/FormBase.php +++ b/lib/SP/Forms/FormBase.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -24,6 +24,10 @@ namespace SP\Forms; +use SP\Config\Config; +use SP\Config\ConfigData; +use SP\Core\Traits\InjectableTrait; + /** * Class FormBase * @@ -31,10 +35,20 @@ namespace SP\Forms; */ abstract class FormBase { + use InjectableTrait; + /** * @var int */ protected $itemId; + /** + * @var Config + */ + protected $Config; + /** + * @var ConfigData + */ + protected $ConfigData; /** * FormBase constructor. @@ -43,9 +57,20 @@ abstract class FormBase */ public function __construct($itemId) { + $this->injectDependencies(); + $this->itemId = $itemId; } + /** + * @param Config $config + */ + public function inject(Config $config) + { + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); + } + /** * Analizar los datos de la petición HTTP * diff --git a/inc/SP/Forms/FormInterface.php b/lib/SP/Forms/FormInterface.php similarity index 100% rename from inc/SP/Forms/FormInterface.php rename to lib/SP/Forms/FormInterface.php diff --git a/inc/SP/Forms/GroupForm.php b/lib/SP/Forms/GroupForm.php similarity index 100% rename from inc/SP/Forms/GroupForm.php rename to lib/SP/Forms/GroupForm.php diff --git a/inc/SP/Forms/NoticeForm.php b/lib/SP/Forms/NoticeForm.php similarity index 100% rename from inc/SP/Forms/NoticeForm.php rename to lib/SP/Forms/NoticeForm.php diff --git a/inc/SP/Forms/ProfileForm.php b/lib/SP/Forms/ProfileForm.php similarity index 100% rename from inc/SP/Forms/ProfileForm.php rename to lib/SP/Forms/ProfileForm.php diff --git a/inc/SP/Forms/PublicLinkForm.php b/lib/SP/Forms/PublicLinkForm.php similarity index 100% rename from inc/SP/Forms/PublicLinkForm.php rename to lib/SP/Forms/PublicLinkForm.php diff --git a/inc/SP/Forms/TagForm.php b/lib/SP/Forms/TagForm.php similarity index 100% rename from inc/SP/Forms/TagForm.php rename to lib/SP/Forms/TagForm.php diff --git a/inc/SP/Forms/UserForm.php b/lib/SP/Forms/UserForm.php similarity index 90% rename from inc/SP/Forms/UserForm.php rename to lib/SP/Forms/UserForm.php index 41a3bde1..89daae07 100644 --- a/inc/SP/Forms/UserForm.php +++ b/lib/SP/Forms/UserForm.php @@ -26,7 +26,7 @@ namespace SP\Forms; use SP\Core\ActionsInterface; use SP\Core\Exceptions\ValidationException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\DataModel\UserData; use SP\Http\Request; use SP\Mgmt\Users\UserUtil; @@ -127,7 +127,7 @@ class UserForm extends FormBase implements FormInterface throw new ValidationException(__('Es necesario un email', false)); } - if (Checks::demoIsEnabled() && !Session::getUserData()->isUserIsAdminApp() && $this->UserData->getUserLogin() === 'demo') { + if ($this->ConfigData->isDemoEnabled() && !SessionFactory::getUserData()->isUserIsAdminApp() && $this->UserData->getUserLogin() === 'demo') { throw new ValidationException(__('Ey, esto es una DEMO!!', false)); } } @@ -139,7 +139,7 @@ class UserForm extends FormBase implements FormInterface { $userPassR = Request::analyzeEncrypted('passR'); - if (Checks::demoIsEnabled() && UserUtil::getUserLoginById($this->itemId) === 'demo') { + if ($this->ConfigData->isDemoEnabled() && UserUtil::getUserLoginById($this->itemId) === 'demo') { throw new ValidationException(__('Ey, esto es una DEMO!!', false)); } @@ -157,12 +157,12 @@ class UserForm extends FormBase implements FormInterface */ protected function checkDelete() { - if (Checks::demoIsEnabled() && UserUtil::getUserLoginById($this->itemId) === 'demo') { + if ($this->ConfigData->isDemoEnabled() && UserUtil::getUserLoginById($this->itemId) === 'demo') { throw new ValidationException(__('Ey, esto es una DEMO!!', false)); } - if ((!is_array($this->itemId) === Session::getUserData()->getUserId()) - || (is_array($this->itemId) && in_array(Session::getUserData()->getUserId(), $this->itemId)) + if ((!is_array($this->itemId) === SessionFactory::getUserData()->getUserId()) + || (is_array($this->itemId) && in_array(SessionFactory::getUserData()->getUserId(), $this->itemId)) ) { throw new ValidationException(__('No es posible eliminar, usuario en uso', false)); } diff --git a/inc/SP/Html/Assets/FontIcon.php b/lib/SP/Html/Assets/FontIcon.php similarity index 92% rename from inc/SP/Html/Assets/FontIcon.php rename to lib/SP/Html/Assets/FontIcon.php index 8dcbb295..14f18f38 100644 --- a/inc/SP/Html/Assets/FontIcon.php +++ b/lib/SP/Html/Assets/FontIcon.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -52,6 +52,6 @@ class FontIcon extends IconBase */ public function getClassButton() { - return preg_replace('/-text--/', '--', $this->getClass()); + return str_replace('-text--', '--', $this->getClass()); } } \ No newline at end of file diff --git a/inc/SP/Html/Assets/IconBase.php b/lib/SP/Html/Assets/IconBase.php similarity index 100% rename from inc/SP/Html/Assets/IconBase.php rename to lib/SP/Html/Assets/IconBase.php diff --git a/inc/SP/Html/Assets/IconInterface.php b/lib/SP/Html/Assets/IconInterface.php similarity index 100% rename from inc/SP/Html/Assets/IconInterface.php rename to lib/SP/Html/Assets/IconInterface.php diff --git a/inc/SP/Html/Assets/ImageIcon.php b/lib/SP/Html/Assets/ImageIcon.php similarity index 100% rename from inc/SP/Html/Assets/ImageIcon.php rename to lib/SP/Html/Assets/ImageIcon.php diff --git a/inc/SP/Html/DataGrid/DataGrid.php b/lib/SP/Html/DataGrid/DataGrid.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGrid.php rename to lib/SP/Html/DataGrid/DataGrid.php diff --git a/inc/SP/Html/DataGrid/DataGridAction.php b/lib/SP/Html/DataGrid/DataGridAction.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridAction.php rename to lib/SP/Html/DataGrid/DataGridAction.php diff --git a/inc/SP/Html/DataGrid/DataGridActionBase.php b/lib/SP/Html/DataGrid/DataGridActionBase.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridActionBase.php rename to lib/SP/Html/DataGrid/DataGridActionBase.php diff --git a/inc/SP/Html/DataGrid/DataGridActionInterface.php b/lib/SP/Html/DataGrid/DataGridActionInterface.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridActionInterface.php rename to lib/SP/Html/DataGrid/DataGridActionInterface.php diff --git a/inc/SP/Html/DataGrid/DataGridActionSearch.php b/lib/SP/Html/DataGrid/DataGridActionSearch.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridActionSearch.php rename to lib/SP/Html/DataGrid/DataGridActionSearch.php diff --git a/inc/SP/Html/DataGrid/DataGridActionType.php b/lib/SP/Html/DataGrid/DataGridActionType.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridActionType.php rename to lib/SP/Html/DataGrid/DataGridActionType.php diff --git a/inc/SP/Html/DataGrid/DataGridBase.php b/lib/SP/Html/DataGrid/DataGridBase.php similarity index 94% rename from inc/SP/Html/DataGrid/DataGridBase.php rename to lib/SP/Html/DataGrid/DataGridBase.php index b18f0fdc..26c2545f 100644 --- a/inc/SP/Html/DataGrid/DataGridBase.php +++ b/lib/SP/Html/DataGrid/DataGridBase.php @@ -27,9 +27,10 @@ namespace SP\Html\DataGrid; defined('APP_ROOT') || die(); use SP\Core\ActionsInterface; -use SP\Core\DiFactory; use SP\Core\Exceptions\FileNotFoundException; use SP\Core\Exceptions\SPException; +use SP\Core\Traits\InjectableTrait; +use SP\Core\UI\Theme; use SplObjectStorage; /** @@ -39,6 +40,8 @@ use SplObjectStorage; */ abstract class DataGridBase implements DataGridInterface { + use InjectableTrait; + /** * Tiempo de ejecución * @@ -111,6 +114,28 @@ abstract class DataGridBase implements DataGridInterface * @var string */ protected $_rowsTemplate; + /** + * @var Theme + */ + protected $theme; + + /** + * DataGridBase constructor. + * + * @throws \Psr\Container\ContainerExceptionInterface + */ + public function __construct() + { + $this->injectDependencies(); + } + + /** + * @param Theme $theme + */ + public function inject(Theme $theme) + { + $this->theme = $theme; + } /** * @return int @@ -257,7 +282,7 @@ abstract class DataGridBase implements DataGridInterface protected function checkTemplate($template, $base = null) { $template = null === $base ? $template . '.inc' : $base . DIRECTORY_SEPARATOR . $template . '.inc'; - $file = DiFactory::getTheme()->getViewsPath() . DIRECTORY_SEPARATOR . $template; + $file = $this->theme->getViewsPath() . DIRECTORY_SEPARATOR . $template; if (!is_readable($file)) { throw new FileNotFoundException(SPException::SP_ERROR, sprintf(__('No es posible obtener la plantilla "%s" : %s'), $template, $file)); diff --git a/inc/SP/Html/DataGrid/DataGridData.php b/lib/SP/Html/DataGrid/DataGridData.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridData.php rename to lib/SP/Html/DataGrid/DataGridData.php diff --git a/inc/SP/Html/DataGrid/DataGridDataBase.php b/lib/SP/Html/DataGrid/DataGridDataBase.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridDataBase.php rename to lib/SP/Html/DataGrid/DataGridDataBase.php diff --git a/inc/SP/Html/DataGrid/DataGridDataInterface.php b/lib/SP/Html/DataGrid/DataGridDataInterface.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridDataInterface.php rename to lib/SP/Html/DataGrid/DataGridDataInterface.php diff --git a/inc/SP/Html/DataGrid/DataGridHeader.php b/lib/SP/Html/DataGrid/DataGridHeader.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridHeader.php rename to lib/SP/Html/DataGrid/DataGridHeader.php diff --git a/inc/SP/Html/DataGrid/DataGridHeaderBase.php b/lib/SP/Html/DataGrid/DataGridHeaderBase.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridHeaderBase.php rename to lib/SP/Html/DataGrid/DataGridHeaderBase.php diff --git a/inc/SP/Html/DataGrid/DataGridHeaderInterface.php b/lib/SP/Html/DataGrid/DataGridHeaderInterface.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridHeaderInterface.php rename to lib/SP/Html/DataGrid/DataGridHeaderInterface.php diff --git a/inc/SP/Html/DataGrid/DataGridHeaderSort.php b/lib/SP/Html/DataGrid/DataGridHeaderSort.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridHeaderSort.php rename to lib/SP/Html/DataGrid/DataGridHeaderSort.php diff --git a/inc/SP/Html/DataGrid/DataGridInterface.php b/lib/SP/Html/DataGrid/DataGridInterface.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridInterface.php rename to lib/SP/Html/DataGrid/DataGridInterface.php diff --git a/inc/SP/Html/DataGrid/DataGridPager.php b/lib/SP/Html/DataGrid/DataGridPager.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridPager.php rename to lib/SP/Html/DataGrid/DataGridPager.php diff --git a/inc/SP/Html/DataGrid/DataGridPagerBase.php b/lib/SP/Html/DataGrid/DataGridPagerBase.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridPagerBase.php rename to lib/SP/Html/DataGrid/DataGridPagerBase.php diff --git a/inc/SP/Html/DataGrid/DataGridPagerInterface.php b/lib/SP/Html/DataGrid/DataGridPagerInterface.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridPagerInterface.php rename to lib/SP/Html/DataGrid/DataGridPagerInterface.php diff --git a/inc/SP/Html/DataGrid/DataGridSort.php b/lib/SP/Html/DataGrid/DataGridSort.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridSort.php rename to lib/SP/Html/DataGrid/DataGridSort.php diff --git a/inc/SP/Html/DataGrid/DataGridSortInterface.php b/lib/SP/Html/DataGrid/DataGridSortInterface.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridSortInterface.php rename to lib/SP/Html/DataGrid/DataGridSortInterface.php diff --git a/inc/SP/Html/DataGrid/DataGridTab.php b/lib/SP/Html/DataGrid/DataGridTab.php similarity index 100% rename from inc/SP/Html/DataGrid/DataGridTab.php rename to lib/SP/Html/DataGrid/DataGridTab.php diff --git a/inc/SP/Html/Html.php b/lib/SP/Html/Html.php similarity index 100% rename from inc/SP/Html/Html.php rename to lib/SP/Html/Html.php diff --git a/inc/SP/Html/Minify.php b/lib/SP/Html/Minify.php similarity index 96% rename from inc/SP/Html/Minify.php rename to lib/SP/Html/Minify.php index 78beed85..93db2d85 100644 --- a/inc/SP/Html/Minify.php +++ b/lib/SP/Html/Minify.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -65,7 +65,7 @@ class Minify /** * @param string $path - * @param bool $checkPath + * @param bool $checkPath * @return $this */ public function setBase($path, $checkPath = false) @@ -141,8 +141,6 @@ class Minify echo '/* MINIFIED FILE: ' . $file['name'] . ' */' . PHP_EOL; if ($this->type === self::FILETYPE_JS) { echo $this->jsCompress(file_get_contents($filePath)); - } elseif ($this->type === self::FILETYPE_CSS) { - echo CssMin::minify(file_get_contents($filePath)); } } else { echo '/* FILE: ' . $file['name'] . ' */' . PHP_EOL; @@ -208,7 +206,7 @@ class Minify * Añadir un archivo * * @param string $file - * @param bool $minify Si es necesario reducir + * @param bool $minify Si es necesario reducir * @return $this */ public function addFile($file, $minify = true) diff --git a/inc/SP/Http/Cookies.php b/lib/SP/Http/Cookies.php similarity index 100% rename from inc/SP/Http/Cookies.php rename to lib/SP/Http/Cookies.php diff --git a/inc/SP/Http/JsonResponse.php b/lib/SP/Http/JsonResponse.php similarity index 100% rename from inc/SP/Http/JsonResponse.php rename to lib/SP/Http/JsonResponse.php diff --git a/inc/SP/Http/Message.php b/lib/SP/Http/Message.php similarity index 100% rename from inc/SP/Http/Message.php rename to lib/SP/Http/Message.php diff --git a/inc/SP/Http/Request.php b/lib/SP/Http/Request.php similarity index 99% rename from inc/SP/Http/Request.php rename to lib/SP/Http/Request.php index 7e864ee5..561e1111 100644 --- a/inc/SP/Http/Request.php +++ b/lib/SP/Http/Request.php @@ -24,9 +24,11 @@ namespace SP\Http; +use SP\Bootstrap; use SP\Core\CryptPKI; use SP\Core\Init; use SP\Html\Html; +use SP\Util\HttpUtil; /** * Clase Request para la gestión de peticiones HTTP @@ -239,7 +241,7 @@ class Request public static function getSecureAppPath($path, $base = null) { if ($base === null) { - $base = Init::$SERVERROOT; + $base = APP_ROOT; } elseif (!in_array(basename($base), self::$secureDirs, true)) { return ''; } diff --git a/inc/SP/Http/Response.php b/lib/SP/Http/Response.php similarity index 89% rename from inc/SP/Http/Response.php rename to lib/SP/Http/Response.php index 4f984126..c97e9150 100644 --- a/inc/SP/Http/Response.php +++ b/lib/SP/Http/Response.php @@ -24,6 +24,7 @@ namespace SP\Http; +use SP\Bootstrap; use SP\Core\Exceptions\SPException; use SP\Util\Json; @@ -111,4 +112,25 @@ class Response exit($error); } + + /** + * Internal URL redirection + * + * @param $url + */ + public static function redirectInternal($url) + { + self::redirect(Bootstrap::$WEBURI . '/' . $url); + } + + /** + * URL redirection + * + * @param $url + */ + public static function redirect($url) + { + header('Location: ' . $url); + die(); + } } \ No newline at end of file diff --git a/inc/SP/Http/XMLRPCResponseParse.php b/lib/SP/Http/XMLRPCResponseParse.php similarity index 100% rename from inc/SP/Http/XMLRPCResponseParse.php rename to lib/SP/Http/XMLRPCResponseParse.php diff --git a/inc/SP/Import/CsvImport.php b/lib/SP/Import/CsvImport.php similarity index 100% rename from inc/SP/Import/CsvImport.php rename to lib/SP/Import/CsvImport.php diff --git a/inc/SP/Import/CsvImportBase.php b/lib/SP/Import/CsvImportBase.php similarity index 100% rename from inc/SP/Import/CsvImportBase.php rename to lib/SP/Import/CsvImportBase.php diff --git a/inc/SP/Import/FileImport.php b/lib/SP/Import/FileImport.php similarity index 100% rename from inc/SP/Import/FileImport.php rename to lib/SP/Import/FileImport.php diff --git a/inc/SP/Import/Import.php b/lib/SP/Import/Import.php similarity index 95% rename from inc/SP/Import/Import.php rename to lib/SP/Import/Import.php index d3e10922..12da0842 100644 --- a/inc/SP/Import/Import.php +++ b/lib/SP/Import/Import.php @@ -29,7 +29,7 @@ use SP\Core\Exceptions\SPException; use SP\Core\Messages\LogMessage; use SP\Log\Email; use SP\Log\Log; -use SP\Storage\DB; +use SP\Storage\DbWrapper; defined('APP_ROOT') || die(); @@ -87,19 +87,19 @@ class Import ); } - if (!DB::beginTransaction()) { + if (!DbWrapper::beginTransaction()) { throw new SPException(SPException::SP_ERROR, __('No es posible iniciar una transacción', false)); } $Import->doImport(); - if (!DB::endTransaction()) { + if (!DbWrapper::endTransaction()) { throw new SPException(SPException::SP_ERROR, __('No es posible finalizar una transacción', false)); } $LogMessage->addDetails(__('Cuentas importadas'), $Import->getCounter()); } catch (SPException $e) { - DB::rollbackTransaction(); + DbWrapper::rollbackTransaction(); $LogMessage->addDescription($e->getMessage()); $LogMessage->addDetails(__('Ayuda', false), $e->getHint()); diff --git a/inc/SP/Import/ImportBase.php b/lib/SP/Import/ImportBase.php similarity index 100% rename from inc/SP/Import/ImportBase.php rename to lib/SP/Import/ImportBase.php diff --git a/inc/SP/Import/ImportInterface.php b/lib/SP/Import/ImportInterface.php similarity index 100% rename from inc/SP/Import/ImportInterface.php rename to lib/SP/Import/ImportInterface.php diff --git a/inc/SP/Import/ImportParams.php b/lib/SP/Import/ImportParams.php similarity index 100% rename from inc/SP/Import/ImportParams.php rename to lib/SP/Import/ImportParams.php diff --git a/inc/SP/Import/KeepassImport.php b/lib/SP/Import/KeepassImport.php similarity index 100% rename from inc/SP/Import/KeepassImport.php rename to lib/SP/Import/KeepassImport.php diff --git a/inc/SP/Import/KeepassXImport.php b/lib/SP/Import/KeepassXImport.php similarity index 100% rename from inc/SP/Import/KeepassXImport.php rename to lib/SP/Import/KeepassXImport.php diff --git a/inc/SP/Import/SyspassImport.php b/lib/SP/Import/SyspassImport.php similarity index 100% rename from inc/SP/Import/SyspassImport.php rename to lib/SP/Import/SyspassImport.php diff --git a/inc/SP/Import/XmlFileImport.php b/lib/SP/Import/XmlFileImport.php similarity index 100% rename from inc/SP/Import/XmlFileImport.php rename to lib/SP/Import/XmlFileImport.php diff --git a/inc/SP/Import/XmlImport.php b/lib/SP/Import/XmlImport.php similarity index 100% rename from inc/SP/Import/XmlImport.php rename to lib/SP/Import/XmlImport.php diff --git a/inc/SP/Import/XmlImportTrait.php b/lib/SP/Import/XmlImportTrait.php similarity index 100% rename from inc/SP/Import/XmlImportTrait.php rename to lib/SP/Import/XmlImportTrait.php diff --git a/inc/SP/Log/AbstractLogger.php b/lib/SP/Log/AbstractLogger.php similarity index 100% rename from inc/SP/Log/AbstractLogger.php rename to lib/SP/Log/AbstractLogger.php diff --git a/inc/SP/Log/ActionLog.php b/lib/SP/Log/ActionLog.php similarity index 74% rename from inc/SP/Log/ActionLog.php rename to lib/SP/Log/ActionLog.php index 247df398..259d10cf 100644 --- a/inc/SP/Log/ActionLog.php +++ b/lib/SP/Log/ActionLog.php @@ -24,7 +24,12 @@ namespace SP\Log; +use SP\Config\Config; +use SP\Config\ConfigData; +use SP\Core\Crypt\Session; +use SP\Core\Language; use SP\Core\Messages\LogMessage; +use SP\Core\Traits\InjectableTrait; /** * Clase abstracta ActionLog para la gestión de mensajes de eventos @@ -33,6 +38,8 @@ use SP\Core\Messages\LogMessage; */ abstract class ActionLog extends LogLevel { + use InjectableTrait; + /** * Constante de nueva línea para descripciones */ @@ -49,6 +56,21 @@ abstract class ActionLog extends LogLevel * @var LogMessage */ protected $LogMessage; + /** + * @var Config + */ + protected $config; + /** + * @var ConfigData + */ + protected $configData; + /** + * @var Language + */ + protected $language; + /** @var \SP\Core\Session\Session */ + protected $session; + /** * Contructor @@ -58,10 +80,24 @@ abstract class ActionLog extends LogLevel */ public function __construct(LogMessage $LogMessage = null, $level = Log::INFO) { + $this->injectDependencies(); + $this->LogMessage = $LogMessage ?: new LogMessage(); $this->logLevel = $level; } + /** + * @param Config $config + * @param Language $language + */ + public function inject(Config $config, Language $language, Session $session) + { + $this->config = $config; + $this->configData = $config->getConfigData(); + $this->language = $language; + $this->session = $session; + } + /** * @return string */ diff --git a/inc/SP/Log/Email.php b/lib/SP/Log/Email.php similarity index 94% rename from inc/SP/Log/Email.php rename to lib/SP/Log/Email.php index 6f8b1678..9b43578d 100644 --- a/inc/SP/Log/Email.php +++ b/lib/SP/Log/Email.php @@ -24,12 +24,13 @@ namespace SP\Log; -use phpmailer\phpmailerException; +use PHPMailer\PHPMailer\Exception; +use PHPMailer\PHPMailer\PHPMailer; use SP\Config\Config; use SP\Core\Init; use SP\Core\Messages\LogMessage; use SP\Core\Messages\NoticeMessage; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\Html\Html; use SP\Util\Checks; use SP\Util\HttpUtil; @@ -46,12 +47,16 @@ class Email * Enviar un email utilizando la clase PHPMailer. * * @param LogMessage $LogMessage con el objeto del tipo Log - * @param string $mailTo con el destinatario - * @param bool $isEvent para indicar si es um + * @param string $mailTo con el destinatario + * @param bool $isEvent para indicar si es um * @return bool + * @throws Exception */ public static function sendEmail(LogMessage $LogMessage, $mailTo = '', $isEvent = true) { + return false; + + // FIXME if (!Checks::mailIsEnabled()) { return false; } @@ -59,7 +64,7 @@ class Email $Mail = self::getMailer($mailTo, $LogMessage->getAction(true)); if ($isEvent === true) { - $performer = Session::getUserData()->getUserLogin() ?: __('N/D'); + $performer = SessionFactory::getUserData()->getUserLogin() ?: __('N/D'); $body[] = sprintf('%s: %s', Html::strongText(__('Acción')), $LogMessage->getAction(true)); $body[] = sprintf('%s: %s (%s)', Html::strongText(__('Realizado por')), $performer, HttpUtil::getClientAddress(true)); @@ -87,7 +92,7 @@ class Email $Log->writeLog(); return true; - } catch (phpmailerException $e) { + } catch (Exception $e) { $LogMessage->addDescription(__('Error al enviar correo', false)); $LogMessage->addDetails(__('Error', false), $e->getMessage()); $LogMessage->addDetails(__('Error', false), $Mail->ErrorInfo); diff --git a/inc/SP/Log/Log.php b/lib/SP/Log/Log.php similarity index 90% rename from inc/SP/Log/Log.php rename to lib/SP/Log/Log.php index ca02dd98..3f55f747 100644 --- a/inc/SP/Log/Log.php +++ b/lib/SP/Log/Log.php @@ -28,8 +28,8 @@ use SP\Core\DiFactory; use SP\Core\Exceptions\SPException; use SP\Core\Language; use SP\Core\Messages\LogMessage; -use SP\Core\Session; -use SP\Storage\DB; +use SP\Core\SessionFactory; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Checks; use SP\Util\HttpUtil; @@ -69,9 +69,9 @@ class Log extends ActionLog $Data->addParam($count); // Obtenemos el número total de registros - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); self::$numRows = $Data->getQueryNumRows(); @@ -95,7 +95,7 @@ class Log extends ActionLog $Data->setQuery($query); $Data->setOnErrorMessage(__('Error al vaciar el registro de eventos', false)); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -154,13 +154,13 @@ class Log extends ActionLog return false; } - if (!Checks::logIsEnabled()) { + if (!$this->configData->isLogEnabled()) { return false; } - Language::setAppLocales(); + $this->language->setAppLocales(); - if (Checks::syslogIsEnabled()) { + if ($this->configData->isSyslogEnabled()) { $this->sendToSyslog(); } @@ -177,8 +177,8 @@ class Log extends ActionLog $Data = new QueryData(); $Data->setQuery($query); - $Data->addParam(Session::getUserData()->getUserLogin()); - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam($this->session->getUserData()->getUserLogin()); + $Data->addParam($this->session->getUserData()->getUserId()); $Data->addParam(HttpUtil::getClientAddress(true)); $Data->addParam(utf8_encode($this->LogMessage->getAction(true))); $Data->addParam($this->getLogLevel()); @@ -193,7 +193,7 @@ class Log extends ActionLog } try { - DB::getQuery($Data); + DbWrapper::getQuery($Data); } catch (SPException $e) { debugLog(__($e->getMessage()), true); debugLog(__($e->getHint())); @@ -202,7 +202,7 @@ class Log extends ActionLog self::$logDbEnabled = 0; } - Language::unsetAppLocales(); + $this->language->unsetAppLocales(); return true; } @@ -218,10 +218,10 @@ class Log extends ActionLog $msg .= $this->LogMessage->getAction(true) . '|'; $msg .= $description . '|'; $msg .= '0|'; - $msg .= sprintf('ip_addr="%s" user_name="%s"', HttpUtil::getClientAddress(), Session::getUserData()->getUserLogin()); + $msg .= sprintf('ip_addr="%s" user_name="%s"', HttpUtil::getClientAddress(), $this->session->getUserData()->getUserLogin()); $Syslog = new Syslog(); - $Syslog->setIsRemote(Checks::remoteSyslogIsEnabled()); + $Syslog->setIsRemote($this->configData->isSyslogRemoteEnabled()); $Syslog->info($msg); } diff --git a/inc/SP/Log/LogLevel.php b/lib/SP/Log/LogLevel.php similarity index 100% rename from inc/SP/Log/LogLevel.php rename to lib/SP/Log/LogLevel.php diff --git a/inc/SP/Log/LogUtil.php b/lib/SP/Log/LogUtil.php similarity index 100% rename from inc/SP/Log/LogUtil.php rename to lib/SP/Log/LogUtil.php diff --git a/inc/SP/Log/LoggerInterface.php b/lib/SP/Log/LoggerInterface.php similarity index 100% rename from inc/SP/Log/LoggerInterface.php rename to lib/SP/Log/LoggerInterface.php diff --git a/inc/SP/Log/Syslog.php b/lib/SP/Log/Syslog.php similarity index 84% rename from inc/SP/Log/Syslog.php rename to lib/SP/Log/Syslog.php index bdc168f2..03e62f81 100644 --- a/inc/SP/Log/Syslog.php +++ b/lib/SP/Log/Syslog.php @@ -25,7 +25,9 @@ namespace SP\Log; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\SPException; +use SP\Core\Traits\InjectableTrait; use SP\Util\Connection; /** @@ -35,11 +37,34 @@ use SP\Util\Connection; */ class Syslog extends AbstractLogger { + use InjectableTrait; + + /** + * @var ConfigData + */ + protected $ConfigData; + /** * @var bool */ private $isRemote = false; + /** + * Syslog constructor. + */ + public function __construct() + { + $this->injectDependencies(); + } + + /** + * @param Config $config + */ + public function inject(Config $config) + { + $this->ConfigData = $config->getConfigData(); + } + /** * @param boolean $isRemote */ @@ -102,14 +127,13 @@ class Syslog extends AbstractLogger */ private function logRemote($message) { - $server = Config::getConfig()->getSyslogServer(); - $port = Config::getConfig()->getSyslogPort(); + $server = $this->ConfigData->getSyslogServer(); if (!empty($server)) { $syslogMsg = date('M d H:i:s ') . "sysPass web: $message"; try { - $Connecion = new Connection($server, $port); + $Connecion = new Connection($server, $this->ConfigData->getSyslogPort()); $Connecion->getSocket(Connection::TYPE_UDP); $Connecion->send($syslogMsg); $Connecion->closeSocket(); diff --git a/inc/SP/Mgmt/ApiTokens/ApiToken.php b/lib/SP/Mgmt/ApiTokens/ApiToken.php similarity index 94% rename from inc/SP/Mgmt/ApiTokens/ApiToken.php rename to lib/SP/Mgmt/ApiTokens/ApiToken.php index 6f2355c6..c74004a8 100644 --- a/inc/SP/Mgmt/ApiTokens/ApiToken.php +++ b/lib/SP/Mgmt/ApiTokens/ApiToken.php @@ -29,11 +29,11 @@ use SP\Core\Crypt\Hash; use SP\Core\Crypt\Session as CryptSession; use SP\Core\Crypt\Vault; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\DataModel\ApiTokenData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Util; @@ -76,7 +76,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->setQuery($query); $Data->addParam($this->itemData->getAuthtokenUserId()); $Data->addParam($this->itemData->getAuthtokenActionId()); - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam(SessionFactory::getUserData()->getUserId()); $Data->addParam($token); $action = $this->itemData->getAuthtokenActionId(); @@ -92,7 +92,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->addParam(Hash::hashKey($this->itemData->getAuthtokenHash())); $Data->setOnErrorMessage(__('Error interno', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -113,7 +113,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->addParam($this->itemData->getAuthtokenUserId()); $Data->addParam($this->itemData->getAuthtokenActionId()); - DB::getResults($Data); + DbWrapper::getResults($Data); return $Data->getQueryNumRows() === 1; } @@ -133,7 +133,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->setQuery($query); $Data->addParam($id); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); return $Data->getQueryNumRows() === 1 ? $queryRes->authtoken_token : $this->generateToken(); } @@ -178,7 +178,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error interno', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Token no encontrado', false)); @@ -220,7 +220,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->setQuery($query); $Data->addParam($this->itemData->getAuthtokenUserId()); $Data->addParam($this->itemData->getAuthtokenActionId()); - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam(SessionFactory::getUserData()->getUserId()); $Data->addParam($token); $action = $this->itemData->getAuthtokenActionId(); @@ -237,7 +237,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->addParam($this->itemData->getAuthtokenId()); $Data->setOnErrorMessage(__('Error interno', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -260,7 +260,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->addParam($this->itemData->getAuthtokenActionId()); $Data->addParam($this->itemData->getAuthtokenId()); - DB::getResults($Data); + DbWrapper::getResults($Data); return $Data->getQueryNumRows() === 1; } @@ -299,7 +299,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->addParam($this->itemData->getAuthtokenUserId()); $Data->setOnErrorMessage(__('Error interno', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -325,7 +325,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->setQuery($query); $Data->addParam($id); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -363,7 +363,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->setParams($ids); $Data->setOnErrorMessage(__('Error interno', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -395,7 +395,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->setQuery($query); $Data->addParam($token); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); return $Data->getQueryNumRows() === 1 ? $queryRes->authtoken_userId : false; } @@ -424,7 +424,7 @@ class ApiToken extends ApiTokenBase implements ItemInterface $Data->addParam($actionId); $Data->addParam($token); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); return $Data->getQueryNumRows() === 1 ? $queryRes : false; } diff --git a/inc/SP/Mgmt/ApiTokens/ApiTokenBase.php b/lib/SP/Mgmt/ApiTokens/ApiTokenBase.php similarity index 100% rename from inc/SP/Mgmt/ApiTokens/ApiTokenBase.php rename to lib/SP/Mgmt/ApiTokens/ApiTokenBase.php diff --git a/inc/SP/Mgmt/ApiTokens/ApiTokenSearch.php b/lib/SP/Mgmt/ApiTokens/ApiTokenSearch.php similarity index 92% rename from inc/SP/Mgmt/ApiTokens/ApiTokenSearch.php rename to lib/SP/Mgmt/ApiTokens/ApiTokenSearch.php index 21239cf6..6432ef32 100644 --- a/inc/SP/Mgmt/ApiTokens/ApiTokenSearch.php +++ b/lib/SP/Mgmt/ApiTokens/ApiTokenSearch.php @@ -27,7 +27,7 @@ namespace SP\Mgmt\ApiTokens; use SP\Core\Acl; use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -69,12 +69,12 @@ class ApiTokenSearch extends ApiTokenBase implements ItemSearchInterface $Data->setQuery($query); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); foreach ($queryRes as $token) { - $token->authtoken_actionId = Acl::getActionName($token->authtoken_actionId); + $token->authtoken_actionId = Acl::getActionInfo($token->authtoken_actionId); } $queryRes['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/ApiTokens/ApiTokensUtil.php b/lib/SP/Mgmt/ApiTokens/ApiTokensUtil.php similarity index 79% rename from inc/SP/Mgmt/ApiTokens/ApiTokensUtil.php rename to lib/SP/Mgmt/ApiTokens/ApiTokensUtil.php index 74ab16df..a952e80b 100644 --- a/inc/SP/Mgmt/ApiTokens/ApiTokensUtil.php +++ b/lib/SP/Mgmt/ApiTokens/ApiTokensUtil.php @@ -44,14 +44,14 @@ class ApiTokensUtil public static function getTokenActions() { $actions = [ - ActionsInterface::ACTION_ACC_SEARCH => Acl::getActionName(ActionsInterface::ACTION_ACC_SEARCH), - ActionsInterface::ACTION_ACC_VIEW => Acl::getActionName(ActionsInterface::ACTION_ACC_VIEW), - ActionsInterface::ACTION_ACC_VIEW_PASS => Acl::getActionName(ActionsInterface::ACTION_ACC_VIEW_PASS), - ActionsInterface::ACTION_ACC_DELETE => Acl::getActionName(ActionsInterface::ACTION_ACC_DELETE), - ActionsInterface::ACTION_ACC_NEW => Acl::getActionName(ActionsInterface::ACTION_ACC_NEW), - ActionsInterface::ACTION_CFG_BACKUP => Acl::getActionName(ActionsInterface::ACTION_CFG_BACKUP), - ActionsInterface::ACTION_MGM_CATEGORIES => Acl::getActionName(ActionsInterface::ACTION_MGM_CATEGORIES), - ActionsInterface::ACTION_MGM_CUSTOMERS => Acl::getActionName(ActionsInterface::ACTION_MGM_CUSTOMERS) + ActionsInterface::ACTION_ACC_SEARCH => Acl::getActionInfo(ActionsInterface::ACTION_ACC_SEARCH), + ActionsInterface::ACTION_ACC_VIEW => Acl::getActionInfo(ActionsInterface::ACTION_ACC_VIEW), + ActionsInterface::ACTION_ACC_VIEW_PASS => Acl::getActionInfo(ActionsInterface::ACTION_ACC_VIEW_PASS), + ActionsInterface::ACTION_ACC_DELETE => Acl::getActionInfo(ActionsInterface::ACTION_ACC_DELETE), + ActionsInterface::ACTION_ACC_NEW => Acl::getActionInfo(ActionsInterface::ACTION_ACC_NEW), + ActionsInterface::ACTION_CFG_BACKUP => Acl::getActionInfo(ActionsInterface::ACTION_CFG_BACKUP), + ActionsInterface::ACTION_MGM_CATEGORIES => Acl::getActionInfo(ActionsInterface::ACTION_MGM_CATEGORIES), + ActionsInterface::ACTION_MGM_CUSTOMERS => Acl::getActionInfo(ActionsInterface::ACTION_MGM_CUSTOMERS) ]; return $actions; diff --git a/inc/SP/Mgmt/Categories/Category.php b/lib/SP/Mgmt/Categories/Category.php similarity index 93% rename from inc/SP/Mgmt/Categories/Category.php rename to lib/SP/Mgmt/Categories/Category.php index f05a61e3..82052493 100644 --- a/inc/SP/Mgmt/Categories/Category.php +++ b/lib/SP/Mgmt/Categories/Category.php @@ -32,7 +32,7 @@ use SP\DataModel\CategoryData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemSelectInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -64,9 +64,9 @@ class Category extends CategoryBase implements ItemInterface, ItemSelectInterfac $Data->addParam($this->makeItemHash($this->itemData->getCategoryName())); $Data->setOnErrorMessage(__('Error al crear la categoría', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setCategoryId(DB::$lastId); + $this->itemData->setCategoryId(DbWrapper::$lastId); return $this; } @@ -87,7 +87,7 @@ class Category extends CategoryBase implements ItemInterface, ItemSelectInterfac $Data->addParam($this->makeItemHash($this->itemData->getCategoryName())); $Data->addParam($this->itemData->getCategoryName()); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes !== false) { if ($Data->getQueryNumRows() === 0) { @@ -118,7 +118,7 @@ class Category extends CategoryBase implements ItemInterface, ItemSelectInterfac $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar la categoría', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Categoría no encontrada', false)); @@ -142,7 +142,7 @@ class Category extends CategoryBase implements ItemInterface, ItemSelectInterfac $Data->setQuery($query); $Data->addParam($id); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -161,7 +161,7 @@ class Category extends CategoryBase implements ItemInterface, ItemSelectInterfac $Data->addParam($id); $Data->setMapClassName($this->getDataModel()); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -189,7 +189,7 @@ class Category extends CategoryBase implements ItemInterface, ItemSelectInterfac $Data->addParam($this->itemData->getCategoryId()); $Data->setOnErrorMessage(__('Error al actualizar la categoría', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -210,7 +210,7 @@ class Category extends CategoryBase implements ItemInterface, ItemSelectInterfac $Data->addParam($this->itemData->getCategoryName()); $Data->addParam($this->itemData->getCategoryId()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -227,7 +227,7 @@ class Category extends CategoryBase implements ItemInterface, ItemSelectInterfac $Data->setMapClassName($this->getDataModel()); $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -250,6 +250,6 @@ class Category extends CategoryBase implements ItemInterface, ItemSelectInterfac $Data->setParams($ids); $Data->setMapClassName($this->getDataModel()); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/Categories/CategoryBase.php b/lib/SP/Mgmt/Categories/CategoryBase.php similarity index 100% rename from inc/SP/Mgmt/Categories/CategoryBase.php rename to lib/SP/Mgmt/Categories/CategoryBase.php diff --git a/inc/SP/Mgmt/Categories/CategorySearch.php b/lib/SP/Mgmt/Categories/CategorySearch.php similarity index 94% rename from inc/SP/Mgmt/Categories/CategorySearch.php rename to lib/SP/Mgmt/Categories/CategorySearch.php index 8bab3507..8055fe49 100644 --- a/inc/SP/Mgmt/Categories/CategorySearch.php +++ b/lib/SP/Mgmt/Categories/CategorySearch.php @@ -28,7 +28,7 @@ defined('APP_ROOT') || die(); use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -63,10 +63,10 @@ class CategorySearch extends CategoryBase implements ItemSearchInterface $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); /** @var array $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/CustomFields/CustomField.php b/lib/SP/Mgmt/CustomFields/CustomField.php similarity index 97% rename from inc/SP/Mgmt/CustomFields/CustomField.php rename to lib/SP/Mgmt/CustomFields/CustomField.php index 36ee6375..71717068 100644 --- a/inc/SP/Mgmt/CustomFields/CustomField.php +++ b/lib/SP/Mgmt/CustomFields/CustomField.php @@ -33,7 +33,7 @@ use SP\Core\Exceptions\SPException; use SP\DataModel\CustomFieldData; use SP\DataModel\CustomFieldDefData; use SP\Mgmt\ItemInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Util; @@ -87,7 +87,7 @@ class CustomField extends CustomFieldBase implements ItemInterface $Data->addParam($this->itemData->getId()); $Data->addParam($this->itemData->getDefinitionId()); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -111,7 +111,7 @@ class CustomField extends CustomFieldBase implements ItemInterface $Data->addParam($this->itemData->getId()); $Data->addParam($this->itemData->getDefinitionId()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return ($Data->getQueryNumRows() >= 1); } @@ -154,7 +154,7 @@ class CustomField extends CustomFieldBase implements ItemInterface $Data->addParam(Crypt::encrypt($this->itemData->getValue(), $securedKey, $sessionKey)); $Data->addParam($securedKey); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -174,7 +174,7 @@ class CustomField extends CustomFieldBase implements ItemInterface $Data->addParam($id); $Data->addParam($this->itemData->getCustomfielddataModuleId()); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -220,7 +220,7 @@ class CustomField extends CustomFieldBase implements ItemInterface $Data->addParam($id); /** @var CustomFieldData[] $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $customFields = []; @@ -289,7 +289,7 @@ class CustomField extends CustomFieldBase implements ItemInterface $Data->addParam($this->itemData->getModule()); /** @var CustomFieldDefData[] $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); if (count($queryRes) === 0) { return ['hash' => '']; diff --git a/inc/SP/Mgmt/CustomFields/CustomFieldBase.php b/lib/SP/Mgmt/CustomFields/CustomFieldBase.php similarity index 100% rename from inc/SP/Mgmt/CustomFields/CustomFieldBase.php rename to lib/SP/Mgmt/CustomFields/CustomFieldBase.php diff --git a/inc/SP/Mgmt/CustomFields/CustomFieldDef.php b/lib/SP/Mgmt/CustomFields/CustomFieldDef.php similarity index 95% rename from inc/SP/Mgmt/CustomFields/CustomFieldDef.php rename to lib/SP/Mgmt/CustomFields/CustomFieldDef.php index ce175a73..f17cf4f2 100644 --- a/inc/SP/Mgmt/CustomFields/CustomFieldDef.php +++ b/lib/SP/Mgmt/CustomFields/CustomFieldDef.php @@ -30,7 +30,7 @@ use SP\Core\Exceptions\SPException; use SP\DataModel\CustomFieldDefData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Util; @@ -59,7 +59,7 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface $Data->addParam(serialize($this->itemData)); $Data->setOnErrorMessage(__('Error al crear el campo personalizado', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -83,7 +83,7 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar el campo personalizado', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -103,7 +103,7 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface $Data->setQuery($query); $Data->addParam($id); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -127,7 +127,7 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface $Data->addParam($this->itemData->getId()); $Data->setOnErrorMessage(__('Error al actualizar el campo personalizado', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($curField->getModule() !== $this->itemData->getModule()) { $this->updateItemsModulesForDefinition(); @@ -156,7 +156,7 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface $Data->addParam($id); /** @var CustomFieldDefData $CustomFieldDef */ - $CustomFieldDef = DB::getResults($Data); + $CustomFieldDef = DbWrapper::getResults($Data); if ($CustomFieldDef === false) { throw new SPException(SPException::SP_INFO, __('Campo personalizado no encontrado', false)); @@ -188,7 +188,7 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface $Data->addParam($this->itemData->getModule()); $Data->addParam($this->itemData->getId()); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -209,7 +209,7 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface $Data->setQuery($query); /** @var CustomFieldDefData[] $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); if (count($queryRes) === 0) { throw new SPException(SPException::SP_INFO, __('No se encontraron campos personalizados', false)); @@ -273,7 +273,7 @@ class CustomFieldDef extends CustomFieldBase implements ItemInterface $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** diff --git a/inc/SP/Mgmt/CustomFields/CustomFieldDefSearch.php b/lib/SP/Mgmt/CustomFields/CustomFieldDefSearch.php similarity index 96% rename from inc/SP/Mgmt/CustomFields/CustomFieldDefSearch.php rename to lib/SP/Mgmt/CustomFields/CustomFieldDefSearch.php index fd2553c5..daf58f11 100644 --- a/inc/SP/Mgmt/CustomFields/CustomFieldDefSearch.php +++ b/lib/SP/Mgmt/CustomFields/CustomFieldDefSearch.php @@ -29,7 +29,7 @@ defined('APP_ROOT') || die(); use SP\DataModel\CustomFieldDefData; use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Util; @@ -56,10 +56,10 @@ class CustomFieldDefSearch extends CustomFieldBase implements ItemSearchInterfac $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); /** @var CustomFieldDefData[] $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $customFields = []; diff --git a/inc/SP/Mgmt/CustomFields/CustomFieldTypes.php b/lib/SP/Mgmt/CustomFields/CustomFieldTypes.php similarity index 100% rename from inc/SP/Mgmt/CustomFields/CustomFieldTypes.php rename to lib/SP/Mgmt/CustomFields/CustomFieldTypes.php diff --git a/inc/SP/Mgmt/CustomFields/CustomFieldsUtil.php b/lib/SP/Mgmt/CustomFields/CustomFieldsUtil.php similarity index 96% rename from inc/SP/Mgmt/CustomFields/CustomFieldsUtil.php rename to lib/SP/Mgmt/CustomFields/CustomFieldsUtil.php index a40c8815..c877eefc 100644 --- a/inc/SP/Mgmt/CustomFields/CustomFieldsUtil.php +++ b/lib/SP/Mgmt/CustomFields/CustomFieldsUtil.php @@ -34,7 +34,7 @@ use SP\Core\OldCrypt; use SP\DataModel\CustomFieldData; use SP\DataModel\CustomFieldDefData; use SP\Log\Log; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Util; @@ -66,7 +66,7 @@ class CustomFieldsUtil $Data->setQuery($query); /** @var CustomFieldData[] $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); if (count($queryRes) === 0) { $LogMessage->addDescription(__('No hay datos de campos personalizados', false)); @@ -100,7 +100,7 @@ class CustomFieldsUtil $Data->addParam($securedKey); $Data->addParam($CustomField->getCustomfielddataId()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $success[] = $CustomField->getCustomfielddataId(); } catch (\Exception $e) { @@ -137,7 +137,7 @@ class CustomFieldsUtil $Data->setQuery($query); /** @var CustomFieldData[] $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); if (count($queryRes) === 0) { $LogMessage->addDescription(__('No hay datos de campos personalizados', false)); @@ -171,7 +171,7 @@ class CustomFieldsUtil $Data->addParam($securedKey); $Data->addParam($CustomField->getCustomfielddataId()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $success[] = $CustomField->getCustomfielddataId(); } catch (\Exception $e) { @@ -251,7 +251,7 @@ class CustomFieldsUtil $Data->setQuery($query); /** @var CustomFieldDefData[] $oldDefs */ - $oldDefs = DB::getResultsArray($Data); + $oldDefs = DbWrapper::getResultsArray($Data); try { if (count($oldDefs) > 0) { @@ -262,7 +262,7 @@ class CustomFieldsUtil $Data->setQuery($query); $Data->setOnErrorMessage(__('Error al migrar campos personalizados', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $query = /** @lang SQL */ 'UPDATE customFieldsDef SET @@ -283,7 +283,7 @@ class CustomFieldsUtil $Data->addParam($cf->customfielddef_id); try { - DB::getQuery($Data); + DbWrapper::getQuery($Data); $LogMessage->addDetails(__('Campo actualizado', false), $cf->customfielddef_id); } catch (SPException $e) { diff --git a/inc/SP/Mgmt/Customers/Customer.php b/lib/SP/Mgmt/Customers/Customer.php similarity index 93% rename from inc/SP/Mgmt/Customers/Customer.php rename to lib/SP/Mgmt/Customers/Customer.php index 53e7ef01..281d4eb5 100644 --- a/inc/SP/Mgmt/Customers/Customer.php +++ b/lib/SP/Mgmt/Customers/Customer.php @@ -33,7 +33,7 @@ use SP\DataModel\CustomerData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemSelectInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -70,9 +70,9 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data->addParam($this->makeItemHash($this->itemData->getCustomerName())); $Data->setOnErrorMessage(__('Error al crear el cliente', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setCustomerId(DB::$lastId); + $this->itemData->setCustomerId(DbWrapper::$lastId); return $this; } @@ -90,7 +90,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data->setQuery($query); $Data->addParam($this->makeItemHash($this->itemData->getCustomerName())); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes !== false) { if ($Data->getQueryNumRows() === 0) { @@ -125,7 +125,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar el cliente', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Cliente no encontrado', false)); @@ -149,7 +149,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data->setQuery($query); $Data->addParam($id); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -168,7 +168,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data->setQuery($query); $Data->addParam($id); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -198,7 +198,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data->addParam($this->itemData->getCustomerId()); $Data->setOnErrorMessage(__('Error al actualizar el cliente', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -218,7 +218,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data->addParam($this->makeItemHash($this->itemData->getCustomerName())); $Data->addParam($this->itemData->getCustomerId()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -235,7 +235,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data->setMapClassName($this->getDataModel()); $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -248,7 +248,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data = new QueryData(); // Acotar los resultados por usuario - $queryWhere = AccountUtil::getAccountFilterUser($Data); + $queryWhere = AccountUtil::getAccountFilterUser($Data, $this->session); $query = /** @lang SQL */ 'SELECT customer_id as id, customer_name as name @@ -262,7 +262,7 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -285,6 +285,6 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } diff --git a/inc/SP/Mgmt/Customers/CustomerBase.php b/lib/SP/Mgmt/Customers/CustomerBase.php similarity index 100% rename from inc/SP/Mgmt/Customers/CustomerBase.php rename to lib/SP/Mgmt/Customers/CustomerBase.php diff --git a/inc/SP/Mgmt/Customers/CustomerSearch.php b/lib/SP/Mgmt/Customers/CustomerSearch.php similarity index 94% rename from inc/SP/Mgmt/Customers/CustomerSearch.php rename to lib/SP/Mgmt/Customers/CustomerSearch.php index c6d03466..68289058 100644 --- a/inc/SP/Mgmt/Customers/CustomerSearch.php +++ b/lib/SP/Mgmt/Customers/CustomerSearch.php @@ -28,7 +28,7 @@ defined('APP_ROOT') || die(); use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -61,9 +61,9 @@ class CustomerSearch extends CustomerBase implements ItemSearchInterface $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/Files/File.php b/lib/SP/Mgmt/Files/File.php similarity index 96% rename from inc/SP/Mgmt/Files/File.php rename to lib/SP/Mgmt/Files/File.php index ac4ad12d..c8a0959e 100644 --- a/inc/SP/Mgmt/Files/File.php +++ b/lib/SP/Mgmt/Files/File.php @@ -34,7 +34,7 @@ use SP\Log\Log; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemSelectInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\ImageUtil; @@ -98,7 +98,7 @@ class File extends FileBase implements ItemInterface, ItemSelectInterface $LogMessage->addDetails(__('Tipo', false), $this->itemData->getAccfileType()); $LogMessage->addDetails(__('Tamaño', false), $this->itemData->getRoundSize() . 'KB'); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $LogMessage->addDescription(__('Archivo subido', false)); $Log->writeLog(); @@ -124,7 +124,7 @@ class File extends FileBase implements ItemInterface, ItemSelectInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar el archivo', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Archivo no encontrado', false)); @@ -157,7 +157,7 @@ class File extends FileBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->addParam($id); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -194,7 +194,7 @@ class File extends FileBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->addParam($id); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -262,6 +262,6 @@ class File extends FileBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/Files/FileBase.php b/lib/SP/Mgmt/Files/FileBase.php similarity index 100% rename from inc/SP/Mgmt/Files/FileBase.php rename to lib/SP/Mgmt/Files/FileBase.php diff --git a/inc/SP/Mgmt/Files/FileSearch.php b/lib/SP/Mgmt/Files/FileSearch.php similarity index 91% rename from inc/SP/Mgmt/Files/FileSearch.php rename to lib/SP/Mgmt/Files/FileSearch.php index 6cb3fd7d..c4c9c0da 100644 --- a/inc/SP/Mgmt/Files/FileSearch.php +++ b/lib/SP/Mgmt/Files/FileSearch.php @@ -26,8 +26,9 @@ namespace SP\Mgmt\Files; use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; +use SP\DataModel\FileExtData; /** * Class FileSearch @@ -43,7 +44,7 @@ class FileSearch extends FileBase implements ItemSearchInterface public function getMgmtSearch(ItemSearchData $SearchData) { $Data = new QueryData(); - $Data->setMapClassName('SP\DataModel\FileExtData'); + $Data->setMapClassName(FileExtData::class); $Data->setSelect('accfile_id, accfile_name, CONCAT(ROUND(accfile_size/1000, 2), "KB") AS accfile_size, accfile_thumb, accfile_type, account_name, customer_name'); $Data->setFrom('accFiles JOIN accounts ON account_id = accfile_accountId JOIN customers ON customer_id = account_customerId'); $Data->setOrder('accfile_name'); @@ -62,9 +63,9 @@ class FileSearch extends FileBase implements ItemSearchInterface $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/Files/FileUtil.php b/lib/SP/Mgmt/Files/FileUtil.php similarity index 93% rename from inc/SP/Mgmt/Files/FileUtil.php rename to lib/SP/Mgmt/Files/FileUtil.php index dc5bf555..7d5a3083 100644 --- a/inc/SP/Mgmt/Files/FileUtil.php +++ b/lib/SP/Mgmt/Files/FileUtil.php @@ -26,7 +26,7 @@ namespace SP\Mgmt\Files; use SP\Core\Exceptions\SPException; use SP\DataModel\FileData; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -58,11 +58,11 @@ class FileUtil WHERE accfile_accountId = ?'; $Data = new QueryData(); - $Data->setMapClassName('SP\DataModel\FileData'); + $Data->setMapClassName(FileData::class); $Data->setQuery($query); $Data->addParam($accountId); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -81,7 +81,7 @@ class FileUtil $Data->setQuery($query); $Data->addParam($accountId); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows(); } @@ -101,7 +101,7 @@ class FileUtil $Data->addParam($accountId); $Data->setOnErrorMessage(__('Error al eliminar archivos asociados a la cuenta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); } /** diff --git a/inc/SP/Mgmt/Groups/Group.php b/lib/SP/Mgmt/Groups/Group.php similarity index 94% rename from inc/SP/Mgmt/Groups/Group.php rename to lib/SP/Mgmt/Groups/Group.php index c49fd89a..65afd686 100644 --- a/inc/SP/Mgmt/Groups/Group.php +++ b/lib/SP/Mgmt/Groups/Group.php @@ -31,7 +31,7 @@ use SP\DataModel\GroupUsersData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemSelectInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -67,9 +67,9 @@ class Group extends GroupBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUsergroupDescription()); $Data->setOnErrorMessage(__('Error al crear el grupo', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setUsergroupId(DB::$lastId); + $this->itemData->setUsergroupId(DbWrapper::$lastId); $GroupUsers = new GroupUsersData(); $GroupUsers->setUsertogroupGroupId($this->itemData->getUsergroupId()); @@ -92,7 +92,7 @@ class Group extends GroupBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->addParam($this->itemData->getUsergroupName()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -119,7 +119,7 @@ class Group extends GroupBase implements ItemInterface, ItemSelectInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar el grupo', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Grupo no encontrado', false)); @@ -158,7 +158,7 @@ class Group extends GroupBase implements ItemInterface, ItemSelectInterface $Data->addParam($id); $Data->addParam($id); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return ($Data->getQueryNumRows() > 1); } @@ -177,7 +177,7 @@ class Group extends GroupBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->addParam($id); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -204,7 +204,7 @@ class Group extends GroupBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUsergroupId()); $Data->setOnErrorMessage(__('Error al actualizar el grupo', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $GroupUsers = new GroupUsersData(); $GroupUsers->setUsertogroupGroupId($this->itemData->getUsergroupId()); @@ -229,7 +229,7 @@ class Group extends GroupBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUsergroupName()); $Data->addParam($this->itemData->getUsergroupId()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -250,7 +250,7 @@ class Group extends GroupBase implements ItemInterface, ItemSelectInterface $Data->setMapClassName($this->getDataModel()); $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -273,6 +273,6 @@ class Group extends GroupBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } diff --git a/inc/SP/Mgmt/Groups/GroupAccounts.php b/lib/SP/Mgmt/Groups/GroupAccounts.php similarity index 95% rename from inc/SP/Mgmt/Groups/GroupAccounts.php rename to lib/SP/Mgmt/Groups/GroupAccounts.php index 93811245..da6cf631 100644 --- a/inc/SP/Mgmt/Groups/GroupAccounts.php +++ b/lib/SP/Mgmt/Groups/GroupAccounts.php @@ -29,7 +29,7 @@ defined('APP_ROOT') || die(); use SP\DataModel\GroupAccountsData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -69,7 +69,7 @@ class GroupAccounts extends GroupAccountsBase implements ItemInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar grupos asociados a la cuenta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -99,7 +99,7 @@ class GroupAccounts extends GroupAccountsBase implements ItemInterface $Data->setOnErrorMessage(__('Error al actualizar los grupos secundarios', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -118,7 +118,7 @@ class GroupAccounts extends GroupAccountsBase implements ItemInterface $Data->setQuery($query); $Data->addParam($id); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -142,7 +142,7 @@ class GroupAccounts extends GroupAccountsBase implements ItemInterface $Data->setQuery($query); $Data->addParam($id); - DB::getResults($Data); + DbWrapper::getResults($Data); return ($Data->getQueryNumRows() > 1); } @@ -177,7 +177,7 @@ class GroupAccounts extends GroupAccountsBase implements ItemInterface $Data->setQuery($query); $Data->addParam($id); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** diff --git a/inc/SP/Mgmt/Groups/GroupAccountsBase.php b/lib/SP/Mgmt/Groups/GroupAccountsBase.php similarity index 100% rename from inc/SP/Mgmt/Groups/GroupAccountsBase.php rename to lib/SP/Mgmt/Groups/GroupAccountsBase.php diff --git a/inc/SP/Mgmt/Groups/GroupAccountsUtil.php b/lib/SP/Mgmt/Groups/GroupAccountsUtil.php similarity index 96% rename from inc/SP/Mgmt/Groups/GroupAccountsUtil.php rename to lib/SP/Mgmt/Groups/GroupAccountsUtil.php index fcbc6fb8..fefd6cec 100644 --- a/inc/SP/Mgmt/Groups/GroupAccountsUtil.php +++ b/lib/SP/Mgmt/Groups/GroupAccountsUtil.php @@ -27,7 +27,7 @@ namespace SP\Mgmt\Groups; defined('APP_ROOT') || die(); use SP\DataModel\GroupData; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -58,7 +58,7 @@ class GroupAccountsUtil $Data->setQuery($query); $Data->addParam($accountId); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** diff --git a/inc/SP/Mgmt/Groups/GroupBase.php b/lib/SP/Mgmt/Groups/GroupBase.php similarity index 100% rename from inc/SP/Mgmt/Groups/GroupBase.php rename to lib/SP/Mgmt/Groups/GroupBase.php diff --git a/inc/SP/Mgmt/Groups/GroupSearch.php b/lib/SP/Mgmt/Groups/GroupSearch.php similarity index 94% rename from inc/SP/Mgmt/Groups/GroupSearch.php rename to lib/SP/Mgmt/Groups/GroupSearch.php index 689e1800..396a3f35 100644 --- a/inc/SP/Mgmt/Groups/GroupSearch.php +++ b/lib/SP/Mgmt/Groups/GroupSearch.php @@ -28,7 +28,7 @@ defined('APP_ROOT') || die(); use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -62,9 +62,9 @@ class GroupSearch extends GroupBase implements ItemSearchInterface $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/Groups/GroupUsers.php b/lib/SP/Mgmt/Groups/GroupUsers.php similarity index 95% rename from inc/SP/Mgmt/Groups/GroupUsers.php rename to lib/SP/Mgmt/Groups/GroupUsers.php index b3209aa6..c4cf848c 100644 --- a/inc/SP/Mgmt/Groups/GroupUsers.php +++ b/lib/SP/Mgmt/Groups/GroupUsers.php @@ -31,7 +31,7 @@ use SP\DataModel\GroupUsersData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemSelectInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -71,7 +71,7 @@ class GroupUsers extends GroupUsersBase implements ItemInterface, ItemSelectInte $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar los usuarios del grupo', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -101,7 +101,7 @@ class GroupUsers extends GroupUsersBase implements ItemInterface, ItemSelectInte $Data->setOnErrorMessage(__('Error al asignar los usuarios al grupo', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -120,7 +120,7 @@ class GroupUsers extends GroupUsersBase implements ItemInterface, ItemSelectInte $Data->setQuery($query); $Data->addParam($id); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -146,7 +146,7 @@ class GroupUsers extends GroupUsersBase implements ItemInterface, ItemSelectInte $Data->setQuery($query); $Data->addParam($id); - DB::getResults($Data); + DbWrapper::getResults($Data); return ($Data->getQueryNumRows() > 1); } @@ -195,7 +195,7 @@ class GroupUsers extends GroupUsersBase implements ItemInterface, ItemSelectInte $Data->addParam($groupId); $Data->addParam($userId); - DB::getResults($Data); + DbWrapper::getResults($Data); return ($Data->getQueryNumRows() === 1); } @@ -215,6 +215,6 @@ class GroupUsers extends GroupUsersBase implements ItemInterface, ItemSelectInte $Data->setQuery($query); $Data->addParam($userId); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/Groups/GroupUsersBase.php b/lib/SP/Mgmt/Groups/GroupUsersBase.php similarity index 100% rename from inc/SP/Mgmt/Groups/GroupUsersBase.php rename to lib/SP/Mgmt/Groups/GroupUsersBase.php diff --git a/inc/SP/Mgmt/Groups/GroupUtil.php b/lib/SP/Mgmt/Groups/GroupUtil.php similarity index 95% rename from inc/SP/Mgmt/Groups/GroupUtil.php rename to lib/SP/Mgmt/Groups/GroupUtil.php index cd57149a..451ec3c4 100644 --- a/inc/SP/Mgmt/Groups/GroupUtil.php +++ b/lib/SP/Mgmt/Groups/GroupUtil.php @@ -26,7 +26,7 @@ namespace SP\Mgmt\Groups; use SP\DataModel\GroupData; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -52,6 +52,6 @@ class GroupUtil $Data->setQuery($query); $Data->addParam($name); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/ItemBaseInterface.php b/lib/SP/Mgmt/ItemBaseInterface.php similarity index 100% rename from inc/SP/Mgmt/ItemBaseInterface.php rename to lib/SP/Mgmt/ItemBaseInterface.php diff --git a/inc/SP/Mgmt/ItemBaseTrait.php b/lib/SP/Mgmt/ItemBaseTrait.php similarity index 76% rename from inc/SP/Mgmt/ItemBaseTrait.php rename to lib/SP/Mgmt/ItemBaseTrait.php index ec4ab31e..49a40c63 100644 --- a/inc/SP/Mgmt/ItemBaseTrait.php +++ b/lib/SP/Mgmt/ItemBaseTrait.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -24,10 +24,14 @@ namespace SP\Mgmt; +use SP\Config\Config; use SP\Core\DiFactory; use SP\Core\Exceptions\InvalidClassException; use SP\Core\Exceptions\SPException; +use SP\Core\Session\Session; +use SP\Core\Traits\InjectableTrait; use SP\DataModel\DataModelInterface; +use SP\Storage\Database; /** * Class ItemBaseTrait @@ -36,6 +40,8 @@ use SP\DataModel\DataModelInterface; */ trait ItemBaseTrait { + use InjectableTrait; + /** * @var string */ @@ -44,6 +50,8 @@ trait ItemBaseTrait * @var mixed|DataModelInterface */ protected $itemData; + /** @var Session */ + protected $session; /** * Constructor. @@ -53,6 +61,8 @@ trait ItemBaseTrait */ public function __construct($itemData = null) { + $this->injectDependencies(); + $this->init(); if (null !== $itemData) { @@ -68,9 +78,9 @@ trait ItemBaseTrait * @param $itemData * @return static */ - public final static function getItem($itemData = null) + final public static function getItem($itemData = null) { - return DiFactory::getItem(get_called_class(), $itemData); + return DiFactory::getItem(static::class, $itemData); } /** @@ -80,7 +90,7 @@ trait ItemBaseTrait * @return static * @throws \SP\Core\Exceptions\InvalidClassException */ - public static final function getNewItem($itemData = null) + final public static function getNewItem($itemData = null) { return new static($itemData); } @@ -100,7 +110,7 @@ trait ItemBaseTrait * @return $this * @throws InvalidClassException */ - public final function setItemData($itemData) + final public function setItemData($itemData) { if (null !== $this->dataModel && ($itemData instanceof $this->dataModel) === false) { throw new InvalidClassException(SPException::SP_ERROR, $this->dataModel); @@ -124,7 +134,7 @@ trait ItemBaseTrait * @return static * @throws InvalidClassException */ - protected final function setDataModel($dataModel) + final protected function setDataModel($dataModel) { if (false === class_exists($dataModel)) { throw new InvalidClassException(SPException::SP_ERROR, $dataModel); @@ -135,10 +145,22 @@ trait ItemBaseTrait return $this; } + /** + * @param Config $config + * @param Database $db + * @param Session $session + */ + public function inject(Config $config, Database $db, Session $session) + { + $this->ConfigData = $config->getConfigData(); + $this->db = $db; + $this->session = $session; + } + /** * Inicializar la clase * * @return void */ - protected abstract function init(); + abstract protected function init(); } \ No newline at end of file diff --git a/inc/SP/Mgmt/ItemInterface.php b/lib/SP/Mgmt/ItemInterface.php similarity index 100% rename from inc/SP/Mgmt/ItemInterface.php rename to lib/SP/Mgmt/ItemInterface.php diff --git a/inc/SP/Mgmt/ItemSearchInterface.php b/lib/SP/Mgmt/ItemSearchInterface.php similarity index 100% rename from inc/SP/Mgmt/ItemSearchInterface.php rename to lib/SP/Mgmt/ItemSearchInterface.php diff --git a/inc/SP/Mgmt/ItemSelectInterface.php b/lib/SP/Mgmt/ItemSelectInterface.php similarity index 100% rename from inc/SP/Mgmt/ItemSelectInterface.php rename to lib/SP/Mgmt/ItemSelectInterface.php diff --git a/inc/SP/Mgmt/ItemTrait.php b/lib/SP/Mgmt/ItemTrait.php similarity index 100% rename from inc/SP/Mgmt/ItemTrait.php rename to lib/SP/Mgmt/ItemTrait.php diff --git a/inc/SP/Mgmt/Notices/Notice.php b/lib/SP/Mgmt/Notices/Notice.php similarity index 92% rename from inc/SP/Mgmt/Notices/Notice.php rename to lib/SP/Mgmt/Notices/Notice.php index 32984680..a14cc8c6 100644 --- a/inc/SP/Mgmt/Notices/Notice.php +++ b/lib/SP/Mgmt/Notices/Notice.php @@ -25,11 +25,11 @@ namespace SP\Mgmt\Notices; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\DataModel\NoticeData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -70,9 +70,9 @@ class Notice extends NoticeBase implements ItemInterface $Data->addParam($this->itemData->isNoticeOnlyAdmin()); $Data->setOnErrorMessage(__('Error al crear la notificación', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setNoticeId(DB::$lastId); + $this->itemData->setNoticeId(DbWrapper::$lastId); return $this; } @@ -86,7 +86,7 @@ class Notice extends NoticeBase implements ItemInterface { $query = 'DELETE FROM notices WHERE notice_id = ? AND BIN(notice_sticky) = 0 LIMIT 1'; - if (Session::getUserData()->isUserIsAdminApp()) { + if (SessionFactory::getUserData()->isUserIsAdminApp()) { $query = 'DELETE FROM notices WHERE notice_id = ? LIMIT 1'; } @@ -95,7 +95,7 @@ class Notice extends NoticeBase implements ItemInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar la notificación', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Notificación no encontrada', false)); @@ -133,7 +133,7 @@ class Notice extends NoticeBase implements ItemInterface $Data->addParam($this->itemData->getNoticeId()); $Data->setOnErrorMessage(__('Error al modificar la notificación', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -164,7 +164,7 @@ class Notice extends NoticeBase implements ItemInterface $Data->addParam($id); try { - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); } catch (SPException $e) { throw new SPException(SPException::SP_ERROR, __('Error al obtener la notificación', false)); } @@ -195,7 +195,7 @@ class Notice extends NoticeBase implements ItemInterface $Data->setMapClassName($this->getDataModel()); try { - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); } catch (SPException $e) { throw new SPException(SPException::SP_ERROR, __('Error al obtener las notificaciones', false)); } @@ -245,9 +245,9 @@ class Notice extends NoticeBase implements ItemInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al modificar la notificación', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setNoticeId(DB::$lastId); + $this->itemData->setNoticeId(DbWrapper::$lastId); return $this; } @@ -281,7 +281,7 @@ class Notice extends NoticeBase implements ItemInterface $Data->addParam($this->itemData->getNoticeUserId()); try { - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); } catch (SPException $e) { throw new SPException(SPException::SP_ERROR, __('Error al obtener las notificaciones', false)); } @@ -312,10 +312,10 @@ class Notice extends NoticeBase implements ItemInterface $Data = new QueryData(); $Data->setQuery($query); $Data->setMapClassName($this->getDataModel()); - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam(SessionFactory::getUserData()->getUserId()); try { - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); } catch (SPException $e) { throw new SPException(SPException::SP_ERROR, __('Error al obtener las notificaciones', false)); } @@ -348,10 +348,10 @@ class Notice extends NoticeBase implements ItemInterface $Data = new QueryData(); $Data->setQuery($query); $Data->setMapClassName($this->getDataModel()); - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam(SessionFactory::getUserData()->getUserId()); try { - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); } catch (SPException $e) { throw new SPException(SPException::SP_ERROR, __('Error al obtener las notificaciones', false)); } @@ -385,6 +385,6 @@ class Notice extends NoticeBase implements ItemInterface $Data->setMapClassName($this->getDataModel()); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/Notices/NoticeBase.php b/lib/SP/Mgmt/Notices/NoticeBase.php similarity index 100% rename from inc/SP/Mgmt/Notices/NoticeBase.php rename to lib/SP/Mgmt/Notices/NoticeBase.php diff --git a/inc/SP/Mgmt/Notices/NoticeSearch.php b/lib/SP/Mgmt/Notices/NoticeSearch.php similarity index 90% rename from inc/SP/Mgmt/Notices/NoticeSearch.php rename to lib/SP/Mgmt/Notices/NoticeSearch.php index 7e192016..261ced52 100644 --- a/inc/SP/Mgmt/Notices/NoticeSearch.php +++ b/lib/SP/Mgmt/Notices/NoticeSearch.php @@ -26,10 +26,10 @@ namespace SP\Mgmt\Notices; defined('APP_ROOT') || die(); -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -65,10 +65,10 @@ class NoticeSearch extends NoticeBase implements ItemSearchInterface $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); /** @var array $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); @@ -97,20 +97,20 @@ class NoticeSearch extends NoticeBase implements ItemSearchInterface $Data->addParam($search); $Data->addParam($search); $Data->addParam($search); - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam(SessionFactory::getUserData()->getUserId()); } else { $Data->setWhere($filterUser); - $Data->addParam(Session::getUserData()->getUserId()); + $Data->addParam(SessionFactory::getUserData()->getUserId()); } $Data->setLimit('?,?'); $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); /** @var array $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/Plugins/Plugin.php b/lib/SP/Mgmt/Plugins/Plugin.php similarity index 93% rename from inc/SP/Mgmt/Plugins/Plugin.php rename to lib/SP/Mgmt/Plugins/Plugin.php index ad28a078..5fac619f 100644 --- a/inc/SP/Mgmt/Plugins/Plugin.php +++ b/lib/SP/Mgmt/Plugins/Plugin.php @@ -28,7 +28,7 @@ use SP\Core\Exceptions\SPException; use SP\DataModel\PluginData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -60,9 +60,9 @@ class Plugin extends PluginBase implements ItemInterface $Data->addParam($this->itemData->getPluginAvailable()); $Data->setOnErrorMessage(__('Error al crear el plugin', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setPluginId(DB::$lastId); + $this->itemData->setPluginId(DbWrapper::$lastId); return $this; } @@ -84,7 +84,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->addParam($name); $Data->setOnErrorMessage(__('Error al eliminar el plugin', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Plugin no encontrado', false)); @@ -118,7 +118,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->addParam($this->itemData->getPluginName()); $Data->setOnErrorMessage(__('Error al actualizar el plugin', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -145,7 +145,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->setQuery($query); $Data->addParam($id); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -167,7 +167,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->setMapClassName($this->getDataModel()); $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -217,7 +217,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->setQuery($query); $Data->addParam($name); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -239,7 +239,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->addParam($this->itemData->getPluginId()); $Data->setOnErrorMessage(__('Error al actualizar el plugin', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -263,7 +263,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->addParam($this->itemData->getPluginName()); $Data->setOnErrorMessage(__('Error al actualizar el plugin', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -288,7 +288,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->addParam($this->itemData->getPluginId()); $Data->setOnErrorMessage(__('Error al actualizar el plugin', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -313,7 +313,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->addParam($this->itemData->getPluginName()); $Data->setOnErrorMessage(__('Error al actualizar el plugin', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -337,7 +337,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al actualizar el plugin', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -367,7 +367,7 @@ class Plugin extends PluginBase implements ItemInterface $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -383,6 +383,6 @@ class Plugin extends PluginBase implements ItemInterface $Data = new QueryData(); $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/Plugins/PluginBase.php b/lib/SP/Mgmt/Plugins/PluginBase.php similarity index 100% rename from inc/SP/Mgmt/Plugins/PluginBase.php rename to lib/SP/Mgmt/Plugins/PluginBase.php diff --git a/inc/SP/Mgmt/Plugins/PluginSearch.php b/lib/SP/Mgmt/Plugins/PluginSearch.php similarity index 94% rename from inc/SP/Mgmt/Plugins/PluginSearch.php rename to lib/SP/Mgmt/Plugins/PluginSearch.php index d0df5daa..cd5e11fa 100644 --- a/inc/SP/Mgmt/Plugins/PluginSearch.php +++ b/lib/SP/Mgmt/Plugins/PluginSearch.php @@ -26,7 +26,7 @@ namespace SP\Mgmt\Plugins; use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -60,10 +60,10 @@ class PluginSearch extends PluginBase implements ItemSearchInterface $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); /** @var array $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/Profiles/Profile.php b/lib/SP/Mgmt/Profiles/Profile.php similarity index 91% rename from inc/SP/Mgmt/Profiles/Profile.php rename to lib/SP/Mgmt/Profiles/Profile.php index b37aabab..e42eda24 100644 --- a/inc/SP/Mgmt/Profiles/Profile.php +++ b/lib/SP/Mgmt/Profiles/Profile.php @@ -28,13 +28,13 @@ namespace SP\Mgmt\Profiles; defined('APP_ROOT') || die(); use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\DataModel\ProfileBaseData; use SP\DataModel\ProfileData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemSelectInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Util; @@ -68,9 +68,9 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface $Data->addParam(serialize($this->itemData)); $Data->setOnErrorMessage(__('Error al crear perfil', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setUserprofileId(DB::getLastId()); + $this->itemData->setUserprofileId(DbWrapper::getLastId()); return $this; } @@ -90,7 +90,7 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUserprofileName()); $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return ($Data->getQueryNumRows() > 0); } @@ -114,7 +114,7 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar perfil', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Perfil no encontrado', false)); @@ -137,7 +137,7 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->addParam($id); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return ($Data->getQueryNumRows() > 0); } @@ -164,7 +164,7 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface * @var ProfileBaseData $queryRes * @var ProfileData $Profile */ - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); $Profile = Util::castToClass($this->getDataModel(), $queryRes->getUserprofileProfile()); $Profile->setUserprofileId($queryRes->getUserprofileId()); @@ -196,7 +196,7 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUserprofileId()); $Data->setOnErrorMessage(__('Error al modificar perfil', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() > 0) { $this->updateSessionProfile(); @@ -223,7 +223,7 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUserprofileId()); $Data->setQuery($query); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return ($Data->getQueryNumRows() > 0); } @@ -233,8 +233,8 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface */ protected function updateSessionProfile() { - if (Session::getUserProfile()->getUserprofileId() === $this->itemData->getUserprofileId()) { - Session::setUserProfile($this->itemData); + if ($this->session->getUserProfile()->getUserprofileId() === $this->itemData->getUserprofileId()) { + $this->session->setUserProfile($this->itemData); } } @@ -252,7 +252,7 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface $Data->setMapClassName($this->getDataModel()); $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -278,6 +278,6 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } diff --git a/inc/SP/Mgmt/Profiles/ProfileBase.php b/lib/SP/Mgmt/Profiles/ProfileBase.php similarity index 100% rename from inc/SP/Mgmt/Profiles/ProfileBase.php rename to lib/SP/Mgmt/Profiles/ProfileBase.php diff --git a/inc/SP/Mgmt/Profiles/ProfileSearch.php b/lib/SP/Mgmt/Profiles/ProfileSearch.php similarity index 94% rename from inc/SP/Mgmt/Profiles/ProfileSearch.php rename to lib/SP/Mgmt/Profiles/ProfileSearch.php index f1361da6..4e08ef2d 100644 --- a/inc/SP/Mgmt/Profiles/ProfileSearch.php +++ b/lib/SP/Mgmt/Profiles/ProfileSearch.php @@ -28,7 +28,7 @@ defined('APP_ROOT') || die(); use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -60,9 +60,9 @@ class ProfileSearch extends ProfileBase implements ItemSearchInterface $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/Profiles/ProfileUtil.php b/lib/SP/Mgmt/Profiles/ProfileUtil.php similarity index 97% rename from inc/SP/Mgmt/Profiles/ProfileUtil.php rename to lib/SP/Mgmt/Profiles/ProfileUtil.php index 65d48623..7cd43d93 100644 --- a/inc/SP/Mgmt/Profiles/ProfileUtil.php +++ b/lib/SP/Mgmt/Profiles/ProfileUtil.php @@ -28,7 +28,7 @@ use SP\Core\Exceptions\SPException; use SP\DataModel\ProfileData; use SP\Log\Email; use SP\Log\Log; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -76,7 +76,7 @@ class ProfileUtil $Data = new QueryData(); $Data->setQuery($query); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); if (count($queryRes) === 0) { $LogMessage->addDescription(__('Error al obtener perfiles', false)); @@ -139,7 +139,7 @@ class ProfileUtil $Data->setQuery($query); try { - DB::getQuery($Data); + DbWrapper::getQuery($Data); $LogMessage->addDescription(__('Operación realizada correctamente', false)); $Log->writeLog(); @@ -168,6 +168,6 @@ class ProfileUtil $Data->setQuery($query); $Data->addParam($id); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/PublicLinks/PublicLink.php b/lib/SP/Mgmt/PublicLinks/PublicLink.php similarity index 94% rename from inc/SP/Mgmt/PublicLinks/PublicLink.php rename to lib/SP/Mgmt/PublicLinks/PublicLink.php index e1dbb354..cf4a1fb7 100644 --- a/inc/SP/Mgmt/PublicLinks/PublicLink.php +++ b/lib/SP/Mgmt/PublicLinks/PublicLink.php @@ -27,7 +27,7 @@ namespace SP\Mgmt\PublicLinks; use SP\Account\AccountUtil; use SP\Config\Config; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\DataModel\PublicLinkBaseData; use SP\DataModel\PublicLinkData; use SP\DataModel\PublicLinkListData; @@ -36,7 +36,7 @@ use SP\Log\Log; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemTrait; use SP\Mgmt\Users\UserUtil; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\HttpUtil; use SP\Util\Util; @@ -105,7 +105,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->addParam($this->itemData->getPublicLinkId()); $Data->setOnErrorMessage(__('Error al actualizar enlace', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return true; } @@ -126,8 +126,8 @@ class PublicLink extends PublicLinkBase implements ItemInterface } $this->itemData->setDateAdd(time()); - $this->itemData->setUserId(Session::getUserData()->getUserId()); - $this->itemData->setMaxCountViews(Config::getConfig()->getPublinksMaxViews()); + $this->itemData->setUserId(SessionFactory::getUserData()->getUserId()); + $this->itemData->setMaxCountViews($this->ConfigData->getPublinksMaxViews()); $this->calcDateExpire(); $this->createLinkHash(); $this->setLinkData(); @@ -145,7 +145,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->addParam(serialize($this->itemData)); $Data->setOnErrorMessage(__('Error al crear enlace', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -162,7 +162,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->setQuery($query); $Data->addParam($this->itemData->getPublicLinkItemId()); - DB::getResults($Data); + DbWrapper::getResults($Data); return ($Data->getQueryNumRows() === 1); } @@ -182,7 +182,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar enlace', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Enlace no encontrado', false)); @@ -200,7 +200,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface */ public function refresh() { - $this->itemData->setMaxCountViews($this->itemData->getMaxCountViews() + Config::getConfig()->getPublinksMaxViews()); + $this->itemData->setMaxCountViews($this->itemData->getMaxCountViews() + $this->ConfigData->getPublinksMaxViews()); $this->calcDateExpire(); $this->createLinkHash(true); @@ -219,7 +219,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->addParam($this->itemData->getPublicLinkId()); $Data->setOnErrorMessage(__('Error al renovar enlace', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -243,7 +243,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->addParam($id); /** @var PublicLinkBaseData $queryRes */ - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_ERROR, __('Error al obtener enlace', false)); @@ -269,7 +269,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->setQuery($query); /** @var PublicLinkData[] $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $publicLinks = []; @@ -342,7 +342,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->addParam($hash); /** @var PublicLinkBaseData $queryRes */ - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_ERROR, __('Error al obtener enlace', false)); @@ -376,7 +376,7 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->setQuery($query); $Data->addParam($itemId); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_ERROR, __('Error al obtener enlace', false)); @@ -404,6 +404,6 @@ class PublicLink extends PublicLinkBase implements ItemInterface $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/PublicLinks/PublicLinkBase.php b/lib/SP/Mgmt/PublicLinks/PublicLinkBase.php similarity index 86% rename from inc/SP/Mgmt/PublicLinks/PublicLinkBase.php rename to lib/SP/Mgmt/PublicLinks/PublicLinkBase.php index 35cc223e..12264455 100644 --- a/inc/SP/Mgmt/PublicLinks/PublicLinkBase.php +++ b/lib/SP/Mgmt/PublicLinks/PublicLinkBase.php @@ -28,6 +28,7 @@ defined('APP_ROOT') || die(); use SP\Account\Account; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Crypt\Crypt; use SP\Core\Crypt\Session as CryptSession; use SP\Core\Exceptions\InvalidClassException; @@ -47,6 +48,11 @@ abstract class PublicLinkBase implements ItemBaseInterface { use ItemBaseTrait; + /** + * @var ConfigData + */ + protected $ConfigData; + /** * Inicializar la clase * @@ -66,9 +72,9 @@ abstract class PublicLinkBase implements ItemBaseInterface * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException * @throws \Defuse\Crypto\Exception\CryptoException */ - protected final function createLinkPass() + final protected function createLinkPass() { - $key = Config::getConfig()->getPasswordSalt() . $this->createLinkHash(); + $key = $this->ConfigData->getPasswordSalt() . $this->createLinkHash(); $securedKey = Crypt::makeSecuredKey($key); $this->itemData->setPass(Crypt::encrypt(CryptSession::getSessionKey(), $securedKey, $key)); @@ -81,7 +87,7 @@ abstract class PublicLinkBase implements ItemBaseInterface * @param bool $refresh Si es necesario regenerar el hash * @return string */ - protected final function createLinkHash($refresh = false) + final protected function createLinkHash($refresh = false) { if ($refresh === true || $this->itemData->getLinkHash() === '' @@ -103,7 +109,7 @@ abstract class PublicLinkBase implements ItemBaseInterface * @throws \Defuse\Crypto\Exception\BadFormatException * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException */ - protected final function setLinkData() + final protected function setLinkData() { // Obtener los datos de la cuenta $Account = new Account(new AccountExtData($this->itemData->getItemId())); @@ -115,7 +121,7 @@ abstract class PublicLinkBase implements ItemBaseInterface $AccountData->setAccountKey(null); // Encriptar los datos de la cuenta - $linkKey = Config::getConfig()->getPasswordSalt() . $this->createLinkHash(); + $linkKey = $this->ConfigData->getPasswordSalt() . $this->createLinkHash(); $linkSecuredKey = Crypt::makeSecuredKey($linkKey); $this->itemData->setData(Crypt::encrypt(serialize($AccountData), $linkSecuredKey, $linkKey)); @@ -125,9 +131,9 @@ abstract class PublicLinkBase implements ItemBaseInterface /** * Devolver el tiempo de caducidad del enlace */ - protected final function calcDateExpire() + final protected function calcDateExpire() { - $this->itemData->setDateExpire(time() + (int)Config::getConfig()->getPublinksMaxTime()); + $this->itemData->setDateExpire(time() + $this->ConfigData->getPublinksMaxTime()); } /** @@ -135,7 +141,7 @@ abstract class PublicLinkBase implements ItemBaseInterface * * @param string $who Quién lo ha visto */ - protected final function updateUseInfo($who) + final protected function updateUseInfo($who) { $this->itemData->addUseInfo(['who' => $who, 'time' => time()]); } diff --git a/inc/SP/Mgmt/PublicLinks/PublicLinkSearch.php b/lib/SP/Mgmt/PublicLinks/PublicLinkSearch.php similarity index 96% rename from inc/SP/Mgmt/PublicLinks/PublicLinkSearch.php rename to lib/SP/Mgmt/PublicLinks/PublicLinkSearch.php index 50015478..a518d472 100644 --- a/inc/SP/Mgmt/PublicLinks/PublicLinkSearch.php +++ b/lib/SP/Mgmt/PublicLinks/PublicLinkSearch.php @@ -29,7 +29,7 @@ use SP\DataModel\ItemSearchData; use SP\DataModel\PublicLinkListData; use SP\Mgmt\ItemSearchInterface; use SP\Mgmt\Users\UserUtil; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Util; @@ -56,10 +56,10 @@ class PublicLinkSearch extends PublicLinkBase implements ItemSearchInterface $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); /** @var PublicLinkListData[] $queryRes */ - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $publicLinks = []; $publicLinks['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/Tags/Tag.php b/lib/SP/Mgmt/Tags/Tag.php similarity index 94% rename from inc/SP/Mgmt/Tags/Tag.php rename to lib/SP/Mgmt/Tags/Tag.php index 69e5c7a8..c2bf1fbb 100644 --- a/inc/SP/Mgmt/Tags/Tag.php +++ b/lib/SP/Mgmt/Tags/Tag.php @@ -31,7 +31,7 @@ use SP\DataModel\TagData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemSelectInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -63,7 +63,7 @@ class Tag extends TagBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getTagHash()); $Data->setOnErrorMessage(__('Error al crear etiqueta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -80,7 +80,7 @@ class Tag extends TagBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->addParam($this->itemData->getTagHash()); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes !== false) { if ($Data->getQueryNumRows() === 0) { @@ -108,7 +108,7 @@ class Tag extends TagBase implements ItemInterface, ItemSelectInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar etiqueta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Etiqueta no encontrada', false)); @@ -137,7 +137,7 @@ class Tag extends TagBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getTagId()); $Data->setOnErrorMessage(__('Error al actualizar etiqueta', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -155,7 +155,7 @@ class Tag extends TagBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getTagHash()); $Data->addParam($this->itemData->getTagId()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -175,7 +175,7 @@ class Tag extends TagBase implements ItemInterface, ItemSelectInterface $Data->addParam($id); $Data->setMapClassName($this->getDataModel()); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_ERROR, __('Error al obtener etiqueta', false)); @@ -196,7 +196,7 @@ class Tag extends TagBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->setMapClassName($this->getDataModel()); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -228,6 +228,6 @@ class Tag extends TagBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/Tags/TagBase.php b/lib/SP/Mgmt/Tags/TagBase.php similarity index 100% rename from inc/SP/Mgmt/Tags/TagBase.php rename to lib/SP/Mgmt/Tags/TagBase.php diff --git a/inc/SP/Mgmt/Tags/TagSearch.php b/lib/SP/Mgmt/Tags/TagSearch.php similarity index 93% rename from inc/SP/Mgmt/Tags/TagSearch.php rename to lib/SP/Mgmt/Tags/TagSearch.php index d89a7383..f8404742 100644 --- a/inc/SP/Mgmt/Tags/TagSearch.php +++ b/lib/SP/Mgmt/Tags/TagSearch.php @@ -28,7 +28,7 @@ defined('APP_ROOT') || die(); use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -60,9 +60,9 @@ class TagSearch extends TagBase implements ItemSearchInterface $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/Tracks/Track.php b/lib/SP/Mgmt/Tracks/Track.php similarity index 94% rename from inc/SP/Mgmt/Tracks/Track.php rename to lib/SP/Mgmt/Tracks/Track.php index 2e554bf1..59507b9c 100644 --- a/inc/SP/Mgmt/Tracks/Track.php +++ b/lib/SP/Mgmt/Tracks/Track.php @@ -26,7 +26,7 @@ namespace SP\Mgmt\Tracks; use SP\DataModel\TrackData; use SP\Mgmt\ItemInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -60,9 +60,9 @@ class Track extends TrackBase implements ItemInterface $Data->addParam($this->itemData->getTrackIpv6Bin()); $Data->setOnErrorMessage(__('Error al crear track', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setTrackId(DB::$lastId); + $this->itemData->setTrackId(DbWrapper::$lastId); return $this; } @@ -83,7 +83,7 @@ class Track extends TrackBase implements ItemInterface $Data->addParam($this->itemData->getTrackId()); $Data->setOnErrorMessage(__('Error al eliminar track', false)); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -111,7 +111,7 @@ class Track extends TrackBase implements ItemInterface $Data->addParam($this->itemData->getTrackId()); $Data->setOnErrorMessage(__('Error al actualizar track', false)); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } /** @@ -138,7 +138,7 @@ class Track extends TrackBase implements ItemInterface $Data->addParam($this->itemData->getTrackId()); $Data->setOnErrorMessage(__('Error al obtener track', false)); - return DB::getResults($Data); + return DbWrapper::getResults($Data); } /** @@ -162,7 +162,7 @@ class Track extends TrackBase implements ItemInterface $Data->addParam($this->itemData->getTrackId()); $Data->setOnErrorMessage(__('Error al obtener tracks', false)); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -237,6 +237,6 @@ class Track extends TrackBase implements ItemInterface $Data->addParam($this->itemData->getTrackSource()); $Data->setOnErrorMessage(__('Error al obtener tracks', false)); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/Tracks/TrackBase.php b/lib/SP/Mgmt/Tracks/TrackBase.php similarity index 100% rename from inc/SP/Mgmt/Tracks/TrackBase.php rename to lib/SP/Mgmt/Tracks/TrackBase.php diff --git a/inc/SP/Mgmt/Users/User.php b/lib/SP/Mgmt/Users/User.php similarity index 95% rename from inc/SP/Mgmt/Users/User.php rename to lib/SP/Mgmt/Users/User.php index c9e06c64..1d330b05 100644 --- a/inc/SP/Mgmt/Users/User.php +++ b/lib/SP/Mgmt/Users/User.php @@ -33,7 +33,7 @@ use SP\DataModel\UserLoginData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemSelectInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -91,9 +91,9 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface $Data->addParam(Hash::hashKey($this->itemData->getUserPass())); $Data->setOnErrorMessage(__('Error al crear el usuario', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setUserId(DB::getLastId()); + $this->itemData->setUserId(DbWrapper::getLastId()); return $this; } @@ -115,7 +115,7 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUserSsoLogin()); $Data->addParam($this->itemData->getUserEmail()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -134,13 +134,13 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface $Data->addParam($id); $Data->setOnErrorMessage(__('Error al eliminar el usuario', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() === 0) { throw new SPException(SPException::SP_INFO, __('Usuario no encontrado', false)); } - $this->itemData->setUserId(DB::$lastId); + $this->itemData->setUserId(DbWrapper::$lastId); return $this; } @@ -187,10 +187,10 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUserId()); $Data->setOnErrorMessage(__('Error al actualizar el usuario', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); if ($Data->getQueryNumRows() > 0) { - $this->itemData->setUserId(DB::getLastId()); + $this->itemData->setUserId(DbWrapper::getLastId()); } return $this; @@ -215,7 +215,7 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUserEmail()); $Data->addParam($this->itemData->getUserId()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -250,7 +250,7 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface try { - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); } catch (SPException $e) { throw new SPException(SPException::SP_ERROR, __('Error al obtener los usuarios', false)); } @@ -288,7 +288,7 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface $Data->addParam($this->itemData->getUserId()); $Data->setOnErrorMessage(__('Error al modificar la clave', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -342,7 +342,7 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->addParam($id); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_ERROR, __('Error al obtener los datos del usuario', false)); @@ -402,7 +402,7 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface $Data->addParam($login); $Data->addParam($login); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_ERROR, __('Error al obtener los datos del usuario', false)); @@ -455,6 +455,6 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface $Data->setQuery($query); $Data->setParams($ids); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/Users/UserBase.php b/lib/SP/Mgmt/Users/UserBase.php similarity index 91% rename from inc/SP/Mgmt/Users/UserBase.php rename to lib/SP/Mgmt/Users/UserBase.php index 015638c7..fa1eedc8 100644 --- a/inc/SP/Mgmt/Users/UserBase.php +++ b/lib/SP/Mgmt/Users/UserBase.php @@ -26,6 +26,8 @@ namespace SP\Mgmt\Users; defined('APP_ROOT') || die(); +use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\InvalidClassException; use SP\DataModel\UserData; use SP\Mgmt\ItemBaseInterface; @@ -40,6 +42,11 @@ abstract class UserBase implements ItemBaseInterface { use ItemBaseTrait; + /** + * @var ConfigData + */ + protected $ConfigData; + /** * Inicializar la clase * diff --git a/inc/SP/Mgmt/Users/UserLdap.php b/lib/SP/Mgmt/Users/UserLdap.php similarity index 94% rename from inc/SP/Mgmt/Users/UserLdap.php rename to lib/SP/Mgmt/Users/UserLdap.php index ee1daadd..86fb955d 100644 --- a/inc/SP/Mgmt/Users/UserLdap.php +++ b/lib/SP/Mgmt/Users/UserLdap.php @@ -31,7 +31,7 @@ use SP\Core\Messages\LogMessage; use SP\DataModel\UserLoginData; use SP\Log\Email; use SP\Log\Log; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -61,7 +61,7 @@ class UserLdap extends User $Data->setQuery($query); $Data->addParam($userLogin); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() === 1; } @@ -76,8 +76,8 @@ class UserLdap extends User throw new SPException(SPException::SP_INFO, __('Login/email de usuario duplicados', false)); } - $groupId = Config::getConfig()->getLdapDefaultGroup(); - $profileId = Config::getConfig()->getLdapDefaultProfile(); + $groupId = $this->ConfigData->getLdapDefaultGroup(); + $profileId = $this->ConfigData->getLdapDefaultProfile(); $this->itemData->setUserIsDisabled(($groupId === 0 || $profileId === 0) ? 1 : 0); $query = /** @lang SQL */ @@ -107,9 +107,9 @@ class UserLdap extends User $Data->addParam(Hash::hashKey($this->itemData->getUserPass())); $Data->setOnErrorMessage(__('Error al guardar los datos de LDAP', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setUserId(DB::getLastId()); + $this->itemData->setUserId(DbWrapper::getLastId()); if (!$groupId || !$profileId) { $LogEmail = new LogMessage(); @@ -151,7 +151,7 @@ class UserLdap extends User $Data->addParam($this->itemData->getUserEmail()); $Data->addParam($this->itemData->getUserEmail()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -189,7 +189,7 @@ class UserLdap extends User $Data->addParam($this->itemData->getUserId()); $Data->setOnErrorMessage(__('Error al actualizar el usuario', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -218,7 +218,7 @@ class UserLdap extends User $Data->addParam($this->itemData->getUserLogin()); $Data->setOnErrorMessage(__('Error al actualizar la clave del usuario en la BBDD', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } diff --git a/inc/SP/Mgmt/Users/UserLdapSync.php b/lib/SP/Mgmt/Users/UserLdapSync.php similarity index 95% rename from inc/SP/Mgmt/Users/UserLdapSync.php rename to lib/SP/Mgmt/Users/UserLdapSync.php index 5c39da14..dcf81664 100644 --- a/inc/SP/Mgmt/Users/UserLdapSync.php +++ b/lib/SP/Mgmt/Users/UserLdapSync.php @@ -26,6 +26,7 @@ namespace SP\Mgmt\Users; use SP\Auth\Ldap\LdapMsAds; use SP\Auth\Ldap\LdapStd; +use SP\Bootstrap; use SP\Config\Config; use SP\Core\Exceptions\SPException; use SP\DataModel\UserData; @@ -57,15 +58,16 @@ class UserLdapSync * * @param array $options * @return bool - * @throws \phpmailer\phpmailerException */ public static function run(array &$options) { + $ConfigData = Bootstrap::getDic()['configData']; + $Log = new Log(); $LogMessage = $Log->getLogMessage(); $LogMessage->setAction(__('Sincronización LDAP', false)); - $Ldap = Config::getConfig()->isLdapAds() || $options['isADS'] ? new LdapMsAds() : new LdapStd(); + $Ldap = $ConfigData->isLdapAds() || $options['isADS'] ? new LdapMsAds() : new LdapStd(); $ldapObjects = $Ldap->findObjects(); diff --git a/inc/SP/Mgmt/Users/UserMigrate.php b/lib/SP/Mgmt/Users/UserMigrate.php similarity index 96% rename from inc/SP/Mgmt/Users/UserMigrate.php rename to lib/SP/Mgmt/Users/UserMigrate.php index cb29a2e9..12705aad 100644 --- a/inc/SP/Mgmt/Users/UserMigrate.php +++ b/lib/SP/Mgmt/Users/UserMigrate.php @@ -33,7 +33,7 @@ use SP\DataModel\UserLoginData; use SP\Log\Email; use SP\Log\Log; use SP\Mgmt\Groups\GroupUsers; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -58,7 +58,7 @@ class UserMigrate $Data->setQuery($query); $Data->addParam($userLogin); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); return ($queryRes !== false && $Data->getQueryNumRows() === 1 && $queryRes->user_isMigrate == 1); } @@ -96,7 +96,7 @@ class UserMigrate $Data->addParam($UserData->getLogin()); $Data->setOnErrorMessage(__('Error al migrar cuenta de usuario', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $Log = new Log(); $Log->getLogMessage() @@ -131,7 +131,7 @@ class UserMigrate $Data = new QueryData(); $Data->setQuery($query); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { $LogMessage->addDescription(__('Error al obtener grupo de usuarios', false)); @@ -172,6 +172,6 @@ class UserMigrate $Data = new QueryData(); $Data->setQuery($query); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } } \ No newline at end of file diff --git a/inc/SP/Mgmt/Users/UserPass.php b/lib/SP/Mgmt/Users/UserPass.php similarity index 93% rename from inc/SP/Mgmt/Users/UserPass.php rename to lib/SP/Mgmt/Users/UserPass.php index f13292a3..e70cddb8 100644 --- a/inc/SP/Mgmt/Users/UserPass.php +++ b/lib/SP/Mgmt/Users/UserPass.php @@ -27,7 +27,9 @@ namespace SP\Mgmt\Users; defined('APP_ROOT') || die(); use Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException; +use SP\Bootstrap; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Config\ConfigDB; use SP\Controller\LoginController; use SP\Core\Crypt\Crypt; @@ -42,7 +44,7 @@ use SP\DataModel\UserLoginData; use SP\DataModel\UserPassData; use SP\Log\Email; use SP\Log\Log; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -88,7 +90,7 @@ class UserPass extends UserBase $Data->setQuery($query); $Data->addParam($id); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { return false; @@ -120,7 +122,7 @@ class UserPass extends UserBase $Data->addParam($userId); /** @var UserPassData $queryRes */ - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); return ($queryRes !== false && $queryRes->getUserLastUpdateMPass() >= $configMPassTime); } @@ -128,7 +130,7 @@ class UserPass extends UserBase /** * Actualizar la clave maestra con la clave anterior del usuario * - * @param string $oldUserPass + * @param string $oldUserPass * @param UserLoginData $UserData * @return bool * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException @@ -144,14 +146,14 @@ class UserPass extends UserBase return self::updateUserMPass(self::$clearUserMPass, $UserData); } - return UserPass::MPASS_WRONG; + return self::MPASS_WRONG; } /** * Comprueba la clave maestra del usuario. * * @param UserLoginData $UserData - * @param string $key Clave de cifrado + * @param string $key Clave de cifrado * @return bool * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException * @throws \Defuse\Crypto\Exception\BadFormatException @@ -205,21 +207,24 @@ class UserPass extends UserBase * Obtener una clave de cifrado basada en la clave del usuario y un salt. * * @param UserLoginData $UserData - * @param string $key Clave de cifrado + * @param string $key Clave de cifrado * @return string con la clave de cifrado */ private static function getKey(UserLoginData $UserData, $key = null) { $pass = $key === null ? $UserData->getLoginPass() : $key; - return $pass . $UserData->getLogin() . Config::getConfig()->getPasswordSalt(); + /** @var ConfigData $ConfigData */ + $ConfigData = Bootstrap::getDic()->get(ConfigData::class); + + return $pass . $UserData->getLogin() . $ConfigData->getPasswordSalt(); } /** * Actualizar la clave maestra del usuario en la BBDD. * - * @param string $userMPass con la clave maestra - * @param UserData|UserLoginData $UserData $UserData + * @param string $userMPass con la clave maestra + * @param UserData|UserLoginData $UserData $UserData * @return bool * @throws \SP\Core\Exceptions\ConstraintException * @throws \Defuse\Crypto\Exception\CryptoException @@ -273,7 +278,7 @@ class UserPass extends UserBase $UserData->setUserMPass($cryptMPass); $UserData->setUserMKey($securedKey); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return self::MPASS_OK; } @@ -322,7 +327,7 @@ class UserPass extends UserBase $Data->addParam($userId); $Data->setOnErrorMessage(__('Error al modificar la clave', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); $Log = new Log(); $Log->getLogMessage() diff --git a/inc/SP/Mgmt/Users/UserPassRecover.php b/lib/SP/Mgmt/Users/UserPassRecover.php similarity index 96% rename from inc/SP/Mgmt/Users/UserPassRecover.php rename to lib/SP/Mgmt/Users/UserPassRecover.php index 9f189324..d57bb60e 100644 --- a/inc/SP/Mgmt/Users/UserPassRecover.php +++ b/lib/SP/Mgmt/Users/UserPassRecover.php @@ -28,7 +28,7 @@ use SP\Core\Exceptions\SPException; use SP\DataModel\UserData; use SP\DataModel\UserPassRecoverData; use SP\Mgmt\ItemInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -73,7 +73,7 @@ class UserPassRecover extends UserPassRecoverBase implements ItemInterface $Data->addParam(time() - self::MAX_PASS_RECOVER_TIME); try { - DB::getQuery($Data); + DbWrapper::getQuery($Data); } catch (SPException $e) { return false; } @@ -105,7 +105,7 @@ class UserPassRecover extends UserPassRecoverBase implements ItemInterface $Data->addParam(time() - self::MAX_PASS_RECOVER_TIME); /** @var UserPassRecoverData $queryRes */ - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { throw new SPException(SPException::SP_ERROR, __('Error en comprobación de hash', false)); @@ -134,7 +134,7 @@ class UserPassRecover extends UserPassRecoverBase implements ItemInterface $Data->addParam($this->itemData->getUserpassrHash()); $Data->setOnErrorMessage(__('Error interno', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -158,7 +158,7 @@ class UserPassRecover extends UserPassRecoverBase implements ItemInterface $Data->addParam($this->itemData->getUserpassrHash()); $Data->setOnErrorMessage(__('Error al generar el hash de recuperación', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } diff --git a/inc/SP/Mgmt/Users/UserPassRecoverBase.php b/lib/SP/Mgmt/Users/UserPassRecoverBase.php similarity index 100% rename from inc/SP/Mgmt/Users/UserPassRecoverBase.php rename to lib/SP/Mgmt/Users/UserPassRecoverBase.php diff --git a/inc/SP/Mgmt/Users/UserPreferences.php b/lib/SP/Mgmt/Users/UserPreferences.php similarity index 97% rename from inc/SP/Mgmt/Users/UserPreferences.php rename to lib/SP/Mgmt/Users/UserPreferences.php index ca2cdff3..f4c94ba2 100644 --- a/inc/SP/Mgmt/Users/UserPreferences.php +++ b/lib/SP/Mgmt/Users/UserPreferences.php @@ -30,7 +30,7 @@ use SP\DataModel\UserData; use SP\DataModel\UserPreferencesData; use SP\Mgmt\ItemInterface; use SP\Mgmt\ItemTrait; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; use SP\Util\Util; @@ -78,7 +78,7 @@ class UserPreferences extends UserPreferencesBase implements ItemInterface $Data->addParam($this->itemData->getUserId()); $Data->setOnErrorMessage(__('Error al actualizar preferencias', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } @@ -98,7 +98,7 @@ class UserPreferences extends UserPreferencesBase implements ItemInterface $Data->addParam($id); /** @var UserData $queryRes */ - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false || $queryRes->getUserPreferences() === null diff --git a/inc/SP/Mgmt/Users/UserPreferencesBase.php b/lib/SP/Mgmt/Users/UserPreferencesBase.php similarity index 100% rename from inc/SP/Mgmt/Users/UserPreferencesBase.php rename to lib/SP/Mgmt/Users/UserPreferencesBase.php diff --git a/inc/SP/Mgmt/Users/UserPreferencesUtil.php b/lib/SP/Mgmt/Users/UserPreferencesUtil.php similarity index 87% rename from inc/SP/Mgmt/Users/UserPreferencesUtil.php rename to lib/SP/Mgmt/Users/UserPreferencesUtil.php index 283535a4..572b37d8 100644 --- a/inc/SP/Mgmt/Users/UserPreferencesUtil.php +++ b/lib/SP/Mgmt/Users/UserPreferencesUtil.php @@ -26,9 +26,12 @@ namespace SP\Mgmt\Users; use Plugins\Authenticator\AuthenticatorData; use Plugins\Authenticator\AuthenticatorPlugin; +use SP\Bootstrap; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\SPException; use SP\Core\Init; +use SP\Core\Plugin\PluginUtil; use SP\DataModel\PluginData; use SP\DataModel\UserData; use SP\DataModel\UserPreferencesData; @@ -47,11 +50,18 @@ class UserPreferencesUtil * Migrar las preferencias * * @return bool + * @throws \Psr\Container\NotFoundExceptionInterface + * @throws \Psr\Container\ContainerExceptionInterface * @throws \SP\Core\Exceptions\SPException */ public static function migrate() { - $Log = new Log(); + $Container = Bootstrap::getDic(); + /** @var ConfigData $ConfigData */ + $ConfigData = $Container->get(ConfigData::class); + /** @var Log $Log */ + $Log = $Container->get(Log::class); + $LogMessage = $Log->getLogMessage(); $LogMessage->setAction(__FUNCTION__); $LogMessage->addDescription(__('Actualizando preferencias', false)); @@ -67,7 +77,8 @@ class UserPreferencesUtil $Preferences = Util::castToClass(UserPreferencesData::class, $Preferences, 'SP\UserPreferences'); $User->setUserPreferences($Preferences); - $Preferences->setTheme(Config::getConfig()->getSiteTheme()); + // FIXME + $Preferences->setTheme($ConfigData->getSiteTheme()); if ($Preferences->isUse2Fa()) { self::migrateTwoFA($User); @@ -100,7 +111,7 @@ class UserPreferencesUtil */ protected static function migrateTwoFA(UserData $UserData) { - Init::loadPlugins(); + PluginUtil::loadPlugins(); /** @var AuthenticatorData $AuthenticatorData */ $AuthenticatorData = new AuthenticatorData(); diff --git a/inc/SP/Mgmt/Users/UserSSO.php b/lib/SP/Mgmt/Users/UserSSO.php similarity index 93% rename from inc/SP/Mgmt/Users/UserSSO.php rename to lib/SP/Mgmt/Users/UserSSO.php index 3d97ff06..898920e1 100644 --- a/inc/SP/Mgmt/Users/UserSSO.php +++ b/lib/SP/Mgmt/Users/UserSSO.php @@ -29,7 +29,7 @@ use SP\Core\Crypt\Hash; use SP\Core\Exceptions\SPException; use SP\Log\Email; use SP\Log\Log; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; defined('APP_ROOT') || die(); @@ -59,7 +59,7 @@ class UserSSO extends User $Data->addParam($userLogin); $Data->addParam($userLogin); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() === 1; } @@ -75,8 +75,8 @@ class UserSSO extends User throw new SPException(SPException::SP_INFO, __('Login/email de usuario duplicados', false)); } - $groupId = Config::getConfig()->getSsoDefaultGroup(); - $profileId = Config::getConfig()->getSsoDefaultProfile(); + $groupId = $this->ConfigData->getSsoDefaultGroup(); + $profileId = $this->ConfigData->getSsoDefaultProfile(); $this->itemData->setUserIsDisabled(($groupId === 0 || $profileId === 0) ? 1 : 0); @@ -106,9 +106,9 @@ class UserSSO extends User $Data->addParam(Hash::hashKey($this->itemData->getLoginPass())); $Data->setOnErrorMessage(__('Error al guardar los datos de SSO', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); - $this->itemData->setUserId(DB::getLastId()); + $this->itemData->setUserId(DbWrapper::getLastId()); $Log = new Log(); $Log->getLogMessage() @@ -138,7 +138,7 @@ class UserSSO extends User $Data->addParam($this->itemData->getLogin()); $Data->addParam($this->itemData->getLogin()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() > 0; } @@ -165,7 +165,7 @@ class UserSSO extends User $Data->addParam($this->itemData->getLogin()); $Data->setOnErrorMessage(__('Error al actualizar la clave del usuario en la BBDD', false)); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $this; } diff --git a/inc/SP/Mgmt/Users/UserSearch.php b/lib/SP/Mgmt/Users/UserSearch.php similarity index 89% rename from inc/SP/Mgmt/Users/UserSearch.php rename to lib/SP/Mgmt/Users/UserSearch.php index 5a87ae28..21622096 100644 --- a/inc/SP/Mgmt/Users/UserSearch.php +++ b/lib/SP/Mgmt/Users/UserSearch.php @@ -24,10 +24,10 @@ namespace SP\Mgmt\Users; -use SP\Core\Session; +use SP\Core\SessionFactory; use SP\DataModel\ItemSearchData; use SP\Mgmt\ItemSearchInterface; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -58,7 +58,7 @@ class UserSearch extends UserBase implements ItemSearchInterface $Data->setOrder('user_name'); if ($SearchData->getSeachString() !== '') { - if (Session::getUserData()->isUserIsAdminApp()) { + if (SessionFactory::getUserData()->isUserIsAdminApp()) { $Data->setWhere('user_name LIKE ? OR user_login LIKE ?'); } else { $Data->setWhere('user_name LIKE ? OR user_login LIKE ? AND user_isAdminApp = 0'); @@ -67,7 +67,7 @@ class UserSearch extends UserBase implements ItemSearchInterface $search = '%' . $SearchData->getSeachString() . '%'; $Data->addParam($search); $Data->addParam($search); - } elseif (!Session::getUserData()->isUserIsAdminApp()) { + } elseif (!SessionFactory::getUserData()->isUserIsAdminApp()) { $Data->setWhere('user_isAdminApp = 0'); } @@ -75,9 +75,9 @@ class UserSearch extends UserBase implements ItemSearchInterface $Data->addParam($SearchData->getLimitStart()); $Data->addParam($SearchData->getLimitCount()); - DB::setFullRowCount(); + DbWrapper::setFullRowCount(); - $queryRes = DB::getResultsArray($Data); + $queryRes = DbWrapper::getResultsArray($Data); $queryRes['count'] = $Data->getQueryNumRows(); diff --git a/inc/SP/Mgmt/Users/UserUtil.php b/lib/SP/Mgmt/Users/UserUtil.php similarity index 93% rename from inc/SP/Mgmt/Users/UserUtil.php rename to lib/SP/Mgmt/Users/UserUtil.php index e707bda6..873d80e7 100644 --- a/inc/SP/Mgmt/Users/UserUtil.php +++ b/lib/SP/Mgmt/Users/UserUtil.php @@ -27,7 +27,7 @@ namespace SP\Mgmt\Users; defined('APP_ROOT') || die(); use SP\DataModel\UserData; -use SP\Storage\DB; +use SP\Storage\DbWrapper; use SP\Storage\QueryData; /** @@ -60,7 +60,7 @@ class UserUtil $Data->addParam($UserData->getUserLogin()); $Data->addParam($UserData->getUserEmail()); - DB::getQuery($Data); + DbWrapper::getQuery($Data); return $Data->getQueryNumRows() === 1; } @@ -80,7 +80,7 @@ class UserUtil $Data->setQuery($query); $Data->addParam($userId); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { return false; @@ -106,7 +106,7 @@ class UserUtil $Data->setQuery($query); $Data->addParam($userId); - return DB::getQuery($Data); + return DbWrapper::getQuery($Data); } @@ -125,7 +125,7 @@ class UserUtil $Data->setQuery($query); $Data->addParam($id); - $queryRes = DB::getResults($Data); + $queryRes = DbWrapper::getResults($Data); if ($queryRes === false) { return false; @@ -147,7 +147,7 @@ class UserUtil $Data = new QueryData(); $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -172,7 +172,7 @@ class UserUtil $Data->addParam($groupId); $Data->addParam($groupId); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } /** @@ -191,6 +191,6 @@ class UserUtil $Data = new QueryData(); $Data->setQuery($query); - return DB::getResultsArray($Data); + return DbWrapper::getResultsArray($Data); } } \ No newline at end of file diff --git a/lib/SP/Mvc/Controller/CrudControllerInterface.php b/lib/SP/Mvc/Controller/CrudControllerInterface.php new file mode 100644 index 00000000..5f554bde --- /dev/null +++ b/lib/SP/Mvc/Controller/CrudControllerInterface.php @@ -0,0 +1,38 @@ +. + */ + +namespace SP\Lib\Mvc\View; + +/** + * Class View + * + * @package SP\Lib\Mvc\View + */ +class View implements ViewInterface +{ + /** + * @var array + */ + protected $vars = []; + /** + * @var \Twig_Environment + */ + protected $view; + /** + * @var array + */ + protected $template = [ + 'namespace' => '', + 'controller' => '', + 'action' => '' + ]; + /** + * @var string + */ + protected $layouts = '_layouts'; + /** + * @var string + */ + protected $partials = '_partials'; + + /** + * View constructor. + * @param \Twig_Environment $view + */ + public function __construct(\Twig_Environment $view) + { + $this->view = $view; + $this->vars['view'] = $this; + } + + /** + * Asignar una variable + * + * @param $name + * @param $value + * @return $this + */ + public function assign($name, $value) + { + if ($name === 'view') { + return $this; + } + + $this->vars[$name] = $value; + + return $this; + } + + /** + * Establecer variables + * + * @param array $vars + * @return $this + */ + public function setVars(array $vars) + { + $this->vars = $vars; + + return $this; + } + + /** + * Renderizar plantilla + * + * @param $template + * @param string $path + * @return string + */ + public function render($template, $path = null) + { + $this->template['action'] = $template; + + if (null !== $path) { + return $this->view->load($this->template['namespace'] . '/' . trim($path, '/') . '/' . $template)->render($this->vars); + } + + return $this->view->load(implode('/', $this->template))->render($this->vars); + } + + /** + * Establecer namespace para las plantillas + * + * @param $name + * @return $this + */ + public function setNamespace($name) + { + $this->template['namespace'] = '@' . $name; + + return $this; + } + + /** + * Establecer el controlador + * + * @param $name + * @return $this + */ + public function setController($name) + { + $this->template['controller'] = $name; + + return $this; + } + + /** + * Devolver el namespace + * + * @return string + */ + public function getNamespace() + { + return $this->template['namespace']; + } + + /** + * Devolver el controlador + * + * @return string + */ + public function getController() + { + return $this->template['controller']; + } + + /** + * Devolver el directorio a la vista actual + * + * @return string + */ + public function getDir() + { + return $this->template['namespace'] . '/' . $this->template['controller']; + } + + /** + * Devolver el directorio de layouts + * + * @return string + */ + public function getLayoutsDir() + { + return $this->template['namespace'] . '/' . $this->layouts; + } + + /** + * Devolver el directorio de layouts + * + * @return string + */ + public function getLayouts() + { + return $this->layouts; + } + + /** + * Establecer el directorio de layouts + * + * @param string $layouts + */ + public function setLayouts($layouts) + { + $this->layouts = $layouts; + } + + /** + * Devolver una variable + * + * @param $name + * @return mixed + */ + public function get($name) + { + return isset($this->vars[$name]) ? $this->vars[$name] : null; + } + + /** + * Devolver la ruta a los partials + * + * @return string + */ + public function getPartialsDir() + { + return $this->template['namespace'] . '/' . $this->partials; + } + + /** + * Devolver el directorio de partials + * + * @return string + */ + public function getPartials() + { + return $this->partials; + } + + /** + * Establecer el directorio de partials + * + * @param string $partials + */ + public function setPartials($partials) + { + $this->partials = $partials; + } +} \ No newline at end of file diff --git a/lib/SP/Mvc/View/ViewInterface.php b/lib/SP/Mvc/View/ViewInterface.php new file mode 100644 index 00000000..f91b9f17 --- /dev/null +++ b/lib/SP/Mvc/View/ViewInterface.php @@ -0,0 +1,124 @@ +. + */ + +namespace SP\Services; + +defined('APP_ROOT') || die(); + +use Defuse\Crypto\Exception\BadFormatException; +use Defuse\Crypto\Exception\CryptoException; +use SP\Auth\Auth; +use SP\Auth\AuthResult; +use SP\Auth\AuthUtil; +use SP\Auth\Browser\BrowserAuthData; +use SP\Auth\Database\DatabaseAuthData; +use SP\Auth\Ldap\LdapAuthData; +use SP\Config\Config; +use SP\Core\CryptMasterPass; +use SP\Core\Events\EventDispatcher; +use SP\Core\Exceptions\AuthException; +use SP\Core\Exceptions\SPException; +use SP\Core\Init; +use SP\Core\Language; +use SP\Core\Messages\LogMessage; +use SP\Core\Session\Session; +use SP\Core\SessionFactory; +use SP\Core\SessionUtil; +use SP\Core\UI\Theme; +use SP\DataModel\TrackData; +use SP\DataModel\UserLoginData; +use SP\DataModel\UserPassRecoverData; +use SP\DataModel\UserPreferencesData; +use SP\Http\JsonResponse; +use SP\Http\Request; +use SP\Log\Log; +use SP\Mgmt\Groups\Group; +use SP\Mgmt\Profiles\Profile; +use SP\Mgmt\Tracks\Track; +use SP\Mgmt\Users\UserLdap; +use SP\Mgmt\Users\UserPass; +use SP\Mgmt\Users\UserPassRecover; +use SP\Mgmt\Users\UserPreferences; +use SP\Mgmt\Users\UserSSO; +use SP\Mgmt\Users\UserUtil; +use SP\Util\HttpUtil; +use SP\Util\Json; +use SP\Util\Util; + +/** + * Class LoginService + * + * @package SP\Services + */ +class LoginService +{ + /** + * Estados + */ + const STATUS_INVALID_LOGIN = 1; + const STATUS_INVALID_MASTER_PASS = 2; + const STATUS_USER_DISABLED = 3; + const STATUS_INTERNAL_ERROR = 4; + const STATUS_NEED_OLD_PASS = 5; + const STATUS_MAX_ATTEMPTS_EXCEEDED = 6; + /** + * Tiempo para contador de intentos + */ + const TIME_TRACKING = 600; + const TIME_TRACKING_MAX_ATTEMPTS = 5; + + /** + * @var JsonResponse + */ + protected $jsonResponse; + /** + * @var UserLoginData + */ + protected $UserData; + /** + * @var LogMessage + */ + protected $LogMessage; + /** + * @var $ConfigData + */ + protected $configData; + /** + * @var Config + */ + protected $config; + /** + * @var Theme + */ + protected $theme; + /** + * @var Session + */ + private $session; + /** + * @var EventDispatcher + */ + private $eventDispatcher; + + /** + * LoginController constructor. + * + * @param Config $config + * @param Session $session + * @param Theme $theme + * @param EventDispatcher $eventDispatcher + */ + public function __construct(Config $config, Session $session, Theme $theme, EventDispatcher $eventDispatcher) + { + $this->config = $config; + $this->configData = $config->getConfigData(); + $this->theme = $theme; + $this->session = $session; + $this->eventDispatcher = $eventDispatcher; + + $this->jsonResponse = new JsonResponse(); + $this->LogMessage = new LogMessage(); + $this->UserData = new UserLoginData(); + $this->LogMessage->setAction(__('Inicio sesión', false)); + } + + /** + * Ejecutar las acciones de login + * + * @throws \InvalidArgumentException + * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException + */ + public function doLogin() + { + $this->UserData->setLogin(Request::analyze('user')); + $this->UserData->setLoginPass(Request::analyzeEncrypted('pass')); + + $Log = new Log($this->LogMessage); + + try { + $this->checkTracking(); + + $Auth = new Auth($this->UserData); + $result = $Auth->doAuth(); + + if ($result !== false) { + // Ejecutar la acción asociada al tipo de autentificación + + /** @var AuthResult $AuthResult */ + foreach ($result as $AuthResult) { + if ($this->{$AuthResult->getAuth()}($AuthResult->getData()) === true && $AuthResult->isAuthGranted() === true) { + break; + } + } + } else { + $this->addTracking(); + + throw new AuthException(SPException::SP_INFO, __('Login incorrecto', false), '', self::STATUS_INVALID_LOGIN); + } + + $this->getUserData(); + $this->checkUser(); + $this->loadMasterPass(); + $this->setUserSession(); + $this->loadUserPreferences(); + $this->cleanUserData(); + } catch (SPException $e) { + $Log->setLogLevel(Log::ERROR); + $Log->writeLog(); + + $this->jsonResponse->setDescription($e->getMessage()); + $this->jsonResponse->setStatus($e->getCode()); + + Json::returnJson($this->jsonResponse); + } + + $forward = Request::getRequestHeaders('X-Forwarded-For'); + + if ($forward) { + $this->LogMessage->addDetails('X-Forwarded-For', $this->configData->isDemoEnabled() ? '***' : $forward); + } + + $Log->writeLog(); + +// $data = ['url' => 'index.php' . Request::importUrlParamsToGet()]; + $data = ['url' => 'index.php?r=index']; + $this->jsonResponse->setStatus(0); + $this->jsonResponse->setData($data); + + return $this->jsonResponse; + } + + /** + * Comprobar los intentos de login + * + * @throws \SP\Core\Exceptions\AuthException + */ + private function checkTracking() + { + try { + $TrackData = new TrackData(); + $TrackData->setTrackSource('Login'); + $TrackData->setTrackIp(HttpUtil::getClientAddress()); + + $attempts = count(Track::getItem($TrackData)->getTracksForClientFromTime(time() - self::TIME_TRACKING)); + } catch (SPException $e) { + $this->LogMessage->addDescription($e->getMessage()); + $this->LogMessage->addDescription($e->getHint()); + + throw new AuthException(SPException::SP_ERROR, __('Error interno', false), '', self::STATUS_INTERNAL_ERROR); + } + + if ($attempts >= self::TIME_TRACKING_MAX_ATTEMPTS) { + $this->addTracking(); + + sleep(0.3 * $attempts); + + $this->LogMessage->addDescription(sprintf(__('Intentos excedidos (%d/%d)'), $attempts, self::TIME_TRACKING_MAX_ATTEMPTS)); + + throw new AuthException(SPException::SP_INFO, __('Intentos excedidos', false), '', self::STATUS_MAX_ATTEMPTS_EXCEEDED); + } + } + + /** + * Añadir un seguimiento + * + * @throws \SP\Core\Exceptions\AuthException + */ + private function addTracking() + { + try { + $TrackData = new TrackData(); + $TrackData->setTrackSource('Login'); + $TrackData->setTrackIp(HttpUtil::getClientAddress()); + + Track::getItem($TrackData)->add(); + } catch (SPException $e) { + throw new AuthException(SPException::SP_ERROR, __('Error interno', false), '', self::STATUS_INTERNAL_ERROR); + } + } + + /** + * Obtener los datos del usuario + * + * @throws SPException + * @throws \SP\Core\Exceptions\InvalidClassException + * @throws \SP\Core\Exceptions\AuthException + * @throws \InvalidArgumentException + */ + protected function getUserData() + { + try { + $this->UserData->setUserPreferences(UserPreferences::getItem()->getById($this->UserData->getUserId())); + } catch (SPException $e) { + $this->LogMessage->addDescription(__('Error al obtener los datos del usuario de la BBDD', false)); + + throw new AuthException(SPException::SP_ERROR, __('Error interno', false), '', self::STATUS_INTERNAL_ERROR); + } + } + + /** + * Comprobar estado del usuario + * + * @throws \SP\Core\Exceptions\SPException + * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException + * @throws \SP\Core\Exceptions\AuthException + */ + protected function checkUser() + { + // Comprobar si el usuario está deshabilitado + if ($this->UserData->isUserIsDisabled()) { + $this->LogMessage->addDescription(__('Usuario deshabilitado', false)); + $this->LogMessage->addDetails(__('Usuario', false), $this->UserData->getLogin()); + + $this->addTracking(); + + throw new AuthException(SPException::SP_INFO, __('Usuario deshabilitado', false), '', self::STATUS_USER_DISABLED); + } + + if ($this->UserData->isUserIsChangePass()) { + $hash = Util::generateRandomBytes(16); + + $UserPassRecoverData = new UserPassRecoverData(); + $UserPassRecoverData->setUserpassrUserId($this->UserData->getUserId()); + $UserPassRecoverData->setUserpassrHash($hash); + + UserPassRecover::getItem($UserPassRecoverData)->add(); + + $data = ['url' => Init::$WEBURI . '/index.php?a=passreset&h=' . $hash . '&t=' . time() . '&f=1']; + $this->jsonResponse->setData($data); + $this->jsonResponse->setStatus(0); + Json::returnJson($this->jsonResponse); + } + + return false; + } + + /** + * Cargar la clave maestra o solicitarla + * + * @throws \SP\Core\Exceptions\SPException + * @throws \SP\Core\Exceptions\AuthException + * @throws \SP\Core\Exceptions\ConstraintException + * @throws \SP\Core\Exceptions\QueryException + */ + protected function loadMasterPass() + { + $masterPass = Request::analyzeEncrypted('mpass'); + $oldPass = Request::analyzeEncrypted('oldpass'); + + try { + if ($masterPass) { + if (CryptMasterPass::checkTempMasterPass($masterPass)) { + $this->LogMessage->addDescription(__('Usando clave temporal', false)); + + $masterPass = CryptMasterPass::getTempMasterPass($masterPass); + } + + if (!UserPass::updateUserMPass($masterPass, $this->UserData)) { + $this->LogMessage->addDescription(__('Clave maestra incorrecta', false)); + + $this->addTracking(); + + throw new AuthException(SPException::SP_INFO, __('Clave maestra incorrecta', false), '', self::STATUS_INVALID_MASTER_PASS); + } + + $this->LogMessage->addDescription(__('Clave maestra actualizada', false)); + } else if ($oldPass) { + if (!UserPass::updateMasterPassFromOldPass($oldPass, $this->UserData)) { + $this->LogMessage->addDescription(__('Clave maestra incorrecta', false)); + + $this->addTracking(); + + throw new AuthException(SPException::SP_INFO, __('Clave maestra incorrecta', false), '', self::STATUS_INVALID_MASTER_PASS); + } + + $this->LogMessage->addDescription(__('Clave maestra actualizada', false)); + } else { + switch (UserPass::loadUserMPass($this->UserData)) { + case UserPass::MPASS_CHECKOLD: + throw new AuthException(SPException::SP_INFO, __('Es necesaria su clave anterior', false), '', self::STATUS_NEED_OLD_PASS); + break; + case UserPass::MPASS_NOTSET: + case UserPass::MPASS_CHANGED: + case UserPass::MPASS_WRONG: + $this->addTracking(); + + throw new AuthException(SPException::SP_INFO, __('La clave maestra no ha sido guardada o es incorrecta', false), '', self::STATUS_INVALID_MASTER_PASS); + break; + } + } + } catch (BadFormatException $e) { + $this->LogMessage->addDescription(__('Clave maestra incorrecta', false)); + + throw new AuthException(SPException::SP_INFO, __('Clave maestra incorrecta', false), '', self::STATUS_INVALID_MASTER_PASS); + } catch (CryptoException $e) { + $this->LogMessage->addDescription(__('Error interno', false)); + + throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), $e->getMessage(), self::STATUS_INTERNAL_ERROR); + } + } + + /** + * Cargar la sesión del usuario + * + * @throws \SP\Core\Exceptions\SPException + * @throws \InvalidArgumentException + * @throws \SP\Core\Exceptions\AuthException + * @throws \SP\Core\Exceptions\ConstraintException + * @throws \SP\Core\Exceptions\QueryException + */ + protected function setUserSession() + { + // Obtenemos la clave maestra del usuario + if (UserPass::$gotMPass === true) { + // Actualizar el último login del usuario + UserUtil::setUserLastLogin($this->UserData->getUserId()); + + // Cargar las variables de sesión del usuario + SessionUtil::loadUserSession($this->UserData, $this->session); + + $this->LogMessage->addDetails(__('Usuario', false), $this->UserData->getLogin()); + $this->LogMessage->addDetails(__('Perfil', false), Profile::getItem()->getById($this->UserData->getUserProfileId())->getUserprofileName()); + $this->LogMessage->addDetails(__('Grupo', false), Group::getItem()->getById($this->UserData->getUserGroupId())->getUsergroupName()); + } else { + $this->LogMessage->addDescription(__('Error al obtener la clave maestra del usuario', false)); + + throw new AuthException(SPException::SP_ERROR, __('Error interno', false), '', self::STATUS_INTERNAL_ERROR); + } + } + + /** + * Cargar las preferencias del usuario y comprobar si usa 2FA + * + * @throws \SP\Core\Exceptions\SPException + * @throws \SP\Core\Exceptions\InvalidClassException + * @throws \SP\Core\Exceptions\InvalidArgumentException + */ + protected function loadUserPreferences() + { + if ($this->configData->isDemoEnabled()) { + $this->session->setUserPreferences(new UserPreferencesData()); + } else { + $this->session->setUserPreferences($this->UserData->getUserPreferences()); + } + + Language::setLanguage(true); + $this->theme->initTheme(true); + + SessionFactory::setSessionType(SessionFactory::SESSION_INTERACTIVE); + $this->session->setAuthCompleted(true); + + $this->eventDispatcher->notifyEvent('login.preferences', $this); + } + + /** + * Limpiar datos de usuario + */ + private function cleanUserData() + { + $this->UserData->setLogin(null); + $this->UserData->setLoginPass(null); + $this->UserData->setUserMPass(null); + $this->UserData->setUserMKey(null); + } + + /** + * Comprobar si se ha forzado un cambio de clave + * + * @throws \SP\Core\Exceptions\SPException + * @throws \SP\Core\Exceptions\InvalidClassException + * @throws \Defuse\Crypto\Exception\EnvironmentIsBrokenException + */ + protected function checkPasswordChange() + { + // Comprobar si se ha forzado un cambio de clave + if ($this->UserData->isUserIsChangePass()) { + $hash = Util::generateRandomBytes(); + + $UserPassRecoverData = new UserPassRecoverData(); + $UserPassRecoverData->setUserpassrUserId($this->UserData->getUserId()); + $UserPassRecoverData->setUserpassrHash($hash); + + UserPassRecover::getItem($UserPassRecoverData)->add(); + + $data = ['url' => Init::$WEBURI . '/index.php?a=passreset&h=' . $hash . '&t=' . time() . '&f=1']; + $this->jsonResponse->setData($data); + $this->jsonResponse->setStatus(0); + Json::returnJson($this->jsonResponse); + } + + return false; + } + + /** + * Autentificación LDAP + * + * @param LdapAuthData $AuthData + * @return bool + * @throws \SP\Core\Exceptions\SPException + * @throws AuthException + */ + protected function authLdap(LdapAuthData $AuthData) + { + if ($AuthData->getStatusCode() > 0) { + $this->LogMessage->addDetails(__('Tipo', false), __FUNCTION__); + $this->LogMessage->addDetails(__('Usuario', false), $this->UserData->getLogin()); + + if ($AuthData->getStatusCode() === 49) { + $this->LogMessage->addDescription(__('Login incorrecto', false)); + + $this->addTracking(); + + throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_INVALID_LOGIN); + } + + if ($AuthData->getStatusCode() === 701) { + $this->LogMessage->addDescription(__('Cuenta expirada', false)); + + throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_USER_DISABLED); + } + + if ($AuthData->getStatusCode() === 702) { + $this->LogMessage->addDescription(__('El usuario no tiene grupos asociados', false)); + + throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_USER_DISABLED); + } + + if ($AuthData->isAuthGranted() === false) { + return false; + } + + $this->LogMessage->addDescription(__('Error interno', false)); + + throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_INTERNAL_ERROR); + } + + $this->UserData->setUserName($AuthData->getName()); + $this->UserData->setUserEmail($AuthData->getEmail()); + + $this->LogMessage->addDetails(__('Tipo', false), __FUNCTION__); + $this->LogMessage->addDetails(__('Servidor LDAP', false), $AuthData->getServer()); + + try { + $this->UserData->setUserLogin($this->UserData->getLogin()); + + // Verificamos si el usuario existe en la BBDD + if (UserLdap::checkLDAPUserInDB($this->UserData->getLogin())) { + // Actualizamos el usuario de LDAP en MySQL + UserLdap::getItem($this->UserData)->updateOnLogin(); + } else { + // Creamos el usuario de LDAP en MySQL + UserLdap::getItem($this->UserData)->add(); + } + } catch (SPException $e) { + $this->LogMessage->addDescription($e->getMessage()); + + throw new AuthException(SPException::SP_ERROR, __('Error interno', false), '', self::STATUS_INTERNAL_ERROR); + } + + return true; + } + + /** + * Autentificación en BD + * + * @param DatabaseAuthData $AuthData + * @return bool + * @throws \SP\Core\Exceptions\SPException + * @throws AuthException + */ + protected function authDatabase(DatabaseAuthData $AuthData) + { + // Autentificamos con la BBDD + if ($AuthData->getAuthenticated() === 0) { + if ($AuthData->isAuthGranted() === false) { + return false; + } + + $this->LogMessage->addDescription(__('Login incorrecto', false)); + $this->LogMessage->addDetails(__('Usuario', false), $this->UserData->getLogin()); + + $this->addTracking(); + + throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_INVALID_LOGIN); + } + + if ($AuthData->getAuthenticated() === 1) { + $this->LogMessage->addDetails(__('Tipo', false), __FUNCTION__); + } + + return true; + } + + /** + * Comprobar si el cliente ha enviado las variables de autentificación + * + * @param BrowserAuthData $AuthData + * @return mixed + * @throws \SP\Core\Exceptions\ConstraintException + * @throws AuthException + */ + protected function authBrowser(BrowserAuthData $AuthData) + { + // Comprobar si concide el login con la autentificación del servidor web + if ($AuthData->getAuthenticated() === 0) { + if ($AuthData->isAuthGranted() === false) { + return false; + } + + $this->LogMessage->addDescription(__('Login incorrecto', false)); + $this->LogMessage->addDetails(__('Tipo', false), __FUNCTION__); + $this->LogMessage->addDetails(__('Usuario', false), $this->UserData->getLogin()); + $this->LogMessage->addDetails(__('Autentificación', false), sprintf('%s (%s)', AuthUtil::getServerAuthType(), $AuthData->getName())); + + $this->addTracking(); + + throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_INVALID_LOGIN); + } + + $this->LogMessage->addDetails(__('Tipo', false), __FUNCTION__); + + if ($this->configData->isAuthBasicAutoLoginEnabled()) { + try { + if (!UserSSO::getItem($this->UserData)->checkUserInDB($this->UserData->getLogin())) { + UserSSO::getItem()->add(); + } else { + UserSSO::getItem()->updateOnLogin(); + } + } catch (SPException $e) { + throw new AuthException(SPException::SP_ERROR, __('Error interno', false), '', self::STATUS_INTERNAL_ERROR); + } + + $this->LogMessage->addDetails(__('Usuario', false), $this->UserData->getLogin()); + $this->LogMessage->addDetails(__('Autentificación', false), sprintf('%s (%s)', AuthUtil::getServerAuthType(), $AuthData->getName())); + + return true; + } + + return null; + } +} \ No newline at end of file diff --git a/ajax/ajax_checkUpds.php b/lib/SP/Storage/CacheableInterface.php similarity index 71% rename from ajax/ajax_checkUpds.php rename to lib/SP/Storage/CacheableInterface.php index 8b15e698..89e890de 100644 --- a/ajax/ajax_checkUpds.php +++ b/lib/SP/Storage/CacheableInterface.php @@ -22,15 +22,19 @@ * along with sysPass. If not, see . */ -use SP\Controller\MainController; -use SP\Http\Request; +namespace SP\Storage; -define('APP_ROOT', dirname(__DIR__)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +/** + * Interface CacheableInterface + * + * @package SP\Storage + */ +interface CacheableInterface +{ + /** + * @return mixed + */ + public function save(); -Request::checkReferer('GET'); - -$Controller = new MainController(null, null, false); -$Controller->getCheckUpdates(); -$Controller->view(); \ No newline at end of file +} \ No newline at end of file diff --git a/inc/SP/Storage/DBStorageInterface.php b/lib/SP/Storage/DBStorageInterface.php similarity index 84% rename from inc/SP/Storage/DBStorageInterface.php rename to lib/SP/Storage/DBStorageInterface.php index dacdb683..abe9ff4f 100644 --- a/inc/SP/Storage/DBStorageInterface.php +++ b/lib/SP/Storage/DBStorageInterface.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -32,16 +32,22 @@ namespace SP\Storage; interface DBStorageInterface { /** + * Obtener una conexión PDO + * * @return \PDO */ public function getConnection(); /** - * @return mixed + * Establecer datos de conexión + * + * @return void */ public function setConnectionData(); /** + * Devolcer el estado de la BD + * * @return int */ public function getDbStatus(); diff --git a/inc/SP/Storage/DBUtil.php b/lib/SP/Storage/DBUtil.php similarity index 85% rename from inc/SP/Storage/DBUtil.php rename to lib/SP/Storage/DBUtil.php index 2c393e99..a7c9db53 100644 --- a/inc/SP/Storage/DBUtil.php +++ b/lib/SP/Storage/DBUtil.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -25,7 +25,8 @@ namespace SP\Storage; -use SP\Config\Config; +use SP\Bootstrap; +use SP\Config\ConfigData; use SP\Core\DiFactory; use SP\Core\Exceptions\SPException; @@ -67,31 +68,6 @@ class DBUtil 'account_search_v' ]; - /** - * Comprobar que la base de datos existe. - * - * @return bool - */ - public static function checkDatabaseExist() - { - try { - $db = DiFactory::getDBStorage()->getConnection(); - - $query = /** @lang SQL */ - 'SELECT COUNT(*) - FROM information_schema.tables - WHERE table_schema = \'' . Config::getConfig()->getDbName() . '\' - AND table_name IN (\'customers\', \'categories\', \'accounts\', \'usrData\', \'config\', \'log\' )'; - - return (int)$db->query($query)->fetchColumn() === 6; - } catch (\Exception $e) { - debugLog($e->getMessage()); - debugLog($e->getCode()); - } - - return false; - } - /** * Escapar una cadena de texto con funciones de mysqli. * @@ -137,4 +113,34 @@ class DBUtil return $dbinfo; } + + /** + * Comprobar que la base de datos existe. + * + * @return bool + * @throws \Psr\Container\ContainerExceptionInterface + */ + public static function checkDatabaseExist() + { + $dic = Bootstrap::getDic(); + /** @var Database $Db */ + $Db = $dic->get(Database::class); + /** @var ConfigData $ConfigData */ + $ConfigData = $dic->get(ConfigData::class); + + try { + $query = /** @lang SQL */ + 'SELECT COUNT(*) + FROM information_schema.tables + WHERE table_schema = \'' . $ConfigData->getDbName() . '\' + AND table_name IN (\'customers\', \'categories\', \'accounts\', \'usrData\', \'config\', \'log\' )'; + + return (int)$Db->getDbHandler()->getConnection()->query($query)->fetchColumn() === 6; + } catch (\Exception $e) { + debugLog($e->getMessage()); + debugLog($e->getCode()); + } + + return false; + } } \ No newline at end of file diff --git a/lib/SP/Storage/Database.php b/lib/SP/Storage/Database.php new file mode 100644 index 00000000..cab90a37 --- /dev/null +++ b/lib/SP/Storage/Database.php @@ -0,0 +1,211 @@ +. + */ + +namespace SP\Storage; + +use PDO; +use PDOStatement; +use SP\Core\Exceptions\SPException; + +/** + * Class Database + * + * @package SP\Storage + */ +class Database +{ + /** + * @var int Número de registros obtenidos + */ + public $numRows = 0; + /** + * @var int Número de campos de la consulta + */ + public $numFields = 0; + /** + * @var array Resultados de la consulta + */ + public $lastResult; + /** + * @var DBStorageInterface + */ + protected $dbHandler; + + /** + * DB constructor. + * + * @param DBStorageInterface $dbHandler + */ + public function __construct(DBStorageInterface $dbHandler) + { + $this->dbHandler = $dbHandler; + } + + /** + * Realizar una consulta a la BBDD. + * + * @param $queryData QueryData Los datos de la consulta + * @param $getRawData bool realizar la consulta para obtener registro a registro + * @return PDOStatement|array + * @throws SPException + */ + public function doQuery(QueryData $queryData, $getRawData = false) + { + $isSelect = preg_match("/^(select|show)\s/i", $queryData->getQuery()); + + // Limpiar valores de caché + $this->lastResult = []; + + /** @var PDOStatement $queryRes */ + $queryRes = $this->prepareQueryData($queryData); + + if ($isSelect) { + if ($getRawData) { + return $queryRes; + } + + $this->numFields = $queryRes->columnCount(); + $this->lastResult = $queryRes->fetchAll(); + $this->numRows = count($this->lastResult); + + $queryData->setQueryNumRows($this->numRows); + } else { + $queryData->setQueryNumRows($queryRes->rowCount()); + } + + return $queryRes; + } + + /** + * Asociar los parámetros de la consulta utilizando el tipo adecuado + * + * @param $queryData QueryData Los datos de la consulta + * @param $isCount bool Indica si es una consulta de contador de registros + * @return \PDOStatement|false + * @throws SPException + */ + private function prepareQueryData(QueryData $queryData, $isCount = false) + { + if ($isCount === true) { + $query = $queryData->getQueryCount(); + $paramMaxIndex = count($queryData->getParams()) - 3; + } else { + $query = $queryData->getQuery(); + } + + try { + $db = $this->dbHandler->getConnection(); + + if (is_array($queryData->getParams())) { + $stmt = $db->prepare($query); + $paramIndex = 0; + + foreach ($queryData->getParams() as $param => $value) { + if ($isCount === true + && $queryData->getLimit() !== '' + && $paramIndex > $paramMaxIndex + ) { + continue; + } + + // Si la clave es un número utilizamos marcadores de posición "?" en + // la consulta. En caso contrario marcadores de nombre + $param = is_int($param) ? $param + 1 : ':' . $param; + + if ($param === 'blobcontent') { + $stmt->bindValue($param, $value, PDO::PARAM_LOB); + } elseif (is_int($value)) { +// error_log("INT: " . $param . " -> " . $value); + $stmt->bindValue($param, $value, PDO::PARAM_INT); + } else { +// error_log("STR: " . $param . " -> " . print_r($value, true)); + $stmt->bindValue($param, $value, PDO::PARAM_STR); + } + + $paramIndex++; + } + + $stmt->execute(); + } else { + $stmt = $db->query($query); + } + + if ($queryData->isUseKeyPair() === true) { + $stmt->setFetchMode(PDO::FETCH_KEY_PAIR); + } elseif (null !== $queryData->getMapClass()) { + $stmt->setFetchMode(PDO::FETCH_INTO, $queryData->getMapClass()); + } elseif ($queryData->getMapClassName()) { + $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, $queryData->getMapClassName()); + } else { + $stmt->setFetchMode(PDO::FETCH_OBJ); + } + + // FIXME + DbWrapper::$lastId = $db->lastInsertId(); + + return $stmt; + } catch (SPException $e) { + ob_start(); + debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + debugLog(sprintf('Exception: %s - %s', $e->getMessage(), $e->getHint())); + debugLog(ob_get_clean()); + + throw $e; + } catch (\Exception $e) { + ob_start(); + debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + debugLog('Exception: ' . $e->getMessage()); + debugLog(ob_get_clean()); + + throw new SPException(SPException::SP_CRITICAL, $e->getMessage(), $e->getCode(), 0, $e); + } + } + + /** + * Obtener el número de filas de una consulta realizada + * + * @param $queryData QueryData Los datos de la consulta + * @return int Número de files de la consulta + * @throws SPException + */ + public function getFullRowCount(QueryData $queryData) + { + if ($queryData->getQueryCount() === '') { + return 0; + } + + $queryRes = $this->prepareQueryData($queryData, true); + $num = (int)$queryRes->fetchColumn(); + $queryRes->closeCursor(); + $queryData->setQueryNumRows($num); + } + + /** + * @return DBStorageInterface + */ + public function getDbHandler() + { + return $this->dbHandler; + } +} \ No newline at end of file diff --git a/inc/SP/Storage/DB.php b/lib/SP/Storage/DbWrapper.php similarity index 55% rename from inc/SP/Storage/DB.php rename to lib/SP/Storage/DbWrapper.php index 4622ddc6..80ea67e8 100644 --- a/inc/SP/Storage/DB.php +++ b/lib/SP/Storage/DbWrapper.php @@ -26,6 +26,7 @@ namespace SP\Storage; use PDO; use PDOStatement; +use SP\Bootstrap; use SP\Core\DiFactory; use SP\Core\Exceptions\ConstraintException; use SP\Core\Exceptions\QueryException; @@ -39,7 +40,7 @@ defined('APP_ROOT') || die(); /** * Esta clase es la encargada de realizar las operaciones con la BBDD de sysPass. */ -class DB +class DbWrapper { /** * @var int @@ -49,18 +50,6 @@ class DB * @var bool Contar el número de filas totales */ private static $fullRowCount = false; - /** - * @var int Número de registros obtenidos - */ - private $numRows = 0; - /** - * @var int Número de campos de la consulta - */ - private $numFields = 0; - /** - * @var array Resultados de la consulta - */ - private $lastResult; /** * @return int @@ -101,7 +90,8 @@ class DB } try { - $db = new DB(); + /** @var Database $db */ + $db = Bootstrap::getDic()->get(Database::class); $db->doQuery($queryData); if (self::$fullRowCount === true) { @@ -131,144 +121,6 @@ class DB self::$fullRowCount = false; } - /** - * Realizar una consulta a la BBDD. - * - * @param $queryData QueryData Los datos de la consulta - * @param $getRawData bool realizar la consulta para obtener registro a registro - * @return PDOStatement|array - * @throws SPException - */ - public function doQuery(QueryData $queryData, $getRawData = false) - { - $isSelect = preg_match("/^(select|show)\s/i", $queryData->getQuery()); - - // Limpiar valores de caché - $this->lastResult = []; - - /** @var PDOStatement $queryRes */ - $queryRes = $this->prepareQueryData($queryData); - - if ($isSelect) { - if ($getRawData) { - return $queryRes; - } - - $this->numFields = $queryRes->columnCount(); - $this->lastResult = $queryRes->fetchAll(); - $this->numRows = count($this->lastResult); - - $queryData->setQueryNumRows($this->numRows); - } else { - $queryData->setQueryNumRows($queryRes->rowCount()); - } - - return $queryRes; - } - - /** - * Asociar los parámetros de la consulta utilizando el tipo adecuado - * - * @param $queryData QueryData Los datos de la consulta - * @param $isCount bool Indica si es una consulta de contador de registros - * @return \PDOStatement|false - * @throws SPException - */ - private function prepareQueryData(QueryData $queryData, $isCount = false) - { - if ($isCount === true) { - $query = $queryData->getQueryCount(); - $paramMaxIndex = count($queryData->getParams()) - 3; - } else { - $query = $queryData->getQuery(); - } - - try { - $db = DiFactory::getDBStorage()->getConnection(); - - if (is_array($queryData->getParams())) { - $stmt = $db->prepare($query); - $paramIndex = 0; - - foreach ($queryData->getParams() as $param => $value) { - if ($isCount === true - && $queryData->getLimit() !== '' - && $paramIndex > $paramMaxIndex - ) { - continue; - } - - // Si la clave es un número utilizamos marcadores de posición "?" en - // la consulta. En caso contrario marcadores de nombre - $param = is_int($param) ? $param + 1 : ':' . $param; - - if ($param === 'blobcontent') { - $stmt->bindValue($param, $value, PDO::PARAM_LOB); - } elseif (is_int($value)) { -// error_log("INT: " . $param . " -> " . $value); - $stmt->bindValue($param, $value, PDO::PARAM_INT); - } else { -// error_log("STR: " . $param . " -> " . print_r($value, true)); - $stmt->bindValue($param, $value, PDO::PARAM_STR); - } - - $paramIndex++; - } - - $stmt->execute(); - } else { - $stmt = $db->query($query); - } - - if ($queryData->isUseKeyPair() === true) { - $stmt->setFetchMode(PDO::FETCH_KEY_PAIR); - } elseif (null !== $queryData->getMapClass()) { - $stmt->setFetchMode(PDO::FETCH_INTO, $queryData->getMapClass()); - } elseif ($queryData->getMapClassName()) { - $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, $queryData->getMapClassName()); - } else { - $stmt->setFetchMode(PDO::FETCH_OBJ); - } - - DB::$lastId = $db->lastInsertId(); - - return $stmt; - } catch (SPException $e) { - ob_start(); - debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - debugLog(sprintf('Exception: %s - %s', $e->getMessage(), $e->getHint())); - debugLog(ob_get_clean()); - - throw $e; - } catch (\Exception $e) { - ob_start(); - debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - debugLog('Exception: ' . $e->getMessage()); - debugLog(ob_get_clean()); - - throw new SPException(SPException::SP_CRITICAL, $e->getMessage(), $e->getCode(), 0, $e); - } - } - - /** - * Obtener el número de filas de una consulta realizada - * - * @param $queryData QueryData Los datos de la consulta - * @return int Número de files de la consulta - * @throws SPException - */ - private function getFullRowCount(QueryData $queryData) - { - if ($queryData->getQueryCount() === '') { - return 0; - } - - $queryRes = $this->prepareQueryData($queryData, true); - $num = (int)$queryRes->fetchColumn(); - $queryRes->closeCursor(); - $queryData->setQueryNumRows($num); - } - /** * Método para registar los eventos de BD en el log * @@ -307,7 +159,9 @@ class DB public static function getResultsRaw(QueryData $queryData) { try { - $db = new DB(); + /** @var Database $db */ + $db = Bootstrap::getDic()->get(Database::class); + return $db->doQuery($queryData, true); } catch (SPException $e) { self::logDBException($queryData->getQuery(), $e, __FUNCTION__); @@ -337,7 +191,9 @@ class DB } try { - $db = new DB(); + /** @var Database $db */ + $db = Bootstrap::getDic()->get(Database::class); + $db->doQuery($queryData); return true; @@ -370,7 +226,9 @@ class DB */ public static function beginTransaction() { - $conn = DiFactory::getDBStorage()->getConnection(); + /** @var Database $db */ + $db = Bootstrap::getDic()->get(Database::class); + $conn = $db->getDbHandler()->getConnection(); return !$conn->inTransaction() && $conn->beginTransaction(); } @@ -380,7 +238,9 @@ class DB */ public static function endTransaction() { - $conn = DiFactory::getDBStorage()->getConnection(); + /** @var Database $db */ + $db = Bootstrap::getDic()->get(Database::class); + $conn = $db->getDbHandler()->getConnection(); return $conn->inTransaction() && $conn->commit(); } diff --git a/inc/SP/Storage/FileStorageInterface.php b/lib/SP/Storage/FileStorageInterface.php similarity index 95% rename from inc/SP/Storage/FileStorageInterface.php rename to lib/SP/Storage/FileStorageInterface.php index de713441..f7b8afa0 100644 --- a/inc/SP/Storage/FileStorageInterface.php +++ b/lib/SP/Storage/FileStorageInterface.php @@ -39,9 +39,10 @@ interface FileStorageInterface public function load($node = ''); /** + * @param string $node * @return FileStorageInterface */ - public function save(); + public function save($node = ''); /** * @return mixed diff --git a/inc/SP/Storage/MySQLHandler.php b/lib/SP/Storage/MySQLHandler.php similarity index 73% rename from inc/SP/Storage/MySQLHandler.php rename to lib/SP/Storage/MySQLHandler.php index 64a5955d..5a4db06a 100644 --- a/inc/SP/Storage/MySQLHandler.php +++ b/lib/SP/Storage/MySQLHandler.php @@ -2,8 +2,8 @@ /** * sysPass * - * @author nuxsmin - * @link http://syspass.org + * @author nuxsmin + * @link http://syspass.org * @copyright 2012-2017, Rubén Domínguez nuxsmin@$syspass.org * * This file is part of sysPass. @@ -26,8 +26,10 @@ namespace SP\Storage; use PDO; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\SPException; use SP\Core\Init; +use SP\Core\Traits\InjectableTrait; defined('APP_ROOT') || die(); @@ -38,6 +40,18 @@ defined('APP_ROOT') || die(); */ class MySQLHandler implements DBStorageInterface { + use InjectableTrait; + + const STATUS_OK = 0; + const STATUS_KO = 1; + /** + * @var ConfigData + */ + protected $ConfigData; + /** + * @var Config + */ + protected $Config; /** * @var PDO */ @@ -69,49 +83,40 @@ class MySQLHandler implements DBStorageInterface /** * @var int */ - private $dbStatus = 1; + private $dbStatus = self::STATUS_KO; /** * MySQLHandler constructor. - * - * @param string $dbHost - * @param int $dbPort - * @param string $dbName - * @param string $dbUser - * @param string $dbPass */ - public function __construct($dbHost = null, $dbPort = null, $dbName = null, $dbUser = null, $dbPass = null) + public function __construct() { - if ($dbHost - && $dbPass - && $dbName - && $dbUser - && $dbPass - && $dbPort - ) { - $this->dbHost = $dbHost; - $this->dbPort = $dbPort; - $this->dbName = $dbName; - $this->dbUser = $dbUser; - $this->dbPass = $dbPass; - } else { - $this->setConnectionData(); - } + $this->injectDependencies(); + $this->setConnectionData(); } /** - * @return mixed + * Establecer datos de conexión */ public function setConnectionData() { - $Config = Config::getConfig(); + $this->dbHost = $this->ConfigData->getDbHost(); + $this->dbSocket = $this->ConfigData->getDbSocket(); + $this->dbUser = $this->ConfigData->getDbUser(); + $this->dbPass = $this->ConfigData->getDbPass(); + $this->dbName = $this->ConfigData->getDbName(); + $this->dbPort = $this->ConfigData->getDbPort(); + } - $this->dbHost = $Config->getDbHost(); - $this->dbSocket = $Config->getDbSocket(); - $this->dbUser = $Config->getDbUser(); - $this->dbPass = $Config->getDbPass(); - $this->dbName = $Config->getDbName(); - $this->dbPort = $Config->getDbPort(); + /** + * Devuelve el estado de conexión a la BBDD + * OK -> 0 + * KO -> 1 + * + * @return int + */ + public function getDbStatus() + { + return $this->dbStatus; } /** @@ -126,7 +131,7 @@ class MySQLHandler implements DBStorageInterface public function getConnection() { if (!$this->db) { - $isInstalled = Config::getConfig()->isInstalled(); + $isInstalled = $this->ConfigData->isInstalled(); if (empty($this->dbHost) || empty($this->dbUser) || empty($this->dbPass) || empty($this->dbName)) { if ($isInstalled) { @@ -148,13 +153,12 @@ class MySQLHandler implements DBStorageInterface } $this->db = new PDO($dsn, $this->dbUser, $this->dbPass, $opts); -// $this->db = new PDO($dsn, $this->dbUser, $this->dbPass); - $this->dbStatus = 0; + $this->dbStatus = self::STATUS_OK; } catch (\Exception $e) { if ($isInstalled) { if ($e->getCode() === 1049) { - Config::getConfig()->setInstalled(false); - Config::saveConfig(); + $this->ConfigData->setInstalled(false); + $this->Config->saveConfig($this->ConfigData); } Init::initError( __('No es posible conectar con la BD'), @@ -169,14 +173,11 @@ class MySQLHandler implements DBStorageInterface } /** - * Devuelve el estado de conexión a la BBDD - * OK -> 0 - * KO -> 1 - * - * @return int + * @param Config $config */ - public function getDbStatus() + public function inject(Config $config) { - return $this->dbStatus; + $this->Config = $config; + $this->ConfigData = $config->getConfigData(); } } \ No newline at end of file diff --git a/inc/SP/Storage/QueryData.php b/lib/SP/Storage/QueryData.php similarity index 100% rename from inc/SP/Storage/QueryData.php rename to lib/SP/Storage/QueryData.php diff --git a/inc/SP/Storage/XmlHandler.php b/lib/SP/Storage/XmlHandler.php similarity index 92% rename from inc/SP/Storage/XmlHandler.php rename to lib/SP/Storage/XmlHandler.php index 6308a2c9..223af69b 100644 --- a/inc/SP/Storage/XmlHandler.php +++ b/lib/SP/Storage/XmlHandler.php @@ -29,6 +29,7 @@ use DOMElement; use DOMNode; use DOMNodeList; use ReflectionObject; +use RuntimeException; /** * Class XmlHandler para manejo básico de documentos XML @@ -69,12 +70,12 @@ class XmlHandler implements FileStorageInterface * * @param string $node * @return FileStorageInterface - * @throws \Exception + * @throws \RuntimeException */ public function load($node = 'root') { if (!$this->checkSourceFile()) { - throw new \Exception(sprintf(__('No es posible leer/escribir el archivo: %s', false), $this->file)); + throw new RuntimeException(sprintf(__('No es posible leer/escribir el archivo: %s', false), $this->file)); } $this->setDOM(); @@ -151,20 +152,20 @@ class XmlHandler implements FileStorageInterface /** * Guardar el archivo XML * - * @param string $tag + * @param string $node * @return FileStorageInterface - * @throws \Exception + * @throws \RuntimeException */ - public function save($tag = 'root') + public function save($node = 'root') { if (null === $this->items) { - throw new \Exception(__('No hay elementos para guardar', false)); + throw new RuntimeException(__('No hay elementos para guardar', false)); } $this->setDOM(); $this->Dom->formatOutput = true; - $this->root = $this->Dom->createElement($tag); + $this->root = $this->Dom->createElement($node); $this->Dom->appendChild($this->root); $this->writeChildNodes($this->items, $this->root); // $this->Dom->save($this->file); @@ -177,9 +178,9 @@ class XmlHandler implements FileStorageInterface /** * Crear los nodos hijos recursivamente a partir de un array multidimensional * - * @param mixed $items + * @param mixed $items * @param DOMNode $Node - * @param null $type + * @param null $type */ protected function writeChildNodes($items, DOMNode $Node, $type = null) { @@ -208,7 +209,7 @@ class XmlHandler implements FileStorageInterface * Analizar el tipo de elementos * * @param mixed $items - * @param bool $serialize + * @param bool $serialize * @return array */ protected function analyzeItems($items, $serialize = false) diff --git a/inc/SP/Util/ArrayUtil.php b/lib/SP/Util/ArrayUtil.php similarity index 100% rename from inc/SP/Util/ArrayUtil.php rename to lib/SP/Util/ArrayUtil.php diff --git a/inc/SP/Util/Checks.php b/lib/SP/Util/Checks.php similarity index 54% rename from inc/SP/Util/Checks.php rename to lib/SP/Util/Checks.php index c8f63894..dd28d239 100644 --- a/inc/SP/Util/Checks.php +++ b/lib/SP/Util/Checks.php @@ -24,7 +24,6 @@ namespace SP\Util; -use SP\Config\Config; use SP\Http\Request; /** @@ -142,157 +141,6 @@ class Checks return extension_loaded('gd'); } - /** - * Comprobar si está en modo DEMO. - * - * @return bool - */ - public static function demoIsEnabled() - { - return Config::getConfig()->isDemoEnabled(); - } - - /** - * Comprobar si está habilitada la gestión de archivos. - * - * @return bool - */ - public static function fileIsEnabled() - { - return Config::getConfig()->isFilesEnabled(); - } - - /** - * Comprobar si están habilitadas las notificaciones por correo. - * - * @return bool - */ - public static function mailIsEnabled() - { - return Config::getConfig()->isMailEnabled(); - } - - /** - * Comprobar si está habilitada la Wiki. - * - * @return bool - */ - public static function wikiIsEnabled() - { - return Config::getConfig()->isWikiEnabled(); - } - - /** - * Comprobar si está habilitada la API de DokuWiki. - * - * @return bool - */ - public static function dokuWikiIsEnabled() - { - return Config::getConfig()->isDokuwikiEnabled(); - } - - /** - * Comprobar si están habilitadas las peticiones por correo. - * - * @return bool - */ - public static function mailrequestIsEnabled() - { - return Config::getConfig()->isMailRequestsEnabled(); - } - - /** - * Comprobar si está habilitado LDAP. - * - * @return bool - */ - public static function ldapIsEnabled() - { - return Checks::ldapIsAvailable() && Config::getConfig()->isLdapEnabled(); - } - - /** - * Comprobar si está habilitado el log de eventos. - * - * @return bool - */ - public static function logIsEnabled() - { - return Config::getConfig()->isLogEnabled(); - } - - /** - * Comprobar si está habilitado el servidor de syslog. - * - * @return bool - */ - public static function syslogIsEnabled() - { - return Config::getConfig()->isSyslogEnabled(); - } - - /** - * Comprobar si está habilitado el servidor de syslog. - * - * @return bool - */ - public static function remoteSyslogIsEnabled() - { - return Config::getConfig()->isSyslogRemoteEnabled(); - } - - - /** - * Comprobar si está habilitado el formato de tarjeta en los resultados. - * - * @return bool - */ - public static function resultsCardsIsEnabled() - { - return Config::getConfig()->isResultsAsCards(); - } - - /** - * Comprobar si está habilitada Auth Basic. - * - * @return bool - */ - public static function authBasicIsEnabled() - { - return Config::getConfig()->isAuthBasicEnabled(); - } - - /** - * Comprobar si está habilitado usar imagen para claves de cuentas - * - * @return bool - */ - public static function accountPassToImageIsEnabled() - { - return Config::getConfig()->isAccountPassToImage(); - } - - /** - * Comprobar si está habilitado forzar la conexión por HTTPS - * - * @return bool - */ - public static function forceHttpsIsEnabled() - { - return Config::getConfig()->isHttpsEnabled(); - } - - /** - * Comprobar si está habilitado la publicación de enlaces - * - * @return bool - */ - public static function publicLinksIsEnabled() - { - return Config::getConfig()->isPublinksEnabled(); - } - /** * Comprobar si se utiliza HTTPS * diff --git a/inc/SP/Util/Connection.php b/lib/SP/Util/Connection.php similarity index 100% rename from inc/SP/Util/Connection.php rename to lib/SP/Util/Connection.php diff --git a/inc/SP/Util/ConnectionInterface.php b/lib/SP/Util/ConnectionInterface.php similarity index 100% rename from inc/SP/Util/ConnectionInterface.php rename to lib/SP/Util/ConnectionInterface.php diff --git a/inc/SP/Util/Filter.php b/lib/SP/Util/Filter.php similarity index 100% rename from inc/SP/Util/Filter.php rename to lib/SP/Util/Filter.php diff --git a/inc/SP/Util/HttpUtil.php b/lib/SP/Util/HttpUtil.php similarity index 94% rename from inc/SP/Util/HttpUtil.php rename to lib/SP/Util/HttpUtil.php index fd5557b3..cb7ce60c 100644 --- a/inc/SP/Util/HttpUtil.php +++ b/lib/SP/Util/HttpUtil.php @@ -24,6 +24,8 @@ namespace SP\Util; +use SP\Bootstrap; +use SP\Config\ConfigData; use SP\Http\Request; /** @@ -35,10 +37,15 @@ class HttpUtil { /** * Comprobar y forzar (si es necesario) la conexión HTTPS + * + * @throws \Psr\Container\ContainerExceptionInterface */ public static function checkHttps() { - if (Checks::forceHttpsIsEnabled() && !Checks::httpsEnabled()) { + /** @var ConfigData $ConfigData */ + $ConfigData = Bootstrap::getDic()->get(ConfigData::class); + + if ($ConfigData->isHttpsEnabled() && !Checks::httpsEnabled()) { $port = ((int)$_SERVER['SERVER_PORT'] !== 443) ? ':' . $_SERVER['SERVER_PORT'] : ''; $host = str_replace('http', 'https', self::getHttpHost()); diff --git a/inc/SP/Util/ImageUtil.php b/lib/SP/Util/ImageUtil.php similarity index 100% rename from inc/SP/Util/ImageUtil.php rename to lib/SP/Util/ImageUtil.php diff --git a/inc/SP/Util/Json.php b/lib/SP/Util/Json.php similarity index 100% rename from inc/SP/Util/Json.php rename to lib/SP/Util/Json.php diff --git a/inc/SP/Util/Util.php b/lib/SP/Util/Util.php similarity index 90% rename from inc/SP/Util/Util.php rename to lib/SP/Util/Util.php index 7077cb40..7e165581 100644 --- a/inc/SP/Util/Util.php +++ b/lib/SP/Util/Util.php @@ -26,15 +26,19 @@ namespace SP\Util; use Defuse\Crypto\Core; use Defuse\Crypto\Encoding; +use SP\Bootstrap; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Config\ConfigDB; use SP\Core\Exceptions\SPException; use SP\Core\Init; use SP\Core\Installer; -use SP\Core\Session; +use SP\Core\Session\Session; +use SP\Core\SessionFactory; use SP\Html\Html; use SP\Log\Log; use SP\Log\LogUtil; +use SP\Storage\Database; defined('APP_ROOT') || die(); @@ -166,10 +170,6 @@ class Util */ public static function checkUpdates() { - if (!Config::getConfig()->isCheckUpdates()) { - return false; - } - try { $data = self::getDataFromUrl(self::getAppInfo('appupdates')); } catch (SPException $e) { @@ -196,7 +196,7 @@ class Util preg_match('/v?(\d+)\.(\d+)\.(\d+)\.(\d+)(\-[a-z0-9.]+)?$/', $version, $remoteVersion); // preg_match('/v?(\d+)\.(\d+)\.(\d+)(\-[a-z0-9.]+)?$/', $version, $realVer); - if (is_array($remoteVersion) && Init::isLoggedIn()) { + if (is_array($remoteVersion)) { $appVersion = self::getVersionStringNormalized(); $pubVersion = $remoteVersion[1] . $remoteVersion[2] . $remoteVersion[3] . '.' . $remoteVersion[4]; // $pubVersion = $realVer[1] . $realVer[2] . $realVer[3]; @@ -227,10 +227,15 @@ class Util * @param bool|null $useCookie * @param bool $weak * @return bool|string + * @throws \Psr\Container\NotFoundExceptionInterface + * @throws \Psr\Container\ContainerExceptionInterface * @throws SPException */ public static function getDataFromUrl($url, array $data = null, $useCookie = false, $weak = false) { + /** @var ConfigData $ConfigData */ + $ConfigData = Bootstrap::getDic()->get(ConfigData::class); + if (!Checks::curlIsAvailable()) { $Log = LogUtil::extensionNotLoaded('CURL', __FUNCTION__); @@ -239,15 +244,15 @@ class Util $ch = curl_init($url); - if (Config::getConfig()->isProxyEnabled()) { - curl_setopt($ch, CURLOPT_PROXY, Config::getConfig()->getProxyServer()); - curl_setopt($ch, CURLOPT_PROXYPORT, Config::getConfig()->getProxyPort()); + if ($ConfigData->isProxyEnabled()) { + curl_setopt($ch, CURLOPT_PROXY, $ConfigData->getProxyServer()); + curl_setopt($ch, CURLOPT_PROXYPORT, $ConfigData->getProxyPort()); curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); - $proxyUser = Config::getConfig()->getProxyUser(); + $proxyUser = $ConfigData->getProxyUser(); if ($proxyUser) { - $proxyAuth = $proxyUser . ':' . Config::getConfig()->getProxyPass(); + $proxyAuth = $proxyUser . ':' . $ConfigData->getProxyPass(); curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth); } } @@ -275,11 +280,11 @@ class Util $cookie = self::getUserCookieFile(); if ($cookie) { - if (!Session::getCurlCookieSession()) { + if (!SessionFactory::getCurlCookieSession()) { curl_setopt($ch, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); - Session::setCurlCookieSession(true); + SessionFactory::setCurlCookieSession(true); } curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); @@ -314,7 +319,7 @@ class Util { $tempDir = self::getTempDir(); - return $tempDir ? $tempDir . DIRECTORY_SEPARATOR . md5('syspass-' . Session::getUserData()->getUserLogin()) : false; + return $tempDir ? $tempDir . DIRECTORY_SEPARATOR . md5('syspass-' . SessionFactory::getUserData()->getUserLogin()) : false; } /** @@ -473,10 +478,14 @@ class Util * Esta función hace una petición a GitHub y parsea el JSON devuelto * * @return array|bool + * @throws \Psr\Container\ContainerExceptionInterface */ public static function checkNotices() { - if (!Config::getConfig()->isChecknotices()) { + /** @var ConfigData $ConfigData */ + $ConfigData = Bootstrap::getDic()->get(ConfigData::class); + + if (!$ConfigData->isChecknotices()) { return false; } @@ -567,8 +576,8 @@ class Util */ public static function reload() { - if (Session::getReload() === false) { - Session::setReload(true); + if (SessionFactory::getReload() === false) { + SessionFactory::setReload(true); } } @@ -577,8 +586,8 @@ class Util */ public static function checkReload() { - if (Session::getReload() === true) { - Session::setReload(false); + if (SessionFactory::getReload() === true) { + SessionFactory::setReload(false); exit(''); } } @@ -674,11 +683,14 @@ class Util */ public static function lockApp($setMaintenance = true) { - ConfigDB::setValue('lock', Session::getUserData()->getUserId(), false); + ConfigDB::setValue('lock', SessionFactory::getUserData()->getUserId(), false); + + /** @var Config $Config */ + $Config = Bootstrap::getDic()['config']; if ($setMaintenance) { - Config::getConfig()->setMaintenance(true); - Config::saveConfig(null, false); + $Config->getConfigData()->setMaintenance(true); + $Config->saveConfig(null, false); } } @@ -691,9 +703,12 @@ class Util { ConfigDB::setValue('lock', 0, false); + /** @var Config $Config */ + $Config = Bootstrap::getDic()['config']; + if ($unsetMaintenance) { - Config::getConfig()->setMaintenance(false); - Config::saveConfig(null, false); + $Config->getConfigData()->setMaintenance(false); + $Config->saveConfig(null, false); } } @@ -727,4 +742,17 @@ class Util return [0, 0]; } + + /** + * Comprobar si el usuario está logado. + * + * @param Session $session + * @return bool + * @internal param Database $db + */ + public static function isLoggedIn(Session $session) + { + return ($session->getUserData()->getUserLogin() + && is_object($session->getUserPreferences())); + } } diff --git a/inc/SP/Util/Wiki/DokuWikiApi.php b/lib/SP/Util/Wiki/DokuWikiApi.php similarity index 94% rename from inc/SP/Util/Wiki/DokuWikiApi.php rename to lib/SP/Util/Wiki/DokuWikiApi.php index 3b1fbc66..e5b3ab5d 100644 --- a/inc/SP/Util/Wiki/DokuWikiApi.php +++ b/lib/SP/Util/Wiki/DokuWikiApi.php @@ -25,8 +25,10 @@ namespace SP\Util\Wiki; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\SPException; -use SP\Core\Session; +use SP\Core\SessionFactory; +use SP\Core\Traits\InjectableTrait; use SP\Log\Log; use SP\Log\LogLevel; @@ -54,22 +56,24 @@ class DokuWikiApi extends DokuWikiApiBase */ public function __construct($url = null, $user = null, $pass = null) { + parent::__construct(); + try { $this->setConnectionData($url, $user, $pass); - if (!empty($this->apiUser) && Session::getDokuWikiSession() === false) { + if (!empty($this->apiUser) && SessionFactory::getDokuWikiSession() === false) { $Res = new DokuWikiApiParse($this->doLogin()); $this->catchError($Res); $resLogin = $Res->parseParams(); - Session::setDokuWikiSession($resLogin[0]); + SessionFactory::setDokuWikiSession($resLogin[0]); if ($resLogin[0] === false) { throw new SPException(SPException::SP_WARNING, __('Fallo de autentificación', false)); } } - $this->namespace = Config::getConfig()->getDokuwikiNamespace(); + $this->namespace = $this->ConfigData->getDokuwikiNamespace(); } catch (SPException $e) { $this->logException($e); throw $e; @@ -78,7 +82,7 @@ class DokuWikiApi extends DokuWikiApiBase throw new SPException(SPException::SP_WARNING, $e->getMessage()); } } - + /** * Comprobar la conexión a DokuWiki * @@ -92,7 +96,7 @@ class DokuWikiApi extends DokuWikiApiBase { try { // Reinicializar la cookie de DokuWiki - Session::setDokuWikiSession(false); + SessionFactory::setDokuWikiSession(false); return new DokuWikiApi($url, $user, $pass); } catch (SPException $e) { diff --git a/inc/SP/Util/Wiki/DokuWikiApiBase.php b/lib/SP/Util/Wiki/DokuWikiApiBase.php similarity index 89% rename from inc/SP/Util/Wiki/DokuWikiApiBase.php rename to lib/SP/Util/Wiki/DokuWikiApiBase.php index caf4f3f6..584a4279 100644 --- a/inc/SP/Util/Wiki/DokuWikiApiBase.php +++ b/lib/SP/Util/Wiki/DokuWikiApiBase.php @@ -27,7 +27,9 @@ namespace SP\Util\Wiki; use DOMDocument; use DOMException; use SP\Config\Config; +use SP\Config\ConfigData; use SP\Core\Exceptions\SPException; +use SP\Core\Traits\InjectableTrait; use SP\Http\XMLRPCResponseParse; use SP\Log\Log; use SP\Log\LogLevel; @@ -40,6 +42,8 @@ use SP\Util\Util; */ abstract class DokuWikiApiBase { + use InjectableTrait; + /** * @var string */ @@ -52,6 +56,10 @@ abstract class DokuWikiApiBase * @var string */ protected $apiUrl = ''; + /** + * @var ConfigData + */ + protected $ConfigData; /** * @var DOMDocument */ @@ -65,6 +73,14 @@ abstract class DokuWikiApiBase */ private $params; + /** + * DokuWikiApiBase constructor. + */ + public function __construct() + { + $this->injectDependencies(); + } + /** * @return string */ @@ -73,6 +89,14 @@ abstract class DokuWikiApiBase return $this->xml->saveXML(); } + /** + * @param Config $config + */ + public function inject(Config $config) + { + $this->ConfigData = $config->getConfigData(); + } + /** * Establecer la autorización * @@ -211,9 +235,9 @@ abstract class DokuWikiApiBase */ protected function setConnectionData($url, $user, $pass) { - $this->apiUrl = empty($url) ? Config::getConfig()->getDokuwikiUrl() : $url; - $this->apiUser = empty($user) ? Config::getConfig()->getDokuwikiUser() : $user; - $this->apiPassword = empty($pass) ? Config::getConfig()->getDokuwikiPass() : $pass; + $this->apiUrl = empty($url) ? $this->ConfigData->getDokuwikiUrl() : $url; + $this->apiUser = empty($user) ? $this->ConfigData->getDokuwikiUser() : $user; + $this->apiPassword = empty($pass) ? $this->ConfigData->getDokuwikiPass() : $pass; if (empty($this->apiUrl)) { throw new SPException(SPException::SP_WARNING, __('URL de conexión no establecida', false)); diff --git a/inc/SP/Util/Wiki/DokuWikiApiParse.php b/lib/SP/Util/Wiki/DokuWikiApiParse.php similarity index 100% rename from inc/SP/Util/Wiki/DokuWikiApiParse.php rename to lib/SP/Util/Wiki/DokuWikiApiParse.php diff --git a/inc/SplClassLoader.php b/lib/SplClassLoader.php similarity index 100% rename from inc/SplClassLoader.php rename to lib/SplClassLoader.php diff --git a/css/css.php b/public/css/css.php similarity index 92% rename from css/css.php rename to public/css/css.php index f278783f..7bffd5b3 100644 --- a/css/css.php +++ b/public/css/css.php @@ -25,9 +25,9 @@ use SP\Html\Minify; use SP\Http\Request; -define('APP_ROOT', dirname(__DIR__)); +define('APP_ROOT', dirname(__DIR__, 2)); -require_once APP_ROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Base.php'; +require_once APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Base.php'; $file = Request::analyze('f'); $base = Request::analyze('b'); @@ -46,8 +46,6 @@ if (!$file) { ->addFile('magnific-popup.min.css') ->getMinified(); } elseif ($file && $base) { - $base = Request::analyze('b'); - $Minify = new Minify(); $Minify->setType(Minify::FILETYPE_CSS) ->setBase(urldecode($base), true) diff --git a/css/fonts.css b/public/css/fonts.css similarity index 100% rename from css/fonts.css rename to public/css/fonts.css diff --git a/css/fonts.min.css b/public/css/fonts.min.css similarity index 100% rename from css/fonts.min.css rename to public/css/fonts.min.css diff --git a/css/fonts/MaterialIcons-Regular.eot b/public/css/fonts/MaterialIcons-Regular.eot similarity index 100% rename from css/fonts/MaterialIcons-Regular.eot rename to public/css/fonts/MaterialIcons-Regular.eot diff --git a/css/fonts/MaterialIcons-Regular.svg b/public/css/fonts/MaterialIcons-Regular.svg similarity index 100% rename from css/fonts/MaterialIcons-Regular.svg rename to public/css/fonts/MaterialIcons-Regular.svg diff --git a/css/fonts/MaterialIcons-Regular.ttf b/public/css/fonts/MaterialIcons-Regular.ttf similarity index 100% rename from css/fonts/MaterialIcons-Regular.ttf rename to public/css/fonts/MaterialIcons-Regular.ttf diff --git a/css/fonts/MaterialIcons-Regular.woff b/public/css/fonts/MaterialIcons-Regular.woff similarity index 100% rename from css/fonts/MaterialIcons-Regular.woff rename to public/css/fonts/MaterialIcons-Regular.woff diff --git a/css/fonts/MaterialIcons-Regular.woff2 b/public/css/fonts/MaterialIcons-Regular.woff2 similarity index 100% rename from css/fonts/MaterialIcons-Regular.woff2 rename to public/css/fonts/MaterialIcons-Regular.woff2 diff --git a/css/fonts/NotoSans-Regular-webfont.ttf b/public/css/fonts/NotoSans-Regular-webfont.ttf similarity index 100% rename from css/fonts/NotoSans-Regular-webfont.ttf rename to public/css/fonts/NotoSans-Regular-webfont.ttf diff --git a/css/jquery-ui.min.css b/public/css/jquery-ui.min.css similarity index 100% rename from css/jquery-ui.min.css rename to public/css/jquery-ui.min.css diff --git a/css/jquery-ui.structure.min.css b/public/css/jquery-ui.structure.min.css similarity index 100% rename from css/jquery-ui.structure.min.css rename to public/css/jquery-ui.structure.min.css diff --git a/css/jquery.tagsinput.min.css b/public/css/jquery.tagsinput.min.css similarity index 100% rename from css/jquery.tagsinput.min.css rename to public/css/jquery.tagsinput.min.css diff --git a/css/magnific-popup.css b/public/css/magnific-popup.css similarity index 100% rename from css/magnific-popup.css rename to public/css/magnific-popup.css diff --git a/css/magnific-popup.min.css b/public/css/magnific-popup.min.css similarity index 100% rename from css/magnific-popup.min.css rename to public/css/magnific-popup.min.css diff --git a/css/material-icons.css b/public/css/material-icons.css similarity index 100% rename from css/material-icons.css rename to public/css/material-icons.css diff --git a/css/material-icons.min.css b/public/css/material-icons.min.css similarity index 100% rename from css/material-icons.min.css rename to public/css/material-icons.min.css diff --git a/css/reset.min.css b/public/css/reset.min.css similarity index 100% rename from css/reset.min.css rename to public/css/reset.min.css diff --git a/css/toastr.css b/public/css/toastr.css similarity index 100% rename from css/toastr.css rename to public/css/toastr.css diff --git a/css/toastr.min.css b/public/css/toastr.min.css similarity index 100% rename from css/toastr.min.css rename to public/css/toastr.min.css diff --git a/imgs/logo_full_bg.png b/public/images/logo_full_bg.png similarity index 100% rename from imgs/logo_full_bg.png rename to public/images/logo_full_bg.png diff --git a/imgs/logo_full_nobg.png b/public/images/logo_full_nobg.png similarity index 100% rename from imgs/logo_full_nobg.png rename to public/images/logo_full_nobg.png diff --git a/imgs/logo_icon.png b/public/images/logo_icon.png similarity index 100% rename from imgs/logo_icon.png rename to public/images/logo_icon.png diff --git a/js/app-actions.js b/public/js/app-actions.js similarity index 96% rename from js/app-actions.js rename to public/js/app-actions.js index 5946dc27..3a2dac85 100644 --- a/js/app-actions.js +++ b/public/js/app-actions.js @@ -34,18 +34,18 @@ sysPass.Actions = function (Common) { // Objeto con las URLs de las acciones var ajaxUrl = { - doAction: "/ajax/ajax_getContent.php", - updateItems: "/ajax/ajax_getItems.php", + doAction: "/index.php", + updateItems: "/index.php", user: { savePreferences: "/ajax/ajax_userPrefsSave.php", password: "/ajax/ajax_usrpass.php", passreset: "/ajax/ajax_passReset.php" }, main: { - login: "/ajax/ajax_doLogin.php", + login: "/index.php?r=login/login", install: "/ajax/ajax_install.php", upgrade: "/ajax/ajax_upgrade.php", - getUpdates: "/ajax/ajax_checkUpds.php", + getUpdates: "/index.php?r=index/checkUpdates", task: "/ajax/ajax_task.php" }, checks: "/ajax/ajax_checkConnection.php", @@ -61,8 +61,8 @@ sysPass.Actions = function (Common) { save: "/ajax/ajax_itemSave.php", saveFavorite: "/ajax/ajax_itemSave.php", request: "/ajax/ajax_itemSave.php", - getFiles: "/ajax/ajax_accGetFiles.php", - search: "/ajax/ajax_accSearch.php" + getFiles: "/index.php", + search: "/index.php?r=account/search" }, appMgmt: { show: "/ajax/ajax_itemShow.php", @@ -83,9 +83,10 @@ sysPass.Actions = function (Common) { // Función para cargar el contenido de la acción del menú seleccionada var doAction = function (obj, view) { + var itemId = obj.itemId !== undefined ? "/" + obj.itemId : ""; + var data = { - actionId: obj.actionId, - itemId: obj.itemId !== "undefined" ? obj.itemId : 0, + r: obj.r + itemId, isAjax: 1 }; @@ -101,7 +102,7 @@ sysPass.Actions = function (Common) { $content.empty().html(response); - var views = sysPassApp.triggers().views; + var views = Common.triggers().views; views.common($content); if (view !== undefined && typeof views[view] === "function") { @@ -214,7 +215,10 @@ sysPass.Actions = function (Common) { opts.url = ajaxUrl.updateItems; opts.method = "get"; opts.cache = true; - opts.data = {sk: $obj.data("sk"), itemType: $obj.data("item-type"), itemId: $obj.data("item-id")}; + opts.data = { + r: "items/" + $obj.data("item-type") + "/" + $obj.data("item-id"), + sk: $obj.data("sk") + }; Common.appRequests().getActionCall(opts, function (json) { callback(json.data); @@ -326,16 +330,7 @@ sysPass.Actions = function (Common) { */ var main = { logout: function () { - var search = window.location.search; - var url = ""; - - if (search.length > 0) { - url = "index.php" + search + "&logout=1"; - } else { - url = "index.php?logout=1"; - } - - Common.redirect(url); + Common.redirect("index.php?r=login/logout"); }, login: function ($obj) { log.info("main:login"); @@ -467,7 +462,7 @@ sysPass.Actions = function (Common) { } }); }, - getUpdates: function ($obj) { + getUpdates: function () { log.info("main:getUpdates"); var opts = Common.appRequests().getRequestOpts(); @@ -481,7 +476,7 @@ sysPass.Actions = function (Common) { Common.appRequests().getActionCall(opts, function (response) { $("#updates").html(response); - if (typeof componentHandler !== "undefined") { + if (componentHandler !== undefined) { componentHandler.upgradeDom(); } }, function () { @@ -838,20 +833,20 @@ sysPass.Actions = function (Common) { * @type {{show: account.show, showHistory: account.showHistory, edit: account.edit, delete: account.delete, showpass: account.showpass, copypass: account.copypass, copy: account.copy, favorite: account.savefavorite, request: account.request, menu: account.menu, sort: account.sort, editpass: account.editpass, restore: account.restore, getfiles: account.getfiles, search: account.search, save: account.save}} */ var account = { - show: function ($obj) { + view: function ($obj) { log.info("account:show"); - doAction({actionId: $obj.data("action-id"), itemId: $obj.data("item-id")}, "account"); + doAction({r: $obj.data("action-id"), itemId: $obj.data("item-id")}, "account"); }, showHistory: function ($obj) { log.info("account:showHistory"); - doAction({actionId: $obj.data("action-id"), itemId: $obj.val()}, "account"); + doAction({r: $obj.data("action-id"), itemId: $obj.val()}, "account"); }, edit: function ($obj) { log.info("account:edit"); - doAction({actionId: $obj.data("action-id"), itemId: $obj.data("item-id")}, "account"); + doAction({r: $obj.data("action-id"), itemId: $obj.data("item-id")}, "account"); }, delete: function ($obj) { log.info("account:delete"); @@ -874,8 +869,7 @@ sysPass.Actions = function (Common) { var opts = Common.appRequests().getRequestOpts(); opts.url = ajaxUrl.account.save; opts.data = { - itemId: $obj.data("item-id"), - actionId: $obj.data("action-id"), + r: $obj.data("action-id") + "/" + $obj.data("item-id"), sk: Common.sk.get() }; @@ -893,13 +887,13 @@ sysPass.Actions = function (Common) { log.info("account:showpass"); var parentId = $obj.data("parent-id"); + var id = parentId == 0 ? $obj.data("item-id") : parentId; var opts = Common.appRequests().getRequestOpts(); opts.url = ajaxUrl.appMgmt.show; opts.method = "get"; opts.data = { - itemId: parentId == 0 ? $obj.data("item-id") : parentId, - actionId: $obj.data("action-id"), + r: $obj.data("action-id") + "/" + id, isHistory: $obj.data("history"), isLinked: parentId > 0 ? 1 : 0, isFull: 1, @@ -936,14 +930,14 @@ sysPass.Actions = function (Common) { log.info("account:copypass"); var parentId = $obj.data("parent-id"); + var id = parentId == 0 ? $obj.data("item-id") : parentId; var opts = Common.appRequests().getRequestOpts(); opts.url = ajaxUrl.appMgmt.show; opts.method = "get"; opts.async = false; opts.data = { - itemId: parentId == 0 ? $obj.data("item-id") : parentId, - actionId: $obj.data("action-id"), + r: $obj.data("action-id") + "/" + id, isHistory: $obj.data("history"), isFull: 0, sk: Common.sk.get(), @@ -955,16 +949,16 @@ sysPass.Actions = function (Common) { copy: function ($obj) { log.info("account:copy"); - doAction({actionId: $obj.data("action-id"), itemId: $obj.data("item-id")}, "account"); + doAction({r: $obj.data("action-id"), itemId: $obj.data("item-id")}, "account"); }, savefavorite: function ($obj, callback) { log.info("account:saveFavorite"); var isOn = $obj.data("status") === "on"; + var actionId = isOn ? $obj.data("action-id-off") : $obj.data("action-id-on"); var data = { - actionId: isOn ? $obj.data("action-id-off") : $obj.data("action-id-on"), - itemId: $obj.data("item-id"), + r: actionId + "/" + $obj.data("item-id"), sk: Common.sk.get(), isAjax: 1 }; @@ -1020,7 +1014,7 @@ sysPass.Actions = function (Common) { var parentId = $obj.data("parent-id"); doAction({ - actionId: $obj.data("action-id"), + r: $obj.data("action-id"), itemId: parentId == 0 ? $obj.data("item-id") : parentId }, "account"); }, @@ -1036,7 +1030,7 @@ sysPass.Actions = function (Common) { opts.method = "get"; opts.type = "html"; opts.url = ajaxUrl.account.getFiles; - opts.data = {id: $obj.data("item-id"), del: $obj.data("delete"), sk: Common.sk.get()}; + opts.data = {r: "account/listFiles/" + $obj.data("item-id"), del: $obj.data("delete"), sk: Common.sk.get()}; Common.appRequests().getActionCall(opts, function (response) { $obj.html(response); diff --git a/public/js/app-actions.min.js b/public/js/app-actions.min.js new file mode 100644 index 00000000..dcf88b6e --- /dev/null +++ b/public/js/app-actions.min.js @@ -0,0 +1,45 @@ +var $jscomp={scope:{},findInternal:function(c,e,k){c instanceof String&&(c=String(c));for(var f=c.length,h=0;h'+b+""),g=d.find("img");if(0===g.length)return l(a,b);g.hide();$.magnificPopup.open({items:{src:d,type:"inline"},callbacks:{open:function(){var a=this;g.on("click",function(){a.close()});setTimeout(function(){var a=c.resizeImage(g); +d.css({backgroundColor:"#fff",width:a.width,height:"auto"});g.show("slow")},500)}}})},p={get:function(a){e.info("items:get");var b=a[0].selectize;b.clearOptions();b.load(function(d){var g=c.appRequests().getRequestOpts();g.url=f.updateItems;g.method="get";g.cache=!0;g.data={r:"items/"+a.data("item-type")+"/"+a.data("item-id"),sk:a.data("sk")};c.appRequests().getActionCall(g,function(g){d(g.data);b.setValue(a.data("selected-id"),!0);c.appTriggers().updateFormHash()})})},update:function(a){e.info("items:update"); +var b=$("#"+a.data("item-dst"))[0].selectize;b.clearOptions();b.load(function(d){var b=c.appRequests().getRequestOpts();b.url=f.updateItems;b.method="get";b.data={sk:c.sk.get(),itemType:a.data("item-type")};c.appRequests().getActionCall(b,function(c){d(c.data)})})}},q={logout:function(){c.redirect("index.php?r=login/logout")},login:function(a){e.info("main:login");var b=c.appRequests().getRequestOpts();b.url=f.main.login;b.method="get";b.data=a.serialize();c.appRequests().getActionCall(b,function(d){var b= +$(".extra-hidden");switch(d.status){case 0:c.redirect(d.data.url);break;case 2:c.msg.out(d);a.find("input[type='text'],input[type='password']").val("");a.find("input:first").focus();0";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault(); +c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(d){d=a.find("input[name='useTask']");var b=$("#taskStatus");b.empty().html(c.config().LANG[62]);if(0";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b=c.appRequests().getRequestOpts();b.url=f.account.save;b.data={r:a.data("action-id")+"/"+a.data("item-id"),sk:c.sk.get()};c.appRequests().getActionCall(b,function(a){c.msg.out(a);m.search()})}}})},showpass:function(a){e.info("account:showpass");var b=a.data("parent-id"),d=0==b? +a.data("item-id"):b,g=c.appRequests().getRequestOpts();g.url=f.appMgmt.show;g.method="get";g.data={r:a.data("action-id")+"/"+d,isHistory:a.data("history"),isLinked:0",d=a.data("selection"),g=[];if(d&& +($(d).find(".is-selected").each(function(a,c){var b=$(this);g.push(b.data("item-id"))}),0===g.length))return;mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault();b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data={itemId:d?g:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){c.msg.out(b); +a.data("nextaction-id")&&h({actionId:a.data("nextaction-id"),itemId:a.data("activetab")})})}}})},save:function(a){e.info("appMgmt:save");var b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data=a.serialize();c.appRequests().getActionCall(b,function(b){c.msg.out(b);0===b.status&&(b=a.data("activetab"),!0===n.refreshTab&&void 0!==b&&h({actionId:a.data("nextaction-id"),itemId:b}),$.magnificPopup.close())})},search:function(a){e.info("appMgmt:search");var b=$(a.data("target")),d=c.appRequests().getRequestOpts(); +d.url=f.appMgmt.search;d.method="get";d.data=a.serialize();c.appRequests().getActionCall(d,function(a){0===a.status?b.html(a.data.html):b.html(c.msg.html.error(a.description));c.sk.set(a.csrf)})},nav:function(a){e.info("appMgmt:nav");var b=$("#"+a.data("action-form"));b.find("[name='start']").val(a.data("start"));b.find("[name='count']").val(a.data("count"));b.find("[name='sk']").val(c.sk.get());n.search(b)},ldapSync:function(a){e.info("appMgmt:ldapSync");var b='

    '+ +c.config().LANG[57]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data={actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1,ldap_loginattribute:$("#ldap_loginattribute").val(),ldap_nameattribute:$("#ldap_nameattribute").val(),ldap_ads:$("#ldap_ads").prop("checked")};c.appRequests().getActionCall(b, +function(a){c.msg.out(a)})}}})}};return{doAction:h,appMgmt:n,account:m,file:{view:function(a){e.info("file:view");var b=c.appRequests().getRequestOpts();b.url=f.file;b.type="html";b.data={fileId:a.data("item-id"),sk:c.sk.get(),actionId:a.data("action-id")};c.appRequests().getActionCall(b,function(b){void 0!==b.status&&1===b.status?c.msg.out(b):b?r(a,b):c.msg.error(c.config().LANG[14])})},download:function(a){e.info("file:download");a={fileId:a.data("item-id"),sk:c.sk.get(),actionId:a.data("action-id")}; +$.fileDownload(c.config().APP_ROOT+f.file,{httpMethod:"POST",data:a})},"delete":function(a){e.info("file:delete");var b='

    '+c.config().LANG[15]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b=c.appRequests().getRequestOpts();b.url=f.file;b.data={fileId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get()}; +c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&(a=$("#list-account-files"),m.getfiles(a))})}}})}},checks:{ldap:function(a){e.info("checks:ldap");a=$(a.data("src"));a.find("[name='sk']").val(c.sk.get());var b=c.appRequests().getRequestOpts();b.url=f.checks;b.data=a.serialize();c.appRequests().getActionCall(b,function(a){c.msg.out(a);var b=$("#ldap-results");b.find(".list-wrap").html(c.appTheme().html.getList(a.data));b.show("slow")})},wiki:function(a){e.info("checks:wiki"); +a=$(a.data("src"));a.find("[name='sk']").val(c.sk.get());var b=c.appRequests().getRequestOpts();b.url=f.checks;b.data=a.serialize();c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&$("#dokuWikiResCheck").html(a.data)})}},config:{save:function(a){e.info("config:save");var b=c.appRequests().getRequestOpts();b.url=f.config.save;b.data=a.serialize();"masterpass"===a.data("type")&&(b.useFullLoading=!0);c.appRequests().getActionCall(b,function(b){c.msg.out(b);0===b.status&&(void 0!== +a.data("nextaction-id")?h({actionId:a.data("nextaction-id"),itemId:a.data("activetab")}):void 0!==a.data("reload")&&setTimeout(function(){c.redirect("index.php")},2E3))})},masterpass:function(a){var b='

    '+c.config().LANG[59]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(b){b.preventDefault();c.msg.error(c.config().LANG[44]);a.find(":input[type=password]").val("")}},positive:{title:c.config().LANG[43],onClick:function(b){b= +a.find("input[name='useTask']");var d=$("#taskStatus");d.empty().html(c.config().LANG[62]);if(0";mdlDialog().show({text:d,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.appRequests().getActionCall(b,function(a){c.msg.out(a)})}},positive:{title:c.config().LANG[43],onClick:function(d){d.preventDefault();b.data.notify=1;c.appRequests().getActionCall(b,function(b){c.msg.out(b);h({actionId:a.data("nextaction-id"),itemId:a.data("item-id")})})}}})},refresh:function(a){e.info("link:refresh"); +var b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")},d=c.appRequests().getRequestOpts();d.url=f.link;d.data=b;c.appRequests().getActionCall(d,function(b){c.msg.out(b);0===b.status&&h({actionId:a.data("nextaction-id"),itemId:a.data("activetab")})})}},eventlog:{nav:function(a){if(void 0===a.data("start"))return!1;var b=c.appRequests().getRequestOpts();b.url=f.eventlog;b.method="get";b.type="html";b.data={actionId:a.data("action-id"),sk:c.sk.get(), +isAjax:1,start:a.data("start"),count:a.data("count"),current:a.data("current")};c.appRequests().getActionCall(b,function(a){$("#content").html(a);c.scrollUp()})},clear:function(a){var b='

    '+c.config().LANG[20]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault();b=c.appRequests().getRequestOpts(); +b.url=f.eventlog;b.method="get";b.data={clear:1,sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){c.msg.out(b);0==b.status&&h({actionId:a.data("nextaction-id")})})}}})}},ajaxUrl:f,plugin:{toggle:function(a){e.info("plugin:enable");a={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")};var b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data=a;c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&setTimeout(function(){c.redirect("index.php")}, +2E3)})},reset:function(a){e.info("plugin:reset");var b='

    '+c.config().LANG[58]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault();b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")};var d=c.appRequests().getRequestOpts();d.url=f.appMgmt.save;d.data= +b;c.appRequests().getActionCall(d,function(a){c.msg.out(a)})}}})}},notice:{check:function(a){e.info("notice:check");var b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get()},d=c.appRequests().getRequestOpts();d.url=f.appMgmt.save;d.data=b;c.appRequests().getActionCall(d,function(b){c.msg.out(b);0===b.status&&h({actionId:a.data("nextaction-id"),itemId:a.data("activetab")})})},search:function(a){e.info("notice:search");var b=$(a.data("target")),d=c.appRequests().getRequestOpts();d.url= +f.notice.search;d.method="get";d.data=a.serialize();c.appRequests().getActionCall(d,function(a){0===a.status?b.html(a.data.html):b.html(c.msg.html.error(a.description));c.sk.set(a.csrf)})},show:function(a){e.info("notice:show");var b=c.appRequests().getRequestOpts();b.url=f.notice.show;b.method="get";b.data={itemId:a.data("item-id"),actionId:a.data("action-id"),activeTab:a.data("activetab"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){0!==b.status?c.msg.out(b):l(a,b.data.html)})}}, +wiki:{show:function(a){e.info("wiki:show");var b=c.appRequests().getRequestOpts();b.url=f.wiki.show;b.method="get";b.data={pageName:a.data("pagename"),actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){0!==b.status?c.msg.out(b):l(a,b.data.html)})}},items:p}}; diff --git a/js/app-main.js b/public/js/app-main.js similarity index 99% rename from js/app-main.js rename to public/js/app-main.js index 4f971231..51be244f 100644 --- a/js/app-main.js +++ b/public/js/app-main.js @@ -344,7 +344,7 @@ sysPass.Main = function () { config.APP_ROOT = window.location.protocol + "//" + window.location.host + rootPath(); var opts = appRequests.getRequestOpts(); - opts.url = "/ajax/ajax_getEnvironment.php"; + opts.url = "/index.php?r=bootstrap/getEnvironment"; opts.method = "get"; // opts.async = false; opts.useLoading = false; @@ -424,9 +424,9 @@ sysPass.Main = function () { var checkLogout = function () { log.info("checkLogout"); - if (parseInt(getUrlVars("logout")) === 1) { + if (parseInt(getUrlVars("r")) === "login/logout") { msg.sticky(config.LANG[61], function () { - redirect("index.php"); + redirect("index.php?r=login"); }); return true; diff --git a/js/app-main.min.js b/public/js/app-main.min.js similarity index 64% rename from js/app-main.min.js rename to public/js/app-main.min.js index 8c913ddb..c73998e2 100644 --- a/js/app-main.min.js +++ b/public/js/app-main.min.js @@ -8,15 +8,15 @@ sysPass.Main=function(){var b={APP_ROOT:"",LANG:[],PK:"",MAX_FILE_SIZE:1024,CRYP warn:function(a){console.warn(a)},debug:function(a){!0===b.DEBUG&&console.debug(a)}};Object.freeze(g);toastr.options={closeButton:!0,debug:!1,newestOnTop:!1,progressBar:!1,positionClass:"toast-top-center",preventDuplicates:!1,onclick:null,showDuration:"300",hideDuration:"1000",timeOut:"5000",extendedTimeOut:"1000",showEasing:"swing",hideEasing:"linear",showMethod:"fadeIn",hideMethod:"fadeOut"};var x=function(){g.info("setupCallbacks");var a=$("#container").data("page");if(""!==a&&"function"===typeof k.views[a])k.views[a](); 0<$("footer").length&&k.views.footer();$("#btnBack").click(function(){u("index.php")});k.bodyHooks()},h={ok:function(a){toastr.success(a)},error:function(a){toastr.error(a)},warn:function(a){toastr.warning(a)},info:function(a){toastr.info(a)},sticky:function(a,c){var d={timeOut:0};"function"===typeof c&&(d.onHidden=c);toastr.warning(a,b.LANG[60],d)},out:function(a){if("object"===typeof a){var b=a.status,d=a.description;void 0!==a.messages&&0"+a.messages.join("
    ")); switch(b){case 0:h.ok(d);break;case 1:case 2:case 4:h.error(d);break;case 3:h.warn(d);break;case 10:l.main.logout();break;case 100:h.ok(d);h.sticky(d);break;case 101:h.error(d);h.sticky(d);break;default:h.error(d)}}},html:{error:function(a){return'

    Oops...
    '+b.LANG[1]+"
    "+a+"

    "}}};Object.freeze(h);String.format||(String.format=function(a){var b=Array.prototype.slice.call(arguments,1);return a.replace(/{(\d+)}/g,function(a,c){return"undefined"!=typeof b[c]?b[c]:a})}); -var y=function(){g.info("getEnvironment");var a=window.location.pathname.split("/");b.APP_ROOT=window.location.protocol+"//"+window.location.host+function(){for(var b="",c=1;c<=a.length-2;c++)b+="/"+a[c];return b}();var c=m.getRequestOpts();c.url="/ajax/ajax_getEnvironment.php";c.method="get";c.useLoading=!1;c.data={isAjax:1};return m.getActionCall(c,function(a){b.LANG=a.lang;b.PK=a.pk;b.CHECK_UPDATES=a.check_updates;b.CRYPT.setPublicKey(a.pk);b.TIMEZONE=a.timezone;b.LOCALE=a.locale;b.DEBUG=a.debug; -b.MAX_FILE_SIZE=parseInt(a.max_file_size);b.COOKIES_ENABLED=a.cookies_enabled;b.PLUGINS=a.plugins;b.LOGGEDIN=a.loggedin;b.AUTHBASIC_AUTOLOGIN=a.authbasic_autologin;Object.freeze(b)})},r={current:"",get:function(){g.info("sk:get");return $("#container").attr("data-sk")},set:function(a){g.info("sk:set");$("#container").attr("data-sk",a);a.current=a}},z=function(){var a=$("#container");if(!a.hasClass("content-no-auto-resize")){var b=$("#content").height()+200;a.css("height",b)}},A=function(){$("html, body").animate({scrollTop:0}, -"slow")},B=function(a){for(var b=[],d,g=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),h=0;hb.MAX_FILE_SIZE)h.error(b.LANG[18]+"
    "+t.name+" (Max: "+b.MAX_FILE_SIZE+")");else{var g;a:{g=t.name;for(var f=a.data("files-ext").toLowerCase().split(","),e=0;e<=f.length;e++)if(-1!==g.indexOf(f[e])){g=!0;break a}g=!1}g?k(c[d]):h.error(b.LANG[19]+"
    "+t.name)}}},e=function(a){var b=$("#fileUploadForm");!1===a&&b.hide();a=b.find("input[type='file']");a.on("change",function(){"function"=== -typeof d.beforeSendAction&&d.beforeSendAction();f(this.files)});return a};window.File&&window.FileList&&window.FileReader?function(){g.info("fileUpload:init");var b=e(!1);a.on("dragover dragenter",function(a){g.info("fileUpload:drag");a.stopPropagation();a.preventDefault()});a.on("drop",function(a){g.info("fileUpload:drop");a.stopPropagation();a.preventDefault();"function"===typeof d.beforeSendAction&&d.beforeSendAction();f(a.originalEvent.dataTransfer.files)});a.on("click",function(){b.click()})}(): -e(!0);return d},E=function(a){g.info("checkPassLevel");f.passLength=a.val().length;w(zxcvbn(a.val()),a)},w=function(a,c){g.info("outputResult");var d=$(".passLevel-"+c.attr("id")),e=a.score;d.show();d.removeClass("weak good strong strongest");0===f.passLength?d.attr("title","").empty():f.passLengthb.MAX_FILE_SIZE)h.error(b.LANG[18]+"
    "+t.name+" (Max: "+b.MAX_FILE_SIZE+")");else{var g;a:{g=t.name;for(var f=a.data("files-ext").toLowerCase().split(","),e=0;e<=f.length;e++)if(-1!==g.indexOf(f[e])){g=!0;break a}g=!1}g?k(c[d]):h.error(b.LANG[19]+"
    "+t.name)}}},e=function(a){var b=$("#fileUploadForm");!1===a&&b.hide();a=b.find("input[type='file']"); +a.on("change",function(){"function"===typeof d.beforeSendAction&&d.beforeSendAction();f(this.files)});return a};window.File&&window.FileList&&window.FileReader?function(){g.info("fileUpload:init");var b=e(!1);a.on("dragover dragenter",function(a){g.info("fileUpload:drag");a.stopPropagation();a.preventDefault()});a.on("drop",function(a){g.info("fileUpload:drop");a.stopPropagation();a.preventDefault();"function"===typeof d.beforeSendAction&&d.beforeSendAction();f(a.originalEvent.dataTransfer.files)}); +a.on("click",function(){b.click()})}():e(!0);return d},E=function(a){g.info("checkPassLevel");f.passLength=a.val().length;w(zxcvbn(a.val()),a)},w=function(a,c){g.info("outputResult");var d=$(".passLevel-"+c.attr("id")),e=a.score;d.show();d.removeClass("weak good strong strongest");0===f.passLength?d.attr("title","").empty():f.passLengtha.secondary?a.calc=a.main/a.rel:a.maina.secondary&&(a.main*=a.factor,h(a));return a},k=function(){f.main=b;f.secondary=d;var c=h(f);a.css({width:c.main,height:c.calc});e.width=c.main;e.height=c.calc},l=function(){f.main=d;f.secondary=b;var c=h(f);a.css({width:c.calc,height:c.main});e.width=c.calc;e.height=c.main}; e.width>b?k():e.height>d&&(g.info("height"),l());return e},F=function(){var a=document.createElement("div");return function(b){b&&"string"===typeof b&&(b=b.replace(/]*>([\S\s]*?)<\/script>/gmi,""),b=b.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi,""),a.innerHTML=b,b=a.textContent,a.textContent="");return b}}(),K=function(){g.info("checkPluginUpdates");for(var a in p)"function"===typeof p[a].checkVersion&&p[a].checkVersion().then(function(a){0===a.status&&void 0!==a.data.plugin&&h.info(String.format(b.LANG[67], diff --git a/js/app-requests.js b/public/js/app-requests.js similarity index 100% rename from js/app-requests.js rename to public/js/app-requests.js diff --git a/js/app-requests.min.js b/public/js/app-requests.min.js similarity index 100% rename from js/app-requests.min.js rename to public/js/app-requests.min.js diff --git a/js/app-triggers.js b/public/js/app-triggers.js similarity index 98% rename from js/app-triggers.js rename to public/js/app-triggers.js index d36fdc39..e61e4868 100644 --- a/js/app-triggers.js +++ b/public/js/app-triggers.js @@ -202,7 +202,7 @@ sysPass.Triggers = function (Common) { Common.appRequests().history.reset(); } - Common.appActions().doAction({actionId: $this.data("action-id")}, $this.data("view")); + Common.appActions().doAction({r: $this.data("action-id")}, $this.data("view")); }); $("#btnLogout").click(function (e) { @@ -213,7 +213,7 @@ sysPass.Triggers = function (Common) { Common.appActions().doAction({actionId: $(this).data("action-id")}); }); - Common.appActions().doAction({actionId: 1}, "search"); + Common.appActions().doAction({r: "account/index"}, "search"); if (typeof Common.appTheme().viewsTriggers.main === "function") { Common.appTheme().viewsTriggers.main(); @@ -228,7 +228,7 @@ sysPass.Triggers = function (Common) { return; } - $frmSearch.find("input[name='search']").on('keyup', function (e) { + $frmSearch.find("input[name='search']").on("keyup", function (e) { e.preventDefault(); if (e.which === 13 || e.keyCode === 13) { diff --git a/js/app-triggers.min.js b/public/js/app-triggers.min.js similarity index 91% rename from js/app-triggers.min.js rename to public/js/app-triggers.min.js index a1a839d1..ba9131db 100644 --- a/js/app-triggers.min.js +++ b/public/js/app-triggers.min.js @@ -2,8 +2,8 @@ var $jscomp={scope:{},findInternal:function(b,d,e){b instanceof String&&(b=Strin $jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global?global:b};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(b,d,e,a){if(d){e=$jscomp.global;b=b.split(".");for(a=0;aform").each(function(){var a=$(this);a.find("button.btn-clear").on("click", function(b){b.preventDefault();a.trigger("reset")})})},config:function(){d.info("views:config");var a=$("#drop-import-files");if(0. */ -$stringsJsLang = [ +return [ 0 => __('Error en la consulta'), 1 => __('Ha ocurrido un error'), 2 => __('Sesión finalizada'), diff --git a/js/toastr.js b/public/js/toastr.js similarity index 100% rename from js/toastr.js rename to public/js/toastr.js diff --git a/js/toastr.min.js b/public/js/toastr.min.js similarity index 100% rename from js/toastr.min.js rename to public/js/toastr.min.js diff --git a/public/js/zxcvbn-async.js b/public/js/zxcvbn-async.js new file mode 100644 index 00000000..f8f8fdcc --- /dev/null +++ b/public/js/zxcvbn-async.js @@ -0,0 +1,26 @@ +// cross-browser asynchronous script loading for zxcvbn. +// adapted from http://friendlybit.com/js/lazy-loading-asyncronous-javascript/ + +// You probably don't need this script; see README for bower/npm/requirejs setup +// instructions. + +// If you do want to manually include zxcvbn, you'll likely only need to change +// ZXCVBN_SRC to point to the correct relative path from your index.html. +// (this script assumes index.html and zxcvbn.js sit next to each other.) + +(function () { + var ZXCVBN_SRC = "public/js/zxcvbn.min.js"; + + var async_load = function () { + var first, s; + s = document.createElement("script"); + s.src = ZXCVBN_SRC; + s.type = "text/javascript"; + s.async = true; + first = document.getElementsByTagName("script")[0]; + return first.parentNode.insertBefore(s, first); + }; + + window.addEventListener("load", async_load, false); + +}).call(this); \ No newline at end of file diff --git a/public/js/zxcvbn-async.min.js b/public/js/zxcvbn-async.min.js new file mode 100644 index 00000000..8d067b14 --- /dev/null +++ b/public/js/zxcvbn-async.min.js @@ -0,0 +1 @@ +(function(){window.addEventListener("load",function(){var b,a;a=document.createElement("script");a.src="public/js/zxcvbn.min.js";a.type="text/javascript";a.async=!0;b=document.getElementsByTagName("script")[0];return b.parentNode.insertBefore(a,b)},!1)}).call(this); diff --git a/js/zxcvbn.min.js b/public/js/zxcvbn.min.js similarity index 100% rename from js/zxcvbn.min.js rename to public/js/zxcvbn.min.js diff --git a/inc/sql/110.sql b/schemas/110.sql similarity index 100% rename from inc/sql/110.sql rename to schemas/110.sql diff --git a/inc/sql/1121.sql b/schemas/1121.sql similarity index 100% rename from inc/sql/1121.sql rename to schemas/1121.sql diff --git a/inc/sql/11213.sql b/schemas/11213.sql similarity index 100% rename from inc/sql/11213.sql rename to schemas/11213.sql diff --git a/inc/sql/11219.sql b/schemas/11219.sql similarity index 100% rename from inc/sql/11219.sql rename to schemas/11219.sql diff --git a/inc/sql/1122.sql b/schemas/1122.sql similarity index 100% rename from inc/sql/1122.sql rename to schemas/1122.sql diff --git a/inc/sql/11220.sql b/schemas/11220.sql similarity index 100% rename from inc/sql/11220.sql rename to schemas/11220.sql diff --git a/inc/sql/1123.sql b/schemas/1123.sql similarity index 100% rename from inc/sql/1123.sql rename to schemas/1123.sql diff --git a/inc/sql/12001.sql b/schemas/12001.sql similarity index 100% rename from inc/sql/12001.sql rename to schemas/12001.sql diff --git a/inc/sql/12002.sql b/schemas/12002.sql similarity index 100% rename from inc/sql/12002.sql rename to schemas/12002.sql diff --git a/inc/sql/13000000000.sql b/schemas/13000000000.sql similarity index 100% rename from inc/sql/13000000000.sql rename to schemas/13000000000.sql diff --git a/inc/sql/13016100601.sql b/schemas/13016100601.sql similarity index 100% rename from inc/sql/13016100601.sql rename to schemas/13016100601.sql diff --git a/inc/sql/20017011302.sql b/schemas/20017011302.sql similarity index 100% rename from inc/sql/20017011302.sql rename to schemas/20017011302.sql diff --git a/inc/sql/20017011701.sql b/schemas/20017011701.sql similarity index 100% rename from inc/sql/20017011701.sql rename to schemas/20017011701.sql diff --git a/inc/sql/20017012901.sql b/schemas/20017012901.sql similarity index 100% rename from inc/sql/20017012901.sql rename to schemas/20017012901.sql diff --git a/inc/sql/21017022601.sql b/schemas/21017022601.sql similarity index 100% rename from inc/sql/21017022601.sql rename to schemas/21017022601.sql diff --git a/inc/sql/21317031402.sql b/schemas/21317031402.sql similarity index 100% rename from inc/sql/21317031402.sql rename to schemas/21317031402.sql diff --git a/inc/sql/22017050101.sql b/schemas/22017050101.sql similarity index 100% rename from inc/sql/22017050101.sql rename to schemas/22017050101.sql diff --git a/inc/sql/dbstructure.sql b/schemas/dbstructure.sql similarity index 100% rename from inc/sql/dbstructure.sql rename to schemas/dbstructure.sql diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index cd5adfd4..7a91153b 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -6,361 +6,4 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'Defuse\\Crypto\\Core' => $vendorDir . '/defuse/php-encryption/src/Core.php', - 'Defuse\\Crypto\\Crypto' => $vendorDir . '/defuse/php-encryption/src/Crypto.php', - 'Defuse\\Crypto\\DerivedKeys' => $vendorDir . '/defuse/php-encryption/src/DerivedKeys.php', - 'Defuse\\Crypto\\Encoding' => $vendorDir . '/defuse/php-encryption/src/Encoding.php', - 'Defuse\\Crypto\\Exception\\BadFormatException' => $vendorDir . '/defuse/php-encryption/src/Exception/BadFormatException.php', - 'Defuse\\Crypto\\Exception\\CryptoException' => $vendorDir . '/defuse/php-encryption/src/Exception/CryptoException.php', - 'Defuse\\Crypto\\Exception\\EnvironmentIsBrokenException' => $vendorDir . '/defuse/php-encryption/src/Exception/EnvironmentIsBrokenException.php', - 'Defuse\\Crypto\\Exception\\IOException' => $vendorDir . '/defuse/php-encryption/src/Exception/IOException.php', - 'Defuse\\Crypto\\Exception\\WrongKeyOrModifiedCiphertextException' => $vendorDir . '/defuse/php-encryption/src/Exception/WrongKeyOrModifiedCiphertextException.php', - 'Defuse\\Crypto\\File' => $vendorDir . '/defuse/php-encryption/src/File.php', - 'Defuse\\Crypto\\Key' => $vendorDir . '/defuse/php-encryption/src/Key.php', - 'Defuse\\Crypto\\KeyOrPassword' => $vendorDir . '/defuse/php-encryption/src/KeyOrPassword.php', - 'Defuse\\Crypto\\KeyProtectedByPassword' => $vendorDir . '/defuse/php-encryption/src/KeyProtectedByPassword.php', - 'Defuse\\Crypto\\RuntimeTests' => $vendorDir . '/defuse/php-encryption/src/RuntimeTests.php', - 'PHPMailer\\PHPMailer\\Exception' => $vendorDir . '/phpmailer/phpmailer/src/Exception.php', - 'PHPMailer\\PHPMailer\\OAuth' => $vendorDir . '/phpmailer/phpmailer/src/OAuth.php', - 'PHPMailer\\PHPMailer\\PHPMailer' => $vendorDir . '/phpmailer/phpmailer/src/PHPMailer.php', - 'PHPMailer\\PHPMailer\\POP3' => $vendorDir . '/phpmailer/phpmailer/src/POP3.php', - 'PHPMailer\\PHPMailer\\SMTP' => $vendorDir . '/phpmailer/phpmailer/src/SMTP.php', - 'SP\\Account\\Account' => $baseDir . '/inc/SP/Account/Account.php', - 'SP\\Account\\AccountAcl' => $baseDir . '/inc/SP/Account/AccountAcl.php', - 'SP\\Account\\AccountBase' => $baseDir . '/inc/SP/Account/AccountBase.php', - 'SP\\Account\\AccountCrypt' => $baseDir . '/inc/SP/Account/AccountCrypt.php', - 'SP\\Account\\AccountFavorites' => $baseDir . '/inc/SP/Account/AccountFavorites.php', - 'SP\\Account\\AccountHistory' => $baseDir . '/inc/SP/Account/AccountHistory.php', - 'SP\\Account\\AccountHistoryCrypt' => $baseDir . '/inc/SP/Account/AccountHistoryCrypt.php', - 'SP\\Account\\AccountHistoryUtil' => $baseDir . '/inc/SP/Account/AccountHistoryUtil.php', - 'SP\\Account\\AccountInterface' => $baseDir . '/inc/SP/Account/AccountInterface.php', - 'SP\\Account\\AccountSearch' => $baseDir . '/inc/SP/Account/AccountSearch.php', - 'SP\\Account\\AccountTags' => $baseDir . '/inc/SP/Account/AccountTags.php', - 'SP\\Account\\AccountUtil' => $baseDir . '/inc/SP/Account/AccountUtil.php', - 'SP\\Account\\AccountsSearchItem' => $baseDir . '/inc/SP/Account/AccountsSearchItem.php', - 'SP\\Account\\UserAccounts' => $baseDir . '/inc/SP/Account/UserAccounts.php', - 'SP\\Api\\ApiBase' => $baseDir . '/inc/SP/Api/ApiBase.php', - 'SP\\Api\\ApiInterface' => $baseDir . '/inc/SP/Api/ApiInterface.php', - 'SP\\Api\\ApiRequest' => $baseDir . '/inc/SP/Api/ApiRequest.php', - 'SP\\Api\\ApiUtil' => $baseDir . '/inc/SP/Api/ApiUtil.php', - 'SP\\Api\\SyspassApi' => $baseDir . '/inc/SP/Api/SyspassApi.php', - 'SP\\Auth\\Auth' => $baseDir . '/inc/SP/Auth/Auth.php', - 'SP\\Auth\\AuthDataBase' => $baseDir . '/inc/SP/Auth/AuthDataBase.php', - 'SP\\Auth\\AuthInterface' => $baseDir . '/inc/SP/Auth/AuthInterface.php', - 'SP\\Auth\\AuthResult' => $baseDir . '/inc/SP/Auth/AuthResult.php', - 'SP\\Auth\\AuthUtil' => $baseDir . '/inc/SP/Auth/AuthUtil.php', - 'SP\\Auth\\Browser\\Browser' => $baseDir . '/inc/SP/Auth/Browser/Browser.php', - 'SP\\Auth\\Browser\\BrowserAuthData' => $baseDir . '/inc/SP/Auth/Browser/BrowserAuthData.php', - 'SP\\Auth\\Database\\Database' => $baseDir . '/inc/SP/Auth/Database/Database.php', - 'SP\\Auth\\Database\\DatabaseAuthData' => $baseDir . '/inc/SP/Auth/Database/DatabaseAuthData.php', - 'SP\\Auth\\Ldap\\LdapAuthData' => $baseDir . '/inc/SP/Auth/Ldap/LdapAuthData.php', - 'SP\\Auth\\Ldap\\LdapBase' => $baseDir . '/inc/SP/Auth/Ldap/LdapBase.php', - 'SP\\Auth\\Ldap\\LdapInterface' => $baseDir . '/inc/SP/Auth/Ldap/LdapInterface.php', - 'SP\\Auth\\Ldap\\LdapMsAds' => $baseDir . '/inc/SP/Auth/Ldap/LdapMsAds.php', - 'SP\\Auth\\Ldap\\LdapStd' => $baseDir . '/inc/SP/Auth/Ldap/LdapStd.php', - 'SP\\Auth\\Ldap\\LdapUtil' => $baseDir . '/inc/SP/Auth/Ldap/LdapUtil.php', - 'SP\\Config\\Config' => $baseDir . '/inc/SP/Config/Config.php', - 'SP\\Config\\ConfigDB' => $baseDir . '/inc/SP/Config/ConfigDB.php', - 'SP\\Config\\ConfigData' => $baseDir . '/inc/SP/Config/ConfigData.php', - 'SP\\Config\\ConfigInterface' => $baseDir . '/inc/SP/Config/ConfigInterface.php', - 'SP\\Config\\ConfigUtil' => $baseDir . '/inc/SP/Config/ConfigUtil.php', - 'SP\\Controller\\AccountController' => $baseDir . '/inc/SP/Controller/AccountController.php', - 'SP\\Controller\\AccountSearchController' => $baseDir . '/inc/SP/Controller/AccountSearchController.php', - 'SP\\Controller\\ChecksController' => $baseDir . '/inc/SP/Controller/ChecksController.php', - 'SP\\Controller\\ConfigActionController' => $baseDir . '/inc/SP/Controller/ConfigActionController.php', - 'SP\\Controller\\ConfigController' => $baseDir . '/inc/SP/Controller/ConfigController.php', - 'SP\\Controller\\ControllerBase' => $baseDir . '/inc/SP/Controller/ControllerBase.php', - 'SP\\Controller\\EventlogController' => $baseDir . '/inc/SP/Controller/EventlogController.php', - 'SP\\Controller\\GridItemsSearchController' => $baseDir . '/inc/SP/Controller/GridItemsSearchController.php', - 'SP\\Controller\\GridTabControllerBase' => $baseDir . '/inc/SP/Controller/GridTabControllerBase.php', - 'SP\\Controller\\Grids\\GridBase' => $baseDir . '/inc/SP/Controller/Grids/GridBase.php', - 'SP\\Controller\\Grids\\Items' => $baseDir . '/inc/SP/Controller/Grids/Items.php', - 'SP\\Controller\\Grids\\Notices' => $baseDir . '/inc/SP/Controller/Grids/Notices.php', - 'SP\\Controller\\ItemActionController' => $baseDir . '/inc/SP/Controller/ItemActionController.php', - 'SP\\Controller\\ItemControllerInterface' => $baseDir . '/inc/SP/Controller/ItemControllerInterface.php', - 'SP\\Controller\\ItemListController' => $baseDir . '/inc/SP/Controller/ItemListController.php', - 'SP\\Controller\\ItemSearchController' => $baseDir . '/inc/SP/Controller/ItemSearchController.php', - 'SP\\Controller\\ItemShowController' => $baseDir . '/inc/SP/Controller/ItemShowController.php', - 'SP\\Controller\\ItemsController' => $baseDir . '/inc/SP/Controller/ItemsController.php', - 'SP\\Controller\\LoginController' => $baseDir . '/inc/SP/Controller/LoginController.php', - 'SP\\Controller\\MainActionController' => $baseDir . '/inc/SP/Controller/MainActionController.php', - 'SP\\Controller\\MainController' => $baseDir . '/inc/SP/Controller/MainController.php', - 'SP\\Controller\\NoticeShowController' => $baseDir . '/inc/SP/Controller/NoticeShowController.php', - 'SP\\Controller\\NoticesController' => $baseDir . '/inc/SP/Controller/NoticesController.php', - 'SP\\Controller\\NoticesSearchController' => $baseDir . '/inc/SP/Controller/NoticesSearchController.php', - 'SP\\Controller\\RequestControllerTrait' => $baseDir . '/inc/SP/Controller/RequestControllerTrait.php', - 'SP\\Controller\\TabControllerBase' => $baseDir . '/inc/SP/Controller/TabControllerBase.php', - 'SP\\Controller\\TabsInterface' => $baseDir . '/inc/SP/Controller/TabsInterface.php', - 'SP\\Controller\\TaskController' => $baseDir . '/inc/SP/Controller/TaskController.php', - 'SP\\Controller\\UserPreferencesController' => $baseDir . '/inc/SP/Controller/UserPreferencesController.php', - 'SP\\Controller\\WikiController' => $baseDir . '/inc/SP/Controller/WikiController.php', - 'SP\\Core\\Acl' => $baseDir . '/inc/SP/Core/Acl.php', - 'SP\\Core\\ActionsInterface' => $baseDir . '/inc/SP/Core/ActionsInterface.php', - 'SP\\Core\\Backup' => $baseDir . '/inc/SP/Core/Backup.php', - 'SP\\Core\\CryptMasterPass' => $baseDir . '/inc/SP/Core/CryptMasterPass.php', - 'SP\\Core\\CryptPKI' => $baseDir . '/inc/SP/Core/CryptPKI.php', - 'SP\\Core\\Crypt\\Cookie' => $baseDir . '/inc/SP/Core/Crypt/Cookie.php', - 'SP\\Core\\Crypt\\Crypt' => $baseDir . '/inc/SP/Core/Crypt/Crypt.php', - 'SP\\Core\\Crypt\\CryptSessionHandler' => $baseDir . '/inc/SP/Core/Crypt/CryptSessionHandler.php', - 'SP\\Core\\Crypt\\Hash' => $baseDir . '/inc/SP/Core/Crypt/Hash.php', - 'SP\\Core\\Crypt\\SecureKeyCookie' => $baseDir . '/inc/SP/Core/Crypt/SecureKeyCookie.php', - 'SP\\Core\\Crypt\\Session' => $baseDir . '/inc/SP/Core/Crypt/Session.php', - 'SP\\Core\\Crypt\\Vault' => $baseDir . '/inc/SP/Core/Crypt/Vault.php', - 'SP\\Core\\DiFactory' => $baseDir . '/inc/SP/Core/DiFactory.php', - 'SP\\Core\\Events\\EventDispatcher' => $baseDir . '/inc/SP/Core/Events/EventDispatcher.php', - 'SP\\Core\\Events\\EventDispatcherBase' => $baseDir . '/inc/SP/Core/Events/EventDispatcherBase.php', - 'SP\\Core\\Events\\EventDispatcherInterface' => $baseDir . '/inc/SP/Core/Events/EventDispatcherInterface.php', - 'SP\\Core\\Events\\EventReceiver' => $baseDir . '/inc/SP/Core/Events/EventReceiver.php', - 'SP\\Core\\Exceptions\\AuthException' => $baseDir . '/inc/SP/Core/Exceptions/AuthException.php', - 'SP\\Core\\Exceptions\\ConstraintException' => $baseDir . '/inc/SP/Core/Exceptions/ConstraintException.php', - 'SP\\Core\\Exceptions\\FileNotFoundException' => $baseDir . '/inc/SP/Core/Exceptions/FileNotFoundException.php', - 'SP\\Core\\Exceptions\\InvalidArgumentException' => $baseDir . '/inc/SP/Core/Exceptions/InvalidArgumentException.php', - 'SP\\Core\\Exceptions\\InvalidClassException' => $baseDir . '/inc/SP/Core/Exceptions/InvalidClassException.php', - 'SP\\Core\\Exceptions\\ItemException' => $baseDir . '/inc/SP/Core/Exceptions/ItemException.php', - 'SP\\Core\\Exceptions\\QueryException' => $baseDir . '/inc/SP/Core/Exceptions/QueryException.php', - 'SP\\Core\\Exceptions\\SPException' => $baseDir . '/inc/SP/Core/Exceptions/SPException.php', - 'SP\\Core\\Exceptions\\ValidationException' => $baseDir . '/inc/SP/Core/Exceptions/ValidationException.php', - 'SP\\Core\\Init' => $baseDir . '/inc/SP/Core/Init.php', - 'SP\\Core\\Installer' => $baseDir . '/inc/SP/Core/Installer.php', - 'SP\\Core\\ItemsTypeInterface' => $baseDir . '/inc/SP/Core/ItemsTypeInterface.php', - 'SP\\Core\\Language' => $baseDir . '/inc/SP/Core/Language.php', - 'SP\\Core\\Messages\\LogMessage' => $baseDir . '/inc/SP/Core/Messages/LogMessage.php', - 'SP\\Core\\Messages\\MessageBase' => $baseDir . '/inc/SP/Core/Messages/MessageBase.php', - 'SP\\Core\\Messages\\MessageInterface' => $baseDir . '/inc/SP/Core/Messages/MessageInterface.php', - 'SP\\Core\\Messages\\NoticeMessage' => $baseDir . '/inc/SP/Core/Messages/NoticeMessage.php', - 'SP\\Core\\Messages\\TaskMessage' => $baseDir . '/inc/SP/Core/Messages/TaskMessage.php', - 'SP\\Core\\OldCrypt' => $baseDir . '/inc/SP/Core/OldCrypt.php', - 'SP\\Core\\Plugin\\PluginBase' => $baseDir . '/inc/SP/Core/Plugin/PluginBase.php', - 'SP\\Core\\Plugin\\PluginDataStore' => $baseDir . '/inc/SP/Core/Plugin/PluginDataStore.php', - 'SP\\Core\\Plugin\\PluginInterface' => $baseDir . '/inc/SP/Core/Plugin/PluginInterface.php', - 'SP\\Core\\Plugin\\PluginUtil' => $baseDir . '/inc/SP/Core/Plugin/PluginUtil.php', - 'SP\\Core\\Session' => $baseDir . '/inc/SP/Core/Session.php', - 'SP\\Core\\SessionUtil' => $baseDir . '/inc/SP/Core/SessionUtil.php', - 'SP\\Core\\Task' => $baseDir . '/inc/SP/Core/Task.php', - 'SP\\Core\\TaskFactory' => $baseDir . '/inc/SP/Core/TaskFactory.php', - 'SP\\Core\\Template' => $baseDir . '/inc/SP/Core/Template.php', - 'SP\\Core\\UI\\Theme' => $baseDir . '/inc/SP/Core/UI/Theme.php', - 'SP\\Core\\UI\\ThemeIconsBase' => $baseDir . '/inc/SP/Core/UI/ThemeIconsBase.php', - 'SP\\Core\\UI\\ThemeIconsInterface' => $baseDir . '/inc/SP/Core/UI/ThemeIconsInterface.php', - 'SP\\Core\\UI\\ThemeInterface' => $baseDir . '/inc/SP/Core/UI/ThemeInterface.php', - 'SP\\Core\\Upgrade\\Account' => $baseDir . '/inc/SP/Core/Upgrade/Account.php', - 'SP\\Core\\Upgrade\\Category' => $baseDir . '/inc/SP/Core/Upgrade/Category.php', - 'SP\\Core\\Upgrade\\Check' => $baseDir . '/inc/SP/Core/Upgrade/Check.php', - 'SP\\Core\\Upgrade\\Crypt' => $baseDir . '/inc/SP/Core/Upgrade/Crypt.php', - 'SP\\Core\\Upgrade\\Customer' => $baseDir . '/inc/SP/Core/Upgrade/Customer.php', - 'SP\\Core\\Upgrade\\Group' => $baseDir . '/inc/SP/Core/Upgrade/Group.php', - 'SP\\Core\\Upgrade\\Profile' => $baseDir . '/inc/SP/Core/Upgrade/Profile.php', - 'SP\\Core\\Upgrade\\Upgrade' => $baseDir . '/inc/SP/Core/Upgrade/Upgrade.php', - 'SP\\Core\\Upgrade\\User' => $baseDir . '/inc/SP/Core/Upgrade/User.php', - 'SP\\Core\\XmlExport' => $baseDir . '/inc/SP/Core/XmlExport.php', - 'SP\\DataModel\\AccountData' => $baseDir . '/inc/SP/DataModel/AccountData.php', - 'SP\\DataModel\\AccountExtData' => $baseDir . '/inc/SP/DataModel/AccountExtData.php', - 'SP\\DataModel\\AccountHistoryData' => $baseDir . '/inc/SP/DataModel/AccountHistoryData.php', - 'SP\\DataModel\\AccountSearchData' => $baseDir . '/inc/SP/DataModel/AccountSearchData.php', - 'SP\\DataModel\\ApiTokenData' => $baseDir . '/inc/SP/DataModel/ApiTokenData.php', - 'SP\\DataModel\\CategoryData' => $baseDir . '/inc/SP/DataModel/CategoryData.php', - 'SP\\DataModel\\CustomFieldBaseData' => $baseDir . '/inc/SP/DataModel/CustomFieldBaseData.php', - 'SP\\DataModel\\CustomFieldData' => $baseDir . '/inc/SP/DataModel/CustomFieldData.php', - 'SP\\DataModel\\CustomFieldDefData' => $baseDir . '/inc/SP/DataModel/CustomFieldDefData.php', - 'SP\\DataModel\\CustomerData' => $baseDir . '/inc/SP/DataModel/CustomerData.php', - 'SP\\DataModel\\DataModelBase' => $baseDir . '/inc/SP/DataModel/DataModelBase.php', - 'SP\\DataModel\\DataModelInterface' => $baseDir . '/inc/SP/DataModel/DataModelInterface.php', - 'SP\\DataModel\\FileData' => $baseDir . '/inc/SP/DataModel/FileData.php', - 'SP\\DataModel\\FileExtData' => $baseDir . '/inc/SP/DataModel/FileExtData.php', - 'SP\\DataModel\\GroupAccountsData' => $baseDir . '/inc/SP/DataModel/GroupAccountsData.php', - 'SP\\DataModel\\GroupData' => $baseDir . '/inc/SP/DataModel/GroupData.php', - 'SP\\DataModel\\GroupUsersData' => $baseDir . '/inc/SP/DataModel/GroupUsersData.php', - 'SP\\DataModel\\InstallData' => $baseDir . '/inc/SP/DataModel/InstallData.php', - 'SP\\DataModel\\ItemSearchData' => $baseDir . '/inc/SP/DataModel/ItemSearchData.php', - 'SP\\DataModel\\NoticeData' => $baseDir . '/inc/SP/DataModel/NoticeData.php', - 'SP\\DataModel\\PluginData' => $baseDir . '/inc/SP/DataModel/PluginData.php', - 'SP\\DataModel\\ProfileBaseData' => $baseDir . '/inc/SP/DataModel/ProfileBaseData.php', - 'SP\\DataModel\\ProfileData' => $baseDir . '/inc/SP/DataModel/ProfileData.php', - 'SP\\DataModel\\PublicLinkBaseData' => $baseDir . '/inc/SP/DataModel/PublicLinkBaseData.php', - 'SP\\DataModel\\PublicLinkData' => $baseDir . '/inc/SP/DataModel/PublicLinkData.php', - 'SP\\DataModel\\PublicLinkListData' => $baseDir . '/inc/SP/DataModel/PublicLinkListData.php', - 'SP\\DataModel\\TagData' => $baseDir . '/inc/SP/DataModel/TagData.php', - 'SP\\DataModel\\TrackData' => $baseDir . '/inc/SP/DataModel/TrackData.php', - 'SP\\DataModel\\UserData' => $baseDir . '/inc/SP/DataModel/UserData.php', - 'SP\\DataModel\\UserLoginData' => $baseDir . '/inc/SP/DataModel/UserLoginData.php', - 'SP\\DataModel\\UserPassData' => $baseDir . '/inc/SP/DataModel/UserPassData.php', - 'SP\\DataModel\\UserPassRecoverData' => $baseDir . '/inc/SP/DataModel/UserPassRecoverData.php', - 'SP\\DataModel\\UserPreferencesData' => $baseDir . '/inc/SP/DataModel/UserPreferencesData.php', - 'SP\\Forms\\AccountForm' => $baseDir . '/inc/SP/Forms/AccountForm.php', - 'SP\\Forms\\ApiTokenForm' => $baseDir . '/inc/SP/Forms/ApiTokenForm.php', - 'SP\\Forms\\CategoryForm' => $baseDir . '/inc/SP/Forms/CategoryForm.php', - 'SP\\Forms\\CustomFieldDefForm' => $baseDir . '/inc/SP/Forms/CustomFieldDefForm.php', - 'SP\\Forms\\CustomerForm' => $baseDir . '/inc/SP/Forms/CustomerForm.php', - 'SP\\Forms\\FormBase' => $baseDir . '/inc/SP/Forms/FormBase.php', - 'SP\\Forms\\FormInterface' => $baseDir . '/inc/SP/Forms/FormInterface.php', - 'SP\\Forms\\GroupForm' => $baseDir . '/inc/SP/Forms/GroupForm.php', - 'SP\\Forms\\NoticeForm' => $baseDir . '/inc/SP/Forms/NoticeForm.php', - 'SP\\Forms\\ProfileForm' => $baseDir . '/inc/SP/Forms/ProfileForm.php', - 'SP\\Forms\\PublicLinkForm' => $baseDir . '/inc/SP/Forms/PublicLinkForm.php', - 'SP\\Forms\\TagForm' => $baseDir . '/inc/SP/Forms/TagForm.php', - 'SP\\Forms\\UserForm' => $baseDir . '/inc/SP/Forms/UserForm.php', - 'SP\\Html\\Assets\\FontIcon' => $baseDir . '/inc/SP/Html/Assets/FontIcon.php', - 'SP\\Html\\Assets\\IconBase' => $baseDir . '/inc/SP/Html/Assets/IconBase.php', - 'SP\\Html\\Assets\\IconInterface' => $baseDir . '/inc/SP/Html/Assets/IconInterface.php', - 'SP\\Html\\Assets\\ImageIcon' => $baseDir . '/inc/SP/Html/Assets/ImageIcon.php', - 'SP\\Html\\DataGrid\\DataGrid' => $baseDir . '/inc/SP/Html/DataGrid/DataGrid.php', - 'SP\\Html\\DataGrid\\DataGridAction' => $baseDir . '/inc/SP/Html/DataGrid/DataGridAction.php', - 'SP\\Html\\DataGrid\\DataGridActionBase' => $baseDir . '/inc/SP/Html/DataGrid/DataGridActionBase.php', - 'SP\\Html\\DataGrid\\DataGridActionInterface' => $baseDir . '/inc/SP/Html/DataGrid/DataGridActionInterface.php', - 'SP\\Html\\DataGrid\\DataGridActionSearch' => $baseDir . '/inc/SP/Html/DataGrid/DataGridActionSearch.php', - 'SP\\Html\\DataGrid\\DataGridActionType' => $baseDir . '/inc/SP/Html/DataGrid/DataGridActionType.php', - 'SP\\Html\\DataGrid\\DataGridBase' => $baseDir . '/inc/SP/Html/DataGrid/DataGridBase.php', - 'SP\\Html\\DataGrid\\DataGridData' => $baseDir . '/inc/SP/Html/DataGrid/DataGridData.php', - 'SP\\Html\\DataGrid\\DataGridDataBase' => $baseDir . '/inc/SP/Html/DataGrid/DataGridDataBase.php', - 'SP\\Html\\DataGrid\\DataGridDataInterface' => $baseDir . '/inc/SP/Html/DataGrid/DataGridDataInterface.php', - 'SP\\Html\\DataGrid\\DataGridHeader' => $baseDir . '/inc/SP/Html/DataGrid/DataGridHeader.php', - 'SP\\Html\\DataGrid\\DataGridHeaderBase' => $baseDir . '/inc/SP/Html/DataGrid/DataGridHeaderBase.php', - 'SP\\Html\\DataGrid\\DataGridHeaderInterface' => $baseDir . '/inc/SP/Html/DataGrid/DataGridHeaderInterface.php', - 'SP\\Html\\DataGrid\\DataGridHeaderSort' => $baseDir . '/inc/SP/Html/DataGrid/DataGridHeaderSort.php', - 'SP\\Html\\DataGrid\\DataGridInterface' => $baseDir . '/inc/SP/Html/DataGrid/DataGridInterface.php', - 'SP\\Html\\DataGrid\\DataGridPager' => $baseDir . '/inc/SP/Html/DataGrid/DataGridPager.php', - 'SP\\Html\\DataGrid\\DataGridPagerBase' => $baseDir . '/inc/SP/Html/DataGrid/DataGridPagerBase.php', - 'SP\\Html\\DataGrid\\DataGridPagerInterface' => $baseDir . '/inc/SP/Html/DataGrid/DataGridPagerInterface.php', - 'SP\\Html\\DataGrid\\DataGridSort' => $baseDir . '/inc/SP/Html/DataGrid/DataGridSort.php', - 'SP\\Html\\DataGrid\\DataGridSortInterface' => $baseDir . '/inc/SP/Html/DataGrid/DataGridSortInterface.php', - 'SP\\Html\\DataGrid\\DataGridTab' => $baseDir . '/inc/SP/Html/DataGrid/DataGridTab.php', - 'SP\\Html\\Html' => $baseDir . '/inc/SP/Html/Html.php', - 'SP\\Html\\Minify' => $baseDir . '/inc/SP/Html/Minify.php', - 'SP\\Http\\Cookies' => $baseDir . '/inc/SP/Http/Cookies.php', - 'SP\\Http\\JsonResponse' => $baseDir . '/inc/SP/Http/JsonResponse.php', - 'SP\\Http\\Message' => $baseDir . '/inc/SP/Http/Message.php', - 'SP\\Http\\Request' => $baseDir . '/inc/SP/Http/Request.php', - 'SP\\Http\\Response' => $baseDir . '/inc/SP/Http/Response.php', - 'SP\\Http\\XMLRPCResponseParse' => $baseDir . '/inc/SP/Http/XMLRPCResponseParse.php', - 'SP\\Import\\CsvImport' => $baseDir . '/inc/SP/Import/CsvImport.php', - 'SP\\Import\\CsvImportBase' => $baseDir . '/inc/SP/Import/CsvImportBase.php', - 'SP\\Import\\FileImport' => $baseDir . '/inc/SP/Import/FileImport.php', - 'SP\\Import\\Import' => $baseDir . '/inc/SP/Import/Import.php', - 'SP\\Import\\ImportBase' => $baseDir . '/inc/SP/Import/ImportBase.php', - 'SP\\Import\\ImportInterface' => $baseDir . '/inc/SP/Import/ImportInterface.php', - 'SP\\Import\\ImportParams' => $baseDir . '/inc/SP/Import/ImportParams.php', - 'SP\\Import\\KeepassImport' => $baseDir . '/inc/SP/Import/KeepassImport.php', - 'SP\\Import\\KeepassXImport' => $baseDir . '/inc/SP/Import/KeepassXImport.php', - 'SP\\Import\\SyspassImport' => $baseDir . '/inc/SP/Import/SyspassImport.php', - 'SP\\Import\\XmlFileImport' => $baseDir . '/inc/SP/Import/XmlFileImport.php', - 'SP\\Import\\XmlImport' => $baseDir . '/inc/SP/Import/XmlImport.php', - 'SP\\Import\\XmlImportTrait' => $baseDir . '/inc/SP/Import/XmlImportTrait.php', - 'SP\\Log\\AbstractLogger' => $baseDir . '/inc/SP/Log/AbstractLogger.php', - 'SP\\Log\\ActionLog' => $baseDir . '/inc/SP/Log/ActionLog.php', - 'SP\\Log\\Email' => $baseDir . '/inc/SP/Log/Email.php', - 'SP\\Log\\Log' => $baseDir . '/inc/SP/Log/Log.php', - 'SP\\Log\\LogLevel' => $baseDir . '/inc/SP/Log/LogLevel.php', - 'SP\\Log\\LogUtil' => $baseDir . '/inc/SP/Log/LogUtil.php', - 'SP\\Log\\LoggerInterface' => $baseDir . '/inc/SP/Log/LoggerInterface.php', - 'SP\\Log\\Syslog' => $baseDir . '/inc/SP/Log/Syslog.php', - 'SP\\Mgmt\\ApiTokens\\ApiToken' => $baseDir . '/inc/SP/Mgmt/ApiTokens/ApiToken.php', - 'SP\\Mgmt\\ApiTokens\\ApiTokenBase' => $baseDir . '/inc/SP/Mgmt/ApiTokens/ApiTokenBase.php', - 'SP\\Mgmt\\ApiTokens\\ApiTokenSearch' => $baseDir . '/inc/SP/Mgmt/ApiTokens/ApiTokenSearch.php', - 'SP\\Mgmt\\ApiTokens\\ApiTokensUtil' => $baseDir . '/inc/SP/Mgmt/ApiTokens/ApiTokensUtil.php', - 'SP\\Mgmt\\Categories\\Category' => $baseDir . '/inc/SP/Mgmt/Categories/Category.php', - 'SP\\Mgmt\\Categories\\CategoryBase' => $baseDir . '/inc/SP/Mgmt/Categories/CategoryBase.php', - 'SP\\Mgmt\\Categories\\CategorySearch' => $baseDir . '/inc/SP/Mgmt/Categories/CategorySearch.php', - 'SP\\Mgmt\\CustomFields\\CustomField' => $baseDir . '/inc/SP/Mgmt/CustomFields/CustomField.php', - 'SP\\Mgmt\\CustomFields\\CustomFieldBase' => $baseDir . '/inc/SP/Mgmt/CustomFields/CustomFieldBase.php', - 'SP\\Mgmt\\CustomFields\\CustomFieldDef' => $baseDir . '/inc/SP/Mgmt/CustomFields/CustomFieldDef.php', - 'SP\\Mgmt\\CustomFields\\CustomFieldDefSearch' => $baseDir . '/inc/SP/Mgmt/CustomFields/CustomFieldDefSearch.php', - 'SP\\Mgmt\\CustomFields\\CustomFieldTypes' => $baseDir . '/inc/SP/Mgmt/CustomFields/CustomFieldTypes.php', - 'SP\\Mgmt\\CustomFields\\CustomFieldsUtil' => $baseDir . '/inc/SP/Mgmt/CustomFields/CustomFieldsUtil.php', - 'SP\\Mgmt\\Customers\\Customer' => $baseDir . '/inc/SP/Mgmt/Customers/Customer.php', - 'SP\\Mgmt\\Customers\\CustomerBase' => $baseDir . '/inc/SP/Mgmt/Customers/CustomerBase.php', - 'SP\\Mgmt\\Customers\\CustomerSearch' => $baseDir . '/inc/SP/Mgmt/Customers/CustomerSearch.php', - 'SP\\Mgmt\\Files\\File' => $baseDir . '/inc/SP/Mgmt/Files/File.php', - 'SP\\Mgmt\\Files\\FileBase' => $baseDir . '/inc/SP/Mgmt/Files/FileBase.php', - 'SP\\Mgmt\\Files\\FileSearch' => $baseDir . '/inc/SP/Mgmt/Files/FileSearch.php', - 'SP\\Mgmt\\Files\\FileUtil' => $baseDir . '/inc/SP/Mgmt/Files/FileUtil.php', - 'SP\\Mgmt\\Groups\\Group' => $baseDir . '/inc/SP/Mgmt/Groups/Group.php', - 'SP\\Mgmt\\Groups\\GroupAccounts' => $baseDir . '/inc/SP/Mgmt/Groups/GroupAccounts.php', - 'SP\\Mgmt\\Groups\\GroupAccountsBase' => $baseDir . '/inc/SP/Mgmt/Groups/GroupAccountsBase.php', - 'SP\\Mgmt\\Groups\\GroupAccountsUtil' => $baseDir . '/inc/SP/Mgmt/Groups/GroupAccountsUtil.php', - 'SP\\Mgmt\\Groups\\GroupBase' => $baseDir . '/inc/SP/Mgmt/Groups/GroupBase.php', - 'SP\\Mgmt\\Groups\\GroupSearch' => $baseDir . '/inc/SP/Mgmt/Groups/GroupSearch.php', - 'SP\\Mgmt\\Groups\\GroupUsers' => $baseDir . '/inc/SP/Mgmt/Groups/GroupUsers.php', - 'SP\\Mgmt\\Groups\\GroupUsersBase' => $baseDir . '/inc/SP/Mgmt/Groups/GroupUsersBase.php', - 'SP\\Mgmt\\Groups\\GroupUtil' => $baseDir . '/inc/SP/Mgmt/Groups/GroupUtil.php', - 'SP\\Mgmt\\ItemBaseInterface' => $baseDir . '/inc/SP/Mgmt/ItemBaseInterface.php', - 'SP\\Mgmt\\ItemBaseTrait' => $baseDir . '/inc/SP/Mgmt/ItemBaseTrait.php', - 'SP\\Mgmt\\ItemInterface' => $baseDir . '/inc/SP/Mgmt/ItemInterface.php', - 'SP\\Mgmt\\ItemSearchInterface' => $baseDir . '/inc/SP/Mgmt/ItemSearchInterface.php', - 'SP\\Mgmt\\ItemSelectInterface' => $baseDir . '/inc/SP/Mgmt/ItemSelectInterface.php', - 'SP\\Mgmt\\ItemTrait' => $baseDir . '/inc/SP/Mgmt/ItemTrait.php', - 'SP\\Mgmt\\Notices\\Notice' => $baseDir . '/inc/SP/Mgmt/Notices/Notice.php', - 'SP\\Mgmt\\Notices\\NoticeBase' => $baseDir . '/inc/SP/Mgmt/Notices/NoticeBase.php', - 'SP\\Mgmt\\Notices\\NoticeSearch' => $baseDir . '/inc/SP/Mgmt/Notices/NoticeSearch.php', - 'SP\\Mgmt\\Plugins\\Plugin' => $baseDir . '/inc/SP/Mgmt/Plugins/Plugin.php', - 'SP\\Mgmt\\Plugins\\PluginBase' => $baseDir . '/inc/SP/Mgmt/Plugins/PluginBase.php', - 'SP\\Mgmt\\Plugins\\PluginSearch' => $baseDir . '/inc/SP/Mgmt/Plugins/PluginSearch.php', - 'SP\\Mgmt\\Profiles\\Profile' => $baseDir . '/inc/SP/Mgmt/Profiles/Profile.php', - 'SP\\Mgmt\\Profiles\\ProfileBase' => $baseDir . '/inc/SP/Mgmt/Profiles/ProfileBase.php', - 'SP\\Mgmt\\Profiles\\ProfileSearch' => $baseDir . '/inc/SP/Mgmt/Profiles/ProfileSearch.php', - 'SP\\Mgmt\\Profiles\\ProfileUtil' => $baseDir . '/inc/SP/Mgmt/Profiles/ProfileUtil.php', - 'SP\\Mgmt\\PublicLinks\\PublicLink' => $baseDir . '/inc/SP/Mgmt/PublicLinks/PublicLink.php', - 'SP\\Mgmt\\PublicLinks\\PublicLinkBase' => $baseDir . '/inc/SP/Mgmt/PublicLinks/PublicLinkBase.php', - 'SP\\Mgmt\\PublicLinks\\PublicLinkSearch' => $baseDir . '/inc/SP/Mgmt/PublicLinks/PublicLinkSearch.php', - 'SP\\Mgmt\\Tags\\Tag' => $baseDir . '/inc/SP/Mgmt/Tags/Tag.php', - 'SP\\Mgmt\\Tags\\TagBase' => $baseDir . '/inc/SP/Mgmt/Tags/TagBase.php', - 'SP\\Mgmt\\Tags\\TagSearch' => $baseDir . '/inc/SP/Mgmt/Tags/TagSearch.php', - 'SP\\Mgmt\\Tracks\\Track' => $baseDir . '/inc/SP/Mgmt/Tracks/Track.php', - 'SP\\Mgmt\\Tracks\\TrackBase' => $baseDir . '/inc/SP/Mgmt/Tracks/TrackBase.php', - 'SP\\Mgmt\\Users\\User' => $baseDir . '/inc/SP/Mgmt/Users/User.php', - 'SP\\Mgmt\\Users\\UserBase' => $baseDir . '/inc/SP/Mgmt/Users/UserBase.php', - 'SP\\Mgmt\\Users\\UserLdap' => $baseDir . '/inc/SP/Mgmt/Users/UserLdap.php', - 'SP\\Mgmt\\Users\\UserLdapSync' => $baseDir . '/inc/SP/Mgmt/Users/UserLdapSync.php', - 'SP\\Mgmt\\Users\\UserMigrate' => $baseDir . '/inc/SP/Mgmt/Users/UserMigrate.php', - 'SP\\Mgmt\\Users\\UserPass' => $baseDir . '/inc/SP/Mgmt/Users/UserPass.php', - 'SP\\Mgmt\\Users\\UserPassRecover' => $baseDir . '/inc/SP/Mgmt/Users/UserPassRecover.php', - 'SP\\Mgmt\\Users\\UserPassRecoverBase' => $baseDir . '/inc/SP/Mgmt/Users/UserPassRecoverBase.php', - 'SP\\Mgmt\\Users\\UserPreferences' => $baseDir . '/inc/SP/Mgmt/Users/UserPreferences.php', - 'SP\\Mgmt\\Users\\UserPreferencesBase' => $baseDir . '/inc/SP/Mgmt/Users/UserPreferencesBase.php', - 'SP\\Mgmt\\Users\\UserPreferencesUtil' => $baseDir . '/inc/SP/Mgmt/Users/UserPreferencesUtil.php', - 'SP\\Mgmt\\Users\\UserSSO' => $baseDir . '/inc/SP/Mgmt/Users/UserSSO.php', - 'SP\\Mgmt\\Users\\UserSearch' => $baseDir . '/inc/SP/Mgmt/Users/UserSearch.php', - 'SP\\Mgmt\\Users\\UserUtil' => $baseDir . '/inc/SP/Mgmt/Users/UserUtil.php', - 'SP\\Storage\\DB' => $baseDir . '/inc/SP/Storage/DB.php', - 'SP\\Storage\\DBStorageInterface' => $baseDir . '/inc/SP/Storage/DBStorageInterface.php', - 'SP\\Storage\\DBUtil' => $baseDir . '/inc/SP/Storage/DBUtil.php', - 'SP\\Storage\\FileStorageInterface' => $baseDir . '/inc/SP/Storage/FileStorageInterface.php', - 'SP\\Storage\\MySQLHandler' => $baseDir . '/inc/SP/Storage/MySQLHandler.php', - 'SP\\Storage\\QueryData' => $baseDir . '/inc/SP/Storage/QueryData.php', - 'SP\\Storage\\XmlHandler' => $baseDir . '/inc/SP/Storage/XmlHandler.php', - 'SP\\Util\\ArrayUtil' => $baseDir . '/inc/SP/Util/ArrayUtil.php', - 'SP\\Util\\Checks' => $baseDir . '/inc/SP/Util/Checks.php', - 'SP\\Util\\Connection' => $baseDir . '/inc/SP/Util/Connection.php', - 'SP\\Util\\ConnectionInterface' => $baseDir . '/inc/SP/Util/ConnectionInterface.php', - 'SP\\Util\\Filter' => $baseDir . '/inc/SP/Util/Filter.php', - 'SP\\Util\\HttpUtil' => $baseDir . '/inc/SP/Util/HttpUtil.php', - 'SP\\Util\\ImageUtil' => $baseDir . '/inc/SP/Util/ImageUtil.php', - 'SP\\Util\\Json' => $baseDir . '/inc/SP/Util/Json.php', - 'SP\\Util\\Util' => $baseDir . '/inc/SP/Util/Util.php', - 'SP\\Util\\Wiki\\DokuWikiApi' => $baseDir . '/inc/SP/Util/Wiki/DokuWikiApi.php', - 'SP\\Util\\Wiki\\DokuWikiApiBase' => $baseDir . '/inc/SP/Util/Wiki/DokuWikiApiBase.php', - 'SP\\Util\\Wiki\\DokuWikiApiParse' => $baseDir . '/inc/SP/Util/Wiki/DokuWikiApiParse.php', - 'phpseclib\\Crypt\\AES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/AES.php', - 'phpseclib\\Crypt\\Base' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Base.php', - 'phpseclib\\Crypt\\Blowfish' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php', - 'phpseclib\\Crypt\\DES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/DES.php', - 'phpseclib\\Crypt\\Hash' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Hash.php', - 'phpseclib\\Crypt\\RC2' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RC2.php', - 'phpseclib\\Crypt\\RC4' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RC4.php', - 'phpseclib\\Crypt\\RSA' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA.php', - 'phpseclib\\Crypt\\Random' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php', - 'phpseclib\\Crypt\\Rijndael' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php', - 'phpseclib\\Crypt\\TripleDES' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php', - 'phpseclib\\Crypt\\Twofish' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php', - 'phpseclib\\File\\ANSI' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/ANSI.php', - 'phpseclib\\File\\ASN1' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/ASN1.php', - 'phpseclib\\File\\ASN1\\Element' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php', - 'phpseclib\\File\\X509' => $vendorDir . '/phpseclib/phpseclib/phpseclib/File/X509.php', - 'phpseclib\\Math\\BigInteger' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger.php', - 'phpseclib\\Net\\SCP' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SCP.php', - 'phpseclib\\Net\\SFTP' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SFTP.php', - 'phpseclib\\Net\\SFTP\\Stream' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php', - 'phpseclib\\Net\\SSH1' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SSH1.php', - 'phpseclib\\Net\\SSH2' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Net/SSH2.php', - 'phpseclib\\System\\SSH\\Agent' => $vendorDir . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php', - 'phpseclib\\System\\SSH\\Agent\\Identity' => $vendorDir . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php', ); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index 4e1048fb..3261f276 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -6,5 +6,6 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + 'Pimple' => array($vendorDir . '/pimple/pimple/src'), 'Base2n' => array($vendorDir . '/ademarre/binary-to-text-php'), ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index cf808e43..a260e0d7 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -7,7 +7,10 @@ $baseDir = dirname($vendorDir); return array( 'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), - 'SP\\' => array($baseDir . '/inc'), + 'SP\\Modules\\Web\\' => array($baseDir . '/app/modules/web'), + 'SP\\' => array($baseDir . '/lib/SP'), + 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'), + 'Klein\\' => array($vendorDir . '/klein/klein/src/Klein'), 'Defuse\\Crypto\\' => array($vendorDir . '/defuse/php-encryption/src'), ); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 96bdcae7..eb929c68 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -29,13 +29,22 @@ class ComposerAutoloaderInit1701764f82c629b16cc164189600cb41 call_user_func(\Composer\Autoload\ComposerStaticInit1701764f82c629b16cc164189600cb41::getInitializer($loader)); } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { $loader->addClassMap($classMap); } } - $loader->setClassMapAuthoritative(true); $loader->register(true); if ($useStaticLoader) { diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index b7df7ace..c4492d83 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -18,12 +18,18 @@ class ComposerStaticInit1701764f82c629b16cc164189600cb41 ), 'S' => array ( + 'SP\\Modules\\Web\\' => 15, 'SP\\' => 3, ), 'P' => array ( + 'Psr\\Container\\' => 14, 'PHPMailer\\PHPMailer\\' => 20, ), + 'K' => + array ( + 'Klein\\' => 6, + ), 'D' => array ( 'Defuse\\Crypto\\' => 14, @@ -35,14 +41,26 @@ class ComposerStaticInit1701764f82c629b16cc164189600cb41 array ( 0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib', ), + 'SP\\Modules\\Web\\' => + array ( + 0 => __DIR__ . '/../..' . '/app/modules/web', + ), 'SP\\' => array ( - 0 => __DIR__ . '/../..' . '/inc', + 0 => __DIR__ . '/../..' . '/lib/SP', + ), + 'Psr\\Container\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/container/src', ), 'PHPMailer\\PHPMailer\\' => array ( 0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src', ), + 'Klein\\' => + array ( + 0 => __DIR__ . '/..' . '/klein/klein/src/Klein', + ), 'Defuse\\Crypto\\' => array ( 0 => __DIR__ . '/..' . '/defuse/php-encryption/src', @@ -50,6 +68,13 @@ class ComposerStaticInit1701764f82c629b16cc164189600cb41 ); public static $prefixesPsr0 = array ( + 'P' => + array ( + 'Pimple' => + array ( + 0 => __DIR__ . '/..' . '/pimple/pimple/src', + ), + ), 'B' => array ( 'Base2n' => @@ -59,373 +84,12 @@ class ComposerStaticInit1701764f82c629b16cc164189600cb41 ), ); - public static $classMap = array ( - 'Defuse\\Crypto\\Core' => __DIR__ . '/..' . '/defuse/php-encryption/src/Core.php', - 'Defuse\\Crypto\\Crypto' => __DIR__ . '/..' . '/defuse/php-encryption/src/Crypto.php', - 'Defuse\\Crypto\\DerivedKeys' => __DIR__ . '/..' . '/defuse/php-encryption/src/DerivedKeys.php', - 'Defuse\\Crypto\\Encoding' => __DIR__ . '/..' . '/defuse/php-encryption/src/Encoding.php', - 'Defuse\\Crypto\\Exception\\BadFormatException' => __DIR__ . '/..' . '/defuse/php-encryption/src/Exception/BadFormatException.php', - 'Defuse\\Crypto\\Exception\\CryptoException' => __DIR__ . '/..' . '/defuse/php-encryption/src/Exception/CryptoException.php', - 'Defuse\\Crypto\\Exception\\EnvironmentIsBrokenException' => __DIR__ . '/..' . '/defuse/php-encryption/src/Exception/EnvironmentIsBrokenException.php', - 'Defuse\\Crypto\\Exception\\IOException' => __DIR__ . '/..' . '/defuse/php-encryption/src/Exception/IOException.php', - 'Defuse\\Crypto\\Exception\\WrongKeyOrModifiedCiphertextException' => __DIR__ . '/..' . '/defuse/php-encryption/src/Exception/WrongKeyOrModifiedCiphertextException.php', - 'Defuse\\Crypto\\File' => __DIR__ . '/..' . '/defuse/php-encryption/src/File.php', - 'Defuse\\Crypto\\Key' => __DIR__ . '/..' . '/defuse/php-encryption/src/Key.php', - 'Defuse\\Crypto\\KeyOrPassword' => __DIR__ . '/..' . '/defuse/php-encryption/src/KeyOrPassword.php', - 'Defuse\\Crypto\\KeyProtectedByPassword' => __DIR__ . '/..' . '/defuse/php-encryption/src/KeyProtectedByPassword.php', - 'Defuse\\Crypto\\RuntimeTests' => __DIR__ . '/..' . '/defuse/php-encryption/src/RuntimeTests.php', - 'PHPMailer\\PHPMailer\\Exception' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/Exception.php', - 'PHPMailer\\PHPMailer\\OAuth' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/OAuth.php', - 'PHPMailer\\PHPMailer\\PHPMailer' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/PHPMailer.php', - 'PHPMailer\\PHPMailer\\POP3' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/POP3.php', - 'PHPMailer\\PHPMailer\\SMTP' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/SMTP.php', - 'SP\\Account\\Account' => __DIR__ . '/../..' . '/inc/SP/Account/Account.php', - 'SP\\Account\\AccountAcl' => __DIR__ . '/../..' . '/inc/SP/Account/AccountAcl.php', - 'SP\\Account\\AccountBase' => __DIR__ . '/../..' . '/inc/SP/Account/AccountBase.php', - 'SP\\Account\\AccountCrypt' => __DIR__ . '/../..' . '/inc/SP/Account/AccountCrypt.php', - 'SP\\Account\\AccountFavorites' => __DIR__ . '/../..' . '/inc/SP/Account/AccountFavorites.php', - 'SP\\Account\\AccountHistory' => __DIR__ . '/../..' . '/inc/SP/Account/AccountHistory.php', - 'SP\\Account\\AccountHistoryCrypt' => __DIR__ . '/../..' . '/inc/SP/Account/AccountHistoryCrypt.php', - 'SP\\Account\\AccountHistoryUtil' => __DIR__ . '/../..' . '/inc/SP/Account/AccountHistoryUtil.php', - 'SP\\Account\\AccountInterface' => __DIR__ . '/../..' . '/inc/SP/Account/AccountInterface.php', - 'SP\\Account\\AccountSearch' => __DIR__ . '/../..' . '/inc/SP/Account/AccountSearch.php', - 'SP\\Account\\AccountTags' => __DIR__ . '/../..' . '/inc/SP/Account/AccountTags.php', - 'SP\\Account\\AccountUtil' => __DIR__ . '/../..' . '/inc/SP/Account/AccountUtil.php', - 'SP\\Account\\AccountsSearchItem' => __DIR__ . '/../..' . '/inc/SP/Account/AccountsSearchItem.php', - 'SP\\Account\\UserAccounts' => __DIR__ . '/../..' . '/inc/SP/Account/UserAccounts.php', - 'SP\\Api\\ApiBase' => __DIR__ . '/../..' . '/inc/SP/Api/ApiBase.php', - 'SP\\Api\\ApiInterface' => __DIR__ . '/../..' . '/inc/SP/Api/ApiInterface.php', - 'SP\\Api\\ApiRequest' => __DIR__ . '/../..' . '/inc/SP/Api/ApiRequest.php', - 'SP\\Api\\ApiUtil' => __DIR__ . '/../..' . '/inc/SP/Api/ApiUtil.php', - 'SP\\Api\\SyspassApi' => __DIR__ . '/../..' . '/inc/SP/Api/SyspassApi.php', - 'SP\\Auth\\Auth' => __DIR__ . '/../..' . '/inc/SP/Auth/Auth.php', - 'SP\\Auth\\AuthDataBase' => __DIR__ . '/../..' . '/inc/SP/Auth/AuthDataBase.php', - 'SP\\Auth\\AuthInterface' => __DIR__ . '/../..' . '/inc/SP/Auth/AuthInterface.php', - 'SP\\Auth\\AuthResult' => __DIR__ . '/../..' . '/inc/SP/Auth/AuthResult.php', - 'SP\\Auth\\AuthUtil' => __DIR__ . '/../..' . '/inc/SP/Auth/AuthUtil.php', - 'SP\\Auth\\Browser\\Browser' => __DIR__ . '/../..' . '/inc/SP/Auth/Browser/Browser.php', - 'SP\\Auth\\Browser\\BrowserAuthData' => __DIR__ . '/../..' . '/inc/SP/Auth/Browser/BrowserAuthData.php', - 'SP\\Auth\\Database\\Database' => __DIR__ . '/../..' . '/inc/SP/Auth/Database/Database.php', - 'SP\\Auth\\Database\\DatabaseAuthData' => __DIR__ . '/../..' . '/inc/SP/Auth/Database/DatabaseAuthData.php', - 'SP\\Auth\\Ldap\\LdapAuthData' => __DIR__ . '/../..' . '/inc/SP/Auth/Ldap/LdapAuthData.php', - 'SP\\Auth\\Ldap\\LdapBase' => __DIR__ . '/../..' . '/inc/SP/Auth/Ldap/LdapBase.php', - 'SP\\Auth\\Ldap\\LdapInterface' => __DIR__ . '/../..' . '/inc/SP/Auth/Ldap/LdapInterface.php', - 'SP\\Auth\\Ldap\\LdapMsAds' => __DIR__ . '/../..' . '/inc/SP/Auth/Ldap/LdapMsAds.php', - 'SP\\Auth\\Ldap\\LdapStd' => __DIR__ . '/../..' . '/inc/SP/Auth/Ldap/LdapStd.php', - 'SP\\Auth\\Ldap\\LdapUtil' => __DIR__ . '/../..' . '/inc/SP/Auth/Ldap/LdapUtil.php', - 'SP\\Config\\Config' => __DIR__ . '/../..' . '/inc/SP/Config/Config.php', - 'SP\\Config\\ConfigDB' => __DIR__ . '/../..' . '/inc/SP/Config/ConfigDB.php', - 'SP\\Config\\ConfigData' => __DIR__ . '/../..' . '/inc/SP/Config/ConfigData.php', - 'SP\\Config\\ConfigInterface' => __DIR__ . '/../..' . '/inc/SP/Config/ConfigInterface.php', - 'SP\\Config\\ConfigUtil' => __DIR__ . '/../..' . '/inc/SP/Config/ConfigUtil.php', - 'SP\\Controller\\AccountController' => __DIR__ . '/../..' . '/inc/SP/Controller/AccountController.php', - 'SP\\Controller\\AccountSearchController' => __DIR__ . '/../..' . '/inc/SP/Controller/AccountSearchController.php', - 'SP\\Controller\\ChecksController' => __DIR__ . '/../..' . '/inc/SP/Controller/ChecksController.php', - 'SP\\Controller\\ConfigActionController' => __DIR__ . '/../..' . '/inc/SP/Controller/ConfigActionController.php', - 'SP\\Controller\\ConfigController' => __DIR__ . '/../..' . '/inc/SP/Controller/ConfigController.php', - 'SP\\Controller\\ControllerBase' => __DIR__ . '/../..' . '/inc/SP/Controller/ControllerBase.php', - 'SP\\Controller\\EventlogController' => __DIR__ . '/../..' . '/inc/SP/Controller/EventlogController.php', - 'SP\\Controller\\GridItemsSearchController' => __DIR__ . '/../..' . '/inc/SP/Controller/GridItemsSearchController.php', - 'SP\\Controller\\GridTabControllerBase' => __DIR__ . '/../..' . '/inc/SP/Controller/GridTabControllerBase.php', - 'SP\\Controller\\Grids\\GridBase' => __DIR__ . '/../..' . '/inc/SP/Controller/Grids/GridBase.php', - 'SP\\Controller\\Grids\\Items' => __DIR__ . '/../..' . '/inc/SP/Controller/Grids/Items.php', - 'SP\\Controller\\Grids\\Notices' => __DIR__ . '/../..' . '/inc/SP/Controller/Grids/Notices.php', - 'SP\\Controller\\ItemActionController' => __DIR__ . '/../..' . '/inc/SP/Controller/ItemActionController.php', - 'SP\\Controller\\ItemControllerInterface' => __DIR__ . '/../..' . '/inc/SP/Controller/ItemControllerInterface.php', - 'SP\\Controller\\ItemListController' => __DIR__ . '/../..' . '/inc/SP/Controller/ItemListController.php', - 'SP\\Controller\\ItemSearchController' => __DIR__ . '/../..' . '/inc/SP/Controller/ItemSearchController.php', - 'SP\\Controller\\ItemShowController' => __DIR__ . '/../..' . '/inc/SP/Controller/ItemShowController.php', - 'SP\\Controller\\ItemsController' => __DIR__ . '/../..' . '/inc/SP/Controller/ItemsController.php', - 'SP\\Controller\\LoginController' => __DIR__ . '/../..' . '/inc/SP/Controller/LoginController.php', - 'SP\\Controller\\MainActionController' => __DIR__ . '/../..' . '/inc/SP/Controller/MainActionController.php', - 'SP\\Controller\\MainController' => __DIR__ . '/../..' . '/inc/SP/Controller/MainController.php', - 'SP\\Controller\\NoticeShowController' => __DIR__ . '/../..' . '/inc/SP/Controller/NoticeShowController.php', - 'SP\\Controller\\NoticesController' => __DIR__ . '/../..' . '/inc/SP/Controller/NoticesController.php', - 'SP\\Controller\\NoticesSearchController' => __DIR__ . '/../..' . '/inc/SP/Controller/NoticesSearchController.php', - 'SP\\Controller\\RequestControllerTrait' => __DIR__ . '/../..' . '/inc/SP/Controller/RequestControllerTrait.php', - 'SP\\Controller\\TabControllerBase' => __DIR__ . '/../..' . '/inc/SP/Controller/TabControllerBase.php', - 'SP\\Controller\\TabsInterface' => __DIR__ . '/../..' . '/inc/SP/Controller/TabsInterface.php', - 'SP\\Controller\\TaskController' => __DIR__ . '/../..' . '/inc/SP/Controller/TaskController.php', - 'SP\\Controller\\UserPreferencesController' => __DIR__ . '/../..' . '/inc/SP/Controller/UserPreferencesController.php', - 'SP\\Controller\\WikiController' => __DIR__ . '/../..' . '/inc/SP/Controller/WikiController.php', - 'SP\\Core\\Acl' => __DIR__ . '/../..' . '/inc/SP/Core/Acl.php', - 'SP\\Core\\ActionsInterface' => __DIR__ . '/../..' . '/inc/SP/Core/ActionsInterface.php', - 'SP\\Core\\Backup' => __DIR__ . '/../..' . '/inc/SP/Core/Backup.php', - 'SP\\Core\\CryptMasterPass' => __DIR__ . '/../..' . '/inc/SP/Core/CryptMasterPass.php', - 'SP\\Core\\CryptPKI' => __DIR__ . '/../..' . '/inc/SP/Core/CryptPKI.php', - 'SP\\Core\\Crypt\\Cookie' => __DIR__ . '/../..' . '/inc/SP/Core/Crypt/Cookie.php', - 'SP\\Core\\Crypt\\Crypt' => __DIR__ . '/../..' . '/inc/SP/Core/Crypt/Crypt.php', - 'SP\\Core\\Crypt\\CryptSessionHandler' => __DIR__ . '/../..' . '/inc/SP/Core/Crypt/CryptSessionHandler.php', - 'SP\\Core\\Crypt\\Hash' => __DIR__ . '/../..' . '/inc/SP/Core/Crypt/Hash.php', - 'SP\\Core\\Crypt\\SecureKeyCookie' => __DIR__ . '/../..' . '/inc/SP/Core/Crypt/SecureKeyCookie.php', - 'SP\\Core\\Crypt\\Session' => __DIR__ . '/../..' . '/inc/SP/Core/Crypt/Session.php', - 'SP\\Core\\Crypt\\Vault' => __DIR__ . '/../..' . '/inc/SP/Core/Crypt/Vault.php', - 'SP\\Core\\DiFactory' => __DIR__ . '/../..' . '/inc/SP/Core/DiFactory.php', - 'SP\\Core\\Events\\EventDispatcher' => __DIR__ . '/../..' . '/inc/SP/Core/Events/EventDispatcher.php', - 'SP\\Core\\Events\\EventDispatcherBase' => __DIR__ . '/../..' . '/inc/SP/Core/Events/EventDispatcherBase.php', - 'SP\\Core\\Events\\EventDispatcherInterface' => __DIR__ . '/../..' . '/inc/SP/Core/Events/EventDispatcherInterface.php', - 'SP\\Core\\Events\\EventReceiver' => __DIR__ . '/../..' . '/inc/SP/Core/Events/EventReceiver.php', - 'SP\\Core\\Exceptions\\AuthException' => __DIR__ . '/../..' . '/inc/SP/Core/Exceptions/AuthException.php', - 'SP\\Core\\Exceptions\\ConstraintException' => __DIR__ . '/../..' . '/inc/SP/Core/Exceptions/ConstraintException.php', - 'SP\\Core\\Exceptions\\FileNotFoundException' => __DIR__ . '/../..' . '/inc/SP/Core/Exceptions/FileNotFoundException.php', - 'SP\\Core\\Exceptions\\InvalidArgumentException' => __DIR__ . '/../..' . '/inc/SP/Core/Exceptions/InvalidArgumentException.php', - 'SP\\Core\\Exceptions\\InvalidClassException' => __DIR__ . '/../..' . '/inc/SP/Core/Exceptions/InvalidClassException.php', - 'SP\\Core\\Exceptions\\ItemException' => __DIR__ . '/../..' . '/inc/SP/Core/Exceptions/ItemException.php', - 'SP\\Core\\Exceptions\\QueryException' => __DIR__ . '/../..' . '/inc/SP/Core/Exceptions/QueryException.php', - 'SP\\Core\\Exceptions\\SPException' => __DIR__ . '/../..' . '/inc/SP/Core/Exceptions/SPException.php', - 'SP\\Core\\Exceptions\\ValidationException' => __DIR__ . '/../..' . '/inc/SP/Core/Exceptions/ValidationException.php', - 'SP\\Core\\Init' => __DIR__ . '/../..' . '/inc/SP/Core/Init.php', - 'SP\\Core\\Installer' => __DIR__ . '/../..' . '/inc/SP/Core/Installer.php', - 'SP\\Core\\ItemsTypeInterface' => __DIR__ . '/../..' . '/inc/SP/Core/ItemsTypeInterface.php', - 'SP\\Core\\Language' => __DIR__ . '/../..' . '/inc/SP/Core/Language.php', - 'SP\\Core\\Messages\\LogMessage' => __DIR__ . '/../..' . '/inc/SP/Core/Messages/LogMessage.php', - 'SP\\Core\\Messages\\MessageBase' => __DIR__ . '/../..' . '/inc/SP/Core/Messages/MessageBase.php', - 'SP\\Core\\Messages\\MessageInterface' => __DIR__ . '/../..' . '/inc/SP/Core/Messages/MessageInterface.php', - 'SP\\Core\\Messages\\NoticeMessage' => __DIR__ . '/../..' . '/inc/SP/Core/Messages/NoticeMessage.php', - 'SP\\Core\\Messages\\TaskMessage' => __DIR__ . '/../..' . '/inc/SP/Core/Messages/TaskMessage.php', - 'SP\\Core\\OldCrypt' => __DIR__ . '/../..' . '/inc/SP/Core/OldCrypt.php', - 'SP\\Core\\Plugin\\PluginBase' => __DIR__ . '/../..' . '/inc/SP/Core/Plugin/PluginBase.php', - 'SP\\Core\\Plugin\\PluginDataStore' => __DIR__ . '/../..' . '/inc/SP/Core/Plugin/PluginDataStore.php', - 'SP\\Core\\Plugin\\PluginInterface' => __DIR__ . '/../..' . '/inc/SP/Core/Plugin/PluginInterface.php', - 'SP\\Core\\Plugin\\PluginUtil' => __DIR__ . '/../..' . '/inc/SP/Core/Plugin/PluginUtil.php', - 'SP\\Core\\Session' => __DIR__ . '/../..' . '/inc/SP/Core/Session.php', - 'SP\\Core\\SessionUtil' => __DIR__ . '/../..' . '/inc/SP/Core/SessionUtil.php', - 'SP\\Core\\Task' => __DIR__ . '/../..' . '/inc/SP/Core/Task.php', - 'SP\\Core\\TaskFactory' => __DIR__ . '/../..' . '/inc/SP/Core/TaskFactory.php', - 'SP\\Core\\Template' => __DIR__ . '/../..' . '/inc/SP/Core/Template.php', - 'SP\\Core\\UI\\Theme' => __DIR__ . '/../..' . '/inc/SP/Core/UI/Theme.php', - 'SP\\Core\\UI\\ThemeIconsBase' => __DIR__ . '/../..' . '/inc/SP/Core/UI/ThemeIconsBase.php', - 'SP\\Core\\UI\\ThemeIconsInterface' => __DIR__ . '/../..' . '/inc/SP/Core/UI/ThemeIconsInterface.php', - 'SP\\Core\\UI\\ThemeInterface' => __DIR__ . '/../..' . '/inc/SP/Core/UI/ThemeInterface.php', - 'SP\\Core\\Upgrade\\Account' => __DIR__ . '/../..' . '/inc/SP/Core/Upgrade/Account.php', - 'SP\\Core\\Upgrade\\Category' => __DIR__ . '/../..' . '/inc/SP/Core/Upgrade/Category.php', - 'SP\\Core\\Upgrade\\Check' => __DIR__ . '/../..' . '/inc/SP/Core/Upgrade/Check.php', - 'SP\\Core\\Upgrade\\Crypt' => __DIR__ . '/../..' . '/inc/SP/Core/Upgrade/Crypt.php', - 'SP\\Core\\Upgrade\\Customer' => __DIR__ . '/../..' . '/inc/SP/Core/Upgrade/Customer.php', - 'SP\\Core\\Upgrade\\Group' => __DIR__ . '/../..' . '/inc/SP/Core/Upgrade/Group.php', - 'SP\\Core\\Upgrade\\Profile' => __DIR__ . '/../..' . '/inc/SP/Core/Upgrade/Profile.php', - 'SP\\Core\\Upgrade\\Upgrade' => __DIR__ . '/../..' . '/inc/SP/Core/Upgrade/Upgrade.php', - 'SP\\Core\\Upgrade\\User' => __DIR__ . '/../..' . '/inc/SP/Core/Upgrade/User.php', - 'SP\\Core\\XmlExport' => __DIR__ . '/../..' . '/inc/SP/Core/XmlExport.php', - 'SP\\DataModel\\AccountData' => __DIR__ . '/../..' . '/inc/SP/DataModel/AccountData.php', - 'SP\\DataModel\\AccountExtData' => __DIR__ . '/../..' . '/inc/SP/DataModel/AccountExtData.php', - 'SP\\DataModel\\AccountHistoryData' => __DIR__ . '/../..' . '/inc/SP/DataModel/AccountHistoryData.php', - 'SP\\DataModel\\AccountSearchData' => __DIR__ . '/../..' . '/inc/SP/DataModel/AccountSearchData.php', - 'SP\\DataModel\\ApiTokenData' => __DIR__ . '/../..' . '/inc/SP/DataModel/ApiTokenData.php', - 'SP\\DataModel\\CategoryData' => __DIR__ . '/../..' . '/inc/SP/DataModel/CategoryData.php', - 'SP\\DataModel\\CustomFieldBaseData' => __DIR__ . '/../..' . '/inc/SP/DataModel/CustomFieldBaseData.php', - 'SP\\DataModel\\CustomFieldData' => __DIR__ . '/../..' . '/inc/SP/DataModel/CustomFieldData.php', - 'SP\\DataModel\\CustomFieldDefData' => __DIR__ . '/../..' . '/inc/SP/DataModel/CustomFieldDefData.php', - 'SP\\DataModel\\CustomerData' => __DIR__ . '/../..' . '/inc/SP/DataModel/CustomerData.php', - 'SP\\DataModel\\DataModelBase' => __DIR__ . '/../..' . '/inc/SP/DataModel/DataModelBase.php', - 'SP\\DataModel\\DataModelInterface' => __DIR__ . '/../..' . '/inc/SP/DataModel/DataModelInterface.php', - 'SP\\DataModel\\FileData' => __DIR__ . '/../..' . '/inc/SP/DataModel/FileData.php', - 'SP\\DataModel\\FileExtData' => __DIR__ . '/../..' . '/inc/SP/DataModel/FileExtData.php', - 'SP\\DataModel\\GroupAccountsData' => __DIR__ . '/../..' . '/inc/SP/DataModel/GroupAccountsData.php', - 'SP\\DataModel\\GroupData' => __DIR__ . '/../..' . '/inc/SP/DataModel/GroupData.php', - 'SP\\DataModel\\GroupUsersData' => __DIR__ . '/../..' . '/inc/SP/DataModel/GroupUsersData.php', - 'SP\\DataModel\\InstallData' => __DIR__ . '/../..' . '/inc/SP/DataModel/InstallData.php', - 'SP\\DataModel\\ItemSearchData' => __DIR__ . '/../..' . '/inc/SP/DataModel/ItemSearchData.php', - 'SP\\DataModel\\NoticeData' => __DIR__ . '/../..' . '/inc/SP/DataModel/NoticeData.php', - 'SP\\DataModel\\PluginData' => __DIR__ . '/../..' . '/inc/SP/DataModel/PluginData.php', - 'SP\\DataModel\\ProfileBaseData' => __DIR__ . '/../..' . '/inc/SP/DataModel/ProfileBaseData.php', - 'SP\\DataModel\\ProfileData' => __DIR__ . '/../..' . '/inc/SP/DataModel/ProfileData.php', - 'SP\\DataModel\\PublicLinkBaseData' => __DIR__ . '/../..' . '/inc/SP/DataModel/PublicLinkBaseData.php', - 'SP\\DataModel\\PublicLinkData' => __DIR__ . '/../..' . '/inc/SP/DataModel/PublicLinkData.php', - 'SP\\DataModel\\PublicLinkListData' => __DIR__ . '/../..' . '/inc/SP/DataModel/PublicLinkListData.php', - 'SP\\DataModel\\TagData' => __DIR__ . '/../..' . '/inc/SP/DataModel/TagData.php', - 'SP\\DataModel\\TrackData' => __DIR__ . '/../..' . '/inc/SP/DataModel/TrackData.php', - 'SP\\DataModel\\UserData' => __DIR__ . '/../..' . '/inc/SP/DataModel/UserData.php', - 'SP\\DataModel\\UserLoginData' => __DIR__ . '/../..' . '/inc/SP/DataModel/UserLoginData.php', - 'SP\\DataModel\\UserPassData' => __DIR__ . '/../..' . '/inc/SP/DataModel/UserPassData.php', - 'SP\\DataModel\\UserPassRecoverData' => __DIR__ . '/../..' . '/inc/SP/DataModel/UserPassRecoverData.php', - 'SP\\DataModel\\UserPreferencesData' => __DIR__ . '/../..' . '/inc/SP/DataModel/UserPreferencesData.php', - 'SP\\Forms\\AccountForm' => __DIR__ . '/../..' . '/inc/SP/Forms/AccountForm.php', - 'SP\\Forms\\ApiTokenForm' => __DIR__ . '/../..' . '/inc/SP/Forms/ApiTokenForm.php', - 'SP\\Forms\\CategoryForm' => __DIR__ . '/../..' . '/inc/SP/Forms/CategoryForm.php', - 'SP\\Forms\\CustomFieldDefForm' => __DIR__ . '/../..' . '/inc/SP/Forms/CustomFieldDefForm.php', - 'SP\\Forms\\CustomerForm' => __DIR__ . '/../..' . '/inc/SP/Forms/CustomerForm.php', - 'SP\\Forms\\FormBase' => __DIR__ . '/../..' . '/inc/SP/Forms/FormBase.php', - 'SP\\Forms\\FormInterface' => __DIR__ . '/../..' . '/inc/SP/Forms/FormInterface.php', - 'SP\\Forms\\GroupForm' => __DIR__ . '/../..' . '/inc/SP/Forms/GroupForm.php', - 'SP\\Forms\\NoticeForm' => __DIR__ . '/../..' . '/inc/SP/Forms/NoticeForm.php', - 'SP\\Forms\\ProfileForm' => __DIR__ . '/../..' . '/inc/SP/Forms/ProfileForm.php', - 'SP\\Forms\\PublicLinkForm' => __DIR__ . '/../..' . '/inc/SP/Forms/PublicLinkForm.php', - 'SP\\Forms\\TagForm' => __DIR__ . '/../..' . '/inc/SP/Forms/TagForm.php', - 'SP\\Forms\\UserForm' => __DIR__ . '/../..' . '/inc/SP/Forms/UserForm.php', - 'SP\\Html\\Assets\\FontIcon' => __DIR__ . '/../..' . '/inc/SP/Html/Assets/FontIcon.php', - 'SP\\Html\\Assets\\IconBase' => __DIR__ . '/../..' . '/inc/SP/Html/Assets/IconBase.php', - 'SP\\Html\\Assets\\IconInterface' => __DIR__ . '/../..' . '/inc/SP/Html/Assets/IconInterface.php', - 'SP\\Html\\Assets\\ImageIcon' => __DIR__ . '/../..' . '/inc/SP/Html/Assets/ImageIcon.php', - 'SP\\Html\\DataGrid\\DataGrid' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGrid.php', - 'SP\\Html\\DataGrid\\DataGridAction' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridAction.php', - 'SP\\Html\\DataGrid\\DataGridActionBase' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridActionBase.php', - 'SP\\Html\\DataGrid\\DataGridActionInterface' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridActionInterface.php', - 'SP\\Html\\DataGrid\\DataGridActionSearch' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridActionSearch.php', - 'SP\\Html\\DataGrid\\DataGridActionType' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridActionType.php', - 'SP\\Html\\DataGrid\\DataGridBase' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridBase.php', - 'SP\\Html\\DataGrid\\DataGridData' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridData.php', - 'SP\\Html\\DataGrid\\DataGridDataBase' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridDataBase.php', - 'SP\\Html\\DataGrid\\DataGridDataInterface' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridDataInterface.php', - 'SP\\Html\\DataGrid\\DataGridHeader' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridHeader.php', - 'SP\\Html\\DataGrid\\DataGridHeaderBase' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridHeaderBase.php', - 'SP\\Html\\DataGrid\\DataGridHeaderInterface' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridHeaderInterface.php', - 'SP\\Html\\DataGrid\\DataGridHeaderSort' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridHeaderSort.php', - 'SP\\Html\\DataGrid\\DataGridInterface' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridInterface.php', - 'SP\\Html\\DataGrid\\DataGridPager' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridPager.php', - 'SP\\Html\\DataGrid\\DataGridPagerBase' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridPagerBase.php', - 'SP\\Html\\DataGrid\\DataGridPagerInterface' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridPagerInterface.php', - 'SP\\Html\\DataGrid\\DataGridSort' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridSort.php', - 'SP\\Html\\DataGrid\\DataGridSortInterface' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridSortInterface.php', - 'SP\\Html\\DataGrid\\DataGridTab' => __DIR__ . '/../..' . '/inc/SP/Html/DataGrid/DataGridTab.php', - 'SP\\Html\\Html' => __DIR__ . '/../..' . '/inc/SP/Html/Html.php', - 'SP\\Html\\Minify' => __DIR__ . '/../..' . '/inc/SP/Html/Minify.php', - 'SP\\Http\\Cookies' => __DIR__ . '/../..' . '/inc/SP/Http/Cookies.php', - 'SP\\Http\\JsonResponse' => __DIR__ . '/../..' . '/inc/SP/Http/JsonResponse.php', - 'SP\\Http\\Message' => __DIR__ . '/../..' . '/inc/SP/Http/Message.php', - 'SP\\Http\\Request' => __DIR__ . '/../..' . '/inc/SP/Http/Request.php', - 'SP\\Http\\Response' => __DIR__ . '/../..' . '/inc/SP/Http/Response.php', - 'SP\\Http\\XMLRPCResponseParse' => __DIR__ . '/../..' . '/inc/SP/Http/XMLRPCResponseParse.php', - 'SP\\Import\\CsvImport' => __DIR__ . '/../..' . '/inc/SP/Import/CsvImport.php', - 'SP\\Import\\CsvImportBase' => __DIR__ . '/../..' . '/inc/SP/Import/CsvImportBase.php', - 'SP\\Import\\FileImport' => __DIR__ . '/../..' . '/inc/SP/Import/FileImport.php', - 'SP\\Import\\Import' => __DIR__ . '/../..' . '/inc/SP/Import/Import.php', - 'SP\\Import\\ImportBase' => __DIR__ . '/../..' . '/inc/SP/Import/ImportBase.php', - 'SP\\Import\\ImportInterface' => __DIR__ . '/../..' . '/inc/SP/Import/ImportInterface.php', - 'SP\\Import\\ImportParams' => __DIR__ . '/../..' . '/inc/SP/Import/ImportParams.php', - 'SP\\Import\\KeepassImport' => __DIR__ . '/../..' . '/inc/SP/Import/KeepassImport.php', - 'SP\\Import\\KeepassXImport' => __DIR__ . '/../..' . '/inc/SP/Import/KeepassXImport.php', - 'SP\\Import\\SyspassImport' => __DIR__ . '/../..' . '/inc/SP/Import/SyspassImport.php', - 'SP\\Import\\XmlFileImport' => __DIR__ . '/../..' . '/inc/SP/Import/XmlFileImport.php', - 'SP\\Import\\XmlImport' => __DIR__ . '/../..' . '/inc/SP/Import/XmlImport.php', - 'SP\\Import\\XmlImportTrait' => __DIR__ . '/../..' . '/inc/SP/Import/XmlImportTrait.php', - 'SP\\Log\\AbstractLogger' => __DIR__ . '/../..' . '/inc/SP/Log/AbstractLogger.php', - 'SP\\Log\\ActionLog' => __DIR__ . '/../..' . '/inc/SP/Log/ActionLog.php', - 'SP\\Log\\Email' => __DIR__ . '/../..' . '/inc/SP/Log/Email.php', - 'SP\\Log\\Log' => __DIR__ . '/../..' . '/inc/SP/Log/Log.php', - 'SP\\Log\\LogLevel' => __DIR__ . '/../..' . '/inc/SP/Log/LogLevel.php', - 'SP\\Log\\LogUtil' => __DIR__ . '/../..' . '/inc/SP/Log/LogUtil.php', - 'SP\\Log\\LoggerInterface' => __DIR__ . '/../..' . '/inc/SP/Log/LoggerInterface.php', - 'SP\\Log\\Syslog' => __DIR__ . '/../..' . '/inc/SP/Log/Syslog.php', - 'SP\\Mgmt\\ApiTokens\\ApiToken' => __DIR__ . '/../..' . '/inc/SP/Mgmt/ApiTokens/ApiToken.php', - 'SP\\Mgmt\\ApiTokens\\ApiTokenBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/ApiTokens/ApiTokenBase.php', - 'SP\\Mgmt\\ApiTokens\\ApiTokenSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/ApiTokens/ApiTokenSearch.php', - 'SP\\Mgmt\\ApiTokens\\ApiTokensUtil' => __DIR__ . '/../..' . '/inc/SP/Mgmt/ApiTokens/ApiTokensUtil.php', - 'SP\\Mgmt\\Categories\\Category' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Categories/Category.php', - 'SP\\Mgmt\\Categories\\CategoryBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Categories/CategoryBase.php', - 'SP\\Mgmt\\Categories\\CategorySearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Categories/CategorySearch.php', - 'SP\\Mgmt\\CustomFields\\CustomField' => __DIR__ . '/../..' . '/inc/SP/Mgmt/CustomFields/CustomField.php', - 'SP\\Mgmt\\CustomFields\\CustomFieldBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/CustomFields/CustomFieldBase.php', - 'SP\\Mgmt\\CustomFields\\CustomFieldDef' => __DIR__ . '/../..' . '/inc/SP/Mgmt/CustomFields/CustomFieldDef.php', - 'SP\\Mgmt\\CustomFields\\CustomFieldDefSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/CustomFields/CustomFieldDefSearch.php', - 'SP\\Mgmt\\CustomFields\\CustomFieldTypes' => __DIR__ . '/../..' . '/inc/SP/Mgmt/CustomFields/CustomFieldTypes.php', - 'SP\\Mgmt\\CustomFields\\CustomFieldsUtil' => __DIR__ . '/../..' . '/inc/SP/Mgmt/CustomFields/CustomFieldsUtil.php', - 'SP\\Mgmt\\Customers\\Customer' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Customers/Customer.php', - 'SP\\Mgmt\\Customers\\CustomerBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Customers/CustomerBase.php', - 'SP\\Mgmt\\Customers\\CustomerSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Customers/CustomerSearch.php', - 'SP\\Mgmt\\Files\\File' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Files/File.php', - 'SP\\Mgmt\\Files\\FileBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Files/FileBase.php', - 'SP\\Mgmt\\Files\\FileSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Files/FileSearch.php', - 'SP\\Mgmt\\Files\\FileUtil' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Files/FileUtil.php', - 'SP\\Mgmt\\Groups\\Group' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Groups/Group.php', - 'SP\\Mgmt\\Groups\\GroupAccounts' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Groups/GroupAccounts.php', - 'SP\\Mgmt\\Groups\\GroupAccountsBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Groups/GroupAccountsBase.php', - 'SP\\Mgmt\\Groups\\GroupAccountsUtil' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Groups/GroupAccountsUtil.php', - 'SP\\Mgmt\\Groups\\GroupBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Groups/GroupBase.php', - 'SP\\Mgmt\\Groups\\GroupSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Groups/GroupSearch.php', - 'SP\\Mgmt\\Groups\\GroupUsers' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Groups/GroupUsers.php', - 'SP\\Mgmt\\Groups\\GroupUsersBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Groups/GroupUsersBase.php', - 'SP\\Mgmt\\Groups\\GroupUtil' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Groups/GroupUtil.php', - 'SP\\Mgmt\\ItemBaseInterface' => __DIR__ . '/../..' . '/inc/SP/Mgmt/ItemBaseInterface.php', - 'SP\\Mgmt\\ItemBaseTrait' => __DIR__ . '/../..' . '/inc/SP/Mgmt/ItemBaseTrait.php', - 'SP\\Mgmt\\ItemInterface' => __DIR__ . '/../..' . '/inc/SP/Mgmt/ItemInterface.php', - 'SP\\Mgmt\\ItemSearchInterface' => __DIR__ . '/../..' . '/inc/SP/Mgmt/ItemSearchInterface.php', - 'SP\\Mgmt\\ItemSelectInterface' => __DIR__ . '/../..' . '/inc/SP/Mgmt/ItemSelectInterface.php', - 'SP\\Mgmt\\ItemTrait' => __DIR__ . '/../..' . '/inc/SP/Mgmt/ItemTrait.php', - 'SP\\Mgmt\\Notices\\Notice' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Notices/Notice.php', - 'SP\\Mgmt\\Notices\\NoticeBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Notices/NoticeBase.php', - 'SP\\Mgmt\\Notices\\NoticeSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Notices/NoticeSearch.php', - 'SP\\Mgmt\\Plugins\\Plugin' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Plugins/Plugin.php', - 'SP\\Mgmt\\Plugins\\PluginBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Plugins/PluginBase.php', - 'SP\\Mgmt\\Plugins\\PluginSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Plugins/PluginSearch.php', - 'SP\\Mgmt\\Profiles\\Profile' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Profiles/Profile.php', - 'SP\\Mgmt\\Profiles\\ProfileBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Profiles/ProfileBase.php', - 'SP\\Mgmt\\Profiles\\ProfileSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Profiles/ProfileSearch.php', - 'SP\\Mgmt\\Profiles\\ProfileUtil' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Profiles/ProfileUtil.php', - 'SP\\Mgmt\\PublicLinks\\PublicLink' => __DIR__ . '/../..' . '/inc/SP/Mgmt/PublicLinks/PublicLink.php', - 'SP\\Mgmt\\PublicLinks\\PublicLinkBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/PublicLinks/PublicLinkBase.php', - 'SP\\Mgmt\\PublicLinks\\PublicLinkSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/PublicLinks/PublicLinkSearch.php', - 'SP\\Mgmt\\Tags\\Tag' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Tags/Tag.php', - 'SP\\Mgmt\\Tags\\TagBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Tags/TagBase.php', - 'SP\\Mgmt\\Tags\\TagSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Tags/TagSearch.php', - 'SP\\Mgmt\\Tracks\\Track' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Tracks/Track.php', - 'SP\\Mgmt\\Tracks\\TrackBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Tracks/TrackBase.php', - 'SP\\Mgmt\\Users\\User' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/User.php', - 'SP\\Mgmt\\Users\\UserBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserBase.php', - 'SP\\Mgmt\\Users\\UserLdap' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserLdap.php', - 'SP\\Mgmt\\Users\\UserLdapSync' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserLdapSync.php', - 'SP\\Mgmt\\Users\\UserMigrate' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserMigrate.php', - 'SP\\Mgmt\\Users\\UserPass' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserPass.php', - 'SP\\Mgmt\\Users\\UserPassRecover' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserPassRecover.php', - 'SP\\Mgmt\\Users\\UserPassRecoverBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserPassRecoverBase.php', - 'SP\\Mgmt\\Users\\UserPreferences' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserPreferences.php', - 'SP\\Mgmt\\Users\\UserPreferencesBase' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserPreferencesBase.php', - 'SP\\Mgmt\\Users\\UserPreferencesUtil' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserPreferencesUtil.php', - 'SP\\Mgmt\\Users\\UserSSO' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserSSO.php', - 'SP\\Mgmt\\Users\\UserSearch' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserSearch.php', - 'SP\\Mgmt\\Users\\UserUtil' => __DIR__ . '/../..' . '/inc/SP/Mgmt/Users/UserUtil.php', - 'SP\\Storage\\DB' => __DIR__ . '/../..' . '/inc/SP/Storage/DB.php', - 'SP\\Storage\\DBStorageInterface' => __DIR__ . '/../..' . '/inc/SP/Storage/DBStorageInterface.php', - 'SP\\Storage\\DBUtil' => __DIR__ . '/../..' . '/inc/SP/Storage/DBUtil.php', - 'SP\\Storage\\FileStorageInterface' => __DIR__ . '/../..' . '/inc/SP/Storage/FileStorageInterface.php', - 'SP\\Storage\\MySQLHandler' => __DIR__ . '/../..' . '/inc/SP/Storage/MySQLHandler.php', - 'SP\\Storage\\QueryData' => __DIR__ . '/../..' . '/inc/SP/Storage/QueryData.php', - 'SP\\Storage\\XmlHandler' => __DIR__ . '/../..' . '/inc/SP/Storage/XmlHandler.php', - 'SP\\Util\\ArrayUtil' => __DIR__ . '/../..' . '/inc/SP/Util/ArrayUtil.php', - 'SP\\Util\\Checks' => __DIR__ . '/../..' . '/inc/SP/Util/Checks.php', - 'SP\\Util\\Connection' => __DIR__ . '/../..' . '/inc/SP/Util/Connection.php', - 'SP\\Util\\ConnectionInterface' => __DIR__ . '/../..' . '/inc/SP/Util/ConnectionInterface.php', - 'SP\\Util\\Filter' => __DIR__ . '/../..' . '/inc/SP/Util/Filter.php', - 'SP\\Util\\HttpUtil' => __DIR__ . '/../..' . '/inc/SP/Util/HttpUtil.php', - 'SP\\Util\\ImageUtil' => __DIR__ . '/../..' . '/inc/SP/Util/ImageUtil.php', - 'SP\\Util\\Json' => __DIR__ . '/../..' . '/inc/SP/Util/Json.php', - 'SP\\Util\\Util' => __DIR__ . '/../..' . '/inc/SP/Util/Util.php', - 'SP\\Util\\Wiki\\DokuWikiApi' => __DIR__ . '/../..' . '/inc/SP/Util/Wiki/DokuWikiApi.php', - 'SP\\Util\\Wiki\\DokuWikiApiBase' => __DIR__ . '/../..' . '/inc/SP/Util/Wiki/DokuWikiApiBase.php', - 'SP\\Util\\Wiki\\DokuWikiApiParse' => __DIR__ . '/../..' . '/inc/SP/Util/Wiki/DokuWikiApiParse.php', - 'phpseclib\\Crypt\\AES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/AES.php', - 'phpseclib\\Crypt\\Base' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Base.php', - 'phpseclib\\Crypt\\Blowfish' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php', - 'phpseclib\\Crypt\\DES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/DES.php', - 'phpseclib\\Crypt\\Hash' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Hash.php', - 'phpseclib\\Crypt\\RC2' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RC2.php', - 'phpseclib\\Crypt\\RC4' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RC4.php', - 'phpseclib\\Crypt\\RSA' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA.php', - 'phpseclib\\Crypt\\Random' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php', - 'phpseclib\\Crypt\\Rijndael' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php', - 'phpseclib\\Crypt\\TripleDES' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php', - 'phpseclib\\Crypt\\Twofish' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php', - 'phpseclib\\File\\ANSI' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/ANSI.php', - 'phpseclib\\File\\ASN1' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/ASN1.php', - 'phpseclib\\File\\ASN1\\Element' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php', - 'phpseclib\\File\\X509' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/File/X509.php', - 'phpseclib\\Math\\BigInteger' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger.php', - 'phpseclib\\Net\\SCP' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SCP.php', - 'phpseclib\\Net\\SFTP' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SFTP.php', - 'phpseclib\\Net\\SFTP\\Stream' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php', - 'phpseclib\\Net\\SSH1' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SSH1.php', - 'phpseclib\\Net\\SSH2' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Net/SSH2.php', - 'phpseclib\\System\\SSH\\Agent' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php', - 'phpseclib\\System\\SSH\\Agent\\Identity' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php', - ); - public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { $loader->prefixLengthsPsr4 = ComposerStaticInit1701764f82c629b16cc164189600cb41::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit1701764f82c629b16cc164189600cb41::$prefixDirsPsr4; $loader->prefixesPsr0 = ComposerStaticInit1701764f82c629b16cc164189600cb41::$prefixesPsr0; - $loader->classMap = ComposerStaticInit1701764f82c629b16cc164189600cb41::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index a7f09538..53d6751c 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,54 +1,4 @@ [ - { - "name": "paragonie/random_compat", - "version": "v2.0.10", - "version_normalized": "2.0.10.0", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/634bae8e911eefa89c1abfbf1b66da679ac8f54d", - "reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "time": "2017-03-13T16:27:32+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "lib/random.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "pseudorandom", - "random" - ] - }, { "name": "phpmailer/phpmailer", "version": "v6.0.1", @@ -321,5 +271,216 @@ "security", "symmetric key cryptography" ] + }, + { + "name": "psr/container", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2017-02-14T16:28:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ] + }, + { + "name": "pimple/pimple", + "version": "v3.2.2", + "version_normalized": "3.2.2.0", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a", + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" + }, + "time": "2017-07-23T07:32:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ] + }, + { + "name": "paragonie/random_compat", + "version": "v2.0.11", + "version_normalized": "2.0.11.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "time": "2017-09-27T21:40:39+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ] + }, + { + "name": "klein/klein", + "version": "v2.1.2", + "version_normalized": "2.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/klein/klein.php.git", + "reference": "6549676cc831b9417332b3d9485c64bbf7bac728" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/klein/klein.php/zipball/6549676cc831b9417332b3d9485c64bbf7bac728", + "reference": "6549676cc831b9417332b3d9485c64bbf7bac728", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/php-code-coverage": "^2.2", + "phpunit/phpunit": "^4.8", + "squizlabs/php_codesniffer": "1.4.8" + }, + "time": "2017-02-01T23:08:58+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Klein\\": "src/Klein/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris O'Hara", + "email": "cohara87@gmail.com", + "homepage": "http://chris6f.com/", + "role": "Creator/Developer" + }, + { + "name": "Trevor Suarez", + "email": "rican7@gmail.com", + "homepage": "https://trevorsuarez.com/", + "role": "Contributor/Developer" + } + ], + "description": "A lightning fast router for PHP", + "homepage": "https://github.com/klein/klein.php", + "keywords": [ + "boilerplate", + "router", + "routing", + "sinatra" + ] } ] diff --git a/vendor/paragonie/random_compat/lib/cast_to_int.php b/vendor/paragonie/random_compat/lib/cast_to_int.php index be7388df..9a4fab99 100644 --- a/vendor/paragonie/random_compat/lib/cast_to_int.php +++ b/vendor/paragonie/random_compat/lib/cast_to_int.php @@ -38,9 +38,10 @@ if (!is_callable('RandomCompat_intval')) { * through. * * @param int|float $number The number we want to convert to an int - * @param boolean $fail_open Set to true to not throw an exception + * @param bool $fail_open Set to true to not throw an exception * * @return float|int + * @psalm-suppress InvalidReturnType * * @throws TypeError */ diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php index 02160b91..705af526 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php @@ -70,10 +70,10 @@ if (!is_callable('random_bytes')) { $n = ($bytes - $i) > 1073741824 ? 1073741824 : $bytes - $i; - $buf .= Sodium::randombytes_buf($n); + $buf .= Sodium::randombytes_buf((int) $n); } } else { - $buf .= Sodium::randombytes_buf($bytes); + $buf .= Sodium::randombytes_buf((int) $bytes); } if (is_string($buf)) { diff --git a/vendor/paragonie/random_compat/lib/random_int.php b/vendor/paragonie/random_compat/lib/random_int.php index b2ea02d1..5b2143a1 100644 --- a/vendor/paragonie/random_compat/lib/random_int.php +++ b/vendor/paragonie/random_compat/lib/random_int.php @@ -78,7 +78,7 @@ if (!is_callable('random_int')) { } if ($max === $min) { - return $min; + return (int) $min; } /** @@ -185,6 +185,6 @@ if (!is_callable('random_int')) { */ } while (!is_int($val) || $val > $max || $val < $min); - return (int)$val; + return (int) $val; } } diff --git a/vendor/paragonie/random_compat/psalm.xml b/vendor/paragonie/random_compat/psalm.xml index f5013156..1e914098 100644 --- a/vendor/paragonie/random_compat/psalm.xml +++ b/vendor/paragonie/random_compat/psalm.xml @@ -8,6 +8,7 @@ +