• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/livefeed/logcomment.php
  • Класс: BitrixSocialnetworkLivefeedLogComment
  • Вызов: LogComment::initSourceFields
public function initSourceFields()
{
	$commentId = $this->entityId;

	if ($commentId > 0)
	{
		$logId = false;

		$res = LogCommentTable::getList([
			'filter' => [
				'=ID' => $commentId,
				'@EVENT_ID' => $this->getEventId(),
			],
			'select' => [ 'ID', 'LOG_ID', 'MESSAGE', 'SHARE_DEST', 'EVENT_ID' ]
		]);
		if ($logComentFields = $res->fetch())
		{
			$logId = (int)$logComentFields['LOG_ID'];
		}

		if ($logId)
		{
			$res = CSocNetLog::getList(
				array(),
				array(
					'=ID' => $logId
				),
				false,
				false,
				array('ID', 'EVENT_ID'),
				array(
					"CHECK_RIGHTS" => "Y",
					"USE_FOLLOW" => "N",
					"USE_SUBSCRIBE" => "N"
				)
			);
			if ($logFields = $res->fetch())
			{
				$this->setLogId($logFields['ID']);
				$this->setSourceFields(array_merge($logComentFields, array('LOG_EVENT_ID' => $logFields['EVENT_ID'])));
				$this->setSourceDescription($logComentFields['MESSAGE']);

				$title = htmlspecialcharsback($logComentFields['MESSAGE']);
				$title = BitrixSocialnetworkHelperMention::clear($title);

				$CBXSanitizer = new CBXSanitizer;
				$CBXSanitizer->delAllTags();
				$title = preg_replace(array("/n+/is".BX_UTF_PCRE_MODIFIER, "/s+/is".BX_UTF_PCRE_MODIFIER), " ", $CBXSanitizer->sanitizeHtml($title));
				$this->setSourceTitle(truncateText($title, 100));
				$this->setSourceAttachedDiskObjects($this->getAttachedDiskObjects($this->cloneDiskObjects));
				$this->setSourceDiskObjects($this->getDiskObjects($commentId, $this->cloneDiskObjects));
				$this->setSourceOriginalText($logComentFields['MESSAGE']);
				$this->setSourceAuxData($logComentFields);
			}
		}
	}
}