本文整理匯總了PHP中CSearch::Search方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSearch::Search方法的具體用法?PHP CSearch::Search怎麽用?PHP CSearch::Search使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CSearch
的用法示例。
在下文中一共展示了CSearch::Search方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getFilter
protected function getFilter()
{
$arFilter = array("IBLOCK_ID" => $this->getIblockId(), 'SECTION_ID' => $this->getSectionId() > 0 ? $this->getSectionId() : 0, 'ACTIVE' => empty($_REQUEST['filter_active']) ? 'Y' : $_REQUEST['filter_active'], "WF_PARENT_ELEMENT_ID" => false, "SHOW_NEW" => "Y");
if ($arProps = $this->getProps()) {
$filtered = null;
foreach ($arProps as $arProp) {
$value = $_REQUEST['filter_el_property_' . $arProp["ID"]];
if (array_key_exists("AddFilterFields", $arProp["PROPERTY_USER_TYPE"])) {
call_user_func_array($arProp["PROPERTY_USER_TYPE"]["AddFilterFields"], array($arProp, array("VALUE" => "filter_el_property_" . $arProp["ID"]), &$arFilter, &$filtered));
} elseif (is_array($value) || strlen($value)) {
if ($value === "NOT_REF") {
$value = false;
}
$arFilter["?PROPERTY_" . $arProp["ID"]] = $value;
}
}
}
$arSubQuery = array();
if ($arSKUProps = $this->getSkuProps()) {
$arCatalog = $this->getOffersCatalog();
$arSubQuery = array("IBLOCK_ID" => $arCatalog['IBLOCK_ID']);
$filtered = null;
for ($i = 0, $intPropCount = count($arSKUProps); $i < $intPropCount; $i++) {
if ('Y' == $arSKUProps[$i]["FILTRABLE"] && 'F' != $arSKUProps[$i]["PROPERTY_TYPE"] && $arCatalog['SKU_PROPERTY_ID'] != $arSKUProps[$i]["ID"]) {
if (array_key_exists("AddFilterFields", $arSKUProps[$i]["PROPERTY_USER_TYPE"])) {
call_user_func_array($arSKUProps[$i]["PROPERTY_USER_TYPE"]["AddFilterFields"], array($arSKUProps[$i], array("VALUE" => "filter_sub_el_property_" . $arSKUProps[$i]["ID"]), &$arSubQuery, &$filtered));
} else {
$value = $_REQUEST['filter_sub_el_property_' . $arSKUProps[$i]["ID"]];
if (is_array($value) || strlen($value)) {
if ($value === "NOT_REF") {
$value = false;
}
$arSubQuery["?PROPERTY_" . $arSKUProps[$i]["ID"]] = $value;
}
}
}
}
}
if (!empty($_REQUEST["filter_timestamp_from"])) {
$arFilter["DATE_MODIFY_FROM"] = $_REQUEST["filter_timestamp_from"];
}
if (!empty($_REQUEST["filter_timestamp_to"])) {
$arFilter["DATE_MODIFY_TO"] = $_REQUEST["filter_timestamp_to"];
}
if (!empty($_REQUEST["filter_code"])) {
$arFilter["CODE"] = $_REQUEST["filter_code"];
}
$arSearchedIds = $arSearchedSectionIds = null;
if (!empty($_REQUEST['QUERY'])) {
$arFilter['QUERY'] = $_REQUEST['QUERY'];
$arSearchedIds = $arSearchedSectionIds = array(0);
if (preg_match('#^[0-9\\s]+$#', $_REQUEST['QUERY'])) {
$barcode = preg_replace('#[^0-9]#', '', $_REQUEST['QUERY']);
if (strlen($barcode) > 0) {
$rsBarCode = \CCatalogStoreBarCode::getList(array(), array("BARCODE" => $barcode), false, false, array('PRODUCT_ID'));
while ($res = $rsBarCode->Fetch()) {
$res2 = \CCatalogSKU::GetProductInfo($res["PRODUCT_ID"]);
$arSearchedIds[] = $res2 ? $res2['ID'] : $res['PRODUCT_ID'];
}
}
} elseif ($this->isAdvancedSearchAvailable()) {
$arFilter['PARAM2'] = $this->getIblockId();
if (!empty($arFilter['SECTION_ID'])) {
$arFilter['PARAMS'] = array('iblock_section' => $arFilter['SECTION_ID']);
}
$obSearch = new \CSearch();
$obSearch->Search($arFilter);
$cnt = 0;
$activeSectionId = $this->getSectionId();
while ($ar = $obSearch->Fetch()) {
if (strpos($ar['ITEM_ID'], 'S') === 0) {
$sectionId = preg_replace('#[^0-9]+#', '', $ar['ITEM_ID']);
if ($sectionId != $activeSectionId) {
$arSearchedSectionIds[] = $sectionId;
}
} else {
$arSearchedIds[] = $ar['ITEM_ID'];
}
if (++$cnt >= 100) {
break;
}
}
} else {
$arSearchedIds = $arSearchedSectionIds = null;
$arFilter['NAME'] = $_REQUEST['QUERY'];
}
}
if (sizeof($arSubQuery) > 1) {
$arFilteredIds = array(0);
$db = \CIBlockElement::GetList(array(), $arSubQuery, false, false, array('PROPERTY_' . $arCatalog['SKU_PROPERTY_ID']));
while ($res = $db->Fetch()) {
$arFilteredIds[] = $res['PROPERTY_' . $arCatalog['SKU_PROPERTY_ID'] . '_VALUE'];
}
$arFilter['ID'] = is_array($arSearchedIds) ? array_intersect($arFilteredIds, $arSearchedIds) : $arFilteredIds;
} elseif ($arSearchedIds) {
$arFilter['ID'] = $arSearchedIds;
}
if ($arSearchedSectionIds) {
$arFilter['S_ID'] = $arSearchedSectionIds;
}
//.........這裏部分代碼省略.........
示例2: array
$arResult["order"]["active"] = "topic";
$aSort = array("PARAM2" => "DESC", "DATE_CHANGE" => "ASC");
}
$arFilter1 = array("MODULE_ID" => "forum", "SITE_ID" => SITE_ID, "QUERY" => $q, "TAGS" => $_REQUEST["tags"] ? $_REQUEST["tags"] : "");
if (intVal($_REQUEST["DATE_CHANGE"]) > 0) {
$arFilter1["DATE_CHANGE"] = Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANGUAGE_ID)), time() - intVal($_REQUEST["DATE_CHANGE"]) * 24 * 3600 + CTimeZone::GetOffset());
}
$arFilter2 = array();
if (!empty($arParams["FID_RANGE"]) || !empty($arParams["FID"])) {
$arFilter2["PARAM1"] = empty($arParams["FID_RANGE"]) ? array() : array_keys($arResult["FORUMS"]);
$arFilter2["PARAM1"] = empty($arParams["FID"]) ? $arFilter2["PARAM1"] : $arParams["FID"];
}
$obSearch = new CSearch();
//When restart option is set we will ignore error on query with only stop words
$obSearch->SetOptions(array("ERROR_ON_EMPTY_STEM" => $arParams["RESTART"] != "Y", "NO_WORD_LOGIC" => $arParams["NO_WORD_LOGIC"] == "Y"));
$obSearch->Search($arFilter1, $aSort, array($arFilter2));
if ($obSearch->errorno != 0) {
$arResult["ERROR_MESSAGE"] = $obSearch->error;
} else {
$obSearch->NavStart($arParams["TOPICS_PER_PAGE"], false);
$obSearch->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"];
$arResult["NAV_RESULT"] = $obSearch;
$arResult["NAV_STRING"] = $obSearch->GetPageNavStringEx($navComponentObject, GetMessage("FL_TOPIC_LIST"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
$arResult["EMPTY"] = "Y";
$topics = array();
if ($res = $obSearch->GetNext()) {
$arResult["order"]["~relevance"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : ""), array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["~topic"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : "") . "&order=topic", array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["~date"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : "") . "&order=date", array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["relevance"] = htmlspecialcharsbx($arResult["order"]["~relevance"]);
$arResult["order"]["topic"] = htmlspecialcharsbx($arResult["order"]["~topic"]);
示例3: array
/*
TODO: now, no course_id in PARAM1, it must be added firstly to search index, and after - uncomment it.
if ($arParams["COURSE_ID"])
{
$arFilter["PARAM1"] = "C".$arParams["COURSE_ID"];
}
*/
if ($arResult["~how"] == "d") {
$aSort = array("DATE_CHANGE" => "DESC", "CUSTOM_RANK" => "DESC", "RANK" => "DESC");
} else {
$aSort = array("CUSTOM_RANK" => "DESC", "RANK" => "DESC", "DATE_CHANGE" => "DESC");
}
$arResult["SEARCH_RESULT"] = array();
if (strlen($arResult["~q"]) > 0 || strlen($arResult["~tags"]) > 0) {
$obSearch = new CSearch();
$obSearch->Search($arFilter, $aSort);
$arResult["SEARCH_RESULT"] = array();
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"]);
$arResult["NAV_STRING"] = $obSearch->GetPageNavString(GetMessage("LEARNING_RESULT_PAGES"), $arParams["NAV_TEMPLATE"]);
while ($arSearch = $obSearch->GetNext()) {
$arResult["SEARCH_RESULT"][] = $arSearch;
}
if (count($arResult["SEARCH_RESULT"]) > 0) {
if (strlen($arResult["~tags"]) > 0) {
$arResult["ORDER_LINK"] = $APPLICATION->GetCurPageParam("tags=" . urlencode($arResult["tags"]) . "&where=" . urlencode($arResult["where"]), array("tags", "where", "how"));
} else {
$arResult["ORDER_LINK"] = $APPLICATION->GetCurPageParam("q=" . urlencode($arResult["q"]) . "&where=" . urlencode($arResult["where"]), array("q", "where", "how"));
}
if ($arResult["~how"] != "d") {
$arResult["ORDER_LINK"] .= "&how=d";
示例4: array
$arUserGroupFilter["USER_ID"] = $arResult["User"]["ID"];
$arUserGroupFilter["<=ROLE"] = SONET_ROLES_USER;
}
if (CModule::IncludeModule("extranet") && !CExtranet::IsExtranetSite() && $arResult["filter_extranet"] == "Y") {
$arUserGroupFilter["GROUP_SITE_ID"] = CExtranet::GetExtranetSiteID();
$arUserGroupFilter["<=ROLE"] = SONET_ROLES_USER;
}
if (!$arResult["CurrentUserPerms"]["IsCurrentUser"] && !CSocNetUser::IsCurrentUserModuleAdmin()) {
$arGroupFilter["VISIBLE"] = "Y";
}
}
if ($arParams["USE_KEYWORDS"] == "Y" && strlen($arResult["~tags"]) > 0 && CModule::IncludeModule("search")) {
$arFilter = array("SITE_ID" => SITE_ID, "QUERY" => "", array("=MODULE_ID" => "socialnetwork", "ITEM_ID" => "G%"), "CHECK_DATES" => "Y", "TAGS" => $arResult["~tags"]);
$aSort = array("DATE_CHANGE" => "DESC", "CUSTOM_RANK" => "DESC", "RANK" => "DESC");
$obSearch = new CSearch();
$obSearch->Search($arFilter);
if ($obSearch->errorno == 0) {
while ($arSearch = $obSearch->Fetch()) {
if (intval($arSearch["PARAM2"]) > 0) {
$arGroupFilter["ID"][] = $arSearch["PARAM2"];
}
}
}
}
if (array_key_exists("ID", $arGroupFilter) && is_array($arGroupFilter["ID"])) {
$arGroupFilter["ID"] = array_unique($arGroupFilter["ID"]);
}
if (!$bNoMyGroups) {
if ($arUserGroupFilter && !empty($arUserGroupFilter)) {
$dbUserGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arUserGroupFilter, false, false, array("GROUP_ID"));
if ($dbUserGroups) {
示例5: array
<div class="c-separator-line"></div><?php
//sim items
$templateData['simId'] = array();
$templateData['simCount'] = 2;
if (empty($arResult['PROPERTIES']['TAGS']['VALUE'])) {
if (\Bitrix\Main\Loader::includeModule('iblock')) {
$arFilter = array('!ID' => $arResult['ID'], 'IBLOCK_ID' => $arParams['IBLOCK_ID'], 'ACTIVE' => 'Y', 'ACTIVE_DATE' => 'Y', 'SECTION_GLOBAL_ACTIVE' => 'Y', 'SECTION_ID' => $arResult['IBLOCK_SECTION_ID']);
$db = CIBlockElement::GetList(array('ACTIVE_FROM' => 'DESC', 'ID' => 'DESC'), $arFilter, false, array('nTopCount' => $templateData['simCount']), array('ID', 'IBLOCK_ID'));
while ($row = $db->Fetch()) {
$templateData['simId'][] = $row['ID'];
}
}
} elseif (\Bitrix\Main\Loader::includeModule('search')) {
$q = '';
foreach ($arResult['PROPERTIES']['TAGS']['VALUE'] as $val) {
if (!empty($q)) {
$q .= ' | ';
}
$q .= 'tag_search_' . $val;
}
$obSearch = new CSearch();
$obSearch->Search(array('QUERY' => $q, 'SITE_ID' => SITE_ID, 'MODULE_ID' => 'iblock', 'PARAM2' => $arResult['IBLOCK_ID'], '!ITEM_ID' => $arResult['ID']), array('RANK' => 'DESC'));
if ($obSearch->errorno == 0) {
while ($row = $obSearch->GetNext()) {
$templateData['simId'][] = $row['ITEM_ID'];
if (count($templateData['simId']) >= $templateData['simCount']) {
break;
}
}
}
}
示例6: PROPFIND
//.........這裏部分代碼省略.........
}
$res["~TYPE"] = "FILE";
$res["TYPE"] = "E";
$res["LOCK_STATUS"] = "green";
$res["EXTENTION"] = $ext;
$res["FILE_SIZE"] = $node->GetFileSize();
$res["FILE_ARRAY"] = array("TIMESTAMP_X" => $res["TIMESTAMP_X"], "MODULE_ID" => "webdav", "HEIGHT" => 0, "WIDTH" => 0, "FILE_SIZE" => $res["FILE_SIZE"], "CONTENT_TYPE" => $node->IsReadable() ? $this->_mimetype($path . $filename) : 'application/x-non-readable', "SUBDIR" => $io->CombinePath("/", $this->real_path, $this->arParams["item_id"]), "FILE_NAME" => $filename, "ORIGINAL_NAME" => $filename, "DESCRIPTION" => "");
}
$res["PROPS"] = $this->_get_props($filePath);
$res["LOCK_STATUS"] = 'green';
if (is_array($res['PROPS']['LOCK'])) {
$userLogin = $GLOBALS['USER']->GetLogin();
$now = time();
foreach ($res['PROPS']['LOCK'] as $arLock) {
if ($arLock['exclusivelock'] == 1 && $arLock['expires'] >= $now && $arLock['created'] <= $now) {
$res['LOCK_STATUS'] = $userLogin == $arLock['owner'] ? 'yellow' : 'red';
$rsUser = CUser::GetByLogin($arLock['owner']);
$arUser = $rsUser->GetNext();
$res['LOCKED_USER_NAME'] = '(' . $arUser['LOGIN'] . ')';
if (strlen($arUser['NAME']) > 0 && strlen($arUser['LAST_NAME']) > 0) {
$res['LOCKED_USER_NAME'] .= ' ' . $arUser['NAME'] . ' ' . $arUser['LAST_NAME'];
}
break;
}
}
}
$res['SHOW'] = $this->_getShowParams($res);
$arResult["RESULT"][($res["TYPE"] == "FOLDER" ? "S" : "E") . $filename] = $res;
$files['files'][] = $this->_get_fileinfo($this->arParams["item_id"] . $filename);
}
}
}
}
}
} else {
$arSearchResults = array();
if (IsModuleInstalled('search') && CModule::IncludeModule('search')) {
$arSearchParams = array("MODULE_ID" => "main", "URL" => $this->base_url . '%');
if (isset($options["FILTER"]["content"]) && strlen($options["FILTER"]["content"]) > 0) {
$arSearchParams += array("QUERY" => $options["FILTER"]["content"]);
}
$obSearch = new CSearch();
$obSearch->Search($arSearchParams);
if ($obSearch->errorno != 0) {
$arResult["ERROR_MESSAGE"] = $obSearch->error;
} else {
while ($arSearchResultItem = $obSearch->GetNext()) {
$arSearchResults[] = $arSearchResultItem['ITEM_ID'];
}
}
$tzOffset = CTimeZone::GetOffset();
foreach ($arSearchResults as $sSearchItem) {
$file = array_pop(explode("|", $sSearchItem));
$filename = GetFileName($file);
$sFullFileName = $io->CombinePath($_SERVER['DOCUMENT_ROOT'], $file);
if (strpos($sFullFileName, $this->real_path_full) === 0) {
$filePath = CWebDavBase::ConvertPathToRelative($sFullFileName, $this->real_path_full);
}
$filePath = CWebDavBase::CleanRelativePathString($filePath, $this->real_path_full);
if ($filePath === false) {
return false;
}
/*$sFullFileName = $io->CombinePath($_SERVER['DOCUMENT_ROOT'], $file);
$filename = array_pop(explode("/", $file));
$path = implode("/", array_slice(explode("/", $sFullFileName), 0 , -1)) . "/";
$filePath = $io->CombinePath($path, $filename);*/
$oFile = $io->GetFile($filePath);
$res = array("ID" => $file, "NAME" => $filename, "TIMESTAMP_X" => $oFile->GetModificationTime() + $tzOffset, "PERMISSION" => $this->permission, "PATH" => substr($file, strlen($this->real_path)), "REAL_PATH" => $filePath, "FILE_SIZE" => 0);
$res['SHOW'] = $this->_getShowParams($res);
if ($this->MetaNames($res)) {
$res["PROPS"] = $this->_get_props(substr($file, strlen($this->real_path)));
if (!isset($res["PROPS"]["UNDELETEBX:"])) {
if ($oFile->IsExists()) {
$ext = strtolower(strrchr($filename, '.'));
if (in_array($ext, $this->arFileForbiddenExtentions["READ"])) {
continue;
}
$fileSize = $oFile->GetFileSize();
$res["~TYPE"] = "FILE";
$res["TYPE"] = "E";
$res["LOCK_STATUS"] = "green";
$res["EXTENTION"] = $ext;
$res["FILE_SIZE"] = $fileSize;
$res["FILE_ARRAY"] = array("TIMESTAMP_X" => $res["TIMESTAMP_X"], "MODULE_ID" => "webdav", "HEIGHT" => 0, "WIDTH" => 0, "FILE_SIZE" => $fileSize, "CONTENT_TYPE" => $oFile->IsReadable() ? $this->_mimetype($filePath) : 'application/x-non-readable', "SUBDIR" => implode("/", array_slice(explode("/", $file), 0, -1)), "FILE_NAME" => $filename, "ORIGINAL_NAME" => $filename, "DESCRIPTION" => "");
}
$arResult["RESULT"][($res["TYPE"] == "FOLDER" ? "S" : "E") . $filename] = $res;
}
}
}
}
}
if ($arParams["return"] == "nav_result" || $arParams["return"] == "array") {
uasort($arResult["RESULT"], "__sort_array_folder_and_file");
$arResult["NAV_RESULT"] = new CDBResult();
$arResult["NAV_RESULT"]->InitFromArray($arResult["RESULT"]);
$arResult["NAV_RESULT"] = new CDBResultWebDAVFiles($arResult["NAV_RESULT"]);
return $arResult;
}
return true;
}
示例7: CSearch
}
$obSearch = new CSearch();
//When restart option is set we will ignore error on query with only stop words
$obSearch->SetOptions(array("ERROR_ON_EMPTY_STEM" => $arParams["RESTART"] != "Y", "NO_WORD_LOGIC" => $arParams["NO_WORD_LOGIC"] == "Y"));
$obSearch->Search($arFilter, $aSort, $exFILTER);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
$arResult["SEARCH"] = array();
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"], false);
$ar = $obSearch->GetNext();
//Search restart
if (!$ar && $arParams["RESTART"] == "Y" && $obSearch->Query->bStemming) {
$exFILTER["STEMMING"] = false;
$obSearch = new CSearch();
$obSearch->Search($arFilter, $aSort, $exFILTER);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"], false);
$ar = $obSearch->GetNext();
}
}
$arReturn = array();
while ($ar) {
$arReturn[$ar["ID"]] = $ar["ITEM_ID"];
$ar["CHAIN_PATH"] = $APPLICATION->GetNavChain($ar["URL"], 0, $folderPath . "/chain_template.php", true, false);
$ar["URL"] = htmlspecialcharsbx($ar["URL"]);
$ar["TAGS"] = array();
if (!empty($ar["~TAGS_FORMATED"])) {
foreach ($ar["~TAGS_FORMATED"] as $name => $tag) {
示例8: PROPFIND
function PROPFIND(&$options, &$files, $arParams = array())
{
global $DB;
if (empty($files)) {
$files = array();
}
$files["files"] = array();
$arParams = is_array($arParams) ? $arParams : array();
if ($this->e_rights) {
$options['check_permissions'] = false;
}
$this->IsDir($options);
$arParamsIsDir = $this->arParams;
$arResult = array("NAV_RESULT" => false, "RESULT" => array());
if ($arParamsIsDir["not_found"] === true) {
$msg = $arParamsIsDir['parent_id'] === false ? GetMessage("WD_FOLDER_NOT_FOUND") : GetMessage("WD_FILE_NOT_FOUND");
return $this->ThrowError("404 Not Found", "DESTINATION_FILE_OR_FOLDER_IS_NOT_FOUND", $msg, __LINE__);
} elseif ($arParamsIsDir["is_dir"] != true) {
$db_res = $this->_get_mixed_list(intVal($arParamsIsDir["parent_id"]), $arParams, intVal($arParamsIsDir["item_id"]));
if ($db_res && ($res = $db_res->Fetch())) {
if ($this->MetaNames($res)) {
$files["files"]["F" . $res["ID"]] = $this->_get_file_info_arr($res, $arParams);
if ($arParams["return"] == "array") {
$files["files"]["F" . $res["ID"]] = $res;
}
$arResult["RESULT"]["E" . $res["ID"]] = $res;
// dummy
}
}
} else {
if (!empty($arParamsIsDir['dir_array'][self::UF_LINK_SECTION_ID])) {
$linkWebdav = new self($arParamsIsDir['dir_array'][self::UF_LINK_IBLOCK_ID], $this->base_url . $this->_path, array_merge($this->_originalParams, array('ROOT_SECTION_ID' => $arParamsIsDir['dir_array'][self::UF_LINK_SECTION_ID], 'symlinkMode' => true, 'symlinkSectionData' => $arParamsIsDir['dir_array'], 'symlinkRealRootSectionData' => $this->arRootSection)));
$options = array('path' => '/', 'depth' => 1, 'check_permissions' => false);
$params = array_merge($arParams, array('PARENT_ID' => $arParamsIsDir['dir_array'][self::UF_LINK_SECTION_ID]));
$linkWebdav->_path = $this->_path;
return $linkWebdav->PROPFIND($options, $files, $params);
}
//simple detect symlink
list($contextType, $contextEntityId) = $this->getContextData();
if ($arParamsIsDir['dir_array']) {
$sectionData = $this->getSectionDataForLinkAnalyze($arParamsIsDir['dir_array']['ID'], array('IBLOCK_ID' => $arParamsIsDir['dir_array']['IBLOCK_ID'], 'ID' => $arParamsIsDir['dir_array']['ID']));
if (!$this->_symlinkMode && CWebDavSymlinkHelper::isLink($contextType, $contextEntityId, $sectionData)) {
$symlinkSectionData = CWebDavSymlinkHelper::getLinkData($contextType, $contextEntityId, $sectionData);
}
}
if (!empty($symlinkSectionData)) {
$linkWebdav = new self($symlinkSectionData[self::UF_LINK_IBLOCK_ID], $this->base_url . $this->_path, array_merge($this->_originalParams, array('ROOT_SECTION_ID' => $symlinkSectionData[self::UF_LINK_SECTION_ID], 'symlinkMode' => true, 'symlinkSectionData' => $symlinkSectionData, 'symlinkRealRootSectionData' => $this->arRootSection)));
$options = array('path' => '/', 'depth' => 1, 'check_permissions' => false);
$params = array_merge($arParams, array('PARENT_ID' => $arParamsIsDir['dir_array']['ID']));
$linkWebdav->_path = $this->_path;
return $linkWebdav->PROPFIND($options, $files, $params);
}
if ($arParamsIsDir["item_id"] <= 0 || $this->arRootSection["ID"] == $arParamsIsDir["item_id"]) {
$files["files"]["iblock"] = $this->get_iblock_info($arr);
if ($this->_symlinkMode) {
$files["files"]["iblock"]['path'] = $this->_path;
if (SITE_CHARSET != "UTF-8") {
$files["files"]["iblock"]['path'] = $GLOBALS["APPLICATION"]->ConvertCharset($this->_path, SITE_CHARSET, "UTF-8");
}
}
$arResult["IBLOCK"] = $arr;
} else {
$arResult["SECTION"] = $this->arParams["dir_array"];
if ($this->MetaNames($arResult["SECTION"])) {
$files["files"]["section"] = $this->_get_section_info_arr($arResult["SECTION"]);
} else {
unset($arResult["SECTION"]);
}
}
if (!empty($options["depth"])) {
if (intVal($arParamsIsDir["item_id"]) <= 0) {
$arParamsIsDir["item_id"] = $this->arRootSection ? $this->arRootSection["ID"] : $arParamsIsDir["item_id"];
}
// content search
$arSearchResults = array();
if (isset($arParams["FILTER"]["content"]) && strlen($arParams["FILTER"]["content"]) > 0 && IsModuleInstalled('search') && CModule::IncludeModule('search')) {
$obSearch = new CSearch();
if (preg_match("/\\.[a-zA-Z]{3,4}\$/", $arParams["FILTER"]["content"])) {
$arParams["FILTER"]["content"] = '"' . $arParams["FILTER"]["content"] . '"';
}
$arSearchParams = array("QUERY" => $arParams["FILTER"]["content"]);
if (!$this->arRootSection) {
$arSearchParams += array("MODULE_ID" => "iblock", "PARAM_2" => $this->IBLOCK_ID);
} else {
if (isset($this->attributes['user_id'])) {
$arSearchParams += array("PARAMS" => array("socnet_user" => $this->attributes['user_id']));
} elseif (isset($this->attributes['group_id'])) {
$arSearchParams += array("PARAMS" => array("socnet_group" => $this->attributes['group_id']));
}
}
$obSearch->Search($arSearchParams);
if ($obSearch->errorno != 0) {
$arResult["ERROR_MESSAGE"] = $obSearch->error;
} else {
while ($arSearchResultItem = $obSearch->GetNext()) {
$arSearchResults[$arSearchResultItem['ITEM_ID']] = true;
}
}
}
$arSearchOptParams = array_flip(array("SHOW_NEW", "SHOW_HISTORY", "FILE_SIZE_multiply"));
//.........這裏部分代碼省略.........
示例9: CSearch
if ($arParams["CHECK_DATES"]) {
$arFilter["CHECK_DATES"] = "Y";
}
$arFilter = array_merge($arFILTERCustom, $arFilter);
$obSearch = new CSearch();
$obSearch->Search($arFilter, array("CNT" => "DESC"), $exFILTER, true);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
$arResult["DATE"] = array();
$arResult["SEARCH"] = array();
if ($obSearch->errorno == 0) {
$res = $obSearch->GetNext();
if (!$res && $arParams["RESTART"] == "Y" && $obSearch->Query->bStemming) {
$exFILTER["STEMMING"] = false;
$obSearch = new CSearch();
$obSearch->Search($arFilter, array("CNT" => "DESC"), $exFILTER, true);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
if ($obSearch->errorno == 0) {
$res = $obSearch->GetNext();
}
}
if ($res) {
$arResult["CNT_MIN"] = $res["CNT"];
$arResult["CNT_MAX"] = $res["CNT"];
$res["TIME"] = MakeTimeStamp($res["FULL_DATE_CHANGE"]);
$arResult["TIME_MIN"] = $res["TIME"];
$arResult["TIME_MAX"] = $res["TIME"];
$arTags = array();
if ($arParams["TAGS_INHERIT"] != "N" && strlen($arParams["TAGS"]) > 0) {
$tmp = explode(",", $arParams["~TAGS"]);
示例10: getSearchedElement
/**
* $arParams,
* $request
*/
function getSearchedElement($arParams, $request)
{
if (!CModule::IncludeModule("search")) {
return false;
}
$arParams["SHOW_WHEN"] = $arParams["SHOW_WHEN"] == "Y";
if (!is_array($arParams["arrWHERE"])) {
$arParams["arrWHERE"] = array();
}
$arParams["PAGE_RESULT_COUNT"] = 50;
if ($arParams["DEFAULT_SORT"] !== "date") {
$arParams["DEFAULT_SORT"] = "rank";
}
if (strlen($arParams["FILTER_NAME"]) <= 0 || !preg_match("/^[A-Za-z_][A-Za-z01-9_]*\$/", $arParams["FILTER_NAME"])) {
$arFILTERCustom = array();
} else {
$arFILTERCustom = $GLOBALS[$arParams["FILTER_NAME"]];
if (!is_array($arFILTERCustom)) {
$arFILTERCustom = array();
}
}
$exFILTER = CSearchParameters::ConvertParamsToFilter($arParams, "arrFILTER");
//options
if (isset($_REQUEST["q"])) {
$q = trim($_REQUEST["q"]);
} else {
$q = false;
}
if ($q !== false) {
if ($arParams["USE_LANGUAGE_GUESS"] == "N" || isset($_REQUEST["spell"])) {
$arResult["REQUEST"]["~QUERY"] = $q;
$arResult["REQUEST"]["QUERY"] = htmlspecialcharsex($q);
} else {
$arLang = CSearchLanguage::GuessLanguage($q);
if (is_array($arLang) && $arLang["from"] != $arLang["to"]) {
$arResult["REQUEST"]["~ORIGINAL_QUERY"] = $q;
$arResult["REQUEST"]["ORIGINAL_QUERY"] = htmlspecialcharsex($q);
$arResult["REQUEST"]["~QUERY"] = CSearchLanguage::ConvertKeyboardLayout($arResult["REQUEST"]["~ORIGINAL_QUERY"], $arLang["from"], $arLang["to"]);
$arResult["REQUEST"]["QUERY"] = htmlspecialcharsex($arResult["REQUEST"]["~QUERY"]);
} else {
$arResult["REQUEST"]["~QUERY"] = $q;
$arResult["REQUEST"]["QUERY"] = htmlspecialcharsex($q);
}
}
}
$arResult["URL"] = $APPLICATION->GetCurPage() . "?q=" . urlencode($q) . (isset($_REQUEST["spell"]) ? "&spell=1" : "") . ($tags !== false ? "&tags=" . urlencode($tags) : "");
if (isset($arResult["REQUEST"]["~ORIGINAL_QUERY"])) {
$arResult["ORIGINAL_QUERY_URL"] = $APPLICATION->GetCurPage() . "?q=" . urlencode($arResult["REQUEST"]["~ORIGINAL_QUERY"]) . "&spell=1" . "&where=" . urlencode($arResult["REQUEST"]["WHERE"]) . ($arResult["REQUEST"]["HOW"] == "d" ? "&how=d" : "") . ($arResult["REQUEST"]["FROM"] ? '&from=' . urlencode($arResult["REQUEST"]["~FROM"]) : "") . ($arResult["REQUEST"]["TO"] ? '&to=' . urlencode($arResult["REQUEST"]["~TO"]) : "") . ($tags !== false ? "&tags=" . urlencode($tags) : "");
}
$templatePage = "";
$arReturn = false;
$arFilter = array("SITE_ID" => SITE_ID, "QUERY" => $arResult["REQUEST"]["~QUERY"], "TAGS" => $arResult["REQUEST"]["~TAGS"]);
$arFilter = array_merge($arFILTERCustom, $arFilter);
if ($from) {
$arFilter[">=DATE_CHANGE"] = $from;
}
if ($to) {
$arFilter["<=DATE_CHANGE"] = $to;
}
$obSearch = new CSearch();
//When restart option is set we will ignore error on query with only stop words
$obSearch->SetOptions(array("ERROR_ON_EMPTY_STEM" => $arParams["RESTART"] != "Y", "NO_WORD_LOGIC" => $arParams["NO_WORD_LOGIC"] == "Y"));
$obSearch->Search($arFilter, $aSort, $exFILTER);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
$arResult["SEARCH"] = array();
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"], false);
$ar = $obSearch->GetNext();
//Search restart
if (!$ar && $arParams["RESTART"] == "Y" && $obSearch->Query->bStemming) {
$exFILTER["STEMMING"] = false;
$obSearch = new CSearch();
$obSearch->Search($arFilter, $aSort, $exFILTER);
$arResult["ERROR_CODE"] = $obSearch->errorno;
$arResult["ERROR_TEXT"] = $obSearch->error;
if ($obSearch->errorno == 0) {
$obSearch->NavStart($arParams["PAGE_RESULT_COUNT"], false);
$ar = $obSearch->GetNext();
}
}
$arReturn = array();
while ($ar) {
$arReturn[$ar["ID"]] = $ar["ITEM_ID"];
$ar["CHAIN_PATH"] = $APPLICATION->GetNavChain($ar["URL"], 0, $folderPath . "/chain_template.php", true, false);
$ar["URL"] = htmlspecialcharsbx($ar["URL"]);
$ar["TAGS"] = array();
if (!empty($ar["~TAGS_FORMATED"])) {
foreach ($ar["~TAGS_FORMATED"] as $name => $tag) {
if ($arParams["TAGS_INHERIT"] == "Y") {
$arTags = $arResult["REQUEST"]["~TAGS_ARRAY"];
$arTags[$tag] = $tag;
$tags = implode(",", $arTags);
} else {
$tags = $tag;
}
//.........這裏部分代碼省略.........
示例11: IntVal
</font></td></tr>
</table>
</td></tr></table>
</form>
<br>
<?php
if (strlen($q) > 0) {
?>
<table width="99%" align="center" border="0" cellspacing="0" cellpadding="0"><tr><td><?php
$FORUM_ID = IntVal($_REQUEST["FORUM_ID"]);
if ($FORUM_ID <= 0) {
$FORUM_ID = false;
}
$obSearch = new CSearch();
$obSearch->Search(array("MODULE_ID" => "forum", "PARAM1" => $FORUM_ID, "SITE_ID" => SITE_ID, "QUERY" => $q));
if ($obSearch->errorno != 0) {
?>
<font class="text"><?php
echo GetMessage("FS_PHRASE_ERROR");
?>
</font>
<?php
echo ShowError($obSearch->error);
?>
<font class="text"><?php
echo GetMessage("FS_PHRASE_ERROR_CORRECT");
?>
</font><br><br>
<font class="text">