• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/virtual.php
  • Класс: CWebDavVirtual
  • Вызов: CWebDavVirtual::PROPFIND
function PROPFIND(&$options, &$files, $arParams = array())
{
	global $DB;
	$files["files"] = array();
	$arParams = (is_array($arParams) ? $arParams : array());
	$this->IsDir($options);
	$arParamsIsDir = $this->arParams; 
	$arResult = array("NAV_RESULT" => false, "RESULT" => array()); 

	if ($this->arParams["not_found"] === true)
	{
		return false;
	}
	elseif($this->arParams["is_dir"] == true) // virtual files not supported now
	{
		$files["files"]["section"] = $this->_get_fileinfo($this->arParams["item_id"]);
		if (!empty($this->arParams["item_id"]) && $this->arParams["item_id"] != "/")
			$arResult["SECTION"] = array("ID" => $this->arParams["item_id"], "NAME" => $this->arParams["item_id"]); 
		
		if (!empty($options["depth"]))
		{
			$foundID = false;
			foreach ($this->arStructure as $nodeID=>$arNode) // at first find the current 'root'
			{
				if ($arNode['PATH'] == $this->arParams["item_id"]) 
				{
					$foundID = $nodeID;
					break;
				}
			}
			$year = date("Y");
			$curNodeID = $foundID;
			$curDepth = $this->arStructure[$foundID]['DEPTH_LEVEL'];
			while (true)
			{
				$curNodeID++;
				if (!isset($this->arStructure[$curNodeID])) break;
				$arNode = $this->arStructure[$curNodeID];
				if ($arNode["DEPTH_LEVEL"]-1 == $curDepth)	 // children
				{ 
					$filename = $this->arStructure[$curNodeID]["NAME"];
					$res = array(
						"TYPE" => "FOLDER", 
						"ID" => $filename, 
						"NAME" => $filename, 
						"~TIMESTAMP_X" => isset($this->arStructure[$curNodeID]['TIMESTAMP_X'])?$this->arStructure[$curNodeID]['TIMESTAMP_X']:ConvertTimeStamp(mktime(0, 0, 0, 1, 1, $year), "FULL"), 
						"PERMISSION" => $this->permission, 
						"SHOW" => array(), 
						"PATH" => $this->arStructure[$curNodeID]["PATH"]); 
					$res["TIMESTAMP_X"] = $res["~TIMESTAMP_X"]; 
					$arResult["RESULT"][($res["TYPE"] == "FOLDER" ? "S" : "E").$filename] = $res; 
					$files['files'][] = $this->_get_fileinfo($filename);
				}
				elseif ($arNode["DEPTH_LEVEL"] <= $curDepth) // same level or upper level, break
				{	
					break; 
				}
			}
		}
	}

	if ($arParams["return"] == "array" || $arParams["return"] == "nav_result")
	{
		if ($arParams["return"] == "array")
			return $arResult; 
		$arResult["NAV_RESULT"] = new CDBResult(); 
		$arResult["NAV_RESULT"]->InitFromArray($arResult["RESULT"]); 
		return $arResult; 
	}
	
	return true; 
}