ソースを参照

Ticket #3192 - In Comments.

AntonLV 5 年 前
親
コミット
b408a62fd4

+ 134 - 25
inc/classes/BxDolCmts.php

@@ -8,6 +8,7 @@
  */
 
 bx_import('BxDolAcl');
+bx_import('BxDolPrivacy');
 
 define('BX_DOL_CMT_TYPE_COMMENT', 'comment');
 define('BX_DOL_CMT_TYPE_REVIEW', 'review');
@@ -313,6 +314,9 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
     public static function getObjectInstanceByUniqId($iUniqId, $iInit = true, $oTemplate = false)
     {
         $aData = BxDolCmtsQuery::getCommentByUniq($iUniqId);
+        if(empty($aData) || !is_array($aData))
+            return null;
+
         return self::getObjectInstance($aData['system_name'], $aData['cmt_object_id']);
     }
 
@@ -454,6 +458,17 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         ));
     }
 
+    public function getViewText($mixedItem)
+    {
+        if(!is_array($mixedItem))
+            $mixedItem = $this->getCommentSimple((int)$mixedItem);
+
+        if(empty($mixedItem) || !is_array($mixedItem))
+            return '';
+
+        return $this->_prepareTextForOutput($mixedItem['cmt_text'], (int)$mixedItem['cmt_id']);
+    }
+
     public function getBaseUrl()
     {
         return $this->_replaceMarkers($this->_sBaseUrl);
@@ -487,6 +502,43 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         return ($bWithHash ? '#' : '') . sprintf($this->_sItemAnchor, str_replace('_', '-', $this->getSystemName()), $this->getId(), $iItemId);
     }
 
+    public function getAttachments($iCmtId)
+    {
+        $aResult = array();
+
+        if(!$this->isAttachImageEnabled())
+            return $aResult; 
+
+        $aFiles = $this->_oQuery->getFiles($this->_aSystem['system_id'], $iCmtId);
+        if(empty($aFiles) || !is_array($aFiles)) 
+            return $aResult;
+
+        $oStorage = BxDolStorage::getObjectInstance($this->getStorageObjectName());
+        $oTranscoder = BxDolTranscoderImage::getObjectInstance($this->getTranscoderPreviewName());
+
+        foreach($aFiles as $aFile) {
+            $bImage = $oTranscoder && $oTranscoder->isMimeTypeSupported($aFile['mime_type']);
+
+            $sPreview = '';
+            if($bImage)
+                $sPreview = $oTranscoder->getFileUrl($aFile['image_id']);
+
+            if(!$sPreview)
+                $sPreview = $this->_oTemplate->getIconUrl($oStorage->getIconNameByFileName($aFile['file_name']));
+
+            $sUrl = $oStorage->getFileUrlById($aFile['image_id']);
+
+            $aResult[] = array(
+                'id' => $aFile['image_id'],
+                'src' => $sPreview,
+                'src_orig' => $bImage ? $sUrl : '',
+                'url' => !$bImage ? $sUrl : ''
+            );
+        }
+
+        return $aResult;
+    }
+
     public function getConnectionObject($sType)
     {
         $sResult = '';
@@ -643,6 +695,21 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
 
         return $sTitle;
     }
+    
+    public function getObjectPrivacyView ($iObjectId = 0)
+    {
+        if(empty($iObjectId))
+            $iObjectId = $this->getId();
+
+        $sFieldPrivacyView = '';
+        if(!empty($this->_aSystem['trigger_field_privacy_view']))
+            $sFieldPrivacyView = $this->_aSystem['trigger_field_privacy_view'];
+
+        if(($iPrivacyView = $this->_oQuery->getObjectPrivacyView($iObjectId, $sFieldPrivacyView)) !== false)
+            return $iPrivacyView;
+
+        return BX_DOL_PG_ALL;
+    }
 
     public function getCommentsCountAll ($iObjectId = 0)
     {
@@ -1180,7 +1247,8 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
             $iObjId = $aCmt['cmt_object_id'];
         }
         $iObjAthrId = $this->getObjectAuthorId($iObjId);
