- Модуль: webdav
- Путь к файлу: ~/bitrix/modules/webdav/classes/iblock.php
- Класс: CWebDavIblock
- Вызов: CWebDavIblock::GET
function GET(&$options)
{
if (count($this->arParams) <= 0)
{
$this->IsDir($options);
}
$arParams = $this->arParams;
$this->_get_file_info_arr($arParams);
if ($this->arParams["not_found"])
{
return false;
}
elseif($this->withoutAuthorization !== true)
{
if (!$this->CheckWebRights("", array('action' => 'read', 'arElement' => $arParams), false))
{
return $this->ThrowAccessDenied(__LINE__);
}
elseif ($this->arParams["element_array"]["WF_NEW"] == "Y" ||
(intval($this->arParams["element_array"]["WF_PARENT_ELEMENT_ID"]) > 0 &&
$this->arParams["element_array"]["WF_PARENT_ELEMENT_ID"] != $this->arParams["element_array"]["ID"]) ||
$this->arParams["element_array"]["BP_PUBLISHED"] != "Y")
{
$res = $this->arParams["element_array"];
$this->_get_file_info_arr($res);
if ($this->CheckRight($res["PERMISSION"], 'element_read') <= "D")
{
return false;
}
}
}
$arElement = $this->arParams['element_array'];
if ($this->workflow == 'workflow' && $this->permission < "W" && $res["STATUS_PERMISSION"] < 2) // permissions are not enouph to edit
{
$arElement = $this->arParams['original'];
//$arParams["fullpath"] = CFile::GetPath($arElement["PROPERTY_".$this->file_prop."_VALUE"]);
}
$options["mimetype"] = $arParams["file_mimetype"];
$options["mtime"] = MakeTimeStamp($arElement["TIMESTAMP_X"]);
$options["size"] = $arParams["file_size"];
$options["name"] = $arElement["NAME"];
$arTmpFile = CFile::MakeFileArray($arParams['file_id']);
if (!(is_array($arTmpFile) && is_set($arTmpFile, 'tmp_name')))
{
return false;
}
$io = self::GetIo();
if(!empty($options['getContent']))
{
if(file_exists($io->GetPhysicalName($arTmpFile['tmp_name'])))
{
$options['content'] = $io->GetFile($io->GetPhysicalName($arTmpFile['tmp_name']))->GetContents();
}
elseif(file_exists($arTmpFile['tmp_name']))
{
$options['content'] = file_get_contents($arTmpFile['tmp_name']);
}
else
{
$options['content'] = null;
}
}
else
{
if(file_exists($io->GetPhysicalName($arTmpFile['tmp_name'])))
{
$options['stream'] = fopen($io->GetPhysicalName($arTmpFile['tmp_name']), 'rb');
}
elseif(file_exists($arTmpFile['tmp_name']))
{
$options['stream'] = fopen($arTmpFile['tmp_name'], 'rb');
}
else
{
return false;
}
}
if (empty($options["mimetype"]) || $options["mimetype"] == "unknown" || $options["mimetype"] == "application/octet-stream")
{
$options["mimetype"] = $this->get_mime_type($arParams["file_name"]);
}
return true;
}