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/landing/lib/controller/ |
Upload File : |
<?php namespace Bitrix\Landing\Controller; use \Bitrix\Main\Engine\Controller; class Cookies extends Controller { public function getDefaultPreFilters() { return []; } /** * Returns site cookie agreements. * @param int $siteId Site id. * @return array */ public function getAgreementsAction(int $siteId): array { $mainAgreement = \Bitrix\Landing\Site\Cookies::getMainAgreement( \Bitrix\Landing\Hook\Page\Cookies::getAgreementIdBySiteId($siteId) ); $agreements = \Bitrix\Landing\Site\Cookies::getAgreements($siteId, true); $data = [ 'main' => $mainAgreement, 'analytic' => array_filter($agreements, function($item) { return $item['ACTIVE'] == 'Y' && $item['TYPE'] == 'analytic'; }), 'technical' => array_filter($agreements, function($item) { return $item['ACTIVE'] == 'Y' && $item['TYPE'] == 'technical'; }), 'other' => array_filter($agreements, function($item) { return $item['ACTIVE'] == 'Y' && $item['TYPE'] == 'other'; }) ]; foreach ($data as $key => $val) { if (!$val) { unset($data[$key]); } } return $data; } /** * Accepts agreements from user. * @param int $siteId Site id. * @param array $accepted Agreements codes which user has accepted. * @return void */ public function acceptAgreementsAction(int $siteId, array $accepted = []): void { \Bitrix\Landing\Site\Cookies::acceptAgreement($siteId, $accepted); } }