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/restriction/ |
Upload File : |
<?php namespace Bitrix\Landing\Restriction; use \Bitrix\Bitrix24\Feature; use \Bitrix\Main\Entity; class Landing { /** * Checks restriction for creating and publication page. * @param string $code Restriction code (not used here). * @param array $params Additional params. * @return bool */ public static function isCreatingAllowed(string $code, array $params): bool { if (!\Bitrix\Main\Loader::includeModule('bitrix24')) { return true; } $optPrefix = 'landing_page_'; $optSuffix = ($params['action_type'] == 'publication') ? '_publication' : ''; $variableCode = $optPrefix . strtolower($params['type']) . $optSuffix; $limit = (int) Feature::getVariable($variableCode); if ($limit) { $filter = [ 'CHECK_PERMISSIONS' => 'N', '=SITE.TYPE' => $params['type'], '!=SITE.SPECIAL' => 'Y' ]; if ($params['action_type'] == 'publication') { $filter['=ACTIVE'] = 'Y'; } if ( isset($params['filter']) && is_array($params['filter']) ) { $filter = array_merge( $filter, $params['filter'] ); } $check = \Bitrix\Landing\Landing::getList([ 'select' => [ 'CNT' => new Entity\ExpressionField('CNT', 'COUNT(*)') ], 'filter' => $filter, 'group' => [] ])->fetch(); if ($check && $check['CNT'] >= $limit) { return false; } } return true; } }