-        
+        $iObjAthrPrivacyView = $this->getObjectPrivacyView($iObjId);
+
         if($aCmt['cmt_replies'] > 0) {
             if(!$this->isModerator())
                 return array('msg' => _t('_Can not delete comments with replies'));
@@ -1194,6 +1262,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         if(!$this->isRemoveAllowed($aCmt))
             return array('msg' => $aCmt['cmt_author_id'] == $iPerformerId ? strip_tags($this->msgErrRemoveAllowed()) : _t('_Access denied'));
 
+        $iCmtUniqId = $this->getCommentUniqId($iCmtId);
         if($this->_oQuery->removeComment($iObjId, $iCmtId, $aCmt['cmt_parent_id'])) {
             $this->_triggerComment();
 
@@ -1208,41 +1277,52 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
             $this->isRemoveAllowed($aCmt, true);
 
             $this->deleteMetaInfo ($iCmtId);
-            
+
             bx_audit(
                $this->getId(), 
                $this->_aSystem['module'], 
                '_sys_audit_action_delete_comment',  
                $this->_prepareAuditParams($iCmtId, array('comment_author_id' => $aCmt['cmt_author_id'], 'comment_text' => $aCmt['cmt_text']))
-           );
+            );
 
             bx_alert($this->_sSystem, 'commentRemoved', $iObjId, $iPerformerId, array(
                 'object_author_id' => $iObjAthrId,
 
                 'comment_id' => $iCmtId, 
-                'comment_author_id' => $aCmt['cmt_author_id']
+                'comment_uniq_id' => $iCmtUniqId,
+                'comment_author_id' => $aCmt['cmt_author_id'],
+
+                'privacy_view' => $iObjAthrPrivacyView,
             ));
 
             bx_alert('comment', 'deleted', $iCmtId, $iPerformerId, array(
                 'object_system' => $this->_sSystem, 
                 'object_id' => $iObjId, 
                 'object_author_id' => $iObjAthrId,
-                
-                'comment_author_id' => $aCmt['cmt_author_id']
+
+                'comment_uniq_id' => $iCmtUniqId,
+                'comment_author_id' => $aCmt['cmt_author_id'],
+                    
+                'privacy_view' => $iObjAthrPrivacyView,
             ));
 
             if(!empty($aCmt['cmt_parent_id'])) {
                 $iCmtPrntId = (int)$aCmt['cmt_parent_id'];
                 $aCmtPrnt = $this->_oQuery->getCommentSimple($iObjId, $iCmtPrntId);
                 if(!empty($aCmtPrnt) && is_array($aCmtPrnt)) {
+                    $iCmtPrntUniqId = $this->getCommentUniqId($iCmtPrntId);
+
                     bx_alert($this->_sSystem, 'replyRemoved', $iCmtPrntId, $iPerformerId, array(
                         'object_id' => $iObjId, 
                         'object_author_id' => $iObjAthrId,
-                        
+
+                        'parent_uniq_id' => $iCmtPrntUniqId,
                         'parent_author_id' => $aCmtPrnt['cmt_author_id'],
                         
                         'comment_id' => $iCmtId, 
                         'comment_author_id' => $aCmt['cmt_author_id'],
+
+                        'privacy_view' => $iObjAthrPrivacyView,
                     ));
 
                     bx_alert('reply', 'deleted', $iCmtId, $iPerformerId, array(
@@ -1251,9 +1331,12 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
                         'object_author_id' => $iObjAthrId,
 
                         'parent_id' => $iCmtPrntId,
+                        'parent_uniq_id' => $iCmtPrntUniqId,
                         'parent_author_id' => $aCmtPrnt['cmt_author_id'],
 
                         'comment_author_id' => $aCmt['cmt_author_id'], 
+
+                        'privacy_view' => $iObjAthrPrivacyView,
                     ));
                 }
             }
@@ -1287,49 +1370,63 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
     {
         $iObjId = (int)$this->getId();
         $iObjAthrId = $this->getObjectAuthorId($iObjId);
+        $iObjAthrPrivacyView = $this->getObjectPrivacyView($iObjId);
 
         $aCmt = $this->_oQuery->getCommentSimple($iObjId, $iCmtId);
         if(empty($aCmt) || !is_array($aCmt))
             return false;
 
+        $iCmtUniqId = $this->getCommentUniqId($iCmtId);
         $iCmtPrntId = (int)$aCmt['cmt_parent_id'];
         $iPerformerId = (int)$aCmt['cmt_author_id'];
         bx_alert($this->_sSystem, 'commentPost', $iObjId, $iPerformerId, array(
             'object_author_id' => $iObjAthrId,
 
             'comment_id' => $iCmtId, 
+            'comment_uniq_id' => $iCmtUniqId,
             'comment_author_id' => $aCmt['cmt_author_id'], 
-            'comment_text' => $aCmt['cmt_text']
+            'comment_text' => $aCmt['cmt_text'],
+
+            'privacy_view' => $iObjAthrPrivacyView,
         ));
-        
+
         bx_audit(
-           $this->getId(), 
-           $this->_aSystem['module'], 
-           '_sys_audit_action_add_comment',  
-           $this->_prepareAuditParams($iCmtId, array('comment_author_id' => $aCmt['cmt_author_id'], 'comment_text' => $aCmt['cmt_text']))
-       );
+            $this->getId(), 
+            $this->_aSystem['module'], 
+            '_sys_audit_action_add_comment',  
+            $this->_prepareAuditParams($iCmtId, array('comment_author_id' => $aCmt['cmt_author_id'], 'comment_text' => $aCmt['cmt_text']))
+        );
 
         bx_alert('comment', 'added', $iCmtId, $iPerformerId, array(
             'object_system' => $this->_sSystem, 
             'object_id' => $iObjId, 
             'object_author_id' => $iObjAthrId,
 
+            'comment_uniq_id' => $iCmtUniqId,
             'comment_author_id' => $aCmt['cmt_author_id'], 
-            'comment_text' => $aCmt['cmt_text']
+            'comment_text' => $aCmt['cmt_text'],
+
+            'privacy_view' => $iObjAthrPrivacyView,
         ));
 
         if(!empty($iCmtPrntId)) {
             $aCmtPrnt = $this->_oQuery->getCommentSimple($iObjId, $iCmtPrntId);
             if(!empty($aCmtPrnt) && is_array($aCmtPrnt)) {
+                $iCmtPrntUniqId = $this->getCommentUniqId($iCmtPrntId);
+
                 bx_alert($this->_sSystem, 'replyPost', $iCmtPrntId, $iPerformerId, array(
                     'object_id' => $iObjId, 
                     'object_author_id' => $iObjAthrId,
 
+                    'parent_uniq_id' => $iCmtPrntUniqId,
                     'parent_author_id' => $aCmtPrnt['cmt_author_id'],
 
                     'comment_id' => $iCmtId,
+                    'comment_uniq_id' => $iCmtUniqId,
                     'comment_author_id' => $aCmt['cmt_author_id'], 
-                    'comment_text' => $aCmt['cmt_text']
+                    'comment_text' => $aCmt['cmt_text'],
+
+                    'privacy_view' => $iObjAthrPrivacyView,
                 ));
 
                 bx_alert('comment', 'replied', $iCmtId, $iPerformerId, array(
@@ -1338,10 +1435,14 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
                     'object_author_id' => $iObjAthrId,
 
                     'parent_id' => $iCmtPrntId,
+                    'parent_uniq_id' => $iCmtPrntUniqId,
                     'parent_author_id' => $aCmtPrnt['cmt_author_id'],
 
+                    'comment_uniq_id' => $iCmtUniqId,
                     'comment_author_id' => $aCmt['cmt_author_id'],  
-                    'comment_text' => $aCmt['cmt_text']
+                    'comment_text' => $aCmt['cmt_text'],
+
+                    'privacy_view' => $iObjAthrPrivacyView,
                 ));
             }
         }
@@ -1353,34 +1454,42 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
     {
         $iObjId = (int)$this->getId();
     	$iObjAthrId = $this->getObjectAuthorId($iObjId);
+        $iObjAthrPrivacyView = $this->getObjectPrivacyView($iObjId);
 
     	$aCmt = $this->getCommentRow($iCmtId);
         if(empty($aCmt) || !is_array($aCmt))
             return false;
 
+        $iCmtUniqId = $this->getCommentUniqId($iCmtId);
         $iPerformerId = $this->_getAuthorId();
         bx_alert($this->_sSystem, 'commentUpdated', $iObjId, $iPerformerId, array(
             'object_author_id' => $iObjAthrId,
 
             'comment_id' => $iCmtId, 
+            'comment_uniq_id' => $iCmtUniqId,
             'comment_author_id' => $aCmt['cmt_author_id'], 
-            'comment_text' => $aCmt['cmt_text']        	
+            'comment_text' => $aCmt['cmt_text'],
+
+            'privacy_view' => $iObjAthrPrivacyView,
         ));
-        
+
         bx_audit(
-           $this->getId(), 
-           $this->_aSystem['module'], 
-           '_sys_audit_action_edit_comment',  
-           $this->_prepareAuditParams($iCmtId, array('comment_author_id' => $aCmt['cmt_author_id'], 'comment_text' => $aCmt['cmt_text']))
-       );
+            $this->getId(), 
+            $this->_aSystem['module'], 
+            '_sys_audit_action_edit_comment',  
+            $this->_prepareAuditParams($iCmtId, array('comment_author_id' => $aCmt['cmt_author_id'], 'comment_text' => $aCmt['cmt_text']))
+        );
 
         bx_alert('comment', 'edited', $iCmtId, $iPerformerId, array(
             'object_system' => $this->_sSystem, 
             'object_id' => $iObjId, 
             'object_author_id' => $iObjAthrId,
 
+            'comment_uniq_id' => $iCmtUniqId,
             'comment_author_id' => $aCmt['cmt_author_id'],
-            'comment_text' => $aCmt['cmt_text']
+            'comment_text' => $aCmt['cmt_text'],
+
+            'privacy_view' => $iObjAthrPrivacyView,
         ));
 
         return array('id' => $iCmtId, 'content' => $this->_getContent($aCmt));

+ 102 - 19
inc/classes/BxDolCmtsQuery.php

@@ -46,6 +46,93 @@ class BxDolCmtsQuery extends BxDolDb
         parent::__construct();
     }
 
