本文整理汇总了PHP中CBlogComment::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlogComment::Update方法的具体用法?PHP CBlogComment::Update怎么用?PHP CBlogComment::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlogComment
的用法示例。
在下文中一共展示了CBlogComment::Update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rewritePreviousHistoryComment
protected static function rewritePreviousHistoryComment(array $file)
{
if (!CModule::IncludeModule('blog')) {
return;
}
$dbComments = CBlogComment::GetList(array('ID' => 'DESC'), array('POST_ID' => static::getPostIdForComment(), 'UF_BLOG_COMMENT_FH' => static::getStringForLike($file[0])), false, false, array('ID', 'POST_ID', 'BLOG_ID', 'UF_BLOG_COMMENT_FH'));
if ($dbComments && ($lastComment = $dbComments->Fetch())) {
$entityType = static::getEntityType($file[0]['ib_code']);
$documentId = static::getEntityIdDocumentData($entityType, array('ELEMENT_ID' => $file[0]['id']));
$filter = array("DOCUMENT_ID" => $documentId);
$historyDoc = static::getIdHistoryDocument($filter);
if (!empty($historyDoc['ID'])) {
$newFileData = static::getDataFromValue($lastComment['UF_BLOG_COMMENT_FH']);
$newFileData[0]['v'] = $historyDoc['ID'];
CBlogComment::Update($lastComment['ID'], array('UF_BLOG_COMMENT_FH' => static::genData($newFileData[0], $newFileData[1]), 'HAS_PROPS' => 'Y'));
}
}
}
示例2: CallBack_UpdateComment
public static function CallBack_UpdateComment($arFields)
{
if (!CModule::IncludeModule('blog')) {
return false;
}
if (!isset($arFields["SOURCE_ID"]) || intval($arFields["SOURCE_ID"]) <= 0) {
return false;
}
$messageId = intval($arFields["SOURCE_ID"]);
$ufFileID = array();
$ufDocID = array();
if ($arBlogComment = CBlogComment::GetByID($messageId)) {
$arBlogCommentFields = array("POST_TEXT" => $arFields["TEXT_MESSAGE"]);
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arTmp);
if (is_array($arTmp)) {
if (array_key_exists("UF_SONET_COM_DOC", $arTmp)) {
$arBlogCommentFields["UF_BLOG_COMMENT_FILE"] = $arTmp["UF_SONET_COM_DOC"];
}
}
if ($messageId = CBlogComment::Update($messageId, $arBlogCommentFields)) {
$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("BLOG_COMMENT", "UF_BLOG_COMMENT_FILE", $messageId, LANGUAGE_ID);
$sNote = GetMessage("IDEA_SONET_UPDATE_COMMENT_SOURCE_SUCCESS");
$cache = new CPHPCache();
$cache->CleanDir(SITE_ID . "/idea/" . $arBlogComment["BLOG_ID"] . "/comment/" . $arBlogComment["POST_ID"] . "/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlogComment["BLOG_ID"] . "/first_page/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlogComment["BLOG_ID"] . "/pages/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlogComment["BLOG_ID"] . "/comment/" . $arBlogComment["POST_ID"] . "/");
BXClearCache(True, "/" . SITE_ID . "/idea/" . $arBlogComment["BLOG_ID"] . "/post/" . $arBlogComment["POST_ID"] . "/");
} else {
if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
$sError = $ex->GetString();
} else {
$sError = GetMessage("IDEA_SONET_UPDATE_COMMENT_SOURCE_ERROR");
}
}
} else {
$sError = GetMessage("IDEA_SONET_UPDATE_COMMENT_SOURCE_ERROR");
}
return array("ERROR" => $sError, "NOTES" => $sNote, "UF" => array("FILE" => $ufFileID, "DOC" => $ufDocID));
}
示例3: array
if ($arResult["Perm"] == BLOG_PERMS_PREMODERATE) {
$arFields["PUBLISH_STATUS"] = BLOG_PUBLISH_STATUS_READY;
}
$commentUrl = CComponentEngine::MakePathFromTemplate(htmlspecialcharsBack($arParams["PATH_TO_POST"]), array("blog" => $arBlog["URL"], "post_id" => CBlogPost::GetPostID($arPost["ID"], $arPost["CODE"], $arParams["ALLOW_POST_CODE"]), "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"]));
$arFields["PATH"] = $commentUrl;
if (strpos($arFields["PATH"], "?") !== false) {
$arFields["PATH"] .= "&";
} else {
$arFields["PATH"] .= "?";
}
$arFields["PATH"] .= $arParams["COMMENT_ID_VAR"] . "=" . $commentID . "#" . $commentID;
$dbComment = CBlogComment::GetList(array(), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "PARENT_ID" => $commentID));
if ($arComment = $dbComment->Fetch() && $blogModulePermissions < "W") {
$arResult["COMMENT_ERROR"] = "<b>" . GetMessage("B_B_PC_COM_ERROR_EDIT") . "</b><br />" . GetMessage("B_B_PC_EDIT_ALREADY_COMMENTED");
} else {
if ($commentID = CBlogComment::Update($commentID, $arFields)) {
//Notifications
$Notify = CIdeaManagment::getInstance()->Notification(array_merge($arFields, array("TYPE" => 'IDEA_COMMENT', "ACTION" => 'UPDATE', "AUTHOR_ID" => $user_id, "ID" => $commentID, "POST_ID" => $arPost["ID"])));
//Socialnetwork notification
$Notify->getSonetNotify()->Send();
//Email notification
//$Notify->getEmailNotify()->Send();
//END -> Notifications
//start custom, use UF binding ::@Idea
if ($arResult["IDEA_MODERATOR"] && $_REQUEST["BIND_OFFICIAL_ANSWER"] == "Y") {
// Bind offical answer
CIdeaManagment::getInstance()->IdeaComment($commentID)->Bind();
}
if ($arResult["IDEA_MODERATOR"] && $_REQUEST["BIND_IDEA_STATUS"] != "") {
CIdeaManagment::getInstance()->Idea($arPost["ID"])->SetStatus($_REQUEST["BIND_IDEA_STATUS"]);
BXClearCache(True, '/' . SITE_ID . '/idea/statistic_list/');
示例4: str_replace
$arComment["DATE_CREATE_DATE"] = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $arComment["DATE_CREATE_DATE"]);
}
if ($arParams["MOBILE"] == "Y") {
$timestamp = MakeTimeStamp($arComment["DATE_CREATE"]);
$arComment["DATE_CREATE_TIME"] = FormatDate(GetMessage("SONET_SBPC_MOBILE_FORMAT_TIME"), $timestamp);
} else {
$arComment["DATE_CREATE_TIME"] = FormatDateFromDB($arComment["DATE_CREATE"], strpos($arParams["DATE_TIME_FORMAT_S"], 'a') !== false || ($arParams["DATE_TIME_FORMAT_S"] == 'FULL' && IsAmPmMode()) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'G:MI TT' : 'G:MI T' : 'GG:MI');
}
$arResult["CommentsResult"][] = $arComment;
$arResult["IDS"][] = $arComment["ID"];
$arFieldsHave = array();
if ($arComment["HAS_PROPS"] == "") {
$arFieldsHave["HAS_PROPS"] = $bHasProps ? "Y" : "N";
}
if (!empty($arFieldsHave)) {
CBlogComment::Update($arComment["ID"], $arFieldsHave, false);
}
$i++;
} while ($i < count($arCommentsAll) && ($arComment = $arCommentsAll[$i]));
}
unset($arResult["MESSAGE"]);
unset($arResult["ERROR_MESSAGE"]);
if ($arParams["CACHE_TIME"] > 0) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
$cache->EndDataCache(array("templateCachedData" => $this->GetTemplateCachedData(), "arResult" => $arResult));
}
}
}
$arResult["MESSAGE"] = $tmp["MESSAGE"];
示例5: implode
if (!empty($arCopyCat)) {
$arCopyPostUpdate["CATEGORY_ID"] = implode(",", $arCopyCat);
}
if ($_POST["move2blogcopy"] == "Y") {
$arCopyPostUpdate["NUM_COMMENTS"] = 0;
}
if (!empty($arCopyPostUpdate)) {
$copyID = CBlogPost::Update($copyID, $arCopyPostUpdate);
$arCopyPost = CBlogPost::GetByID($copyID);
}
if ($_POST["move2blogcopy"] != "Y") {
if (CBlogPost::CanUserDeletePost($arParams["ID"], $user_id)) {
$dbC = CBlogComment::GetList(array("ID" => "ASC"), array("BLOG_ID" => $arBlog["ID"], "POST_ID" => $arParams["ID"]), false, false, array("PATH", "PUBLISH_STATUS", "POST_TEXT", "TITLE", "DATE_CREATE", "AUTHOR_IP1", "AUTHOR_IP", "AUTHOR_EMAIL", "AUTHOR_NAME", "AUTHOR_ID", "PARENT_ID", "POST_ID", "BLOG_ID", "ID"));
while ($arC = $dbC->Fetch()) {
$arCTmp = array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID);
CBlogComment::Update($arC["ID"], $arCTmp);
}
$arFilter = array("POST_ID" => $arParams["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "Y");
$res = CBlogImage::GetList(array("ID" => "ASC"), $arFilter);
while ($arImg = $res->GetNext()) {
$arNewImg = array("BLOG_ID" => $arCopyBlog["ID"], "POST_ID" => $copyID);
CBlogImage::Update($arImg["ID"], $arNewImg);
}
if (!CBlogPost::Delete($arParams["ID"])) {
$arResult["ERROR_MESSAGE"] = GetMessage("BPE_COPY_DELETE_ERROR");
} else {
CBlogPost::DeleteLog($arParams["ID"], $arParams["MICROBLOG"]);
}
}
}
BXClearCache(True, "/" . SITE_ID . "/blog/" . $arCopyBlog["URL"] . "/first_page/");
示例6: foreach
} else {
$lAdmin->AddGroupError(GetMessage("BLB_DELETE_ERROR"), $ID);
}
}
break;
case "hide":
if (!CBlogComment::Update($ID, array("PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_READY))) {
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddGroupError($ex->GetString(), $ID);
} else {
$lAdmin->AddGroupError(GetMessage("BLB_HIDE_ERROR"), $ID);
}
}
break;
case "show":
if (!CBlogComment::Update($ID, array("PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH))) {
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddGroupError($ex->GetString(), $ID);
} else {
$lAdmin->AddGroupError(GetMessage("BLB_SHOW_ERROR"), $ID);
}
}
break;
}
}
if (!empty($arCacheInfo)) {
foreach ($arCacheInfo as $site => $arB) {
foreach ($arB as $blogUrl => $v) {
foreach ($v as $postID) {
BXClearCache(True, "/" . $site . "/blog/" . $blogUrl . "/first_page/");
BXClearCache(True, "/" . $site . "/blog/" . $blogUrl . "/comment/" . $postID . "/");