{{ 'Profile'|trans }}
{{ 'Your protected content'|trans }}
- +diff --git a/src/composer.json b/src/composer.json index 0eb7364cb..57270a2c3 100644 --- a/src/composer.json +++ b/src/composer.json @@ -41,7 +41,9 @@ "phpunit/phpunit": "^9.0", "friendsofphp/php-cs-fixer": "^3.8", "symfony/deprecation-contracts": "^3.0.0", - "rector/rector": "^0.15.4" + "rector/rector": "^0.15.4", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan-deprecation-rules": "^1.1" }, "suggest": { "ext-gettext": "*", @@ -53,5 +55,10 @@ }, "autoload-dev": { "psr-0": { "": "../tests/library" } + }, + "config": { + "allow-plugins": { + "phpstan/extension-installer": true + } } } diff --git a/src/composer.lock b/src/composer.lock index 7d12caaea..4006d7009 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a82451ba23e9ac8f2921c25024628dbb", + "content-hash": "a02c67624fb2477ae667587578cabf08", "packages": [ { "name": "composer/ca-bundle", @@ -4372,6 +4372,50 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpstan/extension-installer", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "f06dbb052ddc394e7896fcd1cfcd533f9f6ace40" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f06dbb052ddc394e7896fcd1cfcd533f9f6ace40", + "reference": "f06dbb052ddc394e7896fcd1cfcd533f9f6ace40", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.8.0" + }, + "require-dev": { + "composer/composer": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.2.0" + }, + "time": "2022-10-17T12:59:16+00:00" + }, { "name": "phpstan/phpstan", "version": "1.9.12", @@ -4431,6 +4475,54 @@ ], "time": "2023-01-17T10:44:04+00:00" }, + { + "name": "phpstan/phpstan-deprecation-rules", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", + "reference": "2c6792eda026d9c474c14aa018aed312686714db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/2c6792eda026d9c474c14aa018aed312686714db", + "reference": "2c6792eda026d9c474c14aa018aed312686714db", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.3" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-php-parser": "^1.1", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^9.5" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", + "support": { + "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.1.1" + }, + "time": "2022-12-13T14:26:20+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.23", diff --git a/src/library/Api/Abstract.php b/src/library/Api/Abstract.php index 18415d84d..49342e5b5 100644 --- a/src/library/Api/Abstract.php +++ b/src/library/Api/Abstract.php @@ -123,31 +123,4 @@ class Api_Abstract implements InjectionAwareInterface { return $this->ip; } - - /** - * @deprecated use DI - */ - public function getApiAdmin() - { - if($this->identity instanceof \Model_Admin) { - return $this->di['api_admin']; - } - return $this->di['api_system']; - } - - /** - * @deprecated use DI - */ - public function getApiGuest() - { - return $this->di['api_guest']; - } - - /** - * @deprecated use DI - */ - public function getApiClient() - { - return $this->di['api_client']; - } } \ No newline at end of file diff --git a/src/library/Box/App.php b/src/library/Box/App.php index e3b919b0a..8e7346e72 100644 --- a/src/library/Box/App.php +++ b/src/library/Box/App.php @@ -385,28 +385,4 @@ class Box_App return $this->show404($e); } - - /** - * @deprecated - */ - public function getApiAdmin() - { - return $this->di['api_admin']; - } - - /** - * @deprecated - */ - public function getApiClient() - { - return $this->di['api_client']; - } - - /** - * @deprecated - */ - public function getApiGuest() - { - return $this->di['api_guest']; - } } diff --git a/src/library/Box/Tools.php b/src/library/Box/Tools.php index 2e2910c53..16d9c8baf 100644 --- a/src/library/Box/Tools.php +++ b/src/library/Box/Tools.php @@ -245,86 +245,6 @@ class Box_Tools return stripslashes($string); } - /** - * @Deprecated not used anywhere - * @param $filename - * @return mixed|string - */ - public function get_mime_content_type($filename) - { - $mime_types = array( - - 'txt' => 'text/plain', - 'htm' => 'text/html', - 'html' => 'text/html', - 'php' => 'text/html', - 'css' => 'text/css', - 'js' => 'application/javascript', - 'json' => 'application/json', - 'xml' => 'application/xml', - 'swf' => 'application/x-shockwave-flash', - 'flv' => 'video/x-flv', - - // images - 'png' => 'image/png', - 'jpe' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'gif' => 'image/gif', - 'bmp' => 'image/bmp', - 'ico' => 'image/vnd.microsoft.icon', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'svg' => 'image/svg+xml', - 'svgz' => 'image/svg+xml', - - // archives - 'zip' => 'application/zip', - 'rar' => 'application/x-rar-compressed', - 'exe' => 'application/x-msdownload', - 'msi' => 'application/x-msdownload', - 'cab' => 'application/vnd.ms-cab-compressed', - - // audio/video - 'mp3' => 'audio/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - - // adobe - 'pdf' => 'application/pdf', - 'psd' => 'image/vnd.adobe.photoshop', - 'ai' => 'application/postscript', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - - // ms office - 'doc' => 'application/msword', - 'rtf' => 'application/rtf', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint', - - // open office - 'odt' => 'application/vnd.oasis.opendocument.text', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - ); - - $ext = explode('.',$filename); - $ext = array_pop($ext); - $ext = strtolower($ext); - if (array_key_exists($ext, $mime_types)) { - return $mime_types[$ext]; - } - elseif (function_exists('finfo_open')) { - $finfo = finfo_open(FILEINFO_MIME); - $mimetype = finfo_file($finfo, $filename); - finfo_close($finfo); - return $mimetype; - } - else { - return 'application/octet-stream'; - } - } - public function to_camel_case($str, $capitalise_first_char = false) { if($capitalise_first_char) { $str[0] = strtoupper($str[0]); diff --git a/src/library/Model/ProductTable.php b/src/library/Model/ProductTable.php index 2f354cb57..c6219d268 100644 --- a/src/library/Model/ProductTable.php +++ b/src/library/Model/ProductTable.php @@ -1,4 +1,5 @@ getCode(); - switch ($code) { - case '1W': - return 'w'; - - case '1M': - return 'm'; - - case '3M': - return 'q'; - - case '6M': - return 'b'; - - case '12M': - case '1Y': - return 'a'; - - case '2Y': - return 'bia'; - - case '3Y': - return 'tria'; - - default: - throw new Box_Exception('Unknown period selected ' . $code); + try { + return match ($$code) { + '1W' => 'w', + '1M' => 'm', + '3M' => 'q', + '6M' => 'b', + '12M' => 'a', + '1Y' => 'a', + '2Y' => 'bia', + '3Y' => 'tria' + }; + } catch (\UnhandledMatchError) { + throw new Box_Exception('Unknown period selected ' . $code); } } public function getPricingArray(Model_Product $model) { - if($model->product_payment_id) { + if ($model->product_payment_id) { $service = $this->di['mod_service']('product'); $productPayment = $this->di['db']->load('ProductPayment', $model->product_payment_id); return $service->toProductPaymentApiArray($productPayment); } - throw new \Box_Exception('Product pricing could not be determined. '.get_class($this)); + throw new \Box_Exception('Product pricing could not be determined. ' . get_class($this)); } /** @@ -109,21 +97,21 @@ class Model_ProductTable implements \Box\InjectionAwareInterface { $pp = $this->di['db']->load('ProductPayment', $product->product_payment_id); - if($pp->type == Model_ProductPayment::FREE) { + if ($pp->type == Model_ProductPayment::FREE) { $price = 0; } - if($pp->type == Model_ProductPayment::ONCE) { + if ($pp->type == Model_ProductPayment::ONCE) { $price = (float)$pp->once_setup_price; } - if($pp->type == Model_ProductPayment::RECURRENT) { + if ($pp->type == Model_ProductPayment::RECURRENT) { $period = new Box_Period($config['period']); $key = $this->_getPeriodKey($period); - $price = (float)$pp->{$key.'_setup_price'}; + $price = (float)$pp->{$key . '_setup_price'}; } - if(isset($price)) { + if (isset($price)) { return $price; } @@ -141,28 +129,28 @@ class Model_ProductTable implements \Box\InjectionAwareInterface { $pp = $this->di['db']->load('ProductPayment', $product->product_payment_id); - if($pp->type == Model_ProductPayment::FREE) { + if ($pp->type == Model_ProductPayment::FREE) { $price = 0; } - if($pp->type == Model_ProductPayment::ONCE) { + if ($pp->type == Model_ProductPayment::ONCE) { $price = $pp->once_price; } - if($pp->type == Model_ProductPayment::RECURRENT) { - if(!isset($config['period'])) { - throw new \Box_Exception('Product :id payment type is recurrent, but period was not selected', array(':id'=>$product->id)); + if ($pp->type == Model_ProductPayment::RECURRENT) { + if (!isset($config['period'])) { + throw new \Box_Exception('Product :id payment type is recurrent, but period was not selected', array(':id' => $product->id)); } $period = new Box_Period($config['period']); $key = $this->_getPeriodKey($period); - $price =$pp->{$key.'_price'}; + $price = $pp->{$key . '_price'}; } - if(isset($price)) { + if (isset($price)) { return $price; } throw new \Box_Exception('Unknown Period selected for price'); } -} \ No newline at end of file +} diff --git a/src/modules/Api/Service.php b/src/modules/Api/Service.php index c6c3b8849..37e8f0e7e 100644 --- a/src/modules/Api/Service.php +++ b/src/modules/Api/Service.php @@ -90,28 +90,4 @@ class Service implements \Box\InjectionAwareInterface return (int) $this->di['db']->getCell($sql, $values); } - - /** - * @deprecated use DI - */ - public function getApiGuest() - { - return $this->di['api_guest']; - } - - /** - * @deprecated use DI - */ - public function getApiClient($id) - { - return $this->di['api_client']; - } - - /** - * @deprecated use DI - */ - public function getApiAdmin($id = null) - { - return $this->di['api_admin']; - } } diff --git a/src/modules/Cart/Service.php b/src/modules/Cart/Service.php index d5ccc58ab..369813eee 100644 --- a/src/modules/Cart/Service.php +++ b/src/modules/Cart/Service.php @@ -148,11 +148,6 @@ class Service implements InjectionAwareInterface $productServiceFromList = $productFromList->getService(); - // @deprecated logic - if (method_exists($productServiceFromList, 'prependOrderConfig')) { - $productFromListConfig = $productServiceFromList->prependOrderConfig($productFromList, $productFromListConfig); - } - if (method_exists($productServiceFromList, 'attachOrderConfig')) { $model = $this->di['db']->load('Product', $productFromList->id); $productFromListConfig = $productServiceFromList->attachOrderConfig($model, $productFromListConfig); @@ -438,7 +433,8 @@ class Service implements InjectionAwareInterface 'params' => [ 'ip' => $this->di['request']->getClientAddress(), 'client_id' => $client->id, - 'cart_id' => $cart->id, ], + 'cart_id' => $cart->id, + ], ] ); diff --git a/src/modules/Client/Api/Client.php b/src/modules/Client/Api/Client.php index 98aa11729..83adb7dc3 100644 --- a/src/modules/Client/Api/Client.php +++ b/src/modules/Client/Api/Client.php @@ -22,205 +22,6 @@ namespace Box\Mod\Client\Api; class Client extends \Api_Abstract { - /** - * Get currently logged in client details. - * - * @deprecated moved to profile module - */ - public function get() - { - return $this->getService()->toApiArray($this->getIdentity(), true, $this->getIdentity()); - } - - /** - * Update currently logged in client details. - * - * @optional string $email - new client email. Must not exist on system - * @optional string $last_name - last name - * @optional string $aid - Alternative id. Usually used by import tools. - * @optional string $gender - Gender - values: male|female|nonbinary|other - * @optional string $country - Country - * @optional string $city - city - * @optional string $birthday - Birthday - * @optional string $company - Company - * @optional string $company_vat - Company VAT number - * @optional string $company_number - Company number - * @optional string $type - Identifies client type: company or individual - * @optional string $address_1 - Address line 1 - * @optional string $address_2 - Address line 2 - * @optional string $postcode - zip or postcode - * @optional string $state - country state - * @optional string $phone - Phone number - * @optional string $phone_cc - Phone country code - * @optional string $document_type - Related document type, ie: passport, driving license - * @optional string $document_nr - Related document number, ie: passport number: LC45698122 - * @optional string $notes - Notes about client. Visible for admin only - * @optional string $custom_1 - Custom field 1 - * @optional string $custom_2 - Custom field 2 - * @optional string $custom_3 - Custom field 3 - * @optional string $custom_4 - Custom field 4 - * @optional string $custom_5 - Custom field 5 - * @optional string $custom_6 - Custom field 6 - * @optional string $custom_7 - Custom field 7 - * @optional string $custom_8 - Custom field 8 - * @optional string $custom_9 - Custom field 9 - * @optional string $custom_10 - Custom field 10 - * - * @return bool - * - * @throws Exception - * - * @deprecated moved to profile module - */ - public function update($data = []) - { - $client = $this->getIdentity(); - - $event_params = $data; - $event_params['id'] = $client->id; - $this->di['events_manager']->fire(['event' => 'onBeforeClientProfileUpdate', 'params' => $event_params]); - - $email = $this->di['array_get']($data, 'email', ''); - if (!empty($email)) { - $email = $this->di['tools']->validateAndSanitizeEmail($email); - - $this->getService()->canChangeEmail($client, $email); - - if ($this->getService()->emailAlreadyRegistered($email, $client)) { - throw new \Box_Exception('Can not change email. It is already registered.'); - } - $client->email = strtolower(trim($email)); - } - - $phoneCC = $this->di['array_get']($data, 'phone_cc', $client->phone_cc); - if (!empty($phoneCC)) { - $client->phone_cc = intval($phoneCC); - } - - $client->first_name = $this->di['array_get']($data, 'first_name', $client->first_name); - $client->last_name = $this->di['array_get']($data, 'last_name', $client->last_name); - $client->gender = $this->di['array_get']($data, 'gender', $client->gender); - $client->birthday = $this->di['array_get']($data, 'birthday', $client->birthday); - $client->company = $this->di['array_get']($data, 'company', $client->company); - $client->company_vat = $this->di['array_get']($data, 'company_vat', $client->company_vat); - $client->company_number = $this->di['array_get']($data, 'company_number', $client->company_number); - $client->type = $this->di['array_get']($data, 'type', $client->type); - $client->address_1 = $this->di['array_get']($data, 'address_1', $client->address_1); - $client->address_2 = $this->di['array_get']($data, 'address_2', $client->address_2); - $client->phone = $this->di['array_get']($data, 'phone', $client->phone); - $client->country = $this->di['array_get']($data, 'country', $client->country); - $client->postcode = $this->di['array_get']($data, 'postcode', $client->postcode); - $client->city = $this->di['array_get']($data, 'city', $client->city); - $client->state = $this->di['array_get']($data, 'state', $client->state); - $client->document_type = $this->di['array_get']($data, 'document_type', 'passport'); - $client->document_nr = $this->di['array_get']($data, 'document_nr', ''); - $client->notes = $this->di['array_get']($data, 'notes', $client->notes); - - $client->custom_1 = $this->di['array_get']($data, 'custom_1', $client->custom_1); - $client->custom_2 = $this->di['array_get']($data, 'custom_2', $client->custom_2); - $client->custom_3 = $this->di['array_get']($data, 'custom_3', $client->custom_3); - $client->custom_4 = $this->di['array_get']($data, 'custom_4', $client->custom_4); - $client->custom_5 = $this->di['array_get']($data, 'custom_5', $client->custom_5); - $client->custom_6 = $this->di['array_get']($data, 'custom_6', $client->custom_6); - $client->custom_7 = $this->di['array_get']($data, 'custom_7', $client->custom_7); - $client->custom_8 = $this->di['array_get']($data, 'custom_8', $client->custom_8); - $client->custom_9 = $this->di['array_get']($data, 'custom_9', $client->custom_9); - $client->custom_10 = $this->di['array_get']($data, 'custom_10', $client->custom_10); - - $client->updated_at = date('Y-m-d H:i:s'); - $this->di['db']->store($client); - - $this->di['events_manager']->fire(['event' => 'onAfterClientProfileUpdate', 'params' => ['id' => $client->id]]); - - $this->di['logger']->info('Updated profile'); - - return true; - } - - /** - * Retrieve current API key. - * - * @deprecated moved to profile module - */ - public function api_key_get($data) - { - $client = $this->getIdentity(); - - return $client->api_token; - } - - /** - * Generate new API key. - * - * @deprecated moved to profile module - */ - public function api_key_reset($data) - { - $client = $this->getIdentity(); - - $client->api_token = $this->di['tools']->generatePassword(32); - $client->updated_at = date('Y-m-d H:i:s'); - $this->di['db']->store($client); - - $this->di['logger']->info('Generated new API key'); - - return $client->api_token; - } - - /** - * Change client area password. - * - * @deprecated moved to profile module - */ - public function change_password($data) - { - $required = [ - 'password' => 'Password required', - 'password_confirm' => 'Password confirmation required', - ]; - $this->di['validator']->checkRequiredParamsForArray($required, $data); - $this->di['validator']->isPasswordStrong($data['password']); - - if ($data['password'] != $data['password_confirm']) { - throw new \Box_Exception('Passwords do not match.'); - } - - $event_params = $data; - $event_params['id'] = $this->getIdentity()->id; - $this->di['events_manager']->fire(['event' => 'onBeforeClientProfilePasswordChange', 'params' => $event_params]); - - $this->di['validator']->isPasswordStrong($data['password']); - - $client = $this->getIdentity(); - $client->pass = $this->di['password']->hashIt($data['password']); - $this->di['db']->store($client); - - $this->di['events_manager']->fire(['event' => 'onAfterClientProfilePasswordChange', 'params' => ['id' => $client->id]]); - - $this->di['logger']->info('Changed profile password'); - - return true; - } - - /** - * Clear session and logout. - * - * @return bool - * - * @deprecated moved to profile module - */ - public function logout() - { - if ($_COOKIE) { // testing env fix - $this->di['cookie']->set('BOXCLR', '', time() - 3600, '/'); - } - $this->di['session']->delete('client'); - $this->di['session']->delete('client_id'); - $this->di['logger']->info('Logged out'); - - return true; - } - /** * Get payments information. * diff --git a/src/modules/Client/Controller/Client.php b/src/modules/Client/Controller/Client.php index e2d8ce08f..3f63fc83b 100644 --- a/src/modules/Client/Controller/Client.php +++ b/src/modules/Client/Controller/Client.php @@ -38,9 +38,6 @@ class Client implements \Box\InjectionAwareInterface public function register(\Box_App &$app) { - // @deprecated - $app->get('/client/me', 'get_profile', [], static::class); - $app->get('/client/reset-password-confirm/:hash', 'get_reset_password_confirm', ['hash' => '[a-z0-9]+'], static::class); $app->get('/client', 'get_client_index', [], static::class); $app->get('/client/logout', 'get_client_logout', [], static::class); @@ -48,22 +45,6 @@ class Client implements \Box\InjectionAwareInterface $app->get('/client/confirm-email/:hash', 'get_client_confirmation', ['page' => '[a-z0-9-]+'], static::class); } - /** - * @deprecated - */ - public function get_profile(\Box_App $app) - { - return $app->redirect('/client/profile'); - } - - /** - * @deprecated - */ - public function get_balance(\Box_App $app) - { - return $app->redirect('/client/balance'); - } - public function get_client_index(\Box_App $app) { $this->di['is_client_logged']; diff --git a/src/modules/Client/html_client/mod_client_balance.html.twig b/src/modules/Client/html_client/mod_client_balance.html.twig index 0d107170a..1cbf00575 100644 --- a/src/modules/Client/html_client/mod_client_balance.html.twig +++ b/src/modules/Client/html_client/mod_client_balance.html.twig @@ -5,7 +5,7 @@ {% block meta_title %}{{ 'Payment history'|trans }}{% endblock %} {% block breadcrumb %}
{{ 'Your protected content'|trans }}
- +
- * Array
- * (
- * [id] => 1
- * [role] => staff
- * [admin_group_id] => 1
- * [email] => demo@boxbilling.org
- * [pass] => 89e495e7941cf9e40e6980d14a16bf023ccd4c91
- * [name] => Demo Administrator
- * [signature] => Sincerely Yours, Demo Administrator
- * [status] => active
- * [api_token] => 29baba87f1c120f1b7fc6b0139167003
- * [created_at] => 1310024416
- * [updated_at] => 1310024416
- * )
- *
- */
- public function profile_get()
- {
- return $this->di['db']->toArray($this->getIdentity());
- }
-
- /**
- * Clear session data and logout from system.
- *
- * @deprecated moved to profile module
- *
- * @codeCoverageIgnore
- *
- * @return bool
- */
- public function profile_logout()
- {
- if ($_COOKIE) { // testing env fix
- $this->di['cookie']->set('BOXADMR', '', time() - 3600, '/');
- }
- $this->di['session']->delete('admin');
- $this->di['logger']->info('Logged out');
-
- return true;
- }
-
- /**
- * Update currently logged in staff member details.
- *
- * @optional string $email - new email
- * @optional string $name - new name
- * @optional string $signature - new signature
- *
- * @deprecated moved to profile module
- *
- * @return bool
- *
- * @throws Exception
- *
- * @codeCoverageIgnore
- */
- public function profile_update($data)
- {
- $event_params = $data;
- $event_params['id'] = $this->getIdentity()->id;
- $this->di['events_manager']->fire(['event' => 'onBeforeAdminStaffProfileUpdate', 'params' => $event_params]);
-
- $admin = $this->getIdentity();
-
- if (!is_null($data['email'])) {
- $data['email'] = $this->di['tools']->validateAndSanitizeEmail($data['email']);
- }
-
- $admin->email = $this->di['array_get']($data, 'email', $admin->email);
- $admin->name = $this->di['array_get']($data, 'name', $admin->name);
- $admin->signature = $this->di['array_get']($data, 'signature', $admin->signature);
- $admin->updated_at = date('Y-m-d H:i:s');
- $this->di['db']->store($admin);
-
- $event_params = [];
- $event_params['id'] = $this->getIdentity()->id;
- $this->di['events_manager']->fire(['event' => 'onAfterAdminStaffProfileUpdate', 'params' => $event_params]);
-
- $this->di['logger']->info('Updated profile');
-
- return true;
- }
-
- /**
- * Generates new API token for currently logged in staff member.
- *
- * @deprecated moved to profile module
- *
- * @return bool
- *
- * @codeCoverageIgnore
- */
- public function profile_generate_api_key($data)
- {
- $admin = $this->getIdentity();
-
- $event_params = [];
- $event_params['id'] = $this->getIdentity()->id;
- $this->di['events_manager']->fire(['event' => 'onBeforeAdminStaffApiKeyChange', 'params' => $event_params]);
-
- $admin->api_token = $this->di['tools']->generatePassword(32);
- $admin->updated_at = date('Y-m-d H:i:s');
- $this->di['db']->store($admin);
-
- $this->di['events_manager']->fire(['event' => 'onAfterAdminStaffApiKeyChange', 'params' => $event_params]);
-
- $this->di['logger']->info('Generated new API key');
-
- return true;
- }
-
- /**
- * Change password for currently logged in staff member.
- *
- * @param string $password - new password
- * @param string $password_confirm - repeat new password
- *
- * @return bool
- *
- * @deprecated moved to profile module
- *
- * @throws Exception
- *
- * @codeCoverageIgnore
- */
- public function profile_change_password($data)
- {
- $required = [
- 'password' => 'Password required',
- 'password_confirm' => 'Password confirmation required',
- ];
- $this->di['validator']->checkRequiredParamsForArray($required, $data);
-
- if ($data['password'] != $data['password_confirm']) {
- throw new \Box_Exception('Passwords do not match');
- }
-
- $this->di['validator']->isPasswordStrong($data['password']);
-
- $event_params = $data;
- $event_params['id'] = $this->getIdentity()->id;
- $this->di['events_manager']->fire(['event' => 'onBeforeAdminStaffProfilePasswordChange', 'params' => $event_params]);
-
- $admin = $this->getIdentity();
-
- $admin->pass = $data['password'];
- $admin->updated_at = date('Y-m-d H:i:s');
- $this->di['db']->store($admin);
-
- $event_params = [];
- $event_params['id'] = $this->getIdentity()->id;
- $this->di['events_manager']->fire(['event' => 'onAfterAdminStaffProfilePasswordChange', 'params' => $event_params]);
-
- $this->di['logger']->info('Changed profile password');
-
- return true;
- }
-
/**
* Deletes admin login logs with given IDs.
*
diff --git a/src/modules/System/Api/Admin.php b/src/modules/System/Api/Admin.php
index f9c96392d..8edcad5f0 100644
--- a/src/modules/System/Api/Admin.php
+++ b/src/modules/System/Api/Admin.php
@@ -22,25 +22,6 @@ namespace Box\Mod\System\Api;
class Admin extends \Api_Abstract
{
- /**
- * Return system setting param.
- *
- * @deprecated
- *
- * @param string $key - parameter key name
- *
- * @return string
- */
- public function param($data)
- {
- $required = [
- 'key' => 'Parameter key is missing',
- ];
- $this->di['validator']->checkRequiredParamsForArray($required, $data);
-
- return $this->getService()->getParamValue($data['key']);
- }
-
/**
* Get all defined system params.
*
diff --git a/src/themes/huraga/html/layout_default.html.twig b/src/themes/huraga/html/layout_default.html.twig
index b99a58bff..bd5124b5d 100644
--- a/src/themes/huraga/html/layout_default.html.twig
+++ b/src/themes/huraga/html/layout_default.html.twig
@@ -58,7 +58,7 @@
{% endif %}
{% if client %}
- {% set profile = client.client_get %}
+ {% set profile = client.profile_get %}
{% endif %}
{% set company = guest.system_company %}
@@ -108,7 +108,7 @@
{% if settings.top_menu_profile %}