403Webshell
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/ilovecveti.ru/bitrix/modules/sale/lib/domain/verification/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/sale/lib/domain/verification/service.php
<?php
namespace Bitrix\Sale\Domain\Verification;

use Bitrix\Main,
	Bitrix\Landing;

/**
 * Class Service
 * @package Bitrix\Main\Domain
 */
final class Service
{
	/**
	 * @param Main\Event $event
	 * @return Main\Entity\EventResult
	 * @throws Main\ArgumentException
	 * @throws Main\ObjectPropertyException
	 * @throws Main\SystemException
	 * @noinspection PhpUnused
	 */
	public static function landingDomainVerificationHandler(Main\Event $event): Main\Entity\EventResult
	{
		$result = new Main\Entity\EventResult;

		if (class_exists('\LandingPubComponent'))
		{
			$code = $event->getParameter('code');
			if ($code === \LandingPubComponent::ERROR_STATUS_NOT_FOUND)
			{
				$landingInstance = \LandingPubComponent::getMainInstance();
				if ($landingInstance)
				{
					$res = Landing\Site::getList([
						'select' => [
							'DOMAIN_NAME' => 'DOMAIN.DOMAIN'
						],
						'filter' => [
							'CHECK_PERMISSIONS' => 'N',
							'ID' => $landingInstance['SITE_ID']
						]
					]);
					if ($row = $res->fetch())
					{
						$context = Main\Application::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 = Landing\Site::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 = \Bitrix\Landing\Manager::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;
	}

	/**
	 * @throws Main\ArgumentException
	 * @throws Main\LoaderException
	 * @throws Main\ObjectPropertyException
	 * @throws Main\SystemException
	 * @noinspection PhpUnused
	 */
	public static function b24DomainVerificationHandler(): void
	{
		if (!Main\ModuleManager::isModuleInstalled('bitrix24'))
		{
			return;
		}

		$isFound = false;
		$managerList = BaseManager::getManagerList();

		/** @var BaseManager $manager */
		foreach (array_keys($managerList) as $manager)
		{
			if (strpos($_SERVER['REQUEST_URI'], $manager::getPathPrefix()) !== false)
			{
				$isFound = true;
				break;
			}
		}

		if ($isFound)
		{
			$context = Main\Application::getInstance()->getContext();
			$serverName = $context->getServer()->getServerName();
			$requestUri = $context->getServer()->getRequestUri();

			$hasParams = strpos($requestUri, '?');
			$requestUriWithoutParams = ($hasParams !== false)
				? substr($requestUri, 0, $hasParams)
				: $requestUri;

			$domainVerification = BaseManager::searchByRequest($serverName, $requestUriWithoutParams);
			if ($domainVerification)
			{
				self::setEndBufferContentHandler($domainVerification['CONTENT']);
			}

			\CHTTP::SetStatus('200 OK');
		}
	}

	/**
	 * @param $content
	 */
	public static function setEndBufferContentHandler($content): void
	{
		$eventManager = Main\EventManager::getInstance();
		$eventManager->addEventHandler(
			'main',
			'onEndBufferContent',
			static function(&$resultContent) use ($content)
			{
				header('Content-Type: text/plain');
				$resultContent = $content;
			}
		);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit