예제 #1
0
	public static function DeleteLog($commentID)
	{
		if (!CModule::IncludeModule('socialnetwork'))
			return;

		$dbRes = CSocNetLogComments::GetList(
			array("ID" => "DESC"),
			array(
				"EVENT_ID"	=> array("blog_comment", "blog_comment_micro"),
				"SOURCE_ID" => $commentID
			),
			false,
			false,
			array("ID")
		);
		while ($arRes = $dbRes->Fetch())
			CSocNetLogComments::Delete($arRes["ID"]);
	}
예제 #2
0
                             }
                             $strPathToLogEntry = str_replace("#log_id#", $arComment["LOG_ID"], COption::GetOptionString("socialnetwork", "log_entry_page", "/company/personal/log/#log_id#/", SITE_ID));
                             $strPathToLogEntryComment = $strPathToLogEntry . (strpos($strPathToLogEntry, "?") !== false ? "&" : "?") . "commentID=" . $comment . "#" . $comment;
                             $arPullMessageParams = array("ID" => $comment, "ENTITY_XML_ID" => $entity_xml_id, "FULL_ID" => array($entity_xml_id, $arComment["SOURCE_ID"] > 0 ? $arComment["SOURCE_ID"] : $comment), "SONET_FULL_ID" => array($arComment["LOG_ID"], $comment), "ACTION" => "REPLY", "APPROVED" => "Y", "PANELS" => array("EDIT" => "N", "MODERATE" => "N", "DELETE" => "N"), "NEW" => "Y", "AUTHOR" => array("ID" => $GLOBALS["USER"]->GetID(), "NAME" => $arResult["arCommentFormatted"]["CREATED_BY"]["FORMATTED"], "URL" => $arResult["arCommentFormatted"]["CREATED_BY"]["URL"], "E-MAIL" => "", "AVATAR" => $arResult["arCommentFormatted"]["AVATAR_SRC"], "IS_EXTRANET" => is_array($GLOBALS["arExtranetUserID"]) && in_array($GLOBALS["USER"]->GetID(), $GLOBALS["arExtranetUserID"])), "POST_TIMESTAMP" => MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComment) && !empty($arComment["LOG_DATE_FORMAT"]) ? $arComment["LOG_DATE_FORMAT"] : $arComment["LOG_DATE"]), "POST_TIME" => $arResult["arCommentFormatted"]["LOG_TIME_FORMAT"], "POST_DATE" => $arResult["arCommentFormatted"]["LOG_DATE_DAY"], "POST_MESSAGE_TEXT" => isset($arResult["arCommentFormatted"]) && isset($arResult["arCommentFormatted"]["MESSAGE_FORMAT"]) ? $arResult["arCommentFormatted"]["MESSAGE_FORMAT"] : $arComment["MESSAGE"], "~POST_MESSAGE_TEXT" => "", "POST_MESSAGE_TEXT_MOBILE" => isset($arResult["arCommentFormatted"]) && isset($arResult["arCommentFormatted"]["MESSAGE_FORMAT_MOBILE"]) ? $arResult["arCommentFormatted"]["MESSAGE_FORMAT_MOBILE"] : $arComment["MESSAGE"], "URL" => array("VIEW" => $strPathToLogEntryComment, "EDIT" => "__logEditComment('" . $entity_xml_id . "', '" . $comment . "', '" . $arComment["LOG_ID"] . "');", "DELETE" => "/bitrix/components/bitrix/socialnetwork.log.entry/ajax.php?lang=" . LANGUAGE_ID . "&action=delete_comment&delete_comment_id=" . $comment . "&post_id=" . $arComment["LOG_ID"] . "&site=" . SITE_ID . "#" . $comment), "BEFORE_ACTIONS" => $strRating, "BEFORE_ACTIONS_MOBILE" => $strRatingMobile, "AFTER" => $strAfter, "AFTER_MOBILE" => $strUFMobile);
                             CPullWatch::AddToStack('UNICOMMENTS' . $entity_xml_id, array('module_id' => 'unicomments', 'command' => 'comment', 'params' => $arPullMessageParams));
                         }
                     }
                 } elseif (is_array($comment) && array_key_exists("MESSAGE", $comment) && strlen($comment["MESSAGE"]) > 0) {
                     $arResult["strMessage"] = $comment["MESSAGE"];
                     $arResult["commentText"] = $comment_text;
                 }
             }
         } elseif ($deleteCommentID > 0 && $arComment) {
             $bHasDeleteCallback = is_array($arCommentEvent) && isset($arCommentEvent["DELETE_CALLBACK"]) && ($arCommentEvent["DELETE_CALLBACK"] == "NO_SOURCE" || is_callable($arCommentEvent["DELETE_CALLBACK"]));
             if ($bHasDeleteCallback && $arComment["USER_ID"] == $GLOBALS["USER"]->GetId()) {
                 if (CSocNetLogComments::Delete($deleteCommentID, true)) {
                     $arResult["commentID"] = $deleteCommentID;
                 } else {
                     $arResult["strMessage"] = GetMessage("SONET_LOG_COMMENT_CANT_DELETE");
                 }
             } else {
                 $arResult["strMessage"] = GetMessage("SONET_LOG_COMMENT_DELETE_NO_PERMISSIONS");
             }
         }
     }
 } elseif ($action == "get_comment") {
     $arResult["arCommentFormatted"] = __SLMAjaxGetComment($_REQUEST["cid"], $arParams, true);
 } elseif ($action == "get_comment_data") {
     $log_id = isset($_REQUEST["log_id"]) ? intval($_REQUEST["log_id"]) : 0;
     $comment_id = isset($_REQUEST["cid"]) ? intval($_REQUEST["cid"]) : 0;
     if ($arLog = CSocNetLog::GetByID($log_id)) {
예제 #3
0
 /**
  * @deprecated
  */
 public static function Remove($taskId, $commentId, $userId, $arParams)
 {
     global $DB;
     if (self::CanRemoveComment($taskId, $commentId, $userId, $arParams) !== true) {
         throw new TasksException('', TasksException::TE_ACCESS_DENIED);
     }
     $strErrorMessage = $strOKMessage = '';
     $result = ForumDeleteMessage($commentId, $strErrorMessage, $strOKMessage, array('PERMISSION' => 'Y'));
     if ($result) {
         if (CModule::IncludeModule("socialnetwork")) {
             $oTask = CTaskItem::getInstance($taskId, CTasksTools::GetCommanderInChief());
             $arTask = $oTask->getData();
             $bCrmTask = isset($arTask["UF_CRM_TASK"]) && (is_array($arTask["UF_CRM_TASK"]) && (isset($arTask["UF_CRM_TASK"][0]) && strlen($arTask["UF_CRM_TASK"][0]) > 0) || !is_array($arTask["UF_CRM_TASK"]) && strlen($arTask["UF_CRM_TASK"]) > 0);
             $dbRes = CSocNetLogComments::GetList(array(), array('EVENT_ID' => $bCrmTask ? array('crm_activity_add_comment') : array('tasks_comment'), 'SOURCE_ID' => $commentId), false, false, array('ID'));
             if ($arRes = $dbRes->Fetch()) {
                 CSocNetLogComments::Delete($arRes['ID']);
             }
         }
         $occurAsUserId = CTasksTools::getOccurAsUserId();
         if (!$occurAsUserId) {
             $occurAsUserId = $userId ? $userId : 1;
         }
         // Tasks log
         $arLogFields = array('TASK_ID' => $taskId, 'USER_ID' => $occurAsUserId, '~CREATED_DATE' => $DB->CurrentTimeFunction(), 'FIELD' => 'COMMENT_REMOVE');
         $log = new CTaskLog();
         $log->Add($arLogFields);
     }
     return $result;
 }
예제 #4
0
 private function RemoveComment($CommentId = false)
 {
     $arNotification = $this->Notify->getNotification();
     $oLogComment = CSocNetLogComments::GetList(            
         array("ID" => "DESC"),
         array(
             "SOURCE_ID" => $CommentId?$CommentId:$arNotification["ID"],
             "EVENT_ID" => 'idea_comment',
         ),
         false,
         false,
         array("ID")
     );
     while($arLogComment = $oLogComment->Fetch())
         CSocNetLogComments::Delete($arLogComment["ID"]);
 }
예제 #5
0
 function onAfterForumMessageDelete($ID, $arFields)
 {
     $val = COption::GetOptionString("intranet", "sonet_log_news_iblock_forum");
     if (strlen($val) > 0) {
         $arIBlockForum = unserialize($val);
     } else {
         $arIBlockForum = array();
     }
     if (CModule::IncludeModule("socialnetwork") && in_array($arFields["FORUM_ID"], $arIBlockForum)) {
         $dbRes = CSocNetLogComments::GetList(array("ID" => "DESC"), array("EVENT_ID" => "news_comment", "SOURCE_ID" => $ID), false, false, array("ID"));
         if ($arRes = $dbRes->Fetch()) {
             CSocNetLogComments::Delete($arRes["ID"]);
         }
     }
 }
	public static function onAfterCommentUpdate($entityType, $entityId, $arData)
	{
		$log_event_id = CSocNetForumComments::FindLogEventIDByForumEntityID($entityType);
		if (!$log_event_id)
			return false;

		$arLogCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($log_event_id);
		if (!$arLogCommentEvent)
			return false;

		$arLogEvent = CSocNetLogTools::FindLogEventByID($log_event_id);

		$entityId = intval($entityId);
		if ($entityId <= 0)
			return;	

		if (empty($arData["MESSAGE_ID"]))
			return;

		$parser = new CTextParser();
		$parser->allow = array("HTML" => 'N',"ANCHOR" => 'Y',"BIU" => 'Y',"IMG" => "Y","VIDEO" => "Y","LIST" => 'N',"QUOTE" => 'Y',"CODE" => 'Y',"FONT" => 'Y',"SMILES" => "N","UPLOAD" => 'N',"NL2BR" => 'N',"TABLE" => "Y");

		switch ($arData["ACTION"])
		{
			case "DEL":
			case "HIDE":
				$dbLogComment = CSocNetLogComments::GetList(
					array("ID" => "DESC"),
					array(
						"EVENT_ID"	=> array($arLogCommentEvent["EVENT_ID"]),
						"SOURCE_ID" => intval($arData["MESSAGE_ID"])
					),
					false,
					false,
					array("ID")
				);
				while ($arLogComment = $dbLogComment->Fetch())
					CSocNetLogComments::Delete($arLogComment["ID"]);
				break;
			case "SHOW":
				$dbLogComment = CSocNetLogComments::GetList(
					array("ID" => "DESC"),
					array(
						"EVENT_ID"	=> array($arLogCommentEvent["EVENT_ID"]),
						"SOURCE_ID" => intval($arData["MESSAGE_ID"])
					),
					false,
					false,
					array("ID")
				);
				$arLogComment = $dbLogComment->Fetch();
				if (!$arLogComment)
				{
					$arMessage = CForumMessage::GetByID(intval($arData["MESSAGE_ID"]));
					if ($arMessage)
					{
						$dbLog = CSocNetLog::GetList(
							array("ID" => "DESC"),
							array(
								"EVENT_ID" => $log_event_id,
								"SOURCE_ID" => $entityId
							),
							false,
							false,
							array("ID", "ENTITY_TYPE", "ENTITY_ID")
						);

						if ($arLog = $dbLog->Fetch())
						{
							$log_id = $arLog["ID"];
							$entity_type = $arLog["ENTITY_TYPE"];
							$entity_id = $arLog["ENTITY_ID"];

							$sText = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
							$strURL = $GLOBALS['APPLICATION']->GetCurPageParam("", array("IFRAME", "MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
							$strURL = ForumAddPageParams(
								$strURL,
								array(
									"MID" => intval($arData["MESSAGE_ID"]),
									"result" => "reply"
								),
								false,
								false
							);

							$arFieldsForSocnet = array(
								"ENTITY_TYPE" => $entity_type,
								"ENTITY_ID" => $entity_id,
								"EVENT_ID" => $arLogCommentEvent["EVENT_ID"],
								"MESSAGE" => $sText,
								"TEXT_MESSAGE" => $parser->convert4mail($sText),
								"URL" => str_replace("?IFRAME=Y", "", str_replace("&IFRAME=Y", "", str_replace("IFRAME=Y&", "", $strURL))),
								"MODULE_ID" => (array_key_exists("MODULE_ID", $arLogCommentEvent) && strlen($arLogCommentEvent["MODULE_ID"]) > 0 ? $arLogCommentEvent["MODULE_ID"] : ""),
								"SOURCE_ID" => intval($arData["MESSAGE_ID"]),
								"LOG_ID" => $log_id,
								"RATING_TYPE_ID" => "FORUM_POST",
								"RATING_ENTITY_ID" => intval($arData["MESSAGE_ID"])
							);

							$arFieldsForSocnet["USER_ID"] = $arMessage["AUTHOR_ID"];
							$arFieldsForSocnet["=LOG_DATE"] = $GLOBALS["DB"]->CurrentTimeFunction();

							$ufFileID = array();
							$dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => intval($arData["MESSAGE_ID"])));
							while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch())
								$ufFileID[] = $arAddedMessageFiles["FILE_ID"];

							if (count($ufFileID) > 0)
								$arFieldsForSocnet["UF_SONET_COM_FILE"] = $ufFileID;

							$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", intval($arData["MESSAGE_ID"]), LANGUAGE_ID);
							if ($ufDocID)
								$arFieldsForSocnet["UF_SONET_COM_DOC"] = $ufDocID;

							$comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
							CSocNetLog::CounterIncrement(
								$comment_id, 
								false, 
								false, 
								"LC",
								CSocNetLogRights::CheckForUserAll($log_id)
							);
						}
					}
				}
				break;
			case "EDIT":
				$arMessage = CForumMessage::GetByID(intval($arData["MESSAGE_ID"]));
				if ($arMessage)
				{
					$dbLogComment = CSocNetLogComments::GetList(
						array("ID" => "DESC"),
						array(
							"EVENT_ID"	=> array($arLogCommentEvent["EVENT_ID"]),
							"SOURCE_ID" => intval($arData["MESSAGE_ID"])
						),
						false,
						false,
						array("ID")
					);
					$arLogComment = $dbLogComment->Fetch();
					if ($arLogComment)
					{
						$sText = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
						$arFieldsForSocnet = array(
							"MESSAGE" => $sText,
							"TEXT_MESSAGE" => $parser->convert4mail($sText),
						);

						$ufFileID = array();
						$dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => intval($arData["MESSAGE_ID"])));
						while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch())
							$ufFileID[] = $arAddedMessageFiles["FILE_ID"];

						if (count($ufFileID) > 0)
							$arFieldsForSocnet["UF_SONET_COM_FILE"] = $ufFileID;

						$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", intval($arData["MESSAGE_ID"]), LANGUAGE_ID);
						if ($ufDocID)
							$arFieldsForSocnet["UF_SONET_COM_DOC"] = $ufDocID;

						CSocNetLogComments::Update($arLogComment["ID"], $arFieldsForSocnet);
					}
				}
				break;
			default:
		}

		foreach (GetModuleEvents("socialnetwork", "onAfterCommentUpdateAfter", true) as $arModuleEvent)
			ExecuteModuleEventEx($arModuleEvent, array(
				$entityType,
				$entityId,
				$arData,
				$log_id
			));
	}
