23 $result =
new Main\Entity\EventResult;
25 if (class_exists(
'\LandingPubComponent'))
27 $code = $event->getParameter(
'code');
28 if ($code === \LandingPubComponent::ERROR_STATUS_NOT_FOUND)
30 $landingInstance = \LandingPubComponent::getMainInstance();
33 $res = Landing\Site::getList([
35 'DOMAIN_NAME' =>
'DOMAIN.DOMAIN'
38 'CHECK_PERMISSIONS' =>
'N',
39 'ID' => $landingInstance[
'SITE_ID']
42 if ($row = $res->fetch())
44 $context = Main\Application::getInstance()->getContext();
46 $realFilePath = $context->getServer()->get(
'REAL_FILE_PATH');
49 $realFilePath = $_SERVER[
'REAL_FILE_PATH'] ??
null;
53 $realFilePath = $context->getServer()->get(
'SCRIPT_NAME');
56 $requestURL = $context->getRequest()->getRequestedPage();
58 $landingUrl = Landing\Site::getPublicUrl($landingInstance[
'SITE_ID']);
59 $realFilePath = str_replace(
'/index.php',
'/', $realFilePath);
60 if (mb_strpos($landingUrl, $realFilePath) ===
false)
62 $requestURL = str_replace($realFilePath.$landingInstance[
'SITE_ID'],
'', $requestURL);
65 $domainVerification = BaseManager::searchByRequest($row[
'DOMAIN_NAME'], $requestURL);
67 if (!$domainVerification)
69 $pubPath = \Bitrix\Landing\Manager::getPublicationPath($landingInstance[
'SITE_ID']);
70 $domainVerification = BaseManager::searchByRequest($row[
'DOMAIN_NAME'], substr($requestURL, strlen($pubPath)-1));
73 if ($domainVerification)
75 $result->modifyFields([
76 'code' => \LandingPubComponent::ERROR_STATUS_OK
79 self::setEndBufferContentHandler($domainVerification[
'CONTENT']);