+    public static function getInfoByUniqId($iUniqId)
+    {
+        $oDb = BxDolDb::getInstance();
+
+        $sQuery = "SELECT 
+                `ti`.`cmt_id` AS `cmt_id`, 
+                `to`.`Name` AS `system_name`, 
+                `to`.`Table` AS `table_name` 
+            FROM `" . BxDolCmts::$sTableIds . "` AS `ti` 
+            INNER JOIN  `" . BxDolCmts::$sTableSystems . "` AS `to` ON  `ti`.`system_id` = `to`.`ID`
+            WHERE `ti`.`id` = :uniq_ig 
+            LIMIT 1";
+
+        $aRow = $oDb->getRow($sQuery, array('uniq_ig' => $iUniqId));
+        if(empty($aRow) || !is_array($aRow))
+            return $aRow;
+
+        $aRow['cmt_object_id'] = $oDb->getOne("SELECT `cmt_object_id` FROM `" . $aRow['table_name'] . "` WHERE `cmt_id` = :cmt_id LIMIT 1", array(
+            'cmt_id' => $aRow['cmt_id']
+        ));
+
+        return $aRow;
+    }
+
+    /**
+     * @deprecated since version 12.0.1
+     */
+    public static function getCommentByUniq ($iUnicId)
+    {
+        return self::getInfoByUniqId($iUnicId);
+    }
+
+    public static function getCommentSimpleByUniqId($iUniqId)
+    {
+        $oDb = BxDolDb::getInstance();
+
+        $sQuery = "SELECT 
+                `ti`.`cmt_id` AS `cmt_id`, 
+                `to`.`Table` AS `cmt_table` 
+            FROM `" . BxDolCmts::$sTableIds . "` as `ti` 
+            INNER JOIN  `" . BxDolCmts::$sTableSystems . "` as `to` ON  `ti`.`system_id` = `to`.`ID`
+            WHERE `ti`.`id` = :uniq_ig 
+            LIMIT 1";
+
+        $aData = $oDb->getRow($sQuery, array('uniq_ig' => $iUniqId));
+        if(empty($aData) || !is_array($aData))
+            return array();
+
+        return $oDb->getRow("SELECT * FROM `" . $aData['cmt_table'] . "` WHERE `cmt_id` = :cmt_id LIMIT 1", array(
+            'cmt_id' => $aData['cmt_id']
+        ));
+    }
+
+    public static function getCommentExtendedByUniqId($iUniqId)
+    {
+        $oDb = BxDolDb::getInstance();
+
+        $sQuery = "SELECT 
+                `ti`.`cmt_id` AS `cmt_id`, 
+                `ti`.`system_id` AS `cmt_system_id`, 
+                `to`.`Table` AS `cmt_table` 
+            FROM `" . BxDolCmts::$sTableIds . "` AS `ti` 
+            INNER JOIN  `" . BxDolCmts::$sTableSystems . "` AS `to` ON  `ti`.`system_id` = `to`.`ID`
+            WHERE `ti`.`id` = :uniq_ig 
+            LIMIT 1";
+
+        $aData = $oDb->getRow($sQuery, array('uniq_ig' => $iUniqId));
+        if(empty($aData) || !is_array($aData))
+            return array();
+
+        $sQuery = "SELECT 
+                `tc`.*,
+                `ti`.`rate`, `ti`.`votes`,
+                `ti`.`rrate`, `ti`.`rvotes`,
+                `ti`.`score`, `ti`.`sc_up`, `ti`.`sc_down`,
+                `ti`.`reports` 
+            FROM `" . $aData['cmt_table'] . "` AS `tc`
+            LEFT JOIN `" . BxDolCmts::$sTableIds . "` AS `ti` ON `ti`.`system_id` = :cmt_system_id AND `tc`.`cmt_id` = `ti`.`cmt_id` 
+            WHERE `tc`.`cmt_id` = :cmt_id 
+            LIMIT 1";       
+
+        return $oDb->getRow($sQuery, array(
+            'cmt_id' => $aData['cmt_id'],
+            'cmt_system_id' => $aData['cmt_system_id']
+        ));
+    }
+
     function getTableName ()
     {
         return $this->_sTable;
@@ -383,24 +470,6 @@ class BxDolCmtsQuery extends BxDolDb
             LIMIT 1", $this->_oMain->getSystemId(), $iId, $iCmtId);
         return $this->getRow($sQuery);
     }
