• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/groupdav.php
  • Класс: constCDavGroupDav
  • Вызов: CDavGroupDav::GET
protected function GET(&$arResult)
{
	$request = $this->request;
	$response = $this->response;

	$arRequestPath = self::ParsePath($request->GetPath());

	if (!$arRequestPath["id"] || !$arRequestPath["account"] || !in_array($arRequestPath["application"], array('addressbook', 'calendar', 'infolog')))
	{
		$arResources = array();

		$retVal = $this->PROPFIND($arResources);
		if ($retVal !== true)
			return $retVal;

		$response->TurnOnHtmlOutput();

		$response->AddHeader('Content-type: text/html; charset=utf-8');
		$response->AddLine("nnt".$this->GetDavPoweredBy().' '.htmlspecialcharsbx($request->GetPath())."");
		$response->AddLine("t");
		$response->AddLine("t");
		$response->AddLine("n");

		$path = '/bitrix/groupdav.php';
		$s = '';
		$arPath = explode('/', trim($request->GetPath(), "/"));
		foreach ($arPath as $n => $name)
		{
			$path .= '/'.$name;
			$s .= "".htmlspecialcharsbx($name.'/')."";
		}
		$response->AddLine('

'.$this->GetDavPoweredBy().' '.$s."

"); $n = 0; $class = 'row2'; foreach ($arResources as $resource) { $arResourceProps = $resource->GetProperties(); if (!isset($collectionProps)) { $collectionProps = $this->ConvertPropertiesToArray($arResourceProps); $response->AddLine("

Collection listing: %s

", htmlspecialcharsbx($collectionProps['DAV:displayname'])); continue; } if (!$n++) $response->AddLine("nt"); $props = $this->ConvertPropertiesToArray($arResourceProps); $class = ($class == 'row1' ? 'row2' : 'row1'); if (mb_substr($resource->GetPath(), -1) == '/') $name = basename(mb_substr($resource->GetPath(), 0, -1)).'/'; else $name = basename($resource->GetPath()); $response->AddLine("tnttntt", $n, htmlspecialcharsbx('/bitrix/groupdav.php'.$resource->GetPath()), htmlspecialcharsbx($name)); $response->AddLine("tt", $props['DAV:getcontentlength']); $response->AddLine("tt", (!empty($props['DAV:getlastmodified']) ? date('Y-m-d H:i:s', $props['DAV:getlastmodified']) : '')); $response->AddLine("tt", $props['DAV:getetag']); $response->AddLine("tt", htmlspecialcharsbx($props['DAV:getcontenttype'])); $response->AddLine("ttnt", $this->RenderPropertyValue($props['DAV:resourcetype'])); } if (!$n) $response->AddLine("

Collection empty.

"); else $response->AddLine("
#NameSizeLast modifiedETagContent typeResource type
%s%s%s%s%s%s%s
"); $response->AddLine("

Properties

"); $response->AddLine("nt"); foreach ($collectionProps as $name => $value) { $class = ($class == 'row1' ? 'row2' : 'row1'); $ns = explode(':', $name); $name = array_pop($ns); $ns = implode(':', $ns); $response->AddLine("tntt", $class, htmlspecialcharsbx($ns), htmlspecialcharsbx($name)); $response->AddLine("ttnt", $this->RenderPropertyValue($value)); } $response->AddLine("
NamespaceNameValue
%s%s%s
"); $response->AddLine("n"); return "200 OK"; } if ($handler = $this->GetApplicationHandler($arRequestPath["application"])) return $handler->Get($arResult, $arRequestPath["id"], $arRequestPath["site"], $arRequestPath["account"], $arRequestPath["path"]); return '501 Not Implemented'; }