1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
entityeditorconfigsigner.php
См. документацию.
1<?php
2
3namespace Bitrix\UI\Form;
4
5use Bitrix\Main\Security\Sign\Signer;
6use Bitrix\Main\Web\Json;
7use Bitrix\Main\Security\Sign\BadSignatureException;
8use Bitrix\Main\Engine\CurrentUser;
9
11{
12 public function __construct(private string $configId)
13 {
14 }
15
16 private const SIGNED_PARAMS_SALT = 'EntityEditorConfigSigner';
17
18 public function sign(array $paramsToSign): string
19 {
20 $paramsToSign['userId'] = (int)CurrentUser::get()->getId(); // must be user dependant
21 $paramsToSign['configId'] = $this->configId; // must be editor dependant
22
23 return (new Signer())->sign(Json::encode($paramsToSign), $this->getSalt());
24 }
25
26 public function unsign(string $signedParams): ?array
27 {
28 try
29 {
30 $params = (new Signer())->unsign($signedParams, $this->getSalt());
31 $params = (array)Json::decode($params);
32 if (($params['userId'] ?? 0) !== (int)CurrentUser::get()->getId())
33 {
34 return null;
35 }
36 if (($params['configId'] ?? '') !== $this->configId)
37 {
38 return null;
39 }
40 unset($params['userId']);
41 unset($params['configId']);
42
43 return $params;
44 }
45 catch (BadSignatureException $e)
46 {
47 return null;
48 }
49 }
50
51 private function getSalt(): string
52 {
53 return self::SIGNED_PARAMS_SALT;
54 }
55}
__construct(private string $configId)
Определения entityeditorconfigsigner.php:12
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799