本文整理汇总了PHP中CSocNetLogTools::AddComment_Review_CheckIBlock_Blog方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogTools::AddComment_Review_CheckIBlock_Blog方法的具体用法?PHP CSocNetLogTools::AddComment_Review_CheckIBlock_Blog怎么用?PHP CSocNetLogTools::AddComment_Review_CheckIBlock_Blog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogTools
的用法示例。
在下文中一共展示了CSocNetLogTools::AddComment_Review_CheckIBlock_Blog方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AddComment_Photo_Blog
public static function AddComment_Photo_Blog($arFields, $BLOG_ID, $arLog)
{
if (!CModule::IncludeModule("blog")) {
return false;
}
if (!CModule::IncludeModule("iblock")) {
return false;
}
$arElement = false;
$arFilter = array("ID" => $arLog["SOURCE_ID"]);
$arSelectedFields = array("IBLOCK_ID", "ID", "NAME", "TAGS", "CODE", "IBLOCK_SECTION_ID", "DETAIL_PAGE_URL", "CREATED_BY", "PREVIEW_PICTURE", "PREVIEW_TEXT", "PROPERTY_BLOG_POST_ID", "PROPERTY_BLOG_COMMENT_CNT", "PROPERTY_REAL_PICTURE");
$db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields);
if ($db_res && ($res = $db_res->GetNext())) {
$arElement = $res;
}
if ($arElement) {
// check iblock properties
$ELEMENT_BLOG_POST_ID = CSocNetLogTools::AddComment_Review_CheckIBlock_Blog($arElement);
if ($ELEMENT_BLOG_POST_ID <= 0) {
// Add Post
$POST_ID = CSocNetLogTools::AddComment_Review_CreateRoot_Blog($arElement, $BLOG_ID);
$bNewPost = true;
} else {
$POST_ID = $ELEMENT_BLOG_POST_ID;
}
if (intval($POST_ID) > 0) {
// Add comment
$commentID = false;
$UserIP = CBlogUser::GetUserIP();
$arFieldsComment = array("POST_ID" => $POST_ID, "BLOG_ID" => $BLOG_ID, "POST_TEXT" => trim($arFields["TEXT_MESSAGE"]), "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1], "PARENT_ID" => false);
if ($GLOBALS["USER"]->IsAuthorized()) {
$arFieldsComment["AUTHOR_ID"] = $GLOBALS["USER"]->GetID();
}
$commentID = CBlogComment::Add($arFieldsComment);
if (!$commentID) {
$strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
} else {
CSocNetLogTools::AddComment_Review_UpdateElement_Blog($arElement, $POST_ID, $BLOG_ID, $bNewPost);
}
} else {
$strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
}
} else {
$strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
}
return array("SOURCE_ID" => $commentID, "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => $commentID, "ERROR" => $strError, "NOTES" => "", "IM_MESSAGE" => $arFieldsComment ? $arFieldsComment["POST_TEXT"] : false);
}