roman.lesnikov@gmail.com 3 лет назад
Родитель
Сommit
fa7ec1e63b
2 измененных файлов с 12 добавлено и 8 удалено
  1. 7 6
      inc/classes/BxDolSockets.php
  2. 5 2
      template/scripts/BxBaseCmtsServices.php

+ 7 - 6
inc/classes/BxDolSockets.php

@@ -17,12 +17,13 @@ class BxDolSockets extends BxDolFactory implements iBxDolSingleton
     protected function __construct()
     {
         parent::__construct();
-        $a = parse_url(getParam('sys_sockets_url'));
-        $this->_sHost = $a['host'];
-        $this->_sPort = $a['port'];
-        $this->_sScheme = $a['scheme'];
-        if (getParam('sys_sockets_type') != 'sys_sockets_disabled')
-            $this->_sIsEnabled =true;
+        if (getParam('sys_sockets_type') != 'sys_sockets_disabled' && trim(getParam('sys_sockets_url')) != ''){
+            $this->_sIsEnabled = true;
+            $a = parse_url(getParam('sys_sockets_url'));
+            $this->_sHost = $a['host'];
+            $this->_sPort = $a['port'];
+            $this->_sScheme = $a['scheme'];
+        }    
     }
 
     static public function getInstance()

+ 5 - 2
template/scripts/BxBaseCmtsServices.php

@@ -511,11 +511,13 @@ class BxBaseCmtsServices extends BxDol
     
     public function serviceGetCommentsApi($oCmts, $aParams)
     {
-        
         $mixedResult = $oCmts->isViewAllowed();
         if($mixedResult !== CHECK_ACTION_RESULT_ALLOWED)
             return $mixedResult; // TODO: error checking
 
+        if (isset($aParams['comment_id']))
+            $aParams['comment_id'] = explode(',', $aParams['comment_id']);
+       
         $aBp = !isset($aParams['aBp']) ? [] : $aParams['aBp'];
         $aDp = ['in_designbox' => false, 'show_empty' => false];
         
@@ -533,7 +535,8 @@ class BxBaseCmtsServices extends BxDol
              $aBp['per_view'] = $aParams['per_view'];
         }
 
-        $aCmts = isset($aParams['comment_id']) ? [['cmt_id' => $aParams['comment_id']]] : $oCmts->getCommentsArray($aBp['vparent_id'], $aBp['filter'], $aBp['order'], $aBp['start'], $aBp[($aBp['init_view'] != -1 ? 'init' : 'per') . '_view']);
+        $aCmts = isset($aParams['comment_id']) ? array_map(function($value) {return ['cmt_id' => $value];}, $aParams['comment_id']) : $oCmts->getCommentsArray($aBp['vparent_id'], $aBp['filter'], $aBp['order'], $aBp['start'], $aBp[($aBp['init_view'] != -1 ? 'init' : 'per') . '_view']);
+
         
         $aParams['start_from'] = 0;
         if (count($aCmts) == $aBp['per_view']){