• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/groupdav.php
  • Класс: constCDavGroupDav
  • Вызов: CDavGroupDav::PROPFIND
protected function PROPFIND(&$arResources, $method = 'PROPFIND')
{
	$arResources = array();

	$arRequestPath = self::ParsePath($this->request->GetPath());
	$accountPrefixPath = CDav::CheckIfRightSlashAdded($arRequestPath["accountPrefix"]);

	$requestDocument = $this->request->GetXmlDocument();

	if ($this->request->getAgent() == 'lightning' && empty($arRequestPath['path']))
		return false;

	$application = $arRequestPath["application"];
	if (!$application)		// If it's the user root folder (it contains applications)
	{
		if (!$arRequestPath["account"])
			$arRequestPath["account"] = array("user", $this->request->GetPrincipal()->Id());

		$arAccount = CDavAccount::GetAccountById($arRequestPath["account"]);

		$resource = new CDavResource($accountPrefixPath);

		$resource->AddProperty('resourcetype', array('collection', ''));

		$this->GetCollectionProperties(
			$resource,
			$arRequestPath["site"],
			$arRequestPath["account"],
			$arRequestPath["path"]
		);

		foreach ($this->arApplications as $app)
		{
			if (($handler = $this->GetApplicationHandler($app)) && method_exists($handler, 'GetCollectionProperties'))
				$handler->GetCollectionProperties($resource, $arRequestPath["site"], $arRequestPath["account"], null, $arRequestPath["path"], 0);
		}

		$arResources[] = $resource;

		if ($this->request->GetDepth())
		{
			if (mb_strlen($accountPrefixPath) == 1)
			{
				$resource = new CDavResource('/principals/');
				$resource->AddProperty('displayname', GetMessage("DAV_PRINCIPALS"));
				$resource->AddProperty('resourcetype', array('principals', ''));
				$resource->AddProperty('current-user-principal', array('href', $this->request->GetPrincipalUrl()));
				$arResources[] = $resource;
			}

			foreach ($this->arApplications as $app)
			{
				if (($handler = $this->GetApplicationHandler($app)) && method_exists($handler, 'GetHomeCollectionUrl'))
					$resourcePath = $handler->GetHomeCollectionUrl($arRequestPath["site"], $arRequestPath["account"], $arRequestPath["path"]);
				else
					$resourcePath = $accountPrefixPath.$app;

				$resource = new CDavResource($resourcePath);

				$this->GetCollectionProperties(
					$resource,
					$arRequestPath["site"],
					$arRequestPath["account"],
					$arRequestPath["path"]
				);

				if (method_exists($handler, 'GetCollectionProperties'))
				{
					$handler->GetCollectionProperties(
						$resource,
						$arRequestPath["site"],
						$arRequestPath["account"],
						$app,
						$arRequestPath["path"],
						0
					);
				}

				$resource->AddProperty('getetag', $app);

				$arResources[] = $resource;
			}
		}

		return true;
	}

	if ($handler = $this->GetApplicationHandler($application))
	{
		if ($application != "principals" && $method != 'REPORT' && $arRequestPath["id"] == null)
		{
			$resource = new CDavResource($this->request->GetPath());

			$this->GetCollectionProperties(
				$resource,
				$arRequestPath["site"],
				$arRequestPath["account"],
				$arRequestPath["path"]
			);

			if (method_exists($handler, 'GetCollectionProperties'))
			{
				$handler->GetCollectionProperties(
					$resource,
					$arRequestPath["site"],
					$arRequestPath["account"],
					$application,
					$arRequestPath["path"],
					($application == 'addressbook' && $this->request->GetAgent() == 'kde') ? BX_GW_SKIP_EXTRA_TYPES : 0
				);
			}

			$arResources[] = $resource;

			if ($this->request->GetDepth() == 0)
				return true;
		}

		return $handler->Propfind($arResources, $arRequestPath["site"], $arRequestPath["account"], $arRequestPath["path"], $arRequestPath["id"]);
	}

	return '501 Not Implemented';
}