From d9e5cda0e09b29d189ee729053a126dc47c52302 Mon Sep 17 00:00:00 2001 From: merelendor Date: Tue, 20 Aug 2024 11:16:41 +0300 Subject: [PATCH] Add support of user registration rules for email domain / phone country --- api/index.php | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/api/index.php b/api/index.php index bc8d9dc..39141a7 100644 --- a/api/index.php +++ b/api/index.php @@ -4,6 +4,12 @@ header('Content-Type: application/json; charset=utf-8'); use \Bitrix\Main\Service\GeoIp; use \Bitrix\Main\Grid\Declension; +use \Bitrix\Highloadblock\HighloadBlockTable as HighloadBT; +use \Bitrix\Main\Context, + \Bitrix\Main\Type\DateTime, + \Bitrix\Main\Loader, + \Bitrix\Iblock; + $httpClient = new \Bitrix\Main\Web\HttpClient(); @@ -62,11 +68,6 @@ $secret_crm = "lk_evolution_the_best_leasing_company_of_the_world_sSOvumhogyAtZy $auth = []; -use Bitrix\Main\Context, - Bitrix\Main\Type\DateTime, - Bitrix\Main\Loader, - Bitrix\Iblock; - include_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/php_interface/classes/tfpdf/tfpdf.php'); class PDF extends tFPDF @@ -870,6 +871,30 @@ switch($PARAM_1) } break; + case "rules": + { + if(CModule::IncludeModule('highloadblock')) + { + $hlblock = HighloadBT::getById(HLBLOCK_REGRULES)->fetch(); + $entity = HighloadBT::compileEntity(HLBLOCK_REGRULES)->getDataClass(); + + $rsData = $entity::getList(array( + 'select' => array('*'), + )); + + $response = []; + while($entry = $rsData->fetch()) + { + array_push($response, [ "type" => $entry['UF_REGRULES_TYPE'], "value" => $entry['UF_REGRULES_VALUE'] ]); + } + + print json_encode($response); + } + + die(); + } + break; + default: { print json_encode([