- Модуль: 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| # | Name | Size | Last modified | ETag | Content type | Resource type |
");
$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("tntt| %s | ntt%s | ", $n, htmlspecialcharsbx('/bitrix/groupdav.php'.$resource->GetPath()), htmlspecialcharsbx($name));
$response->AddLine("tt%s | ", $props['DAV:getcontentlength']);
$response->AddLine("tt%s | ", (!empty($props['DAV:getlastmodified']) ? date('Y-m-d H:i:s', $props['DAV:getlastmodified']) : ''));
$response->AddLine("tt%s | ", $props['DAV:getetag']);
$response->AddLine("tt%s | ", htmlspecialcharsbx($props['DAV:getcontenttype']));
$response->AddLine("tt%s | nt
", $this->RenderPropertyValue($props['DAV:resourcetype']));
}
if (!$n)
$response->AddLine("Collection empty.
");
else
$response->AddLine("
");
$response->AddLine("
Properties
");
$response->AddLine("
nt| Namespace | Name | Value |
");
foreach ($collectionProps as $name => $value)
{
$class = ($class == 'row1' ? 'row2' : 'row1');
$ns = explode(':', $name);
$name = array_pop($ns);
$ns = implode(':', $ns);
$response->AddLine("tntt| %s | %s | ", $class, htmlspecialcharsbx($ns), htmlspecialcharsbx($name));
$response->AddLine("tt%s | nt
", $this->RenderPropertyValue($value));
}
$response->AddLine("
");
$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';
}