• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/file.php
  • Класс: CWebDavFile
  • Вызов: CWebDavFile::PUT
function PUT(&$options)
{
	$io = self::GetIo();
	$this->IsDir($options);
	if ($this->arParams["is_dir"] == true)
	{
		$GLOBALS["APPLICATION"]->ThrowException(GetMessage('WD_FILE_ERROR14'), 'FORBIDDEN_NAME');
		return "409 Conflict";
	}
	$options["~path"] = static::_udecode($options["path"]);
	$this->arParams["base_name"] = $io->CombinePath(static::_udecode($this->arParams["base_name"]));
	if ($this->arParams["not_found"] && !$this->CheckRights("PUT", true, $this->arParams["base_name"]) ||
		!$this->arParams["not_found"] && !$this->CheckRights("PUT", true, $this->arParams["item_id"]))
	{
		$this->ThrowAccessDenied();
		return false;
	}

	/*$fspath = $io->CombinePath($this->real_path_full, $this->arParams["item_id"]);
	if ($this->arParams["not_found"])
	{
		$fspath = $io->CombinePath($this->real_path_full, $this->arParams["parent_id"], $this->arParams["base_name"]);
	}*/

	$fspath = $this->arParams["item_id"];
	if ($this->arParams["not_found"])
	{
		$fspath = $io->CombinePath($this->arParams["parent_id"], $this->arParams["base_name"]);
	}

	$fspath = CWebDavBase::CleanRelativePathString($fspath, $this->real_path_full);
	if($fspath === false)
	{
		return false;
	}

	$oFile = $io->GetFile($fspath);
	if (COption::GetOptionInt("main", "disk_space") > 0)
	{
		CDiskQuota::updateDiskQuota("file", $oFile->GetFileSize(), "delete");
	}

	$options["new"] = $this->arParams["not_found"];
	$options["fspath"] = $fspath;

	if ($options["fopen"] != "N")
	{
		$fp = $oFile->Open("w");
		return $fp;
	}
	return true;
}