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


PHP CForumNew::GetAccessPermissions方法代码示例

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


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

示例1: OnReindex

 function OnReindex($NS = array(), $oCallback = NULL, $callback_method = "")
 {
     global $DB;
     $arResultAll = array();
     $arParams = array("PERMISSION" => array(), "SITE" => array(), "DEFAULT_URL" => array());
     $search_message_count = intVal(COption::GetOptionInt("forum", "search_message_count", 0));
     $strNSJoin = "";
     $strFilter = "";
     if ($NS["MODULE"] == "forum" && intVal($NS["ID"]) > 0 && intVal($NS["CNT"]) > 0) {
         $strFilter = " AND (FM.ID>" . intVal($NS["ID"]) . ") ";
     } elseif ($NS["MODULE"] == "forum" && intVal($NS["ID"]) > 0) {
         // out of date
         $strFilter = " AND (FM.ID>=" . intVal($NS["ID"]) . ") ";
     }
     if ($NS["SITE_ID"] != "") {
         $strNSJoin .= " INNER JOIN b_forum2site FS ON (FS.FORUM_ID=F.ID) ";
         $strFilter .= " AND FS.SITE_ID='" . $DB->ForSQL($NS["SITE_ID"]) . "' ";
     }
     $strSql = "SELECT STRAIGHT_JOIN FT.ID as TID, FM.ID as MID, FM.ID as ID, FT.FORUM_ID, FT.TITLE, " . CForumNew::Concat("-", array("FT.ID", "FT.TITLE_SEO")) . ",\n\t\t\t\tFT.DESCRIPTION, FT.TAGS, FT.HTML as FT_HTML,\n\t\t\t\tFM.PARAM1, FM.PARAM2, FM.POST_MESSAGE, FM.POST_MESSAGE_FILTER, FM.POST_MESSAGE_HTML, FM.AUTHOR_NAME, FM.AUTHOR_ID, FM.NEW_TOPIC,\n\t\t\t\t" . $DB->DateToCharFunction("FM.POST_DATE") . " as POST_DATE, " . $DB->DateToCharFunction("FM.EDIT_DATE") . " as EDIT_DATE, FT.SOCNET_GROUP_ID, FT.OWNER_ID\n\t\t\tFROM b_forum_message FM use index (PRIMARY), b_forum_topic FT, b_forum F\n\t\t\t" . $strNSJoin . "\n\t\t\tWHERE (FM.TOPIC_ID = FT.ID) AND (F.ID = FT.FORUM_ID) AND (F.INDEXATION = 'Y') AND (FM.APPROVED = 'Y')\n\t\t\t" . $strFilter . "\n\t\t\tORDER BY FM.ID";
     if ($search_message_count > 0) {
         $strSql .= " LIMIT 0, " . $search_message_count;
     }
     $db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if ($db_res && COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
         $db_res = new _CMessageDBResult($db_res);
     }
     $rownum = 0;
     while ($res = $db_res->Fetch()) {
         $rownum++;
         if (empty($arParams["PERMISSION"][$res["FORUM_ID"]])) {
             $arGroups = CForumNew::GetAccessPermissions($res["FORUM_ID"]);
             $arParams["PERMISSION"][$res["FORUM_ID"]] = array();
             for ($i = 0; $i < count($arGroups); $i++) {
                 if ($arGroups[$i][1] >= "E") {
                     $arParams["PERMISSION"][$res["FORUM_ID"]][] = $arGroups[$i][0];
                     if ($arGroups[$i][0] == 2) {
                         break;
                     }
                 }
             }
         }
         if (empty($arParams["SITE"][$res["FORUM_ID"]])) {
             $arParams["SITE"][$res["FORUM_ID"]] = CForumNew::GetSites($res["FORUM_ID"]);
         }
         $arResult = array("ID" => $res["MID"], "LID" => array(), "LAST_MODIFIED" => !empty($res["EDIT_DATE"]) ? $res["EDIT_DATE"] : $res["POST_DATE"], "PARAM1" => $res["FORUM_ID"], "PARAM2" => $res["TID"], "USER_ID" => $res["AUTHOR_ID"], "ENTITY_TYPE_ID" => $res["NEW_TOPIC"] == "Y" ? "FORUM_TOPIC" : "FORUM_POST", "ENTITY_ID" => $res["NEW_TOPIC"] == "Y" ? $res["TID"] : $res["MID"], "PERMISSIONS" => $arParams["PERMISSION"][$res["FORUM_ID"]], "TITLE" => $res["TITLE"] . ($res["NEW_TOPIC"] == "Y" && !empty($res["DESCRIPTION"]) ? ", " . $res["DESCRIPTION"] : ""), "TAGS" => $res["NEW_TOPIC"] == "Y" ? $res["TAGS"] : "", "BODY" => GetMessage("AVTOR_PREF") . " " . $res["AUTHOR_NAME"] . ". " . textParser::killAllTags(COption::GetOptionString("forum", "FILTER", "Y") != "Y" ? $res["POST_MESSAGE"] : $res["POST_MESSAGE_FILTER"]), "URL" => "", "INDEX_TITLE" => $res["NEW_TOPIC"] == "Y");
         foreach ($arParams["SITE"][$res["FORUM_ID"]] as $key => $val) {
             $arResult["LID"][$key] = CForumNew::PreparePath2Message($val, array("FORUM_ID" => $res["FORUM_ID"], "TOPIC_ID" => $res["TID"], "MESSAGE_ID" => $res["MID"], "SOCNET_GROUP_ID" => $res["SOCNET_GROUP_ID"], "OWNER_ID" => $res["OWNER_ID"], "PARAM1" => $res["PARAM1"], "PARAM2" => $res["PARAM2"]));
             if (empty($arResult["URL"]) && !empty($arResult["LID"][$key])) {
                 $arResult["URL"] = $arResult["LID"][$key];
             }
         }
         if (empty($arResult["URL"])) {
             if (empty($arParams["DEFAULT_URL"][$res["FORUM_ID"]])) {
                 $arParams["DEFAULT_URL"][$res["FORUM_ID"]] = "/";
                 foreach ($arParams["SITE"][$res["FORUM_ID"]] as $key => $val) {
                     $db_lang = CLang::GetByID($key);
                     if ($db_lang && ($ar_lang = $db_lang->Fetch())) {
                         $arParams["DEFAULT_URL"][$res["FORUM_ID"]] = $ar_lang["DIR"];
                         break;
                     }
                 }
                 $arParams["DEFAULT_URL"][$res["FORUM_ID"]] .= COption::GetOptionString("forum", "REL_FPATH", "") . "forum/read.php?FID=#FID#&TID=#TID#&MID=#MID##message#MID#";
             }
             $arResult["URL"] = CForumNew::PreparePath2Message($arParams["DEFAULT_URL"][$res["FORUM_ID"]], array("FORUM_ID" => $res["FORUM_ID"], "TOPIC_ID" => $res["TID"], "MESSAGE_ID" => $res["MID"], "SOCNET_GROUP_ID" => $res["SOCNET_GROUP_ID"], "OWNER_ID" => $res["OWNER_ID"], "PARAM1" => $res["PARAM1"], "PARAM2" => $res["PARAM2"]));
         }
         if ($oCallback) {
             $resCall = call_user_func(array($oCallback, $callback_method), $arResult);
             if (!$resCall) {
                 return $arResult["ID"];
             }
         } else {
             $arResultAll[] = $arResult;
         }
     }
     if ($oCallback && $search_message_count > 0 && $rownum >= $search_message_count - 1) {
         return $arResult["ID"];
     }
     if ($oCallback) {
         return false;
     }
     return $arResultAll;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:82,代码来源:forum_new.php

示例2: 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

示例3: Add


//.........这里部分代码省略.........
/***************** Attach/******************************************/
/***************** Quota *******************************************/
		$_SESSION["SESS_RECOUNT_DB"] = "Y";

		$GLOBALS["USER_FIELD_MANAGER"]->Update("FORUM_MESSAGE", $ID, $arFields);
		if ($arParams["SKIP_STATISTIC"] == "Y" && $arParams["SKIP_INDEXING"] == "Y")
			return $ID;
		$arMessage = CForumMessage::GetByIDEx($ID, array("GET_FORUM_INFO" => "N", "GET_TOPIC_INFO" => "Y", "FILTER" => "Y"));

		if ($arParams["SKIP_STATISTIC"] != "Y")
		{
			if (intVal($arMessage["AUTHOR_ID"]) > 0)
			{
				CForumUser::SetStat($arMessage["AUTHOR_ID"], array("MESSAGE" => $arMessage));
			}
			CForumTopic::SetStat($arMessage["TOPIC_ID"],  array("MESSAGE" => $arMessage));
			CForumNew::SetStat($arMessage["FORUM_ID"],  array("MESSAGE" => $arMessage));
		}
/***************** Events onAfterMessageAdd ************************/
		foreach(GetModuleEvents("forum", "onAfterMessageAdd", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage, $arMessage["TOPIC_INFO"], $arMessage["FORUM_INFO"], $arFields));
/***************** /Events *****************************************/
		if ($arMessage["APPROVED"] == "Y")
		{
			if ($arParams["SKIP_INDEXING"] != "Y" && CModule::IncludeModule("search"))
			{
				$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"]);
				foreach($arGroups as $arGroup)
				{
					if ($arGroup[1] >= "E")
					{
						$arParams["PERMISSION"][] = $arGroup[0];
						if ($arGroup[0] == 2)
							break;
					}
				}

				$arSearchInd = array(
					"LID" => array(),
					"LAST_MODIFIED" => $arMessage["POST_DATE"],
					"PARAM1" => $arMessage["FORUM_ID"],
					"PARAM2" => $arMessage["TOPIC_ID"],
					"ENTITY_TYPE_ID"  => ($arMessage["NEW_TOPIC"] == "Y"? "FORUM_TOPIC": "FORUM_POST"),
					"ENTITY_ID" => ($arMessage["NEW_TOPIC"] == "Y"? $arMessage["TOPIC_ID"]: $ID),
					"USER_ID" => $arMessage["AUTHOR_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"].". ".(textParser::killAllTags($arMessage["POST_MESSAGE"])),
					"URL" => "",
					"INDEX_TITLE" => $arMessage["NEW_TOPIC"] == "Y",
				);

				// get mentions
				$arMentionedUserID = CForumMessage::GetMentionedUserID($arMessage["POST_MESSAGE"]);
				if (!empty($arMentionedUserID))
				{
					$arSearchInd["PARAMS"] = array(
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:67,代码来源:message.php

示例4: str_replace

    }
}
/********************************************************************
				/Action
********************************************************************/
$APPLICATION->SetTitle($ID > 0 ? str_replace("#ID#", $ID, GetMessage("FE_PAGE_TITLE1")) : GetMessage("FE_PAGE_TITLE2"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
/********************************************************************
				Data
********************************************************************/
$arForum = array("NAME" => "", "DESCRIPTION" => "", "FORUM_GROUP_ID" => "", "GROUP_ID" => "", "SITES" => array(), "PATH2FORUM_MESSAGE" => "/" . SITE_DIR . "/forum/message.php?FID=#FORUM_ID#&TID=#TOPIC_ID#&MID=#MESSAGE_ID#", "MODERATION" => "N", "ACTIVE" => "Y", "INDEXATION" => "Y", "DEDUPLICATION" => "Y", "SORT" => 150, "ORDER_BY" => "P", "ORDER_DIRECTION" => "DESC", "ASK_GUEST_EMAIL" => "N", "USE_CAPTCHA" => "Y", "ALLOW_HTML" => "N", "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_VIDEO" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_TABLE" => "Y", "ALLOW_ALIGN" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_UPLOAD" => "N", "ALLOW_TOPIC_TITLED" => "N", "ALLOW_NL2BR" => "N", "ALLOW_MOVE_TOPIC" => "N", "ALLOW_SIGNATURE" => "Y", "EVENT1" => "forum", "EVENT2" => "message", "EVENT3" => "");
if ($ID > 0) {
    $db_res = CForumNew::GetList(array(), array("ID" => $ID));
    $arForum = $db_res->Fetch();
    $arForum["SITES"] = CForumNew::GetSites($ID);
    $arForum["GROUP_ID"] = CForumNew::GetAccessPermissions($ID, "TWO");
}
if ($bVarsFromForm) {
    $arForum = $arFields;
}
if (!function_exists("__recursive_htmlspecialcharsbx")) {
    function __recursive_htmlspecialcharsbx(&$res)
    {
        if (is_array($res)) {
            foreach ($res as $key => $val) {
                $res[$key] = __recursive_htmlspecialcharsbx($val);
            }
        } elseif (is_string($res)) {
            $res = htmlspecialcharsbx($res);
        }
        return $res;
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:forum_edit.php

示例5: Update

 function Update($ID, $arFields, $bReindex = true)
 {
     global $DB;
     $ID = intVal($ID);
     $arForum_prev = array();
     $arProcAuth = array();
     if ($ID <= 0 || !CForumNew::CheckFields("UPDATE", $arFields)) {
         return false;
     }
     if ($arFields["ACTIVE"] == "N") {
         $arForum_prev = CForumNew::GetByID($ID);
     }
     /***************** Event onBeforeForumUpdate ***********************/
     foreach (GetModuleEvents("forum", "onBeforeForumUpdate", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array(&$ID, &$arFields)) === false) {
             return false;
         }
     }
     /***************** /Event ******************************************/
     if (empty($arFields)) {
         return false;
     }
     /***************** Cleaning cache **********************************/
     unset($GLOBALS["FORUM_CACHE"]["FORUM"][$ID]);
     if (CACHED_b_forum !== false) {
         $GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum");
     }
     if (CACHED_b_forum2site !== false && is_array($arFields["SITES"]) && count($arFields["SITES"]) > 0) {
         $GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum2site");
     }
     /***************** Cleaning cache/**********************************/
     $strUpdate = $DB->PrepareUpdate("b_forum", $arFields);
     if (!empty($strUpdate)) {
         $strSql = "UPDATE b_forum SET " . $strUpdate . " WHERE ID=" . $ID;
         $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     }
     if (is_array($arFields["SITES"]) && count($arFields["SITES"]) > 0) {
         $DB->Query("DELETE FROM b_forum2site WHERE FORUM_ID = " . $ID);
         foreach ($arFields["SITES"] as $key => $value) {
             $value = $DB->ForSql($value, 250);
             $strSql = "INSERT INTO b_forum2site (FORUM_ID, SITE_ID, PATH2FORUM_MESSAGE) VALUES(" . $ID . ", '" . $DB->ForSql($key, 2) . "', '" . $value . "') ";
             if ($DB->type == "MYSQL") {
                 $strSql .= "ON DUPLICATE KEY UPDATE PATH2FORUM_MESSAGE='" . $value . "'";
             }
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
     }
     if (is_set($arFields, "GROUP_ID") && is_array($arFields["GROUP_ID"])) {
         CForumNew::SetAccessPermissions($ID, $arFields["GROUP_ID"]);
     }
     /***************** Event onAfterForumUpdate ************************/
     foreach (GetModuleEvents("forum", "onAfterForumUpdate", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     /***************** /Event ******************************************/
     /***************** Update statistic ********************************/
     /* If forum became inactive than all statistics for users of this forum will be recalculated.*/
     if ($arFields["ACTIVE"] == "N" && $arForum_prev["ACTIVE"] == "Y") {
         $db_res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID, "!AUTHOR_ID" => 0));
         while ($res = $db_res->Fetch()) {
             $res["AUTHOR_ID"] = intVal($res["AUTHOR_ID"]);
             if (!in_array($res["AUTHOR_ID"], $arProcAuth)) {
                 CForumUser::SetStat($res["AUTHOR_ID"]);
                 $arProcAuth[] = $res["AUTHOR_ID"];
             }
         }
         unset($arProcAuth);
     }
     /***************** Update search module ****************************/
     if (CModule::IncludeModule("search") && $bReindex == true) {
         if ($arFields["ACTIVE"] == "N" && $arForum_prev["ACTIVE"] == "Y" || $arFields["INDEXATION"] == "N" && $arForum_prev["INDEXATION"] == "Y") {
             CSearch::DeleteIndex("forum", false, $ID);
         } elseif (is_set($arFields, "GROUP_ID") && is_array($arFields["GROUP_ID"])) {
             $arGroups = CForumNew::GetAccessPermissions($ID);
             $arGPerm = array();
             foreach ($arGroups as $i => $group) {
                 if ($group[1] >= "E") {
                     $arGPerm[] = $group[0];
                     if ($group[0] == 2) {
                         break;
                     }
                 }
             }
             CSearch::ChangePermission("forum", $arGPerm, false, $ID);
         }
     }
     return $ID;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:88,代码来源:forum_new.php

示例6: 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


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