예제 #7
0
 public function OnAfterPhotoCommentDeleteBlog($ID)
 {
     if (!$this->IsSocnet) {
         return;
     }
     if (intval($ID) > 0) {
         $dbRes = CSocNetLogComments::GetList(array("ID" => "DESC"), array("EVENT_ID" => "photo_comment", "SOURCE_ID" => $ID), false, false, array("ID", "LOG_ID"));
         if ($arRes = $dbRes->Fetch()) {
             $res = CSocNetLogComments::Delete($arRes["ID"]);
             if ($res) {
                 $dbResult = CSocNetLog::GetList(array(), array("ID" => $arRes["LOG_ID"]), false, false, array("ID", "COMMENTS_COUNT"));
                 if ($arLog = $dbResult->Fetch()) {
                     if ($arLog["COMMENTS_COUNT"] == 0) {
                         CSocNetLog::Delete($arRes["LOG_ID"]);
                     }
                 }
             }
         }
     }
 }
예제 #8
0
파일: ajax.php 프로젝트: Satariall/izurit
            $arRes = CSocNetLogComponent::getCommentByRequest($comment_id, $post_id, "edit");
            if ($arRes) {
                $arResult["id"] = intval($arRes["ID"]);
                $arResult["message"] = str_replace("<br />", "\n", $arRes["MESSAGE"]);
                $arResult["sourceId"] = intval($arRes["SOURCE_ID"]) > 0 ? intval($arRes["SOURCE_ID"]) : intval($arRes["ID"]);
                $arResult["UF"] = !empty($arRes["UF"]) ? $arRes["UF"] : array();
            }
        }
    } elseif ($action == "delete_comment") {
        $arResult = false;
        $comment_id = intval($_REQUEST["delete_comment_id"]);
        $post_id = intval($_REQUEST["post_id"]);
        if ($comment_id > 0 && $post_id > 0) {
            $arRes = CSocNetLogComponent::getCommentByRequest($comment_id, $post_id, "delete");
            if ($arRes) {
                $bSuccess = CSocNetLogComments::Delete($arRes["ID"], true);
                if (!$bSuccess && ($e = $GLOBALS["APPLICATION"]->GetException())) {
                    $errorMessage = $e->GetString();
                }
                $APPLICATION->IncludeComponent("bitrix:main.post.list", "", array("ENTITY_XML_ID" => $_REQUEST["ENTITY_XML_ID"], "PUSH&PULL" => array("ID" => $bSuccess ? $arRes["SOURCE_ID"] > 0 ? $arRes["SOURCE_ID"] : $arRes["ID"] : false, "ACTION" => "DELETE"), "OK_MESSAGE" => $bSuccess ? GetMessage('SONET_LOG_COMMENT_DELETED') : '', "ERROR_MESSAGE" => !$bSuccess ? $errorMessage : ''));
            }
        }
    }
    header('Content-Type:application/json; charset=UTF-8');
    echo \Bitrix\Main\Web\Json::encode($arResult);
    /** @noinspection PhpUndefinedClassInspection */
    \CMain::finalActions();
    die;
}
define('PUBLIC_AJAX_MODE', true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
예제 #9
0
 function onAfterMessageDelete($ID, $arFields)
 {
     if ((!array_key_exists('PARAM1', $arFields) || $arFields['PARAM1'] != 'IB') && array_key_exists('PARAM2', $arFields) && intval($arFields['PARAM2']) > 0) {
         $dbRes = CSocNetLogComments::GetList(array("ID" => "DESC"), array("EVENT_ID" => "wiki_comment", "SOURCE_ID" => $ID), false, false, array("ID"));
         while ($arRes = $dbRes->Fetch()) {
             CSocNetLogComments::Delete($arRes["ID"]);
         }
     }
 }
예제 #10
0
     // check out not hidden topic messages
     $iApprovedMessagesCnt = CForumMessage::GetList(array(), array("TOPIC_ID" => $arParams["TID"], "APPROVED" => "Y"), true);
     if ($iApprovedMessagesCnt <= 0) {
         $rsForumMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $arParams["TID"]), false, 1);
         if ($arForumMessage = $rsForumMessage->Fetch()) {
             $dbLogRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "forum", "SOURCE_ID" => $arForumMessage["ID"]), false, false, array("ID"));
             if ($arLogRes = $dbLogRes->Fetch()) {
                 $arLogID_Del[] = $arLogRes["ID"];
             }
         }
     }
     foreach ($arLogID_Del as $log_id) {
         CSocNetLog::Delete($log_id);
     }
     foreach ($arLogCommentID_Del as $log_comment_id) {
         CSocNetLogComments::Delete($log_comment_id);
     }
 }
 if (!empty($strErrorMessage)) {
     $arError[] = array("id" => $action, "text" => $strErrorMessage);
 } elseif ($action == "DEL" || $action == "SPAM") {
     $arFields = CForumTopic::GetByID($arParams["TID"]);
     if (empty($arFields)) {
         $url = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_TOPIC_LIST"], array("FID" => $arParams["FID"]));
         $action = "del_topic";
     } else {
         $res = intVal($message);
         $mid = "s";
         if (is_array($message)) {
             sort($message);
             $res = array_pop($message);
예제 #11
0
 private function deleteLogComment($messageID)
 {
     $dbRes = CSocNetLogComments::GetList(array("ID" => "DESC"), array("EVENT_ID" => "wiki_comment", "SOURCE_ID" => $messageID), false, false, array("ID"));
     while ($arRes = $dbRes->Fetch()) {
         CSocNetLogComments::Delete($arRes["ID"]);
     }
 }
예제 #12
0
 public function SocnetLogMessageAdd($ID, $arFields, $bUpdate = false)
 {
     $arForum = CForumNew::GetByID($this->forumID);
     $arMessage = CForumMessage::GetByIDEx($ID);
     if ($arMessage["TOPIC_ID"]) {
         $arTopic = CForumTopic::GetByID($arMessage["TOPIC_ID"]);
     }
     $arRes = $this->_getSocnetLogEntityByComment($arMessage);
     if ($arRes && intval($arRes["TMP_ID"]) > 0) {
         $parser = new textParser(LANGUAGE_ID, $this->arPath["PATH_TO_SMILE"]);
         $parser->image_params["width"] = false;
         $parser->image_params["height"] = false;
         $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "LIST" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "UPLOAD" => $arForum["ALLOW_UPLOAD"], "NL2BR" => "N", "SMILES" => "N");
         if (intval($arRes["COMMENTS_COUNT"]) == intval($arTopic["POSTS"])) {
             $url = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $arMessage["FORUM_ID"], "TID" => $arMessage["TOPIC_ID"], "MID" => $ID));
             $arFieldsForSocnet = array("ENTITY_TYPE" => $arRes["ENTITY_TYPE"], "ENTITY_ID" => $arRes["ENTITY_ID"], "EVENT_ID" => $this->event_comments_id, "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $parser->convert($arMessage["POST_MESSAGE"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($arMessage["POST_MESSAGE"]), "URL" => $url, "MODULE_ID" => false, "SOURCE_ID" => $ID, "LOG_ID" => $arRes["TMP_ID"], "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => intval($ID));
             if (intVal($arMessage["AUTHOR_ID"]) > 0) {
                 $arFieldsForSocnet["USER_ID"] = $arMessage["AUTHOR_ID"];
             }
             if ($bUpdate) {
                 $commentID = $this->_getSocnetLogCommentByForumComment($ID, $arRes);
                 if ($arMessage['APPROVED'] == 'Y') {
                     if ($commentID) {
                         CSocNetLogComments::Update($commentID, $arFieldsForSocnet);
                     } else {
                         $log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
                         //, true
                         CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
                     }
                 } else {
                     if ($commentID) {
                         CSocNetLogComments::Delete($commentID);
                     }
                 }
             } else {
                 $log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
                 //, true
                 CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
             }
         } else {
             $dbComments = CForumMessage::GetListEx(array(), array('TOPIC_ID' => $arMessage["TOPIC_ID"], "NEW_TOPIC" => "N"));
             while ($arComment = $dbComments->GetNext()) {
                 $url = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $arComment["FORUM_ID"], "TID" => $arComment["TOPIC_ID"], "MID" => $arComment["ID"]));
                 $arFieldsForSocnet = array("ENTITY_TYPE" => $arRes["ENTITY_TYPE"], "ENTITY_ID" => $arRes["ENTITY_ID"], "EVENT_ID" => $this->event_comments_id, "=LOG_DATE" => $GLOBALS["DB"]->CharToDateFunction($arComment['POST_DATE'], "FULL", SITE_ID), "MESSAGE" => $parser->convert($arComment["POST_MESSAGE"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($arComment["POST_MESSAGE"]), "URL" => $url, "MODULE_ID" => false, "SOURCE_ID" => $arComment["ID"], "LOG_ID" => $arRes["TMP_ID"], "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => intval($arComment["ID"]));
                 if (intVal($arComment["AUTHOR_ID"]) > 0) {
                     $arFieldsForSocnet["USER_ID"] = $arComment["AUTHOR_ID"];
                 }
                 $log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
                 //, true
                 CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
             }
         }
     }
 }