当前位置: 首页>>代码示例>>PHP>>正文


PHP CSearch::Index方法代码示例

本文整理汇总了PHP中CSearch::Index方法的典型用法代码示例。如果您正苦于以下问题:PHP CSearch::Index方法的具体用法?PHP CSearch::Index怎么用?PHP CSearch::Index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSearch的用法示例。


在下文中一共展示了CSearch::Index方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Update

 function Update($ID, $arFields)
 {
     global $DB;
     $ID = IntVal($ID);
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CBlogUser::CheckFields("UPDATE", $arFields, $ID)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_blog_user", $arFields, "blog/avatar");
     foreach ($arFields1 as $key => $value) {
         if (strlen($strUpdate) > 0) {
             $strUpdate .= ", ";
         }
         $strUpdate .= $key . "=" . $value . " ";
     }
     if (strlen($strUpdate) > 0) {
         $arUser = CBlogUser::GetByID($ID, BLOG_BY_BLOG_USER_ID);
         $strSql = "UPDATE b_blog_user SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         unset($GLOBALS["BLOG_USER_CACHE_" . $ID]);
         unset($GLOBALS["BLOG_USER1_CACHE_" . $arUser["USER_ID"]]);
     } else {
         $ID = false;
     }
     if ($ID && !(count($arFields1) == 1 && strlen($arFields1["LAST_VISIT"]) > 0)) {
         if (CModule::IncludeModule("search")) {
             $arBlogUser = CBlogUser::GetByID($ID);
             $dbUser = CUser::GetByID($arBlogUser["USER_ID"]);
             $arUser = $dbUser->Fetch();
             $arBlog = CBlog::GetByOwnerID($arBlogUser["USER_ID"]);
             if ($arBlog) {
                 $arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
                 $arPostSite = array($arGroup["SITE_ID"] => CBlogUser::PreparePath($arBlogUser["USER_ID"], $arGroup["SITE_ID"]));
             } else {
                 $arPostSite = array(SITE_ID => CBlogUser::PreparePath($arBlogUser["USER_ID"], SITE_ID));
             }
             if (strlen($arBlogUser["LAST_VISIT"]) <= 0) {
                 $arBlogUser["LAST_VISIT"] = ConvertTimeStamp(false, "FULL", false);
             }
             $arSearchIndex = array("SITE_ID" => $arPostSite, "LAST_MODIFIED" => $arBlogUser["LAST_VISIT"], "PARAM1" => "USER", "PARAM2" => $arBlogUser["USER_ID"], "PERMISSIONS" => array(2), "TITLE" => CBlogUser::GetUserName($arBlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"]), "BODY" => blogTextParser::killAllTags($arBlogUser["INTERESTS"] . " " . $arBlogUser["DESCRIPTION"]));
             CSearch::Index("blog", "U" . $ID, $arSearchIndex);
         }
     }
     return $ID;
 }
开发者ID:,项目名称:,代码行数:51,代码来源:

示例2: UpdateSearch

 function UpdateSearch($ID, $bOverWrite = false)
 {
     if (!CModule::IncludeModule("search")) {
         return;
     }
     global $DB;
     $ID = Intval($ID);
     static $arGroups = array();
     static $arSITE = array();
     $strSql = "\n\t\t\tSELECT BS.ID, BS.NAME, BS.DESCRIPTION_TYPE, BS.DESCRIPTION, BS.XML_ID as EXTERNAL_ID,\n\t\t\t\tBS.CODE, BS.IBLOCK_ID, B.IBLOCK_TYPE_ID,\n\t\t\t\t" . $DB->DateToCharFunction("BS.TIMESTAMP_X") . " as LAST_MODIFIED,\n\t\t\t\tB.CODE as IBLOCK_CODE, B.XML_ID as IBLOCK_EXTERNAL_ID, B.SECTION_PAGE_URL,\n\t\t\t\tB.ACTIVE as ACTIVE1,\n\t\t\t\tBS.GLOBAL_ACTIVE as ACTIVE2,\n\t\t\t\tB.INDEX_SECTION, B.RIGHTS_MODE\n\t\t\tFROM b_iblock_section BS, b_iblock B\n\t\t\tWHERE BS.IBLOCK_ID=B.ID\n\t\t\t\tAND BS.ID=" . $ID;
     $dbrIBlockSection = $DB->Query($strSql);
     if ($arIBlockSection = $dbrIBlockSection->Fetch()) {
         $IBLOCK_ID = $arIBlockSection["IBLOCK_ID"];
         $SECTION_URL = "=ID=" . $arIBlockSection["ID"] . "&EXTERNAL_ID=" . $arIBlockSection["EXTERNAL_ID"] . "&IBLOCK_TYPE_ID=" . $arIBlockSection["IBLOCK_TYPE_ID"] . "&IBLOCK_ID=" . $arIBlockSection["IBLOCK_ID"] . "&IBLOCK_CODE=" . $arIBlockSection["IBLOCK_CODE"] . "&IBLOCK_EXTERNAL_ID=" . $arIBlockSection["IBLOCK_EXTERNAL_ID"] . "&CODE=" . $arIBlockSection["CODE"];
         if ($arIBlockSection["ACTIVE1"] != "Y" || $arIBlockSection["ACTIVE2"] != "Y" || $arIBlockSection["INDEX_SECTION"] != "Y") {
             CSearch::DeleteIndex("iblock", "S" . $arIBlockSection["ID"]);
             return;
         }
         if (!array_key_exists($IBLOCK_ID, $arGroups)) {
             $arGroups[$IBLOCK_ID] = array();
             $strSql = "SELECT GROUP_ID " . "FROM b_iblock_group " . "WHERE IBLOCK_ID= " . $IBLOCK_ID . " " . "\tAND PERMISSION>='R' " . "ORDER BY GROUP_ID";
             $dbrIBlockGroup = $DB->Query($strSql);
             while ($arIBlockGroup = $dbrIBlockGroup->Fetch()) {
                 $arGroups[$IBLOCK_ID][] = $arIBlockGroup["GROUP_ID"];
                 if ($arIBlockGroup["GROUP_ID"] == 2) {
                     break;
                 }
             }
         }
         if (!array_key_exists($IBLOCK_ID, $arSITE)) {
             $arSITE[$IBLOCK_ID] = array();
             $strSql = "SELECT SITE_ID " . "FROM b_iblock_site " . "WHERE IBLOCK_ID= " . $IBLOCK_ID;
             $dbrIBlockSite = $DB->Query($strSql);
             while ($arIBlockSite = $dbrIBlockSite->Fetch()) {
                 $arSITE[$IBLOCK_ID][] = $arIBlockSite["SITE_ID"];
             }
         }
         $BODY = $arIBlockSection["DESCRIPTION_TYPE"] == "html" ? CSearch::KillTags($arIBlockSection["DESCRIPTION"]) : $arIBlockSection["DESCRIPTION"];
         $BODY .= $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("IBLOCK_" . $arIBlockSection["IBLOCK_ID"] . "_SECTION", $arIBlockSection["ID"]);
         if ($arIBlockSection["RIGHTS_MODE"] !== "E") {
             $arPermissions = $arGroups[$IBLOCK_ID];
         } else {
             $obSectionRights = new CIBlockSectionRights($IBLOCK_ID, $arIBlockSection["ID"]);
             $arPermissions = $obSectionRights->GetGroups(array("section_read"));
         }
         CSearch::Index("iblock", "S" . $ID, array("LAST_MODIFIED" => $arIBlockSection["LAST_MODIFIED"], "TITLE" => $arIBlockSection["NAME"], "PARAM1" => $arIBlockSection["IBLOCK_TYPE_ID"], "PARAM2" => $IBLOCK_ID, "SITE_ID" => $arSITE[$IBLOCK_ID], "PERMISSIONS" => $arPermissions, "URL" => $SECTION_URL, "BODY" => $BODY), $bOverWrite);
     }
 }
开发者ID:,项目名称:,代码行数:48,代码来源:

示例3: Index

 function Index($arTask, $tags)
 {
     if (CModule::IncludeModule("search")) {
         if (is_array($tags)) {
             $tags = implode(",", $tags);
         }
         if ($arTask["GROUP_ID"] > 0) {
             $path = str_replace("#group_id#", $arTask["GROUP_ID"], COption::GetOptionString("tasks", "paths_task_group_entry", "/workgroups/group/#group_id#/tasks/task/view/#task_id#/", $arTask["SITE_ID"]));
         } else {
             $path = str_replace("#user_id#", $arTask["RESPONSIBLE_ID"], COption::GetOptionString("tasks", "paths_task_user_entry", "/company/personal/user/#user_id#/tasks/task/view/#task_id#/", $arTask["SITE_ID"]));
         }
         $path = str_replace("#task_id#", $arTask["ID"], $path);
         $arSearchIndex = array("LAST_MODIFIED" => $arTask["CHANGED_DATE"] ? $arTask["CHANGED_DATE"] : $arTask["CREATED_DATE"], "TITLE" => $arTask["TITLE"], "BODY" => strip_tags($arTask["DESCRIPTION"]) ? strip_tags($arTask["DESCRIPTION"]) : $arTask["TITLE"], "TAGS" => $tags, "URL" => $path, "SITE_ID" => $arTask["SITE_ID"], "PERMISSIONS" => CTasks::__GetSearchPermissions($arTask), "ENTITY_TYPE_ID" => "TASK", "ENTITY_ID" => $arTask["ID"]);
         $entity_type = $arTask["GROUP_ID"] != 0 ? "G" : "U";
         $entity_name = $entity_type == "G" ? "socnet_group" : "socnet_user";
         $entity_id = $entity_type == "G" ? $arTask["GROUP_ID"] : $arTask["RESPONSIBLE_ID"];
         $feature = $entity_type == "G" ? "view" : "view_all";
         $arSearchIndex["PARAMS"] = array("feature_id" => "S" . $entity_type . "_" . $entity_id . "_tasks_" . $feature, $entity_name => $entity_id);
         CSearch::Index("tasks", $arTask["ID"], $arSearchIndex, true);
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:21,代码来源:task.php

示例4: Reindex

 function Reindex($ID, &$arMessage)
 {
     if (!($ID > 0) || !CModule::IncludeModule("search")) {
         return array("FORUM_ID", "TOPIC_ID", "TITLE_SEO", "MESSAGE_ID", "SOCNET_GROUP_ID", "OWNER_ID", "PARAM1", "PARAM2");
     }
     if (!is_array($arMessage) || !array_key_exists("FORUM_INFO", $arMessage) || !array_key_exists("TOPIC_INFO", $arMessage)) {
         $arMessage = CForumMessage::GetByIDEx($ID, array("GET_TOPIC_INFO" => "Y", "GET_FORUM_INFO" => "Y", "FILTER" => "Y"));
     }
     $arMessage["POST_MESSAGE"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"];
     $arParams = array("PERMISSION" => array(), "SITE" => CForumNew::GetSites($arMessage["FORUM_ID"]), "DEFAULT_URL" => "/");
     $arGroups = CForumNew::GetAccessPermissions($arMessage["FORUM_ID"]);
     for ($i = 0; $i < count($arGroups); $i++) {
         if ($arGroups[$i][1] >= "E") {
             $arParams["PERMISSION"][] = $arGroups[$i][0];
             if ($arGroups[$i][0] == 2) {
                 break;
             }
         }
     }
     $arSearchInd = array("LID" => array(), "LAST_MODIFIED" => $arMessage["POST_DATE"], "PARAM1" => $arMessage["FORUM_ID"], "PARAM2" => $arMessage["TOPIC_ID"], "PERMISSIONS" => $arParams["PERMISSION"], "TITLE" => $arMessage["TOPIC_INFO"]["TITLE"] . ($arMessage["NEW_TOPIC"] == "Y" && !empty($arMessage["TOPIC_INFO"]["DESCRIPTION"]) ? ", " . $arMessage["TOPIC_INFO"]["DESCRIPTION"] : ""), "TAGS" => $arMessage["NEW_TOPIC"] == "Y" ? $arMessage["TOPIC_INFO"]["TAGS"] : "", "BODY" => GetMessage("AVTOR_PREF") . " " . $arMessage["AUTHOR_NAME"] . ". " . forumTextParser::clearAllTags($arMessage["POST_MESSAGE"]), "ENTITY_TYPE_ID" => $arMessage["NEW_TOPIC"] == "Y" ? "FORUM_TOPIC" : "FORUM_POST", "ENTITY_ID" => $arMessage["NEW_TOPIC"] == "Y" ? $arMessage["TOPIC_ID"] : $arMessage["ID"], "USER_ID" => $arMessage["AUTHOR_ID"], "URL" => "", "INDEX_TITLE" => $arMessage["NEW_TOPIC"] == "Y");
     // get mentions
     $arMentionedUserID = CForumMessage::GetMentionedUserID($arMessage["POST_MESSAGE"]);
     if (!empty($arMentionedUserID)) {
         $arSearchInd["PARAMS"] = array("mentioned_user_id" => $arMentionedUserID);
     }
     $urlPatterns = array("FORUM_ID" => $arMessage["FORUM_ID"], "TOPIC_ID" => $arMessage["TOPIC_ID"], "TITLE_SEO" => $arMessage["TOPIC_INFO"]["TITLE_SEO"], "MESSAGE_ID" => $arMessage["ID"], "SOCNET_GROUP_ID" => $arMessage["TOPIC_INFO"]["SOCNET_GROUP_ID"], "OWNER_ID" => $arMessage["TOPIC_INFO"]["OWNER_ID"], "PARAM1" => $arMessage["PARAM1"], "PARAM2" => $arMessage["PARAM2"]);
     foreach ($arParams["SITE"] as $key => $val) {
         $arSearchInd["LID"][$key] = CForumNew::PreparePath2Message($val, $urlPatterns);
         if (empty($arSearchInd["URL"]) && !empty($arSearchInd["LID"][$key])) {
             $arSearchInd["URL"] = $arSearchInd["LID"][$key];
         }
     }
     if (empty($arSearchInd["URL"])) {
         foreach ($arParams["SITE"] as $key => $val) {
             $db_lang = CLang::GetByID($key);
             if ($db_lang && ($ar_lang = $db_lang->Fetch())) {
                 $arParams["DEFAULT_URL"] = $ar_lang["DIR"];
                 break;
             }
         }
         $arParams["DEFAULT_URL"] .= COption::GetOptionString("forum", "REL_FPATH", "") . "forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";
         $arSearchInd["URL"] = CForumNew::PreparePath2Message($arParams["DEFAULT_URL"], $urlPatterns);
     }
     CSearch::DeleteIndex("forum", $ID);
     CSearch::Index("forum", $ID, $arSearchInd, true);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:46,代码来源:message.php

示例5: _IndexPostComments

	public static function _IndexPostComments($arParams = Array())
	{
		if(IntVal($arParams["BLOG_ID"]) <= 0 || IntVal($arParams["POST_ID"]) <= 0 || !CModule::IncludeModule("search"))
			return false;
		if($arParams["USE_SOCNET"] == "Y")
			$arSp = CBlogComment::GetSocNetCommentPerms($arParams["POST_ID"]);

		$dbComment = CBlogComment::GetList(Array(), Array("BLOG_ID" => $arParams["BLOG_ID"], "POST_ID" => $arParams["POST_ID"], "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH), false, false, Array("ID", "POST_ID", "BLOG_ID", "PUBLISH_STATUS", "PATH", "DATE_CREATE", "POST_TEXT", "TITLE", "AUTHOR_ID"));
		while($arComment = $dbComment->Fetch())
		{
			if(strlen($arComment["PATH"]) > 0)
				$arComment["PATH"] = str_replace("#comment_id#", $arComment["ID"], $arComment["PATH"]);
			elseif(strlen($arParams["PATH"]) > 0)
				$arComment["PATH"] = str_replace("#comment_id#", $arComment["ID"], $arParams["PATH"]);
			else
			{
				$arComment["PATH"] = CBlogPost::PreparePath(
							$arParams["BLOG_URL"],
							$arComment["POST_ID"],
							$arParams["SITE_ID"],
							false,
							$arParams["OWNER_ID"],
							$arParams["SOCNET_GROUP_ID"]
						);
			}

			$arSearchIndex = array(
				"SITE_ID" => array($arParams["SITE_ID"] => $arComment["PATH"]),
				"LAST_MODIFIED" => $arComment["DATE_CREATE"],
				"PARAM1" => "COMMENT",
				"PARAM2" => $arComment["BLOG_ID"]."|".$arComment["POST_ID"],
				"PERMISSIONS" => array(2),
				"TITLE" => $arComment["TITLE"],
				"BODY" => blogTextParser::killAllTags($arComment["POST_TEXT"]),
				"INDEX_TITLE" => false,
				"USER_ID" => (IntVal($arComment["AUTHOR_ID"]) > 0) ? $arComment["AUTHOR_ID"] : false,
				"ENTITY_TYPE_ID" => "BLOG_COMMENT",
				"ENTITY_ID" => $arComment["ID"],
			);
			if($arParams["USE_SOCNET"] == "Y")
			{
				$arSearchIndex["PERMISSIONS"] = $arSp;
				if(!in_array("U".$arComment["AUTHOR_ID"], $arSearchIndex["PERMISSIONS"]))
						$arSearchIndex["PERMISSIONS"][] = "U".$arComment["AUTHOR_ID"];

				if(is_array($arSp))
				{
					$sgId = array();
					foreach($arSp as $perm)
					{
						if(strpos($perm, "SG") !== false)
						{
							$sgIdTmp = str_replace("SG", "", substr($perm, 0, strpos($perm, "_")));
							if(!in_array($sgIdTmp, $sgId) && IntVal($sgIdTmp) > 0)
								$sgId[] = $sgIdTmp;
						}
					}

					if(!empty($sgId))
					{
						$arSearchIndex["PARAMS"] = array(
							"socnet_group" => $sgId,
							"entity" => "socnet_group",
						);
					}
				}
			}
			if(strlen($arComment["TITLE"]) <= 0)
				$arSearchIndex["TITLE"] = substr($arSearchIndex["BODY"], 0, 100);

			CSearch::Index("blog", "C".$arComment["ID"], $arSearchIndex, True);
		}
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:73,代码来源:blog_comment.php

示例6: Delete

 function Delete($ID)
 {
     global $DB;
     $ID = IntVal($ID);
     $arPost = CBlogPost::GetByID($ID);
     if ($arPost) {
         $db_events = GetModuleEvents("blog", "OnBeforePostDelete");
         while ($arEvent = $db_events->Fetch()) {
             if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
                 return false;
             }
         }
         $dbResult = CBlogComment::GetList(array(), array("POST_ID" => $ID), false, false, array("ID"));
         while ($arResult = $dbResult->Fetch()) {
             if (!CBlogComment::Delete($arResult["ID"])) {
                 return False;
             }
         }
         $dbResult = CBlogUserGroupPerms::GetList(array(), array("POST_ID" => $ID, "BLOG_ID" => $arPost["BLOG_ID"]), false, false, array("ID"));
         while ($arResult = $dbResult->Fetch()) {
             if (!CBlogUserGroupPerms::Delete($arResult["ID"])) {
                 return False;
             }
         }
         $dbResult = CBlogTrackback::GetList(array(), array("POST_ID" => $ID, "BLOG_ID" => $arPost["BLOG_ID"]), false, false, array("ID"));
         while ($arResult = $dbResult->Fetch()) {
             if (!CBlogTrackback::Delete($arResult["ID"])) {
                 return False;
             }
         }
         $dbResult = CBlogPostCategory::GetList(array(), array("POST_ID" => $ID, "BLOG_ID" => $arPost["BLOG_ID"]), false, false, array("ID"));
         while ($arResult = $dbResult->Fetch()) {
             if (!CBlogPostCategory::Delete($arResult["ID"])) {
                 return False;
             }
         }
         $strSql = "SELECT F.ID " . "FROM b_blog_post P, b_file F " . "WHERE P.ID = " . $ID . " " . "\tAND P.ATTACH_IMG = F.ID ";
         $z = $DB->Query($strSql, false, "FILE: " . __FILE__ . " LINE:" . __LINE__);
         while ($zr = $z->Fetch()) {
             CFile::Delete($zr["ID"]);
         }
         unset($GLOBALS["BLOG_POST"]["BLOG_POST_CACHE_" . $ID]);
         $arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
         $result = $DB->Query("DELETE FROM b_blog_post WHERE ID = " . $ID . "", true);
         if (IntVal($arBlog["LAST_POST_ID"]) == $ID) {
             CBlog::SetStat($arPost["BLOG_ID"]);
         }
         if ($result) {
             $res = CBlogImage::GetList(array(), array("POST_ID" => $ID, "IS_COMMENT" => "N"));
             while ($aImg = $res->Fetch()) {
                 CBlogImage::Delete($aImg['ID']);
             }
         }
         if ($result) {
             $GLOBALS["USER_FIELD_MANAGER"]->Delete("BLOG_POST", $ID);
         }
         $db_events = GetModuleEvents("blog", "OnPostDelete");
         while ($arEvent = $db_events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array($ID, &$result));
         }
         if (CModule::IncludeModule("search")) {
             CSearch::Index("blog", "P" . $ID, array("TITLE" => "", "BODY" => ""));
             //CSearch::DeleteIndex("blog", false, "COMMENT", $arPost["BLOG_ID"]."|".$ID);
         }
         return $result;
     } else {
         return false;
     }
     return True;
 }
开发者ID:,项目名称:,代码行数:70,代码来源:

示例7: Delete

 function Delete($ID)
 {
     global $DB;
     $ID = IntVal($ID);
     $bSuccess = True;
     $arUser = CBlogUser::GetByID($ID, BLOG_BY_USER_ID);
     if ($arUser) {
         $dbResult = CBlog::GetList(array(), array("OWNER_ID" => $arUser["USER_ID"]), false, false, array("ID"));
         if ($dbResult->Fetch()) {
             $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_ERROR_OWNER"), "ERROR_OWNER");
             $bSuccess = False;
         }
         if ($bSuccess) {
             $dbResult = CBlogPost::GetList(array(), array("AUTHOR_ID" => $arUser["USER_ID"]), false, false, array("ID"));
             if ($arResult = $dbResult->Fetch()) {
                 if (!CBlogPost::Delete($arResult["ID"])) {
                     $GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_ERROR_AUTHOR"), "ERROR_AUTHOR");
                     $bSuccess = False;
                 }
             }
         }
         if ($bSuccess) {
             $dbGloUser = CUser::GetByID($arUser["USER_ID"]);
             $arGloUser = $dbGloUser->Fetch();
             $DB->Query("UPDATE b_blog_comment SET " . "\tAUTHOR_NAME = '" . $DB->ForSql(CBlogUser::GetUserName($arUser["ALIAS"], $arGloUser["NAME"], $arGloUser["LAST_NAME"], $arGloUser["LOGIN"], $arGloUser["SECOND_NAME"])) . "', " . "\tAUTHOR_ID = null " . "WHERE AUTHOR_ID = " . $arUser["USER_ID"] . "", true);
             $DB->Query("DELETE FROM b_blog_user2user_group WHERE USER_ID = " . $arUser["USER_ID"] . "", true);
         }
         if ($bSuccess) {
             $strSql = "SELECT F.ID " . "FROM b_blog_user FU, b_file F " . "WHERE FU.ID = " . $arUser["ID"] . " " . "\tAND FU.AVATAR = F.ID ";
             $z = $DB->Query($strSql, false, "FILE: " . __FILE__ . " LINE:" . __LINE__);
             while ($zr = $z->Fetch()) {
                 CFile::Delete($zr["ID"]);
             }
             if (CModule::IncludeModule("search")) {
                 CSearch::Index("blog", "U" . $arUser["ID"], array("TITLE" => "", "BODY" => ""));
             }
             unset($GLOBALS["BLOG_USER"]["BLOG_USER_CACHE_" . $arUser["ID"]]);
             unset($GLOBALS["BLOG_USER"]["BLOG_USER1_CACHE_" . $arUser["USER_ID"]]);
             unset($GLOBALS["BLOG_USER"]["BLOG_USER2GROUP_CACHE_" . $arUser["ID"]]);
             unset($GLOBALS["BLOG_USER"]["BLOG_USER2GROUP1_CACHE_" . $arUser["USER_ID"]]);
             return $DB->Query("DELETE FROM b_blog_user WHERE ID = " . $arUser["ID"] . "", true);
         }
         if (!$bSuccess) {
             return false;
         }
     }
     return True;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:48,代码来源:blog_user.php

示例8: _IndexPostComments

 function _IndexPostComments($arParams = array())
 {
     if (IntVal($arParams["BLOG_ID"]) <= 0 || IntVal($arParams["POST_ID"]) <= 0 || !CModule::IncludeModule("search")) {
         return false;
     }
     if ($arParams["USE_SOCNET"] == "Y") {
         $arSp = CBlogComment::GetSocNetCommentPerms($arParams["POST_ID"]);
     }
     $dbComment = CBlogComment::GetList(array(), array("BLOG_ID" => $arParams["BLOG_ID"], "POST_ID" => $arParams["POST_ID"], "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH), false, false, array("ID", "POST_ID", "BLOG_ID", "PUBLISH_STATUS", "PATH", "DATE_CREATE", "POST_TEXT", "TITLE", "AUTHOR_ID"));
     while ($arComment = $dbComment->Fetch()) {
         if (strlen($arComment["PATH"]) > 0) {
             $arComment["PATH"] = str_replace("#comment_id#", $arComment["ID"], $arComment["PATH"]);
         } elseif (strlen($arParams["PATH"]) > 0) {
             $arComment["PATH"] = str_replace("#comment_id#", $arComment["ID"], $arParams["PATH"]);
         } else {
             $arComment["PATH"] = CBlogPost::PreparePath($arParams["BLOG_URL"], $arComment["POST_ID"], $arParams["SITE_ID"], false, $arParams["OWNER_ID"], $arParams["SOCNET_GROUP_ID"]);
         }
         $arSearchIndex = array("SITE_ID" => array($arParams["SITE_ID"] => $arComment["PATH"]), "LAST_MODIFIED" => $arComment["DATE_CREATE"], "PARAM1" => "COMMENT", "PARAM2" => $arComment["BLOG_ID"] . "|" . $arComment["POST_ID"], "PERMISSIONS" => array(2), "TITLE" => $arComment["TITLE"], "BODY" => blogTextParser::killAllTags($arComment["POST_TEXT"]), "INDEX_TITLE" => false, "USER_ID" => IntVal($arComment["AUTHOR_ID"]) > 0 ? $arComment["AUTHOR_ID"] : false, "ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $arComment["ID"]);
         if ($arParams["USE_SOCNET"] == "Y") {
             $arSearchIndex["PERMISSIONS"] = $arSp;
         }
         if (strlen($arComment["TITLE"]) <= 0) {
             $arSearchIndex["TITLE"] = substr($arSearchIndex["BODY"], 0, 100);
         }
         CSearch::Index("blog", "C" . $arComment["ID"], $arSearchIndex, True);
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:27,代码来源:blog_comment.php

示例9: Update


//.........这里部分代码省略.........
         $arSiteID = array();
         if (is_set($arFields, "SITE_ID")) {
             if (is_array($arFields["SITE_ID"])) {
                 $arSiteID = $arFields["SITE_ID"];
             } else {
                 $arSiteID[] = $arFields["SITE_ID"];
             }
             $arFields["SITE_ID"] = false;
             $str_SiteID = "''";
             foreach ($arSiteID as $v) {
                 $arFields["SITE_ID"] = $v;
                 $str_SiteID .= ", '" . $DB->ForSql($v) . "'";
             }
         }
     }
     $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetGroupUpdate");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
             return false;
         }
     }
     if (array_key_exists("IMAGE_ID", $arFields) && is_array($arFields["IMAGE_ID"]) && (!array_key_exists("MODULE_ID", $arFields["IMAGE_ID"]) || strlen($arFields["IMAGE_ID"]["MODULE_ID"]) <= 0)) {
         $arFields["IMAGE_ID"]["MODULE_ID"] = "socialnetwork";
     }
     CFile::SaveForDB($arFields, "IMAGE_ID", "socialnetwork");
     $strUpdate = $DB->PrepareUpdate("b_sonet_group", $arFields);
     foreach ($arFields1 as $key => $value) {
         if (strlen($strUpdate) > 0) {
             $strUpdate .= ", ";
         }
         $strUpdate .= $key . "=" . $value . " ";
     }
     if (strlen($strUpdate) > 0) {
         $strSql = "UPDATE b_sonet_group SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         if (count($arSiteID) > 0) {
             $strSql = "DELETE FROM b_sonet_group_site WHERE GROUP_ID=" . $ID;
             $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
             $strSql = "INSERT INTO b_sonet_group_site(GROUP_ID, SITE_ID) " . "SELECT " . $ID . ", LID " . "FROM b_lang " . "WHERE LID IN (" . $str_SiteID . ") ";
             $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
             $arLogID = array();
             $dbResult = CSocNetLog::GetList(array(), array("LOG_RIGHTS" => "SG" . $ID), false, false, array("ID"));
             while ($arResult = $dbResult->Fetch()) {
                 $DB->Query("DELETE FROM b_sonet_log_site WHERE LOG_ID = " . $arResult["ID"] . "", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
                 $DB->Query("\n\t\t\t\t\t\tINSERT INTO b_sonet_log_site(LOG_ID, SITE_ID)\n\t\t\t\t\t\tSELECT " . $arResult["ID"] . ", LID\n\t\t\t\t\t\tFROM b_lang\n\t\t\t\t\t\tWHERE LID IN (" . $str_SiteID . ")\n\t\t\t\t\t", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
                 $arLogID[] = $arResult["ID"];
             }
             $dbResult = CSocNetLog::GetList(array(), array("!ID" => $arLogID, "ENTITY_ID" => $ID, "ENTITY_TYPE" => SONET_ENTITY_GROUP), false, false, array("ID"));
             while ($arResult = $dbResult->Fetch()) {
                 $DB->Query("DELETE FROM b_sonet_log_site WHERE LOG_ID = " . $arResult["ID"] . "", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
                 $DB->Query("\n\t\t\t\t\t\tINSERT INTO b_sonet_log_site(LOG_ID, SITE_ID)\n\t\t\t\t\t\tSELECT " . $arResult["ID"] . ", LID\n\t\t\t\t\t\tFROM b_lang\n\t\t\t\t\t\tWHERE LID IN (" . $str_SiteID . ")\n\t\t\t\t\t", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
             }
         }
         unset($GLOBALS["SONET_GROUP_CACHE"][$ID]);
         if (defined("BX_COMP_MANAGED_CACHE")) {
             if ($bClearCommonTag) {
                 $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_group");
             }
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_group_" . $ID);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $ID);
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group");
         }
         $GLOBALS["USER_FIELD_MANAGER"]->Update("SONET_GROUP", $ID, $arFields);
         $events = GetModuleEvents("socialnetwork", "OnSocNetGroupUpdate");
         while ($arEvent = $events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
         }
         if (CModule::IncludeModule("search")) {
             $arGroupNew = CSocNetGroup::GetByID($ID);
             if ($arGroupNew) {
                 if ($arGroupNew["ACTIVE"] == "N" && $arGroupOld["ACTIVE"] == "Y") {
                     CSearch::DeleteIndex("socialnetwork", "G" . $ID);
                 } elseif ($arGroupNew["ACTIVE"] == "Y") {
                     $BODY = CSocNetTextParser::killAllTags($arGroupNew["~DESCRIPTION"]);
                     $BODY .= $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("SONET_GROUP", $ID);
                     $arSearchIndexSiteID = array();
                     $rsGroupSite = CSocNetGroup::GetSite($ID);
                     while ($arGroupSite = $rsGroupSite->Fetch()) {
                         $arSearchIndexSiteID[$arGroupSite["LID"]] = str_replace("#group_id#", $ID, COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", $arGroupSite["LID"]));
                     }
                     $arSearchIndex = array("SITE_ID" => $arSearchIndexSiteID, "LAST_MODIFIED" => $arGroupNew["DATE_ACTIVITY"], "PARAM1" => $arGroupNew["SUBJECT_ID"], "PARAM2" => $ID, "PARAM3" => "GROUP", "PERMISSIONS" => $arGroupNew["VISIBLE"] == "Y" ? array('G2') : array('SG' . $ID . '_A', 'SG' . $ID . '_E', 'SG' . $ID . '_K'), "PARAMS" => array("socnet_group" => $ID, "entity" => "socnet_group"), "TITLE" => $arGroupNew["~NAME"], "BODY" => $BODY, "TAGS" => $arGroupNew["~KEYWORDS"]);
                     CSearch::Index("socialnetwork", "G" . $ID, $arSearchIndex, True);
                 }
                 if ($arGroupNew["OPENED"] == "Y" && $arGroupOld["OPENED"] == "N") {
                     $dbRequests = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $ID, "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_USER), false, false, array("ID"));
                     if ($dbRequests) {
                         $arIDs = array();
                         while ($arRequests = $dbRequests->GetNext()) {
                             $arIDs[] = $arRequests["ID"];
                         }
                         CSocNetUserToGroup::ConfirmRequestToBeMember($GLOBALS["USER"]->GetID(), $ID, $arIDs, $bAutoSubscribe);
                     }
                 }
             }
         }
     } elseif (!$GLOBALS["USER_FIELD_MANAGER"]->Update("SONET_GROUP", $ID, $arFields)) {
         $ID = False;
     }
     return $ID;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:group.php

示例10: Update

 function Update($ID, $arFields)
 {
     global $DB;
     $ID = IntVal($ID);
     if ($ID <= 0) {
         return false;
     }
     if (strlen($arFields["PATH"]) > 0) {
         $path = $arFields["PATH"];
         unset($arFields["PATH"]);
     }
     $arFields1 = array();
     foreach ($arFields as $key => $value) {
         if (substr($key, 0, 1) == "=") {
             $arFields1[substr($key, 1)] = $value;
             unset($arFields[$key]);
         }
     }
     if (!CBlog::CheckFields("UPDATE", $arFields, $ID)) {
         return false;
     } elseif (!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("BLOG_BLOG", $ID, $arFields)) {
         return false;
     }
     $db_events = GetModuleEvents("blog", "OnBeforeBlogUpdate");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
             return false;
         }
     }
     $arBlogOld = CBlog::GetByID($ID);
     $strUpdate = $DB->PrepareUpdate("b_blog", $arFields);
     foreach ($arFields1 as $key => $value) {
         if (strlen($strUpdate) > 0) {
             $strUpdate .= ", ";
         }
         $strUpdate .= $key . "=" . $value . " ";
     }
     if (strlen($strUpdate) > 0) {
         $strSql = "UPDATE b_blog SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
         $DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         unset($GLOBALS["BLOG"]["BLOG_CACHE_" . $ID]);
         unset($GLOBALS["BLOG"]["BLOG4OWNER_CACHE_" . $arBlogOld["OWNER_ID"]]);
         unset($GLOBALS["BLOG"]["BLOG4OWNERGROUP_CACHE_" . $arBlogOld["SOCNET_GROUP_ID"]]);
         $events = GetModuleEvents("blog", "OnBlogUpdate");
         while ($arEvent = $events->Fetch()) {
             ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
         }
         if (is_set($arFields, "PERMS_POST")) {
             CBlog::SetBlogPerms($ID, $arFields["PERMS_POST"], BLOG_PERMS_POST);
         }
         if (is_set($arFields, "PERMS_COMMENT")) {
             CBlog::SetBlogPerms($ID, $arFields["PERMS_COMMENT"], BLOG_PERMS_COMMENT);
         }
         $GLOBALS["USER_FIELD_MANAGER"]->Update("BLOG_BLOG", $ID, $arFields);
     } else {
         $ID = False;
     }
     if ($ID && (is_set($arFields, "NAME") || is_set($arFields, "DESCRIPTION"))) {
         if (CModule::IncludeModule("search")) {
             $arBlog = CBlog::GetByID($ID);
             if ($arBlogOld["ACTIVE"] == "Y" && $arBlog["ACTIVE"] != "Y" || $arBlogOld["SEARCH_INDEX"] == "Y" && $arBlog["SEARCH_INDEX"] != "Y") {
                 CSearch::DeleteIndex("blog", false, "COMMENT", $ID . "|%");
                 CSearch::DeleteIndex("blog", false, "POST", $ID);
                 CSearch::DeleteIndex("blog", "B" . $ID);
             } elseif ($arBlog["ACTIVE"] == "Y" && $arBlog["SEARCH_INDEX"] == "Y") {
                 if ($arBlog["USE_SOCNET"] == "Y") {
                     CSearch::DeleteIndex("blog", "B" . $ID);
                 } else {
                     $arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
                     if (strlen($path) > 0) {
                         $path = str_replace("#blog_url#", $arBlog["URL"], $path);
                         $arPostSite = array($arGroup["SITE_ID"] => $path);
                     } else {
                         $arPostSite = array($arGroup["SITE_ID"] => CBlog::PreparePath($arBlog["URL"], $arGroup["SITE_ID"], false, $arBlog["OWNER_ID"], $arBlog["SOCNET_GROUP_ID"]));
                     }
                     $arSearchIndex = array("SITE_ID" => $arPostSite, "LAST_MODIFIED" => $arBlog["DATE_UPDATE"], "PARAM1" => "BLOG", "PARAM2" => $arBlog["OWNER_ID"], "PERMISSIONS" => array(2), "TITLE" => $arBlog["NAME"], "BODY" => strlen($arBlog["DESCRIPTION"]) > 0 ? $arBlog["DESCRIPTION"] : $arBlog["NAME"]);
                     CSearch::Index("blog", "B" . $ID, $arSearchIndex);
                 }
             }
         }
     }
     return $ID;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:83,代码来源:blog.php

示例11: Reindex

	public static function Reindex($ID, &$arMessage)
	{
		if (!CModule::IncludeModule("search")) return;
		if (!is_set($arMessage, "FORUM_INFO") || !is_set($arMessage, "TOPIC_INFO"))
			$arMessage = CForumMessage::GetByIDEx($arMessage['ID'], array("GET_TOPIC_INFO" => "Y", "GET_FORUM_INFO" => "Y", "FILTER" => "Y"));

		$arForum = $arMessage["FORUM_INFO"];
		$arTopic = $arMessage["TOPIC_INFO"];
		$arMessage["POST_MESSAGE"] = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ?
			$arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);

		$arParams = array(
			"PERMISSION" => array(),
			"SITE" => CForumNew::GetSites($arMessage["FORUM_ID"]),
			"DEFAULT_URL" => "/");

		$arGroups = CForumNew::GetAccessPermissions($arMessage["FORUM_ID"]);
		for ($i = 0; $i < count($arGroups); $i++)
		{
			if ($arGroups[$i][1] >= "E")
			{
				$arParams["PERMISSION"][] = $arGroups[$i][0];
				if ($arGroups[$i][0] == 2)
					break;
			}
		}

		$arSearchInd = array(
			"LID" => array(),
			"LAST_MODIFIED" => $arMessage["POST_DATE"],
			"PARAM1" => $arMessage["FORUM_ID"],
			"PARAM2" => $arMessage["TOPIC_ID"],
			"PERMISSIONS" => $arParams["PERMISSION"],
			"TITLE" => $arMessage["TOPIC_INFO"]["TITLE"],
			"TAGS" => (($arMessage["NEW_TOPIC"] == "Y") ? $arMessage["TOPIC_INFO"]["TAGS"] : ""),
			"BODY" => GetMessage("AVTOR_PREF")." ".$arMessage["AUTHOR_NAME"].". ".(textParser::killAllTags($arMessage["POST_MESSAGE"])),
			"ENTITY_TYPE_ID"  => $arMessage["NEW_TOPIC"] == "Y"? "FORUM_TOPIC": "FORUM_POST",
			"ENTITY_ID"  => $arMessage["NEW_TOPIC"] == "Y"? $arMessage["TOPIC_ID"]: $arMessage["ID"],
			"USER_ID" => $arMessage["AUTHOR_ID"],
			"URL" => "",
			"INDEX_TITLE" => $arMessage["NEW_TOPIC"] == "Y",
		);

		foreach ($arParams["SITE"] as $key => $val)
		{
			$arSearchInd["LID"][$key] =
				CForumNew::PreparePath2Message(
					$val,
					array(
						"FORUM_ID" => $arMessage["FORUM_ID"],
						"TOPIC_ID" => $arMessage["TOPIC_ID"],
						"MESSAGE_ID" => $arMessage["ID"],
						"SOCNET_GROUP_ID" => $arMessage["TOPIC_INFO"]["SOCNET_GROUP_ID"],
						"OWNER_ID" => $arMessage["TOPIC_INFO"]["OWNER_ID"],
						"PARAM1" => $arMessage["PARAM1"],
						"PARAM2" => $arMessage["PARAM2"]));
			if (empty($arSearchInd["URL"]) && !empty($arSearchInd["LID"][$key]))
				$arSearchInd["URL"] = $arSearchInd["LID"][$key];
		}

		if (empty($arSearchInd["URL"]))
		{
			foreach ($arParams["SITE"] as $key => $val) {
				$db_lang = CLang::GetByID($key);
				if ($db_lang && $ar_lang = $db_lang->Fetch()){
					$arParams["DEFAULT_URL"] = $ar_lang["DIR"];
					break;
				}
			}
			$arParams["DEFAULT_URL"] .= COption::GetOptionString("forum", "REL_FPATH", "").
				"forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";

			$arSearchInd["URL"] = CForumNew::PreparePath2Message($arParams["DEFAULT_URL"],
				array("FORUM_ID" => $arMessage["FORUM_ID"], "TOPIC_ID" => $arMessage["TOPIC_ID"], "MESSAGE_ID" => $arMessage["ID"],
				"SOCNET_GROUP_ID" => $arMessage["TOPIC_INFO"]["SOCNET_GROUP_ID"], "OWNER_ID" => $arMessage["TOPIC_INFO"]["OWNER_ID"],
				"PARAM1" => $arMessage["PARAM1"], "PARAM2" => $arMessage["PARAM2"]));
		}
		CSearch::DeleteIndex("forum", $ID);
		CSearch::Index("forum", $ID, $arSearchInd, true);
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:80,代码来源:message.php

示例12: UpdateSearch

 public static function UpdateSearch($arFilter, $ENTITY_TYPE, $bOverWrite = false)
 {
     if (!CModule::IncludeModule('search')) {
         return false;
     }
     $limit = 1000;
     switch ($ENTITY_TYPE) {
         case 'CONTACT':
             $obRes = CCrmContact::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
             $sTitleID = 'FULL_NAME';
             break;
         case 'DEAL':
             $obRes = CCrmDeal::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
             $sTitleID = 'TITLE';
             break;
         case 'INVOICE':
             $obRes = CCrmInvoice::GetList(array('ID' => 'DESC'), $arFilter, false, array('nTopCount' => $limit), array('*'));
             $sTitleID = 'ORDER_TOPIC';
             break;
         case 'QUOTE':
             $obRes = CCrmQuote::GetList(array('ID' => 'ASC'), $arFilter, false, array('nTopCount' => intval($limit)), array());
             $sTitleID = 'TITLE';
             break;
         case 'COMPANY':
             $obRes = CCrmCompany::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
             $sTitleID = 'TITLE';
             break;
         default:
         case 'LEAD':
             $obRes = CCrmLead::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
             $sTitleID = 'TITLE';
             $ENTITY_TYPE = 'LEAD';
             break;
     }
     if (!isset(self::$arMess[$ENTITY_TYPE])) {
         self::$arMess[$ENTITY_TYPE] = __IncludeLang($_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/components/bitrix/crm.' . strtolower($ENTITY_TYPE) . '.show/lang/' . LANGUAGE_ID . '/component.php', true);
     }
     $arAllResult = array();
     $qty = 0;
     $lastItemID = '';
     if (is_object($obRes)) {
         while (($arRow = $obRes->Fetch()) !== false) {
             $elementID = $arRow['ID'];
             $lastItemID = $ENTITY_TYPE . '.' . $elementID;
             if ($ENTITY_TYPE === 'INVOICE') {
                 $arResult = CCrmInvoice::BuildSearchCard($arRow, self::$bReIndex);
             } elseif ($ENTITY_TYPE === 'QUOTE') {
                 $arResult = CCrmQuote::BuildSearchCard($arRow, self::$bReIndex);
             } else {
                 $multiFields = array();
                 if ($ENTITY_TYPE === 'CONTACT' || $ENTITY_TYPE === 'COMPANY' || $ENTITY_TYPE === 'LEAD') {
                     $obMultiFieldRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => $ENTITY_TYPE, 'ELEMENT_ID' => $elementID));
                     while ($multiField = $obMultiFieldRes->Fetch()) {
                         $fieldValue = $multiField['VALUE'];
                         $fieldTypeID = $multiField['TYPE_ID'];
                         if ($fieldValue === '' || $fieldTypeID !== 'PHONE' && $fieldTypeID !== 'EMAIL') {
                             continue;
                         }
                         if (!isset($multiFields[$fieldTypeID])) {
                             $multiFields[$fieldTypeID] = array();
                         }
                         $multiFields[$fieldTypeID][] = $fieldValue;
                     }
                 }
                 $arResult = self::_buildEntityCard($arRow, $sTitleID, $ENTITY_TYPE, array('FM' => $multiFields));
             }
             if (self::$bReIndex) {
                 if (self::$oCallback) {
                     $res = call_user_func(array(self::$oCallback, self::$callback_method), $arResult);
                     if (!$res) {
                         return $lastItemID;
                     }
                 }
             } else {
                 CSearch::Index('crm', $ENTITY_TYPE . '.' . $arRow['ID'], $arResult, $bOverWrite);
             }
             $arAllResult[] = $arResult;
             $qty++;
         }
     }
     if (!self::$bReIndex && !empty($arFilter['ID']) && $qty === 0) {
         CSearch::DeleteIndex('crm', (int) $arFilter['ID']);
     }
     if (self::$bReIndex && $qty === $limit && $lastItemID !== '') {
         return $lastItemID;
     }
     return $arAllResult;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:88,代码来源:crm_search.php

示例13: OnUserDelete

 function OnUserDelete($ID)
 {
     if (CModule::IncludeModule('search')) {
         CSearch::Index("intranet", "U" . $ID, array("TITLE" => "", "BODY" => ""), true);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:6,代码来源:search.php

示例14: IndexItem

 function IndexItem($arFields)
 {
     $ID = $arFields["ID"];
     if ($ID == "") {
         return true;
     }
     unset($arFields["ID"]);
     $arFields["REINDEX_FLAG"] = true;
     CSearch::Index("socialnetwork", $ID, $arFields, false, $this->_sess_id);
     $this->_counter++;
     //		if($this->_end_time && $this->_end_time <= time())
     //			return false;
     //		else
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:15,代码来源:search_reindex.php

示例15: UpdateSearch


//.........这里部分代码省略.........
                 if (strlen($ar["USER_TYPE"]) > 0) {
                     $arUT = CIBlockProperty::GetUserType($ar["USER_TYPE"]);
                     if (array_key_exists("GetSearchContent", $arUT)) {
                         $ar["GetSearchContent"] = $arUT["GetSearchContent"];
                     } elseif (array_key_exists("GetPublicViewHTML", $arUT)) {
                         $ar["GetSearchContent"] = $arUT["GetPublicViewHTML"];
                     }
                 }
                 $arProperties[$IBLOCK_ID][$ar["ID"]] = $ar;
             }
         }
         //Read current property values from database
         $strProperties = "";
         if (count($arProperties[$IBLOCK_ID]) > 0) {
             if ($arIBlockElement["VERSION"] == 1) {
                 $rs = $DB->Query("\n\t\t\t\t\t\tselect *\n\t\t\t\t\t\tfrom b_iblock_element_property\n\t\t\t\t\t\twhere IBLOCK_ELEMENT_ID=" . $arIBlockElement["ID"] . "\n\t\t\t\t\t\tAND IBLOCK_PROPERTY_ID in (" . implode(", ", array_keys($arProperties[$IBLOCK_ID])) . ")\n\t\t\t\t\t");
                 while ($ar = $rs->Fetch()) {
                     $strProperties .= "\r\n";
                     $arProperty = $arProperties[$IBLOCK_ID][$ar["IBLOCK_PROPERTY_ID"]];
                     if ($arProperty["GetSearchContent"]) {
                         $strProperties .= CSearch::KillTags(call_user_func_array($arProperty["GetSearchContent"], array($arProperty, array("VALUE" => $ar["VALUE"]), array())));
                     } elseif ($arProperty["PROPERTY_TYPE"] == 'L') {
                         $arEnum = CIBlockPropertyEnum::GetByID($ar["VALUE"]);
                         if ($arEnum !== false) {
                             $strProperties .= $arEnum["VALUE"];
                         }
                     } elseif ($arProperty["PROPERTY_TYPE"] == 'F') {
                         $arFile = CIBlockElement::__GetFileContent($ar["VALUE"]);
                         if (is_array($arFile)) {
                             $strProperties .= $arFile["CONTENT"];
                             $arIBlockElement["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")];
                         }
                     } else {
                         $strProperties .= $ar["VALUE"];
                     }
                 }
             } else {
                 $rs = $DB->Query("\n\t\t\t\t\t\tselect *\n\t\t\t\t\t\tfrom b_iblock_element_prop_m" . $IBLOCK_ID . "\n\t\t\t\t\t\twhere IBLOCK_ELEMENT_ID=" . $arIBlockElement["ID"] . "\n\t\t\t\t\t\tAND IBLOCK_PROPERTY_ID in (" . implode(", ", array_keys($arProperties[$IBLOCK_ID])) . ")\n\t\t\t\t\t");
                 while ($ar = $rs->Fetch()) {
                     $strProperties .= "\r\n";
                     $arProperty = $arProperties[$IBLOCK_ID][$ar["IBLOCK_PROPERTY_ID"]];
                     if ($arProperty["GetSearchContent"]) {
                         $strProperties .= CSearch::KillTags(call_user_func_array($arProperty["GetSearchContent"], array($arProperty, array("VALUE" => $ar["VALUE"]), array())));
                     } elseif ($arProperty["PROPERTY_TYPE"] == 'L') {
                         $arEnum = CIBlockPropertyEnum::GetByID($ar["VALUE"]);
                         if ($arEnum !== false) {
                             $strProperties .= $arEnum["VALUE"];
                         }
                     } elseif ($arProperty["PROPERTY_TYPE"] == 'F') {
                         $arFile = CIBlockElement::__GetFileContent($ar["VALUE"]);
                         if (is_array($arFile)) {
                             $strProperties .= $arFile["CONTENT"];
                             $arIBlockElement["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")];
                         }
                     } else {
                         $strProperties .= $ar["VALUE"];
                     }
                 }
                 $rs = $DB->Query("\n\t\t\t\t\t\tselect *\n\t\t\t\t\t\tfrom b_iblock_element_prop_s" . $IBLOCK_ID . "\n\t\t\t\t\t\twhere IBLOCK_ELEMENT_ID=" . $arIBlockElement["ID"] . "\n\t\t\t\t\t");
                 if ($ar = $rs->Fetch()) {
                     foreach ($arProperties[$IBLOCK_ID] as $property_id => $property) {
                         if (array_key_exists("PROPERTY_" . $property_id, $ar) && $property["MULTIPLE"] == "N" && strlen($ar["PROPERTY_" . $property_id]) > 0) {
                             $strProperties .= "\r\n";
                             if ($property["GetSearchContent"]) {
                                 $strProperties .= CSearch::KillTags(call_user_func_array($property["GetSearchContent"], array($property, array("VALUE" => $ar["PROPERTY_" . $property_id]), array())));
                             } elseif ($property["PROPERTY_TYPE"] == 'L') {
                                 $arEnum = CIBlockPropertyEnum::GetByID($ar["PROPERTY_" . $property_id]);
                                 if ($arEnum !== false) {
                                     $strProperties .= $arEnum["VALUE"];
                                 }
                             } elseif ($property["PROPERTY_TYPE"] == 'F') {
                                 $arFile = CIBlockElement::__GetFileContent($ar["PROPERTY_" . $property_id]);
                                 if (is_array($arFile)) {
                                     $strProperties .= $arFile["CONTENT"];
                                     $arIBlockElement["TAGS"] .= "," . $arFile["PROPERTIES"][COption::GetOptionString("search", "page_tag_property")];
                                 }
                             } else {
                                 $strProperties .= $ar["PROPERTY_" . $property_id];
                             }
                         }
                     }
                 }
             }
         }
         $BODY .= $strProperties;
         if ($arIBlockElement["RIGHTS_MODE"] !== "E") {
             $arPermissions = $arGroups[$IBLOCK_ID];
         } else {
             $obElementRights = new CIBlockElementRights($IBLOCK_ID, $arIBlockElement["ID"]);
             $arPermissions = $obElementRights->GetGroups(array("element_read"));
         }
         $arFields = array("LAST_MODIFIED" => strlen($arIBlockElement["DATE_FROM"]) > 0 ? $arIBlockElement["DATE_FROM"] : $arIBlockElement["LAST_MODIFIED"], "DATE_FROM" => strlen($arIBlockElement["DATE_FROM"]) > 0 ? $arIBlockElement["DATE_FROM"] : false, "DATE_TO" => strlen($arIBlockElement["DATE_TO"]) > 0 ? $arIBlockElement["DATE_TO"] : false, "TITLE" => $arIBlockElement["NAME"], "PARAM1" => $arIBlockElement["IBLOCK_TYPE_ID"], "PARAM2" => $IBLOCK_ID, "SITE_ID" => $arSITE[$IBLOCK_ID], "PERMISSIONS" => $arPermissions, "URL" => $DETAIL_URL, "BODY" => $BODY, "TAGS" => $arIBlockElement["TAGS"]);
         if ($arIBlockElement["SOCNET_GROUP_ID"] > 0) {
             $arFields["PARAMS"] = array("socnet_group" => $arIBlockElement["SOCNET_GROUP_ID"]);
         }
         CSearch::Index("iblock", $ID, $arFields, $bOverWrite);
     } else {
         CSearch::DeleteIndex("iblock", $ID);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:iblockelement.php


注:本文中的CSearch::Index方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。