• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/symlinkhelper.php
  • Класс: CWebDavSymlinkHelper
  • Вызов: CWebDavSymlinkHelper::isLink
static function isLink($entityType, $entityId, $sectionData)
{
	if($entityType == self::ENTITY_TYPE_USER)
	{
		$userLib = CWebDavIblock::LibOptions('user_files', false, SITE_ID);
		if ($userLib && isset($userLib['id']) && ($iblockId = intval($userLib['id'])))
		{
			if($iblockId != $sectionData['IBLOCK_ID'])
			{
				return true;
			}
			$chain = self::getNavChain($sectionData['IBLOCK_ID'], $sectionData['ID']);
			$rootSection = reset($chain);
			if($rootSection['CREATED_BY'] != $entityId)
			{
				return true;
			}
		}
		return false;
	}
	elseif($entityType == self::ENTITY_TYPE_GROUP)
	{
		$groupLib = CWebDavIblock::LibOptions('group_files', false, SITE_ID);
		if ($groupLib && isset($groupLib['id']) && ($iblockId = intval($groupLib['id'])))
		{
			if($iblockId != $sectionData['IBLOCK_ID'])
			{
				return true;
			}
			$chain = self::getNavChain($sectionData['IBLOCK_ID'], $sectionData['ID']);
			$rootSection = reset($chain);
			if($rootSection['SOCNET_GROUP_ID'] != $entityId)
			{
				return true;
			}
		}
		return false;
	}
	elseif($entityType == self::ENTITY_TYPE_SECTION) //or any another context
	{
		$margins = CIBlockSection::GetList(array(), array(
			'ID' => $entityId,
			'CHECK_PERMISSIONS' => 'N',
		), false, array('LEFT_MARGIN', 'RIGHT_MARGIN', 'IBLOCK_ID'));
		if(!$margins)
		{
			return null;
		}
		$margins = $margins->fetch();

		if($margins['IBLOCK_ID'] != $sectionData['IBLOCK_ID'])
		{
			return true;
		}
		if($sectionData['ID'] == $entityId)
		{
			return false;
		}

		$isSubSection = CIBlockSection::GetList(array(), array(
			'ID' => $sectionData['ID'],
			'IBLOCK_ID' => $sectionData['IBLOCK_ID'],
			'CHECK_PERMISSIONS' => 'N',
			'>LEFT_BORDER' => $margins['LEFT_MARGIN'],
			' $margins['RIGHT_MARGIN'],
		), false, array('ID'));
		if(!$isSubSection || !($isSubSection = $isSubSection->fetch()))
		{
			//not find real subsection === symlink
			return true;
		}
		return empty($isSubSection['ID']);
	}
	elseif($entityType == self::ENTITY_TYPE_SHARED)
	{
		return false;
	}

	throw new Exception('Unknown type ' . $entityType);
}