本文整理汇总了PHP中CBlogComment::GetMentionedUserID方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogComment::GetMentionedUserID方法的具体用法?PHP CBlogComment::GetMentionedUserID怎么用?PHP CBlogComment::GetMentionedUserID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogComment
的用法示例。
在下文中一共展示了CBlogComment::GetMentionedUserID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnSearchReindex
//.........这里部分代码省略.........
}
if (IntVal($arF["BLOG_ID"]) > 0 && $ar["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
$dbComment = CBlogComment::GetList(array(), array("POST_ID" => $ar["ID"]), false, false, array("ID", "POST_ID", "BLOG_ID", "PATH"));
if ($arComment = $dbComment->Fetch()) {
$arParamsComment = array("BLOG_ID" => $arF["BLOG_ID"], "POST_ID" => $ar["ID"], "SITE_ID" => $ar["SITE_ID"], "PATH" => $arPostSite[$arGroup["SITE_ID"]] . "?commentId=#comment_id###comment_id#", "USE_SOCNET" => "Y");
CBlogComment::_IndexPostComments($arParamsComment);
}
}
}
}
if ($ar["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
if (empty($arF["SC_PERM"])) {
$arF["SC_PERM"] = CBlogPost::GetSocNetPermsCode($ar["ID"]);
}
$Result["PERMISSIONS"] = $arF["SC_PERM"];
if (!in_array("U" . $ar["AUTHOR_ID"], $Result["PERMISSIONS"])) {
$Result["PERMISSIONS"][] = "U" . $ar["AUTHOR_ID"];
}
if (is_array($arF["SC_PERM"])) {
$sgId = array();
foreach ($arF["SC_PERM"] 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)) {
$Result["PARAMS"] = array("socnet_group" => $sgId, "entity" => "socnet_group");
}
}
// get mentions and grats
$arMentionedUserID = CBlogPost::GetMentionedUserID($ar);
if (!empty($arMentionedUserID)) {
if (!isset($Result["PARAMS"])) {
$Result["PARAMS"] = array();
}
$Result["PARAMS"]["mentioned_user_id"] = $arMentionedUserID;
}
if (IntVal($ar["SLID"]) <= 0) {
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "TABLE" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
$text4message = $parserBlog->convert($ar["DETAIL_TEXT"], false, array(), $arAllow, array("isSonetLog" => true));
$arSoFields = array("EVENT_ID" => "blog_post", "=LOG_DATE" => $DB->CharToDateFunction($ar["DATE_PUBLISH"], "FULL", SITE_ID), "LOG_UPDATE" => $DB->CharToDateFunction($ar["DATE_PUBLISH"], "FULL", SITE_ID), "TITLE_TEMPLATE" => "#USER_NAME# add post", "TITLE" => $ar["TITLE"], "MESSAGE" => $text4message, "MODULE_ID" => "blog", "CALLBACK_FUNC" => false, "SOURCE_ID" => $ar["ID"], "ENABLE_COMMENTS" => "Y", "ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $ar["AUTHOR_ID"], "USER_ID" => $ar["AUTHOR_ID"], "URL" => $arSite[$ar["SITE_ID"]], "SITE_ID" => $arSites);
$logID = CSocNetLog::Add($arSoFields, false);
if (intval($logID) > 0) {
$socnetPerms = $arF["SC_PERM"];
if (!in_array("U" . $ar["AUTHOR_ID"], $socnetPerms)) {
$socnetPerms[] = "U" . $ar["AUTHOR_ID"];
}
$socnetPerms[] = "SA";
// socnet admin
CSocNetLog::Update($logID, array("TMP_ID" => $logID, "=LOG_UPDATE" => $arSoFields["LOG_UPDATE"]));
}
} else {
$socnetPerms = $arF["SC_PERM"];
if (!in_array("U" . $ar["AUTHOR_ID"], $socnetPerms)) {
$socnetPerms[] = "U" . $ar["AUTHOR_ID"];
}
$socnetPerms[] = "SA";
// socnet admin
$logID = $ar["SLID"];
}
if (intval($logID) > 0 && is_array($socnetPerms)) {
if (in_array("AU", $socnetPerms) || in_array("G2", $socnetPerms)) {
$socnetPermsAdd = array();
示例2: Update
function Update($ID, $arFields, $bSearchIndex = true)
{
global $DB;
$ID = IntVal($ID);
if (strlen($arFields["PATH"]) > 0) {
$arFields["PATH"] = str_replace("#comment_id#", $ID, $arFields["PATH"]);
}
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CBlogComment::CheckFields("UPDATE", $arFields, $ID)) {
return false;
} elseif (!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("BLOG_COMMENT", $ID, $arFields)) {
return false;
}
foreach (GetModuleEvents("blog", "OnBeforeCommentUpdate", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
return false;
}
}
$strUpdate = $DB->PrepareUpdate("b_blog_comment", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
if (is_set($arFields["PUBLISH_STATUS"]) && strlen($arFields["PUBLISH_STATUS"]) > 0) {
$arComment = CBlogComment::GetByID($ID);
if ($arComment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
CBlogPost::Update($arComment["POST_ID"], array("=NUM_COMMENTS" => "NUM_COMMENTS - 1"), false);
} elseif ($arComment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
CBlogPost::Update($arComment["POST_ID"], array("=NUM_COMMENTS" => "NUM_COMMENTS + 1"), false);
}
}
$strSql = "UPDATE b_blog_comment SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
unset($GLOBALS["BLOG_COMMENT"]["BLOG_COMMENT_CACHE_" . $ID]);
$GLOBALS["USER_FIELD_MANAGER"]->Update("BLOG_COMMENT", $ID, $arFields);
$arComment = CBlogComment::GetByID($ID);
$arBlog = CBlog::GetByID($arComment["BLOG_ID"]);
if ($arBlog["USE_SOCNET"] == "Y") {
$arFields["SC_PERM"] = CBlogComment::GetSocNetCommentPerms($arComment["POST_ID"]);
}
foreach (GetModuleEvents("blog", "OnCommentUpdate", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
}
if ($bSearchIndex && CModule::IncludeModule("search")) {
$newPostPerms = CBlogUserGroup::GetGroupPerms(1, $arComment["BLOG_ID"], $arComment["POST_ID"], BLOG_PERMS_POST);
if ($arBlog["SEARCH_INDEX"] != "Y" || $arComment["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
CSearch::Index("blog", "C" . $ID, array("TITLE" => "", "BODY" => ""));
} else {
$arGroup = CBlogGroup::GetByID($arBlog["GROUP_ID"]);
if (strlen($arFields["PATH"]) > 0) {
$arFields["PATH"] = str_replace("#comment_id#", $ID, $arFields["PATH"]);
$arPostSite = array($arGroup["SITE_ID"] => $arFields["PATH"]);
} elseif (strlen($arComment["PATH"]) > 0) {
$arComment["PATH"] = str_replace("#comment_id#", $ID, $arComment["PATH"]);
$arPostSite = array($arGroup["SITE_ID"] => $arComment["PATH"]);
} else {
$arPostSite = array($arGroup["SITE_ID"] => CBlogPost::PreparePath($arBlog["URL"], $arComment["POST_ID"], $arGroup["SITE_ID"], false, $arBlog["OWNER_ID"], $arBlog["SOCNET_GROUP_ID"]));
}
$searchContent = blogTextParser::killAllTags($arComment["POST_TEXT"]);
$searchContent .= "\r\n" . $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("BLOG_COMMENT", $arComment["ID"]);
$arSearchIndex = array("SITE_ID" => $arPostSite, "LAST_MODIFIED" => $arComment["DATE_CREATE"], "PARAM1" => "COMMENT", "PARAM2" => $arComment["BLOG_ID"] . "|" . $arComment["POST_ID"], "PERMISSIONS" => array(2), "TITLE" => $arComment["TITLE"], "BODY" => $searchContent, "USER_ID" => IntVal($arComment["AUTHOR_ID"]) > 0 ? $arComment["AUTHOR_ID"] : false, "ENTITY_TYPE_ID" => "BLOG_COMMENT", "ENTITY_ID" => $arComment["ID"]);
if ($arBlog["USE_SOCNET"] == "Y") {
if (is_array($arFields["SC_PERM"])) {
$arSearchIndex["PERMISSIONS"] = $arFields["SC_PERM"];
$sgId = array();
foreach ($arFields["SC_PERM"] 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 (!in_array("U" . $arComment["AUTHOR_ID"], $arSearchIndex["PERMISSIONS"])) {
$arSearchIndex["PERMISSIONS"][] = "U" . $arComment["AUTHOR_ID"];
}
}
}
if ($arBlog["USE_SOCNET"] == "Y" || strpos($arBlog["URL"], "idea_") === 0) {
// get mentions
$arMentionedUserID = CBlogComment::GetMentionedUserID($arComment);
if (!empty($arMentionedUserID)) {
if (!isset($arSearchIndex["PARAMS"])) {
$arSearchIndex["PARAMS"] = array();
}
$arSearchIndex["PARAMS"]["mentioned_user_id"] = $arMentionedUserID;
}
}
//.........这里部分代码省略.........