• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/general.php
  • Класс: CWebDavBase
  • Вызов: CWebDavBase::base_MOVE
function base_MOVE()
{
	$options = array(
		'path' => $this->_path,
		'depth' => (isset($_SERVER['HTTP_DEPTH']) ? $_SERVER['HTTP_DEPTH'] : 'infinity'),
		'overwrite' => (isset($_SERVER['HTTP_OVERWRITE']) ? ($_SERVER['HTTP_OVERWRITE'] == 'T') : true));

	$pu = parse_url(CWebDavBase::get_request_url($_SERVER['HTTP_DESTINATION']));
	if (intval($pu['port']) == 80 && mb_strpos($_SERVER["HTTP_HOST"], ":80") === false)
	{
		$_SERVER['HTTP_DESTINATION'] = str_replace($pu['host'].":".$pu['port'], $pu['host'], $_SERVER['HTTP_DESTINATION']);
		$pu = parse_url(CWebDavBase::get_request_url($_SERVER['HTTP_DESTINATION']));
	}
	$pu['host_name'] = $pu['host'].(!empty($pu['port']) ? ":".$pu['port'] : "");
	if (mb_strtolower($pu['host_name']) == mb_strtolower($_SERVER["HTTP_HOST"]) || mb_strtolower($pu['host_name']) == mb_strtolower($_SERVER['SERVER_NAME']))
	{
		$options['dest_url'] = $this->GetCurrentPath(urldecode($pu['path']));
		$stat = $this->MOVE($options);
	}
	else
	{
		$stat = $this->ThrowError("412 precondition failed", "WEBDAV_MOVE_PRECONDITION", '', __FILE__.' '.__LINE__);
	}

	$this->SetStatus($stat);
	self::set_header('Content-length: 0');
	if (mb_substr($stat, 0, 1) == '2')
	{
		self::set_header('Location: ' . $this->base_url_full.$this->GetCurrentPath($pu['path']));
	}
}