Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sender/lib/preset/consent/ |
Upload File : |
<?php namespace Bitrix\Sender\Preset\Consent; use Bitrix\Main\Localization\Loc; use Bitrix\Main\UserConsent\Agreement; use Bitrix\Main\UserConsent\Internals\AgreementTable; Loc::loadMessages(__FILE__); class ConsentInstaller { public static function run(string $lang): string { self::createConsent('sender_approve_confirmation_', $lang); return ''; } private static function createConsent(string $code, string $lang) { $preparedCode = $code.$lang; $existed = AgreementTable::getList(array( 'select' => ['ID'], 'filter' => [ '=CODE' => $preparedCode, '=LANGUAGE_ID' => $lang, ], 'limit' => 1 )); if ($existed->fetch()) { return ''; } $title = Loc::getMessage($code.'title', null, $lang); if (!$title) { return '\\Bitrix\\Sender\\Preset\\Consent\\ConsentInstaller::run(\''.$lang.'\')'; } AgreementTable::add(array( "CODE" => $preparedCode, "NAME" => $title, "TYPE" => Agreement::TYPE_CUSTOM, "LANGUAGE_ID" => $lang, "AGREEMENT_TEXT" => Loc::getMessage($code . 'text',null, $lang), "LABEL_TEXT" => Loc::getMessage($code . 'label', null, $lang), )); } }