• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/iblock.php
  • Класс: CWebDavIblock
  • Вызов: CWebDavIblock::PROPPATCH
function PROPPATCH(&$options)
{
	$ID = 0;
	$strProps = "";
	$is_dir = false;
	$object = $this->GetObject($options);
	if ($object["not_found"] === true)
	{
		return "404 Not Found";
	}
	elseif (!$this->CheckWebRights("", array("action" => "proppatch", "arElement" => $object)))
	{
		return $this->ThrowAccessDenied(__LINE__);
	}
	elseif ($object["is_dir"] === true)
	{
		$strProps = $object["dir_array"]["DESCRIPTION"];
		$is_dir = true;
	}
	else
	{
		$strProps = $object["element_array"]["PROPERTY_WEBDAV_INFO_VALUE"];
	}

	$ID = $object["item_id"];
	$arProps = @unserialize($strProps, ['allowed_classes' => false]);
	$arProps = (!is_array($arProps) ? array() : $arProps);

	foreach ($options["props"] as $key => $prop)
	{
		if ($prop["ns"] == "DAV:")
			$options["props"][$key]["status"] = "403 Forbidden";
		else
		{
			if (isset($prop["val"]))
				$arProps["PROPS"][$prop["ns"]][$prop["name"]] = $prop["val"];
			else
				unset($arProps["PROPS"][$prop["ns"]][$prop["name"]]);
		}
	}

	foreach ($arProps["PROPS"] as $nsName => $arNs)
		if (sizeof($arNs) < 1)
			unset($arProps["PROPS"][$nsName]);

	if (sizeof($arProps['PROPS']) < 1)
		unset($arProps['PROPS']);

	if (sizeof($arProps) > 0)
		$strProps = serialize($arProps);
	else
		$strProps = '';

	if ($is_dir)
	{
		$se = new CIBlockSection();
		$se->Update($ID, array("DESCRIPTION" => $strProps));
	}
	else
	{
		CIBlockElement::SetPropertyValues($ID, $this->IBLOCK_ID, $strProps, "WEBDAV_INFO");
	}
	$this->_clear_cache_for_object($options);
	return "";
}