• Модуль: salescenter
  • Путь к файлу: ~/bitrix/modules/salescenter/lib/controller/page.php
  • Класс: BitrixSalesCenterControllerPage
  • Вызов: Page::isFrameDenied
public function isFrameDenied($xFrameOptions, $url)
{
	if(!is_array($xFrameOptions))
	{
		$xFrameOptions = [$xFrameOptions];
	}
	$currentHostUri = new Uri(UrlManager::getInstance()->getHostUrl());
	$currentHost = $currentHostUri->getHost();
	foreach($xFrameOptions as $frameOption)
	{
		$frameOption = trim(mb_strtolower($frameOption));
		if($frameOption == 'deny')
		{
			return true;
		}
		if(!$currentHost)
		{
			return true;
		}
		$allowedHost = false;
		if($frameOption == 'sameorigin')
		{
			$allowedHostUri = new Uri($url);
			$allowedHost = $allowedHostUri->getHost();
		}
		elseif(mb_strpos($frameOption, 'allow-from') === 0)
		{
			list(, $allowedHost) = explode(' ', $frameOption);
			if($allowedHost)
			{
				$allowedHostUri = new Uri($allowedHost);
				$allowedHost = $allowedHostUri->getHost();
			}
		}
		if($allowedHost && $currentHost && $allowedHost == $currentHost)
		{
			return false;
		}
	}

	return true;
}