Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
SettingsEncryptor.php
1<?php
2
4
7use Bitrix\MessageService\Providers\Encryptor;
9
11{
12 use Encryptor;
13
14 protected static $moduleId = 'messageservice';
15
16 function execute(array &$option)
17 {
18 foreach (SmsManager::getRegisteredSenderList() as $sender)
19 {
20 $optionManager = new Option($sender->getType(), $sender->getId());
21
22 $providerOptions = $optionManager->getOptions();
23 $providerOptions = serialize($providerOptions);
24
25 $cryptoKey = mb_strtolower($sender->getType()) . '-' . $sender->getId();
26 $providerOptions = self::encrypt($providerOptions, $cryptoKey);
27
28 $dbOptionName = 'sender.' . mb_strtolower($sender->getType()) . '.' . $sender->getId();
29
30 $data = [
31 'crypto' => 'Y',
32 'data' => $providerOptions
33 ];
34
35 \Bitrix\Main\Config\Option::set('messageservice', $dbOptionName, serialize($data));
36 }
37
38 return false;
39 }
40}