本文整理汇总了PHP中CBlogPost::Notify方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogPost::Notify方法的具体用法?PHP CBlogPost::Notify怎么用?PHP CBlogPost::Notify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogPost
的用法示例。
在下文中一共展示了CBlogPost::Notify方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Execute
public function Execute()
{
global $DB;
if (!CModule::IncludeModule("socialnetwork") || !CModule::IncludeModule("blog")) {
return CBPActivityExecutionStatus::Closed;
}
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$siteId = $this->PostSite ? $this->PostSite : SITE_ID;
$ownerId = CBPHelper::ExtractUsers($this->OwnerId, $documentId, true);
$pathToPost = COption::GetOptionString("socialnetwork", "userblogpost_page", false, $siteId);
$pathToSmile = COption::GetOptionString("socialnetwork", "smile_page", false, $siteId);
$blogGroupID = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, $siteId);
$blog = CBlog::GetByOwnerID($ownerId);
if (!$blog) {
$blog = $this->createBlog($ownerId, $blogGroupID, $siteId);
}
$micro = 'N';
$title = trim($this->PostTitle);
if (!$title) {
$micro = 'Y';
$title = trim(preg_replace(array("/\n+/is" . BX_UTF_PCRE_MODIFIER, '/\\s+/is' . BX_UTF_PCRE_MODIFIER), " ", blogTextParser::killAllTags($this->PostMessage)));
}
try {
$postFields = array('TITLE' => $title, 'DETAIL_TEXT' => $this->PostMessage, 'DETAIL_TEXT_TYPE' => $this->PostMessageType == 'html' ? 'html' : 'text', '=DATE_PUBLISH' => $DB->CurrentTimeFunction(), 'PUBLISH_STATUS' => BLOG_PUBLISH_STATUS_PUBLISH, 'CATEGORY_ID' => '', 'PATH' => CComponentEngine::MakePathFromTemplate($pathToPost, array("post_id" => "#post_id#", "user_id" => $ownerId)), 'URL' => $blog['URL'], 'PERMS_POST' => array(), 'PERMS_COMMENT' => array(), 'MICRO' => $micro, 'SOCNET_RIGHTS' => $this->getSocnetRights($this->UsersTo), '=DATE_CREATE' => $DB->CurrentTimeFunction(), 'AUTHOR_ID' => $ownerId, 'BLOG_ID' => $blog['ID'], "HAS_IMAGES" => "N", "HAS_TAGS" => "N", "HAS_PROPS" => "N", "HAS_SOCNET_ALL" => "N");
if (!empty($postFields["SOCNET_RIGHTS"]) && count($postFields["SOCNET_RIGHTS"]) == 1 && in_array("UA", $postFields["SOCNET_RIGHTS"])) {
$postFields['HAS_SOCNET_ALL'] = 'Y';
}
$newId = CBlogPost::add($postFields);
$postFields["ID"] = $newId;
$arParamsNotify = array("bSoNet" => true, "UserID" => $ownerId, "allowVideo" => COption::GetOptionString("blog", "allow_video", "Y"), "PATH_TO_SMILE" => $pathToSmile, "PATH_TO_POST" => $pathToPost, "SOCNET_GROUP_ID" => $blogGroupID, "user_id" => $ownerId, "NAME_TEMPLATE" => CSite::GetNameFormat(false));
CBlogPost::Notify($postFields, $blog, $arParamsNotify);
BXClearCache(true, "/" . $siteId . "/blog/last_messages_list/");
$arFieldsIM = array("TYPE" => "POST", "TITLE" => $postFields["TITLE"], "URL" => CComponentEngine::MakePathFromTemplate($pathToPost, array("post_id" => $newId, "user_id" => $ownerId)), "ID" => $newId, "FROM_USER_ID" => $ownerId, "TO_USER_ID" => array(), "TO_SOCNET_RIGHTS" => $postFields["SOCNET_RIGHTS"], "TO_SOCNET_RIGHTS_OLD" => array());
CBlogPost::NotifyIm($arFieldsIM);
} catch (Exception $e) {
$this->WriteToTrackingService($e->getMessage());
}
return CBPActivityExecutionStatus::Closed;
}
示例2: PostIntoBuzzAsBlog
//.........这里部分代码省略.........
// $DATE_PUBLISH = $_POST["DATE_PUBLISH_DEF"];
// elseif (strlen($_POST["DATE_PUBLISH"])<=0)
$DATE_PUBLISH = ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL");
// else
// $DATE_PUBLISH = $_POST["DATE_PUBLISH"];
$arFields = array("DETAIL_TEXT" => $userTwit['text'], "DETAIL_TEXT_TYPE" => "text", "DATE_PUBLISH" => $DATE_PUBLISH, "PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "PATH" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => "#post_id#", "user_id" => $arBlog["OWNER_ID"])), "URL" => $arBlog["URL"], "SOURCE_TYPE" => "twitter");
$arFields["PERMS_POST"] = array();
$arFields["PERMS_COMMENT"] = array();
$arFields["MICRO"] = "N";
if (strlen($arFields["TITLE"]) <= 0) {
$arFields["MICRO"] = "Y";
$arFields["TITLE"] = trim(blogTextParser::killAllTags($arFields["DETAIL_TEXT"]));
if (strlen($arFields["TITLE"]) <= 0) {
$arFields["TITLE"] = GetMessage("BLOG_EMPTY_TITLE_PLACEHOLDER");
}
}
$arFields["SOCNET_RIGHTS"] = array();
if (!empty($userTwit['user_perms'])) {
$bOne = true;
foreach ($userTwit['user_perms'] as $v => $k) {
if (strlen($v) > 0 && is_array($k) && !empty($k)) {
foreach ($k as $vv) {
if (strlen($vv) > 0) {
$arFields["SOCNET_RIGHTS"][] = $vv;
if ($v != "SG") {
$bOne = false;
}
}
}
}
}
if ($bOne && !empty($userTwit['user_perms']["SG"])) {
$bOnesg = false;
$bFirst = true;
$oGrId = 0;
foreach ($userTwit['user_perms']["SG"] as $v) {
if (strlen($v) > 0) {
if ($bFirst) {
$bOnesg = true;
$bFirst = false;
$v = str_replace("SG", "", $v);
$oGrId = IntVal($v);
} else {
$bOnesg = false;
}
}
}
if ($bOnesg) {
if (!CSocNetFeaturesPerms::CanPerformOperation($arParams["USER_ID"], SONET_ENTITY_GROUP, $oGrId, "blog", "write_post") && !CSocNetFeaturesPerms::CanPerformOperation($arParams["USER_ID"], SONET_ENTITY_GROUP, $oGrId, "blog", "moderate_post") && !CSocNetFeaturesPerms::CanPerformOperation($arParams["USER_ID"], SONET_ENTITY_GROUP, $oGrId, "blog", "full_post")) {
$arFields["PUBLISH_STATUS"] = BLOG_PUBLISH_STATUS_READY;
}
}
}
}
$bError = false;
/* if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser())
{
if(empty($arFields["SOCNET_RIGHTS"]) || in_array("UA", $arFields["SOCNET_RIGHTS"]))
{
$bError = true;
$arResult["ERROR_MESSAGE"] = GetMessage("BLOG_BPE_EXTRANET_ERROR");
}
}*/
if (!$bError) {
preg_match_all("/\\[user\\s*=\\s*([^\\]]*)\\](.+?)\\[\\/user\\]/ies" . BX_UTF_PCRE_MODIFIER, $userTwit['text'], $arMention);
$arFields["=DATE_CREATE"] = $DB->GetNowFunction();
$arFields["AUTHOR_ID"] = $arParams["USER_ID"];
$arFields["BLOG_ID"] = $arBlog["ID"];
$newID = CBlogPost::Add($arFields);
$socnetRightsOld = array("U" => array());
$bAdd = true;
$bNeedMail = false;
if ($newID) {
$arFields["ID"] = $newID;
$arParamsNotify = array("bSoNet" => true, "UserID" => $arParams["USER_ID"], "allowVideo" => $arResult["allowVideo"], "PATH_TO_SMILE" => $arParams["PATH_TO_SMILE"], "PATH_TO_POST" => $arParams["PATH_TO_POST"], "SOCNET_GROUP_ID" => $arParams["GROUP_ID"], "user_id" => $arParams["USER_ID"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"]);
CBlogPost::Notify($arFields, $arBlog, $arParamsNotify);
}
}
if ($newID > 0 && strlen($arResult["ERROR_MESSAGE"]) <= 0 && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
BXClearCache(true, "/" . SITE_ID . "/blog/last_messages_list/");
$arFieldsIM = array("TYPE" => "POST", "TITLE" => $arFields["TITLE"], "URL" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => $newID, "user_id" => $arBlog["OWNER_ID"])), "ID" => $newID, "FROM_USER_ID" => $arParams["USER_ID"], "TO_USER_ID" => array(), "TO_SOCNET_RIGHTS" => $arFields["SOCNET_RIGHTS"], "TO_SOCNET_RIGHTS_OLD" => $socnetRightsOld["U"]);
if (!empty($arMentionOld)) {
$arFieldsIM["MENTION_ID_OLD"] = $arMentionOld[1];
}
if (!empty($arMention)) {
$arFieldsIM["MENTION_ID"] = $arMention[1];
}
CBlogPost::NotifyIm($arFieldsIM);
$arParams["ID"] = $newID;
if (!empty($_POST["SPERM"]["SG"])) {
foreach ($_POST["SPERM"]["SG"] as $v) {
$group_id_tmp = substr($v, 2);
if (IntVal($group_id_tmp) > 0) {
CSocNetGroup::SetLastActivity(IntVal($group_id_tmp));
}
}
}
}
}
}
示例3: IntVal
$DB->Query("UPDATE b_blog_image SET COMMENT_ID=" . IntVal($commentId) . " WHERE BLOG_ID=" . IntVal($arBlog["ID"]) . " AND POST_ID=" . IntVal($arPost["ID"]) . " AND IS_COMMENT = 'Y' AND (COMMENT_ID = 0 OR COMMENT_ID is null) AND USER_ID=" . IntVal($user_id) . "", true);
$parserBlog = new blogTextParser(false, $arParams["PATH_TO_SMILE"]);
$arParserParams = array("imageWidth" => $arParams["IMAGE_MAX_WIDTH"], "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"]);
$commentUrl .= strpos($commentUrl, "?") !== false ? "&" : "?";
if (strlen($arFields["PUBLISH_STATUS"]) > 0 && $arFields["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
$commentAddedUrl = $commentUrl . $arParams["COMMENT_ID_VAR"] . "=" . $commentId . "&hidden_add_comment_id=" . $commentId;
}
$commentUrl .= $arParams["COMMENT_ID_VAR"] . "=" . $commentId . "#" . $commentId;
if ($arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH || strlen($arFields["PUBLISH_STATUS"]) <= 0) {
$arFil = array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $arPost["ID"]);
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), $arFil, false, false, array("ID", "TMP_ID"));
if ($arRes = $dbRes->Fetch()) {
$log_id = $arRes["ID"];
} else {
$arParamsNotify = array("bSoNet" => true, "UserID" => $arParams["USER_ID"], "allowVideo" => $arResult["allowVideo"], "bGroupMode" => $arResult["bGroupMode"], "PATH_TO_SMILE" => $arParams["PATH_TO_SMILE"], "PATH_TO_POST" => $arParams["PATH_TO_POST"], "SOCNET_GROUP_ID" => $arParams["SOCNET_GROUP_ID"], "user_id" => $user_id, "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"]);
$log_id = CBlogPost::Notify($arPost, $arBlog, $arParamsNotify);
}
$arImages = array();
$res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "Y", "COMMENT_ID" => $commentId));
while ($arImage = $res->Fetch()) {
$arImages[$arImage["ID"]] = $arImage["FILE_ID"];
}
$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");
$text4mail = $parserBlog->convert4mail($_POST['comment'], $arImages);
if (intval($log_id) > 0) {
$text4message = $parserBlog->convert($_POST['comment'], false, $arImages, $arAllow, array("isSonetLog" => true));
$arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $arBlog["OWNER_ID"], "EVENT_ID" => "blog_comment", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $text4message, "TEXT_MESSAGE" => $text4mail, "URL" => $commentUrl, "MODULE_ID" => false, "SOURCE_ID" => $commentId, "LOG_ID" => $log_id, "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => intval($commentId));
if (intval($user_id) > 0) {
$arFieldsForSocnet["USER_ID"] = $user_id;
}
$log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
示例4: foreach
foreach ($arPostFields as $FIELD_NAME => $arPostField) {
if (!empty($arPostField["VALUE"]) > 0) {
$bHasProps = true;
break;
}
}
if (!empty($arFields["SOCNET_RIGHTS"]) && count($arFields["SOCNET_RIGHTS"]) == 1 && in_array("UA", $arFields["SOCNET_RIGHTS"])) {
$bHasOnlyAll = true;
}
$arFieldsHave = array("HAS_IMAGES" => $bHasImg ? "Y" : "N", "HAS_TAGS" => $bHasTag ? "Y" : "N", "HAS_PROPS" => $bHasProps ? "Y" : "N", "HAS_SOCNET_ALL" => $bHasOnlyAll ? "Y" : "N");
CBlogPost::Update($newID, $arFieldsHave);
}
if ($bAdd && $newID && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH || $arOldPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH && $arFields["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
$arFields["ID"] = $newID;
$arParamsNotify = array("bSoNet" => true, "UserID" => $arResult["UserID"], "allowVideo" => $arResult["allowVideo"], "PATH_TO_SMILE" => $arParams["PATH_TO_SMILE"], "PATH_TO_POST" => $arParams["PATH_TO_POST"], "SOCNET_GROUP_ID" => $arParams["SOCNET_GROUP_ID"], "user_id" => $arParams["USER_ID"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"]);
CBlogPost::Notify($arFields, $arBlog, $arParamsNotify);
if (COption::GetOptionString("blog", "send_blog_ping", "N") == "Y") {
if (strlen($serverName) <= 0) {
$dbSite = CSite::GetByID(SITE_ID);
$arSite = $dbSite->Fetch();
$serverName = htmlspecialcharsEx($arSite["SERVER_NAME"]);
if (strlen($serverName) <= 0) {
if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
$serverName = SITE_SERVER_NAME;
} else {
$serverName = COption::GetOptionString("main", "server_name", "");
}
if (strlen($serverName) <= 0) {
$serverName = $_SERVER["SERVER_NAME"];
}
}
示例5: GetMessage
}
} else {
$arResult["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_SESSID_WRONG");
}
}
} elseif (IntVal($_GET["pub_id"]) > 0) {
if ($_GET["success"] == "Y") {
$arResult["OK_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_MES_PUB");
} else {
if (check_bitrix_sessid()) {
$pub_id = IntVal($_GET["pub_id"]);
if ($arPost = CBlogPost::GetByID($pub_id)) {
if ($arPost["AUTHOR_ID"] == $user_id && $arPost["PUBLISH_STATUS"] != BLOG_PUBLISH_STATUS_PUBLISH) {
if (CBlogPost::Update($pub_id, array("PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH, "=DATE_PUBLISH" => $DB->GetNowFunction()))) {
$arParamsNotify = array("bSoNet" => true, "allowVideo" => $arResult["allowVideo"], "PATH_TO_SMILE" => $arParams["PATH_TO_SMILE"], "PATH_TO_POST" => $arParams["PATH_TO_POST"], "SOCNET_GROUP_ID" => $arParams["SOCNET_GROUP_ID"], "user_id" => $arParams["USER_ID"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"]);
CBlogPost::Notify($arPost, false, $arParamsNotify);
$socnetRights = CBlogPost::GetSocNetPermsCode($arPost["ID"]);
$arFieldsIM = array("TYPE" => "POST", "TITLE" => $arPost["TITLE"], "URL" => CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("post_id" => $arPost["ID"], "user_id" => $arParams["USER_ID"])), "ID" => $arPost["ID"], "FROM_USER_ID" => $arParams["USER_ID"], "TO_USER_ID" => array(), "TO_SOCNET_RIGHTS" => $socnetRights, "TO_SOCNET_RIGHTS_OLD" => array());
CBlogPost::NotifyIm($arFieldsIM);
LocalRedirect($APPLICATION->GetCurPageParam("pub_id=" . $pub_id . "&success=Y", array("del_id", "pub_id", "sessid", "success")));
} else {
$arResult["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_MES_PUB_ERROR");
}
}
} else {
$arResult["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_BLOG_MES_PUB_NO_RIGHTS");
}
} else {
$arResult["ERROR_MESSAGE"][] = GetMessage("BLOG_BLOG_SESSID_WRONG");
}
}
示例6: defined
CBlogPost::Notify($arFields, $arBlog, $arParamsNotify);
if (COption::GetOptionString("blog", "send_blog_ping", "N") == "Y") {
if (strlen($serverName) <= 0) {
$serverName = defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", "");
if (strlen($serverName) <= 0) {
$serverName = $_SERVER["SERVER_NAME"];
}
}
$blogUrl = "http://" . $serverName . CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_BLOG"]), array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"]));
CBlog::SendPing($arBlog["NAME"], $blogUrl);
}
}
if (IntVal($copyID) > 0 && $arCopyPost["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
$arCopyPost["ID"] = $copyID;
$arParamsNotify = array("bSoNet" => false, "UserID" => $arResult["UserID"], "allowVideo" => $arResult["allowVideo"], "bGroupMode" => false, "PATH_TO_SMILE" => $arParams["PATH_TO_SMILE"], "PATH_TO_POST" => $pathTemplate, "user_id" => $user_id, "MICROBLOG" => $arParams["MICROBLOG"] ? "Y" : "N");
CBlogPost::Notify($arCopyPost, $arCopyBlog, $arParamsNotify);
if (COption::GetOptionString("blog", "send_blog_ping", "N") == "Y") {
if (strlen($serverName) <= 0) {
$serverName = defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", "");
if (strlen($serverName) <= 0) {
$serverName = $_SERVER["SERVER_NAME"];
}
}
$blogUrl = "http://" . $serverName . CComponentEngine::MakePathFromTemplate($pathTemplateBlog, array("blog" => $arCopyBlog["URL"], "user_id" => $arCopyBlog["OWNER_ID"]));
CBlog::SendPing($arCopyBlog["NAME"], $blogUrl);
}
}
if ($newID > 0 && strlen($arResult["ERROR_MESSAGE"]) <= 0) {
$arParams["ID"] = $newID;
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/first_page/");
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arBlog["URL"] . "/calendar/");