本文整理汇总了PHP中CForumMessage::GetMentionedUserID方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumMessage::GetMentionedUserID方法的具体用法?PHP CForumMessage::GetMentionedUserID怎么用?PHP CForumMessage::GetMentionedUserID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumMessage
的用法示例。
在下文中一共展示了CForumMessage::GetMentionedUserID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: Add
//.........这里部分代码省略.........
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(
"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;
endif;
endforeach;
$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::Index("forum", $ID, $arSearchInd);
}
}
return $ID;
}