- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/domain/verification/service.php
- Класс: BitrixSaleDomainVerificationService
- Вызов: Service::landingDomainVerificationHandler
static function landingDomainVerificationHandler(MainEvent $event): MainEntityEventResult
{
$result = new MainEntityEventResult;
if (class_exists('LandingPubComponent'))
{
$code = $event->getParameter('code');
if ($code === LandingPubComponent::ERROR_STATUS_NOT_FOUND)
{
$landingInstance = LandingPubComponent::getMainInstance();
if ($landingInstance)
{
$res = LandingSite::getList([
'select' => [
'DOMAIN_NAME' => 'DOMAIN.DOMAIN'
],
'filter' => [
'CHECK_PERMISSIONS' => 'N',
'ID' => $landingInstance['SITE_ID']
]
]);
if ($row = $res->fetch())
{
$context = MainApplication::getInstance()->getContext();
$realFilePath = $context->getServer()->get('REAL_FILE_PATH');
if (!$realFilePath)
{
$realFilePath = $_SERVER['REAL_FILE_PATH'] ?? null;
}
if (!$realFilePath)
{
$realFilePath = $context->getServer()->get('SCRIPT_NAME');
}
$requestURL = $context->getRequest()->getRequestedPage();
$landingUrl = LandingSite::getPublicUrl($landingInstance['SITE_ID']);
$realFilePath = str_replace('/index.php', '/', $realFilePath);
if (mb_strpos($landingUrl, $realFilePath) === false)
{
$requestURL = str_replace($realFilePath.$landingInstance['SITE_ID'], '', $requestURL);
}
$domainVerification = BaseManager::searchByRequest($row['DOMAIN_NAME'], $requestURL);
if (!$domainVerification)
{
$pubPath = BitrixLandingManager::getPublicationPath($landingInstance['SITE_ID']);
$domainVerification = BaseManager::searchByRequest($row['DOMAIN_NAME'], substr($requestURL, strlen($pubPath)-1));
}
if ($domainVerification)
{
$result->modifyFields([
'code' => LandingPubComponent::ERROR_STATUS_OK
]);
self::setEndBufferContentHandler($domainVerification['CONTENT']);
}
}
}
}
}
return $result;
}