-    
-    static function getCommentByUniq ($iUnicId)
-    {
-        $oDb = BxDolDb::getInstance();
-        $sQuery = $oDb->prepare("SELECT `table_ids`.`cmt_id`, table_obj.`Name` AS `system_name`, table_obj.`Table` AS `table_name` 
-            FROM `" . BxDolCmts::$sTableIds . "` as `table_ids`  
-            INNER JOIN  `" . BxDolCmts::$sTableSystems . "` as `table_obj` ON  `table_ids`.`system_id` = `table_obj`.`ID`
-            WHERE `table_ids`.`id` = ?
-            LIMIT 1", $iUnicId);
-        $aRow = $oDb->getRow($sQuery);
-        
-        if ($aRow){
-            $sQuery = $oDb->prepare("SELECT `cmt_object_id` FROM `" . $aRow['table_name'] . "` WHERE `cmt_id` = ? LIMIT 1", $aRow['cmt_id']);
-            $aRow['cmt_object_id'] = $oDb->getOne($sQuery);
-        }
-        
-        return $aRow;
-    }
 
     function getCommentSimple ($iId, $iCmtId)
     {
@@ -576,7 +645,7 @@ class BxDolCmtsQuery extends BxDolDb
         return $this->query ($sQuery);
     }
 
-	function getObjectAuthorId($iId)
+    function getObjectAuthorId($iId)
     {
         $sQuery = $this->prepare("SELECT `{$this->_sTriggerFieldAuthor}` FROM `{$this->_sTriggerTable}` WHERE `{$this->_sTriggerFieldId}` = ? LIMIT 1", $iId);
         return $this->getOne($sQuery);
@@ -588,6 +657,20 @@ class BxDolCmtsQuery extends BxDolDb
         return $this->getOne($sQuery);
     }
 
+    function getObjectPrivacyView($iId, $sField = '')
+    {
+        if(empty($sField)) {
+            $sField = 'allow_view_to';
+            if(!$this->isFieldExists($this->_sTriggerTable, $sField))
+                return false;
+        }
+
+        return $this->getOne("SELECT `{$sField}` FROM `{$this->_sTriggerTable}` WHERE `{$this->_sTriggerFieldId}` = :id LIMIT 1", array(
+            'id' => $iId
+        ));
+    }
+    
+
     function updateTriggerTable($iId, $iCount)
     {
         if (!$this->_sTriggerFieldComments)

+ 2 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -1772,11 +1772,13 @@
 	<string name="_cmt_txt_or"><![CDATA[or]]></string>
         <string name="_cmt_txt_pinned"><![CDATA[Pinned comment]]></string>
 	<string name="_cmt_txt_sample_comment_single"><![CDATA[comment]]></string>
+        <string name="_cmt_txt_sample_comment_single_with_article"><![CDATA[a comment]]></string>
         <string name="_cmt_txt_sample_reaction_single"><![CDATA['{0}' reaction to comment]]></string>
 	<string name="_cmt_txt_sample_reply_to"><![CDATA[reply to comment]]></string>
         <string name="_cmt_txt_sample_score_up_single"><![CDATA[score up vote to comment]]></string>
         <string name="_cmt_txt_sample_score_down_single"><![CDATA[score down vote to comment]]></string>
         <string name="_cmt_txt_sample_vote_single"><![CDATA[vote to comment]]></string>
+        <string name="_cmt_txt_added_sample_custom"><![CDATA[Added <a href="{sample_url}">{sample}</a> to <a href="{psample_url}">{psample}</a>]]></string>
 	<string name="_cmt_txt_n_comments"><![CDATA[{0} comments]]></string>
         <string name="_cmt_txt_do"><![CDATA[Comment]]></string>
         <string name="_cmt_txt_counter"><![CDATA[{0}]]></string>

+ 2 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -1755,11 +1755,13 @@
 	<string name="_cmt_txt_or"><![CDATA[или]]></string>
         <string name="_cmt_txt_pinned"><![CDATA[Закрепленный комментарий]]></string>
 	<string name="_cmt_txt_sample_comment_single"><![CDATA[комментарий]]></string>
+        <string name="_cmt_txt_sample_comment_single_with_article"><![CDATA[комментарий]]></string>
         <string name="_cmt_txt_sample_reaction_single"><![CDATA[реакция '{0}' к комментарию]]></string>
 	<string name="_cmt_txt_sample_reply_to"><![CDATA[ответ на комментарий]]></string>
         <string name="_cmt_txt_sample_score_up_single"><![CDATA[голос за комментарий]]></string>
         <string name="_cmt_txt_sample_score_down_single"><![CDATA[голос против комментария]]></string>
         <string name="_cmt_txt_sample_vote_single"><![CDATA[голос за комментарий]]></string>
+        <string name="_cmt_txt_added_sample_custom"><![CDATA[Добавил <a href="{sample_url}">{sample}</a> к <a href="{psample_url}">{psample}</a>]]></string>
 	<string name="_cmt_txt_n_comments"><![CDATA[{0} комментариев]]></string>	
         <string name="_cmt_txt_do"><![CDATA[Комментировать]]></string>
         <string name="_cmt_txt_counter"><![CDATA[{0}]]></string>

+ 117 - 1
template/scripts/BxBaseCmtsServices.php

@@ -125,7 +125,123 @@ class BxBaseCmtsServices extends BxDol
             'content' =>  $oGrid->getCode()
         );
     }
