• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/iblock.php
  • Класс: CWebDavIblock
  • Вызов: CWebDavIblock::get_file
function get_file(&$res)
{
	$res["FILE"] = CFile::GetFileArray($res["PROPERTY_" . $this->file_prop . "_VALUE"]);
	$res["FILE"] = (is_array($res["FILE"]) ? $res["FILE"] : array("FILE_SIZE" => 0, "CONTENT_TYPE" => "text/plain", "MTIME" => 0));
	if (isset($res["FILE"]["CONTENT_TYPE"]) && ($res["FILE"]["CONTENT_TYPE"] == "application/zip"))
	{
		$ext = GetFileExtension($res["FILE"]["FILE_NAME"]);
		switch ($ext)  // http://en.wikipedia.org/wiki/Microsoft_Office_2007_filename_extensions
		{
			case "docx":
			case "docm":
			case "dotx":
			case "dotm":
				$res["FILE"]["CONTENT_TYPE"] = "application/msword";
				break;
			case "xlsx":
			case "xlsm":
			case "xltx":
			case "xltm":
			case "xlsb":
			case "xlam":
			case "xll":
				$res["FILE"]["CONTENT_TYPE"] = "application/vnd.ms-excel";
				break;
			case "pptx":
			case "pptm":
			case "potx":
			case "potm":
			case "ppam":
			case "ppsx":
			case "ppsm":
				$res["FILE"]["CONTENT_TYPE"] = "application/vnd.ms-powerpoint";
				break;
		}
	}
}