本文整理汇总了PHP中CBlogPost::GetSocnetPermsCode方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogPost::GetSocnetPermsCode方法的具体用法?PHP CBlogPost::GetSocnetPermsCode怎么用?PHP CBlogPost::GetSocnetPermsCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogPost
的用法示例。
在下文中一共展示了CBlogPost::GetSocnetPermsCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Update
//.........这里部分代码省略.........
"NAME" => $arUser["NAME"],
"LAST_NAME" => $arUser["LAST_NAME"],
"SECOND_NAME" => $arUser["SECOND_NAME"],
"LOGIN" => $arUser["LOGIN"],
);
$authorName = CUser::FormatName(CSite::GetNameFormat(), $arTmpUser, false, false);
if(strlen($authorName) > 0)
$searchContent .= "\r\n".$authorName;
}
}
$arSearchIndex = array(
"SITE_ID" => $arPostSite,
"LAST_MODIFIED" => $arNewPost["DATE_PUBLISH"],
"PARAM1" => "POST",
"PARAM2" => $arNewPost["BLOG_ID"],
"PARAM3" => $arNewPost["ID"],
"PERMISSIONS" => array(2),
"TITLE" => $arNewPost["TITLE"],
"BODY" => $searchContent,
"TAGS" => $tag,
"USER_ID" => $arNewPost["AUTHOR_ID"],
"ENTITY_TYPE_ID" => "BLOG_POST",
"ENTITY_ID" => $arNewPost["ID"],
);
$bIndexComment = false;
if($arBlog["USE_SOCNET"] == "Y")
{
if(!empty($arFields["SC_PERM"]))
{
$arSearchIndex["PERMISSIONS"] = $arFields["SC_PERM"];
if($arFields["SC_PERM"] != $arFields["SC_PERM_OLD"])
$bIndexComment = true;
}
else
$arSearchIndex["PERMISSIONS"] = CBlogPost::GetSocnetPermsCode($ID);
if(!in_array("U".$arNewPost["AUTHOR_ID"], $arSearchIndex["PERMISSIONS"]))
$arSearchIndex["PERMISSIONS"][] = "U".$arNewPost["AUTHOR_ID"];
if(is_array($arSearchIndex["PERMISSIONS"]))
{
$sgId = array();
foreach($arSearchIndex["PERMISSIONS"] 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",
);
}
}
// get mentions and grats
$arMentionedUserID = CBlogPost::GetMentionedUserID($arNewPost);
if (!empty($arMentionedUserID))
{
if (!isset($arSearchIndex["PARAMS"]))
{
$arSearchIndex["PARAMS"] = array();
}
$arSearchIndex["PARAMS"]["mentioned_user_id"] = $arMentionedUserID;
}
}
CSearch::Index("blog", "P".$ID, $arSearchIndex, True);
if(($arOldPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && $arNewPost["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) || $bIndexComment) //index comments
{
$arParamsComment = Array(
"BLOG_ID" => $arBlog["ID"],
"POST_ID" => $ID,
"SITE_ID" => $arGroup["SITE_ID"],
"PATH" => $arPostSite[$arGroup["SITE_ID"]]."?commentId=#comment_id###comment_id#",
"BLOG_URL" => $arBlog["URL"],
"OWNER_ID" => $arBlog["OWNER_ID"],
"SOCNET_GROUP_ID" => $arBlog["SOCNET_GROUP_ID"],
"USE_SOCNET" => $arBlog["USE_SOCNET"],
);
CBlogComment::_IndexPostComments($arParamsComment);
}
}
}
}
BXClearCache(true, '/blog/socnet_post/gen/'.$ID);
return $ID;
}