-    
+
+    /**
+     * Comment Added for Timeline module
+     */
+    public function serviceGetTimelinePost($aEvent, $aBrowseParams = array())
+    {
+        $bCache = true;
+
+        $iCmtUniqId = $aEvent['object_id'];
+        $oCmts = BxDolCmts::getObjectInstanceByUniqId($iCmtUniqId);
+        if(!$oCmts)
+            return false;
+
+        $aCmt = BxDolCmtsQuery::getCommentExtendedByUniqId($iCmtUniqId);
+        if(empty($aCmt) || !is_array($aCmt))
+            return false;
+
+        $iCmtId = (int)$aCmt['cmt_id'];
+
+        $iUserId = bx_get_logged_profile_id();
+        $iAuthorId = (int)$aCmt['cmt_author_id'];
+        $iAuthorIdAbs = abs($iAuthorId);
+        if($iAuthorId < 0 && ((is_numeric($aEvent['owner_id']) && $iAuthorIdAbs == (int)$aEvent['owner_id']) || (is_array($aEvent['owner_id']) && in_array($iAuthorIdAbs, $aEvent['owner_id']))) && $iAuthorIdAbs != $iUserId)
+            return false;
+
+        $sCmtUrl = $oCmts->getViewUrl($iCmtId);
+
+        $sSample = '_cmt_txt_sample_comment_single_with_article';
+        $sSampleWoArticle = '_cmt_txt_sample_comment_single';
+        $sAction = '';
+        $sActionCustom = '_cmt_txt_added_sample_custom';
+        $aActionCustomMarkers = array(
+            'sample' => $sSample,
+            'sample_url' => $sCmtUrl,
+            'psample' => strip_tags($oCmts->getObjectTitle()),
+            'psample_url' => $oCmts->getBaseUrl(),
+        );
+
+        $iOwnerId = $iAuthorIdAbs;
+        if(isset($aEvent['object_privacy_view']) && (int)$aEvent['object_privacy_view'] < 0)
+            $iOwnerId = abs($aEvent['object_privacy_view']);
+
+        //--- Votes
+        $aVotes = array();
+        if(($oVotes = $oCmts->getVoteObject($iCmtId)) !== false)
+            $aVotes = array(
+                'system' => $oVotes->getSystemName(),
+                'object_id' => $iCmtId,
+                'count' => $aCmt['votes']
+            );
+        
+        //--- Reactions
+        $aReactions = array();
+        if(($oReactions = $oCmts->getReactionObject($iCmtId)) !== false)
+            $aReactions = array(
+                'system' => $oReactions->getSystemName(),
+                'object_id' => $iCmtId,
+                'count' => $aCmt['rvotes']
+            );
+
+        //--- Scores
+        $aScores = array();
+        if(($oScores = $oCmts->getScoreObject($iCmtId)) !== false)
+            $aScores = array(
+                'system' => $oScores->getSystemName(),
+                'object_id' => $iCmtId,
+                'score' => $aCmt['score']
+            );
+
+        //--- Reports
+        $aReports = array();
+        if(($oReports = $oCmts->getReportObject($iCmtId)) !== false)
+            $aReports = array(
+                'system' => $oReports->getSystemName(),
+                'object_id' => $iCmtId,
+                'count' => $aCmt['reports']
+            );
+
+        return array(
+            '_cache' => $bCache,
+            'owner_id' => $iOwnerId,
+            'object_owner_id' => $iAuthorId,
+            'icon' => 'comments',
+            'sample' => $sSample,
+            'sample_wo_article' => $sSampleWoArticle,
+            'sample_action' => $sAction,
+            'sample_action_custom' => array(
+                'content' => $sActionCustom,
+                'markers' => $aActionCustomMarkers
+            ),
+            'url' => $sCmtUrl,
+            'content' => array(
+                'sample' => $sSample,
+                'sample_wo_article' => $sSampleWoArticle,
+                'sample_action' => $sAction,
+                'url' => $sCmtUrl,
+                'title' => '',
+                'text' => $oCmts->getViewText($aCmt),
+                'images' => array(),
+                'images_attach' => array(),
+                'videos' => array(),
+                'videos_attach' => array(),
+                'files' => array(),
+                'files_attach' => $oCmts->getAttachments($iCmtId)
+            ), //a string to display or array to parse default template before displaying.
+            'date' => $aCmt['cmt_time'],
+            'views' => array(),
+            'votes' => $aVotes,
+            'reactions' => $aReactions,
+            'scores' => $aScores,
+            'reports' => $aReports,
+            'comments' => array(),
+            'title' => !empty($aCmt['cmt_text']) ? $aCmt['cmt_text'] : '', //may be empty.
+            'description' => '' //may be empty.
+        );
+    }
+
     /**
      * Comment vote for Notifications module
      */