function _get_mixed_list($section_id, $arParams = array(), $element_id = 0) { list($contextType, $contextEntityId) = $this->getContextData(); if ($section_id) { $sectionData = $this->getSectionDataForLinkAnalyze($section_id); if (CWebDavSymlinkHelper::isLink($contextType, $contextEntityId, $sectionData)) { $parentSectionData = CWebDavSymlinkHelper::getLinkData($contextType, $contextEntityId, $sectionData); if ($parentSectionData) { $linkWebdav = new self($parentSectionData[self::UF_LINK_IBLOCK_ID], $this->base_url . $this->_path, array('ROOT_SECTION_ID' => $parentSectionData[self::UF_LINK_SECTION_ID], 'symlinkMode' => true, 'symlinkSectionData' => $parentSectionData, 'symlinkRealRootSectionData' => $this->arRootSection)); return $linkWebdav->_get_mixed_list($section_id, $arParams, $element_id); } } } else { if (CWebDavSymlinkHelper::isLinkElement($contextType, $contextEntityId, $element_id)) { $parentSectionData = CWebDavSymlinkHelper::getLinkDataOfElement($contextType, $contextEntityId, $element_id); if ($parentSectionData) { $linkWebdav = new self($parentSectionData[self::UF_LINK_IBLOCK_ID], $this->base_url . $this->_path, array('ROOT_SECTION_ID' => $parentSectionData[self::UF_LINK_SECTION_ID], 'symlinkMode' => true, 'symlinkSectionData' => $parentSectionData, 'symlinkRealRootSectionData' => $this->arRootSection)); return $linkWebdav->_get_mixed_list($section_id, $arParams, $element_id); } } } global $by, $order; InitSorting(); if (empty($by)) { $by = "NAME"; $order = "ASC"; } $by = strtoupper($by); $order = strtoupper($order); $section_id = $section_id === null ? null : intVal($section_id); $element_id = intVal($element_id); $arParams = is_array($arParams) ? $arParams : array(); $arParams["COLUMNS"] = is_array($arParams["COLUMNS"]) ? $arParams["COLUMNS"] : array(); $arFilter = array("IBLOCK_ID" => $this->IBLOCK_ID, "IBLOCK_ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R", "SHOW_NEW" => "Y"); if ($section_id !== null) { $arFilter["SECTION_ID"] = $section_id; } $perms = $this->permission; if ($this->e_rights && !$GLOBALS['USER']->CanDoOperation('webdav_change_settings')) { if ($element_id > 0) { $arParentPerms = $this->GetPermissions('ELEMENT', (int) $element_id); } else { $arParentPerms = $this->GetPermissions('SECTION', $section_id !== null ? $section_id : ($this->arRootSection ? $this->arRootSection : 0)); } if (is_array($arParentPerms)) { if (isset($arParentPerms['element_rights_edit'])) { $perms = 'X'; } elseif (isset($arParentPerms['element_edit_any_wf_status'])) { $perms = 'W'; } elseif (isset($arParentPerms['element_edit'])) { $perms = 'U'; } elseif (isset($arParentPerms['element_read'])) { $perms = 'R'; } else { $perms = 'A'; } } } if ($perms < "U") { $arFilter["ACTIVE"] = "Y"; $arFilter["GLOBAL_ACTIVE"] = "Y"; $arFilter["SHOW_HISTORY"] = "N"; $arFilter["SHOW_NEW"] = "N"; $arParams["COLUMNS"] = array_diff($arParams["COLUMNS"], array("ACTIVE", "GLOBAL_ACTIVE", "SORT", "CODE", "EXTERNAL_ID", "DATE_ACTIVE_FROM", "DATE_ACTIVE_TO")); } if ($perms < "W" && $this->workflow == "bizproc") { $arFilter["SHOW_BP_NEW"] = array("GROUPS" => $this->USER["GROUPS"], "MODULE_ID" => $this->wfParams["DOCUMENT_TYPE"][0], "ENTITY" => $this->wfParams["DOCUMENT_TYPE"][1], "PERMISSION" => "read", "USER_ID" => $GLOBALS["USER"]->GetID()); } if ($element_id > 0 && $arParams["SHOW_VERSIONS"] == "Y") { $arFilter["SHOW_HISTORY"] = "Y"; $arFilter["WF_PARENT_ELEMENT_ID"] = $element_id; if ($perms >= "U" && $perms < "W") { $arFilter["CHECK_BP_PERMISSIONS"] = $arFilter["SHOW_BP_NEW"]; } } elseif ($element_id > 0) { $arFilter["ID"] = $element_id; } if ($this->arRootSection && $element_id <= 0) { if ($arFilter["SECTION_ID"] === null) { $arFilter["SECTION_ID"] = $this->arRootSection["ID"]; } if (sizeof($arParams['FILTER']) > 0) { $arFilter["INCLUDE_SUBSECTIONS"] = "Y"; } $arFilter["RIGHT_MARGIN"] = $this->arRootSection["RIGHT_MARGIN"]; $arFilter["LEFT_MARGIN"] = $this->arRootSection["LEFT_MARGIN"]; } if ($arFilter["SECTION_ID"] === null) { unset($arFilter["SECTION_ID"]); } if (isset($arParams["FILTER"]) && sizeof($arParams["FILTER"]) > 0) { if (isset($arParams["FILTER"]["timestamp_2"]) && strlen($arParams["FILTER"]["timestamp_2"]) > 0 && $arParams["FILTER"]["timestamp_datesel"] != "before") { $arParams["FILTER"]["timestamp_2"] .= " 23:59:59"; } $arFilter = array_merge($arFilter, $arParams["FILTER"]); } if (isset($arFilter["NAME"]) && isset($arFilter["DESCRIPTION"])) { $arFilter[] = array("LOGIC" => "OR", "NAME" => $arFilter["NAME"], "DESCRIPTION" => $arFilter["DESCRIPTION"]); unset($arFilter["NAME"]); unset($arFilter["DESCRIPTION"]); } $arSelectedFields = $arParams["COLUMNS"]; if (in_array("LOCKED_USER_NAME", $arSelectedFields)) { $arSelectedFields[] = "WF_LOCKED_BY"; } if (in_array("USER_NAME", $arSelectedFields)) { $arSelectedFields[] = "MODIFIED_BY"; } if (in_array("CREATED_USER_NAME", $arSelectedFields)) { $arSelectedFields[] = "CREATED_BY"; } if (in_array("DETAIL_TEXT", $arSelectedFields)) { $arSelectedFields[] = "DETAIL_TEXT_TYPE"; } $arSelectedFields = array_merge($arSelectedFields, array("ACTIVE", "CODE", "CREATED_BY", "DATE_CREATE", "DATE_CREATE_UNIX", "DESCRIPTION", "DETAIL_PAGE_URL", "EXTERNAL_ID", "IBLOCK_ID", "IBLOCK_CODE", "IBLOCK_SECTION_ID", "ID", "LANG_DIR", "XML_ID", "LID", "LOCKED_USER_NAME", "LOCK_STATUS", "MODIFIED_BY", "NAME", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE", "PROPERTY_FORUM_TOPIC_ID", "PROPERTY_" . $this->file_prop, "PROPERTY_WEBDAV_INFO", "PROPERTY_WEBDAV_SIZE", "SITE_ID", "TAGS", "TIMESTAMP_X", "TIMESTAMP_X_UNIX", "WF_DATE_LOCK", "WF_NEW", "WF_PARENT_ELEMENT_ID", "WF_STATUS_ID", "WF_LOCKED_BY")); if ($this->workflow == "bizproc") { $arSelectedFields[] = "BP_PUBLISHED"; $arSelectedFields[] = "BIZPROC"; } elseif ($this->workflow == 'workflow') { $arSelectedFields[] = "WF_COMMENTS"; } $arSelectedFields = array_unique($arSelectedFields); $arSelectedFields = array_filter($arSelectedFields); $this->wfParams["selected_fields"] = $arSelectedFields; if ($element_id > 0) { $arElementResult = array(); $arFilter["SHOW_HISTORY"] = "Y"; $db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields); if ($db_res) { while ($arElement = $db_res->Fetch()) { $arElement["TYPE"] = "E"; $arElement["FILE"] = CFile::GetFileArray($arElement["PROPERTY_" . $this->file_prop . "_VALUE"]); $arElement["FILE"] = is_array($arElement["FILE"]) ? $arElement["FILE"] : array("FILE_SIZE" => 0, "CONTENT_TYPE" => "text/plain", "MTIME" => 0); if ($this->e_rights) { $arElement['E_RIGHTS'] = $this->GetPermission('ELEMENT', $arElement['ID']); } $arElementResult[] = $arElement; } } $db_res = new CDBResult(); $db_res->InitFromArray($arElementResult); } else { $arOrder = array($by => $order); $arResult = array(); if (!isset($arFilter["ID"])) { $arSectionFilter = array("IBLOCK_ID" => $arFilter["IBLOCK_ID"], "?NAME" => $arFilter["NAME"], "SECTION_ID" => $arFilter["SECTION_ID"], ">=ID" => $arFilter["ID_1"], "<=ID" => $arFilter["ID_2"], ">=TIMESTAMP_X" => $arFilter["TIMESTAMP_X_1"], "<=TIMESTAMP_X" => $arFilter["TIMESTAMP_X_2"], "MODIFIED_BY" => $arFilter["MODIFIED_USER_ID"] ? $arFilter["MODIFIED_USER_ID"] : $arFilter["MODIFIED_BY"], ">=DATE_CREATE" => $arFilter["DATE_CREATE_1"], "<=DATE_CREATE" => $arFilter["DATE_CREATE_2"], "CREATED_BY" => $arFilter["CREATED_USER_ID"] ? $arFilter["CREATED_USER_ID"] : $arFilter["CREATED_BY"], "ACTIVE" => $arFilter["ACTIVE"], "CHECK_PERMISSIONS" => "Y"); if (isset($arFilter["content"])) { $arSectionFilter["?NAME"] = $arFilter["content"]; } $arSectionIDs = array(); $excludeDropped = $excludeOldDropped = $excludeTrash = $excludeSectionMargin = array(); if (!empty($arParams['NON_OLD_DROPPED_SECTION'])) { if ($excludeId = $this->GetMetaID(self::OLD_DROPPED)) { $excludeOldDropped = self::$_metaSectionData[$excludeId]; $excludeSectionMargin[] = array($excludeOldDropped['LEFT_MARGIN'], $excludeOldDropped['RIGHT_MARGIN']); } } if (!empty($arParams['NON_DROPPED_SECTION'])) { if ($excludeId = $this->GetMetaID(self::DROPPED, false)) { $excludeDropped = self::$_metaSectionData[$excludeId]; $excludeSectionMargin[] = array($excludeDropped['LEFT_MARGIN'], $excludeDropped['RIGHT_MARGIN']); } } if (!empty($arParams['NON_TRASH_SECTION'])) { if ($excludeId = $this->GetMetaID(self::TRASH)) { $excludeTrash = self::$_metaSectionData[$excludeId]; $excludeSectionMargin[] = array($excludeTrash['LEFT_MARGIN'], $excludeTrash['RIGHT_MARGIN']); } } $obSection = new CIBlockSection(); $rsSection = $obSection->GetList($arOrder, $arSectionFilter, false, array_merge($arSelectedFields, self::getUFNamesForSectionLink(), array('LEFT_MARGIN', 'RIGHT_MARGIN'))); while ($arSection = $rsSection->Fetch()) { if ($excludeOldDropped && $arSection['LEFT_MARGIN'] >= $excludeOldDropped['LEFT_MARGIN'] && $arSection['RIGHT_MARGIN'] <= $excludeOldDropped['RIGHT_MARGIN']) { continue; } if ($excludeTrash && $arSection['LEFT_MARGIN'] >= $excludeTrash['LEFT_MARGIN'] && $arSection['RIGHT_MARGIN'] <= $excludeTrash['RIGHT_MARGIN']) { continue; } if ($excludeDropped && $arSection['LEFT_MARGIN'] >= $excludeDropped['LEFT_MARGIN'] && $arSection['RIGHT_MARGIN'] <= $excludeDropped['RIGHT_MARGIN']) { continue; } $arSection["TYPE"] = "S"; $arResult[] = $arSection; if ($this->e_rights) { $arSectionIDs[] = $arSection['ID']; } } if ($this->e_rights) { $arSectionRights = $this->GetPermissions('SECTION', $arSectionIDs); $arSectionRules = $this->GetPermissionRules('SECTION', $arSectionIDs); foreach ($arResult as $id => &$arSection) { if ($arSection['XML_ID'] == 'SHARED_FOLDER' && !isset($arSectionRights[$arSection['ID']]['element_read'])) { unset($arResult[$id]); continue; } if (isset($arSectionRights[$arSection['ID']])) { $arSection['E_RIGHTS'] = $arSectionRights[$arSection['ID']]; } if (isset($arSectionRules[$arSection['ID']]) && $this->IsShared($arSectionRules[$arSection['ID']])) { $arSection['SHARED'] = true; } } unset($arSection); } } $arElementFilter = array("IBLOCK_ID" => $arFilter["IBLOCK_ID"], "?NAME" => $arFilter["NAME"], "SECTION_ID" => $arFilter["SECTION_ID"], "ID" => $arFilter["ID"], ">=ID" => $arFilter["ID_1"], "<=ID" => $arFilter["ID_2"], ">=TIMESTAMP_X" => $arFilter["TIMESTAMP_X_1"], "<=TIMESTAMP_X" => $arFilter["TIMESTAMP_X_2"], "EXTERNAL_ID" => $arFilter["EXTERNAL_ID"], "MODIFIED_USER_ID" => $arFilter["MODIFIED_USER_ID"], "MODIFIED_BY" => $arFilter["MODIFIED_BY"], ">=DATE_CREATE" => $arFilter["DATE_CREATE_1"], "<=DATE_CREATE" => $arFilter["DATE_CREATE_2"], "CREATED_BY" => $arFilter["CREATED_BY"], "CREATED_USER_ID" => $arFilter["CREATED_USER_ID"], ">=DATE_ACTIVE_FROM" => $arFilter["DATE_ACTIVE_FROM_1"], "<=DATE_ACTIVE_FROM" => $arFilter["DATE_ACTIVE_FROM_2"], ">=DATE_ACTIVE_TO" => $arFilter["DATE_ACTIVE_TO_1"], "<=DATE_ACTIVE_TO" => $arFilter["DATE_ACTIVE_TO_2"], "ACTIVE" => $arFilter["ACTIVE"], "?SEARCHABLE_CONTENT" => $arFilter["DESCRIPTION"], "?TAGS" => $arFilter["?TAGS"], "WF_STATUS" => $arFilter["WF_STATUS"], "WF_LOCK_STATUS" => $arFilter["WF_LOCK_STATUS"], "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R", "SHOW_NEW" => $arFilter["SHOW_NEW"] !== "N" ? "Y" : "N", "SHOW_HISTORY" => $arFilter["SHOW_HISTORY"] !== "Y" ? "N" : "Y", "SHOW_BP_NEW" => $arFilter["SHOW_BP_NEW"]); if ($arElementFilter["SHOW_HISTORY"] == "Y") { $arElementFilter["SHOW_NEW"] = "N"; } $fltSizeFrom = isset($arParams["FILTER"]["FILE_SIZE_1"]) ? $arParams["FILTER"]["FILE_SIZE_1"] : null; $fltSizeTo = isset($arParams["FILTER"]["FILE_SIZE_2"]) ? $arParams["FILTER"]["FILE_SIZE_2"] : null; if (($fltSizeFrom !== null || $fltSizeTo !== null) && isset($arParams["FILTER"]["FILE_SIZE_multiply"]) && in_array($arParams["FILTER"]["FILE_SIZE_multiply"], array("b", "kb", "mb", "gb"))) { $multiply = 1; if ($arParams["FILTER"]["FILE_SIZE_multiply"] === "kb") { $multiply = 1024; } elseif ($arParams["FILTER"]["FILE_SIZE_multiply"] === "mb") { $multiply = 1024 * 1024; } elseif ($arParams["FILTER"]["FILE_SIZE_multiply"] === "gb") { $multiply = 1024 * 1024 * 1024; } if ($fltSizeFrom !== null) { $fltSizeFrom = $fltSizeFrom * $multiply; $arElementFilter[">=PROPERTY_WEBDAV_SIZE"] = $fltSizeFrom; } if ($fltSizeTo !== null) { $fltSizeTo = $fltSizeTo * $multiply; $arElementFilter["<=PROPERTY_WEBDAV_SIZE"] = $fltSizeTo; } } if (isset($arFilter["timestamp_1"]) && isset($arFilter["timestamp_2"])) { $arElementFilter[] = array("LOGIC" => "OR", array("LOGIC" => "AND", ">=DATE_CREATE" => $arFilter["timestamp_1"], "<=DATE_CREATE" => $arFilter["timestamp_2"]), array("LOGIC" => "AND", ">=TIMESTAMP_X" => $arFilter["timestamp_1"], "<=TIMESTAMP_X" => $arFilter["timestamp_2"])); unset($arFilter["timestamp_1"]); unset($arFilter["timestamp_2"]); } elseif (isset($arFilter["timestamp_1"])) { $arElementFilter[] = array("LOGIC" => "OR", ">=DATE_CREATE" => $arFilter["timestamp_1"], ">=TIMESTAMP_X" => $arFilter["timestamp_1"]); unset($arFilter["timestamp_2"]); } elseif (isset($arFilter["timestamp_2"])) { $arElementFilter[] = array("LOGIC" => "OR", "<=DATE_CREATE" => $arFilter["timestamp_2"], "<=TIMESTAMP_X" => $arFilter["timestamp_2"]); unset($arFilter["timestamp_2"]); } if (isset($arFilter["user"])) { $arElementFilter[] = array("LOGIC" => "OR", "MODIFIED_BY" => $arFilter["user"], "CREATED_BY" => $arFilter["user"]); unset($arFilter["user"]); } if (strlen($arFilter["SECTION_ID"]) <= 0) { unset($arElementFilter["SECTION_ID"]); } if (!is_array($arSelectedFields)) { $arSelectedFields = array("*"); } elseif (!in_array("PROPERTY_WEBDAV_SIZE", $arSelectedFields)) { $arSelectedFields[] = "PROPERTY_WEBDAV_SIZE"; } if (isset($arFilter["INCLUDE_SUBSECTIONS"])) { $arElementFilter["INCLUDE_SUBSECTIONS"] = $arFilter["INCLUDE_SUBSECTIONS"]; } if (isset($arFilter["CHECK_BP_PERMISSIONS"])) { $arElementFilter["CHECK_BP_PERMISSIONS"] = $arFilter["CHECK_BP_PERMISSIONS"]; } if (!empty($excludeSectionMargin)) { $arElementFilter['!SUBSECTION'] = $excludeSectionMargin; } $arNavParams = isset($arParams["NAV_PARAMS"]) ? $arParams["NAV_PARAMS"] : false; $arElementIDs = array(); $arElementResult = array(); $obElement = new CIBlockElement(); $rsElement = $obElement->GetList($arOrder, $arElementFilter, false, $arNavParams, $arSelectedFields); while ($arElement = $rsElement->Fetch()) { $arElement["TYPE"] = "E"; $arElement["FILE"]["FILE_SIZE"] = $this->GetFileSize($arElement); //$arElement['ID'] $arElementResult[] = $arElement; if ($this->e_rights) { $arElementIDs[] = $arElement['ID']; } } if ($this->e_rights) { $arElementRights = $this->GetPermissions('ELEMENT', $arElementIDs); $arElementRules = $this->GetPermissionRules('ELEMENT', $arElementIDs); foreach ($arElementResult as $id => &$arElement) { if (isset($arElementRights[$arElement['ID']])) { $arElement['E_RIGHTS'] = $arElementRights[$arElement['ID']]; } if (isset($arElementRules[$arElement['ID']]) && $this->IsShared($arElementRules[$arElement['ID']])) { $arElement['SHARED'] = true; } } unset($arElement); } $arResult = array_merge($arResult, $arElementResult); $db_res = new CDBResult(); $db_res->InitFromArray($arResult); } return $db_res; }