- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/log_tools.php
- Класс: CSocNetLogTools
- Вызов: CSocNetLogTools::AddComment_Review_CreateRoot_Blog
static function AddComment_Review_CreateRoot_Blog($arElement, $blogID)
{
global $DB;
if (!CModule::IncludeModule("blog"))
return false;
$arBlog = CBlog::GetByID($blogID);
$arElement["DETAIL_PICTURE"] = CFile::GetFileArray($arElement["DETAIL_PICTURE"]);
$arElement["REAL_PICTURE"] = CFile::GetFileArray($arElement["PROPERTY_REAL_PICTURE_VALUE"]);
if (!empty($arElement["TAGS"]))
{
$arCategoryVal = explode(",", $arElement["TAGS"]);
foreach($arCategoryVal as $k => $v)
{
if ($id = CBlogCategory::Add(array("BLOG_ID" => $arBlog["ID"],"NAME" => $v)))
$arCategory[] = $id;
}
}
$arFields=array(
"TITLE" => $arElement["NAME"],
"DETAIL_TEXT" =>
"[IMG]http://".$_SERVER['HTTP_HOST'].$arElement["DETAIL_PICTURE"]["SRC"]."[/IMG]n".
"[URL=http://".$_SERVER['HTTP_HOST'].$arElement["~DETAIL_PAGE_URL"]."]".$arElement["NAME"]."[/URL]n".
(!empty($arElement["TAGS"]) ? $arElement["TAGS"]."n" : "").
$arElement["~DETAIL_TEXT"]."n".
"[URL=http://".$_SERVER['HTTP_HOST'].$arElement["REAL_PICTURE"]["SRC"]."]".GetMessage("P_ORIGINAL")."[/URL]",
"CATEGORY_ID" => implode(",", $arCategory),
"PUBLISH_STATUS" => "P",
"PERMS_POST" => array(),
"PERMS_COMMENT" => array(),
"=DATE_CREATE" => $DB->GetNowFunction(),
"=DATE_PUBLISH" => $DB->GetNowFunction(),
"AUTHOR_ID" => (!empty($arElement["CREATED_BY"]) ? $arElement["CREATED_BY"] : 1),
"BLOG_ID" => $arBlog["ID"],
"ENABLE_TRACKBACK" => "N"
);
$POST_ID = CBlogPost::Add($arFields);
return $POST_ID;
}