CCompress::Disable2048Spaces(); } session_write_close(); $arParams["USE_AUTH"] = "Y"; $baseURL = $arParams["BASE_URL"]; $arParams["BASE_URL"] = ($APPLICATION->IsHTTPS() ? 'https' : 'http') . '://' . str_replace("//", "/", $_SERVER['HTTP_HOST'] . "/" . $baseURL . "/"); $arParams["NOT_SAVE_SUG_FILES"] = true; if ($arParams["RESOURCE_TYPE"] == "FOLDER") { $ob = new CWebDavFile($arParams, $baseURL); } else { $ob = new CWebDavIblock(intval($arParams['IBLOCK_ID']), $baseURL, $arParams); if ($requestTupe == "user" && !empty($filesOwnerUserID)) { $ob->attributes['user_id'] = $filesOwnerUserID; } } if ($ob->IsDir()) { $arResFiles = array(); $optionsQ = array('path' => $ob->_path, 'depth' => 1, 'check_permissions' => true); $arSelectedFieldsQ = array('NAME', 'FILE_TUPES'); $filesQ = null; $arFilterQ = array(); $resQ = $ob->PROPFIND($optionsQ, $filesQ, array("FILTER" => $arFilterQ, "COLUMNS" => $arSelectedFieldsQ, "return" => "nav_result", "get_clones" => "Y", 'NON_TRASH_SECTION' => true, 'NON_OLD_DROPPED_SECTION' => true)); $foldersNum = 0; $filesNum = 0; if (is_array($resQ) && array_key_exists("NAV_RESULT", $resQ)) { while ($arF = $resQ["NAV_RESULT"]->Fetch()) { $nameQ = CheckStrCharsetForJson($arF["NAME"]); $pathQ = CheckStrCharsetForJson($arF["PATH"]); if ($arF["TYPE"] == "S") { $arResFiles[] = array("NAME" => $nameQ, "TABLE_URL" => $ob->base_url . $pathQ, "IMAGE" => $compPath . "/images/folder.png", "TABLE_SETTINGS" => array("type" => "files", "useTagsInSearch" => "NO")); $foldersNum++;
/******************************************************************** / ********************************************************************/ if (($_SERVER['REQUEST_METHOD'] == 'POST' || $_SERVER['REQUEST_METHOD'] == 'GET') && !$ob->IsDavHeaders()) { if ($componentPage == "user_files" || $componentPage == "group_files") { $arResult["VARIABLES"]["SECTION_ID"] = 0; if ($arParams["SEF_MODE"] != "Y") { $res = explode("/", urldecode($_REQUEST["path"])); $result = array(); foreach ($res as $r) { $result[] = urlencode($APPLICATION->ConvertCharset($r, SITE_CHARSET, 'UTF-8')); } $arResult["VARIABLES"]["PATH"] = implode("/", $result); $ob->SetPath("/" . $arResult["VARIABLES"]["PATH"]); } $ob->IsDir(array('check_permissions' => false)); if ($ob->arParams['is_file']) { $APPLICATION->RestartBuffer(); $ob->base_GET(); die; } elseif ($ob->arParams['is_dir']) { $arResult["VARIABLES"]["SECTION_ID"] = $ob->arParams["item_id"]; } } elseif ($componentPage == "user_files_short" || $componentPage == "group_files_short") { if ($arResult["VARIABLES"]["element_id"] > 0) { $ob->IsDir(array("element_id" => $arResult["VARIABLES"]["element_id"])); if ($ob->arParams['is_file']) { $APPLICATION->RestartBuffer(); $ob->base_GET(); die; }
$obGroup = new CWebDavIblock($arParams['IBLOCK_USER_ID'], $localPath, $arParams); $obGroup->SetRootSection($sectionID); $cnt = count($arLocalPath); if ($cnt > 1) { $path = ""; foreach ($arLocalPath as $k => $v) { if ($k > 0) { $path .= "/" . $v; } } } else { $path = "/"; } $options = array("path" => $path, "depth" => 1); $res = $obGroup->PROPFIND($options, $files, array("return" => "array", "get_clones" => "Y", "FILTER" => array())); $obGroup->IsDir($options); if ($obGroup->arParams['is_file']) { $APPLICATION->RestartBuffer(); $obGroup->base_GET(); die; } foreach ($res["RESULT"] as $val) { if ($val["~NAME"] != ".Trash") { $tmp = array('NAME' => $val["NAME"], 'PATH' => $rootPath . "/" . $arLocalPath[0] . $val["PATH"], 'DEPTH_LEVEL' => $val["DEPTH_LEVEL"]); if ($val["TYPE"] == "E") { $tmp["TYPE"] = "file"; $tmp["FILE_EXTENTION"] = htmlspecialcharsbx(strtolower(strrchr($val['NAME'], '.'))); } else { $tmp = array('NAME' => $val["NAME"], 'PATH' => $rootPath . "/" . $arLocalPath[0] . $val["PATH"], 'DEPTH_LEVEL' => $val["DEPTH_LEVEL"]); $tmp["TYPE"] = "folder"; }