AntonLV 9 سال پیش
والد
کامیت
4f38ee645d

+ 36 - 8
inc/classes/BxDolCmts.php

@@ -1021,14 +1021,42 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
 
     protected function _getParams(&$aBp, &$aDp)
     {
-    	$aBp['vparent_id'] = isset($_REQUEST['CmtParent'])? bx_process_input($_REQUEST['CmtParent'], BX_DATA_INT) : 0;
-    	$aBp['type'] = isset($_REQUEST['CmtBrowse']) ? bx_process_input($_REQUEST['CmtBrowse'], BX_DATA_TEXT) : '';
-    	$aBp['filter'] = isset($_REQUEST['CmtFilter']) ? bx_process_input($_REQUEST['CmtFilter'], BX_DATA_TEXT) : '';
-        $aBp['start'] = isset($_REQUEST['CmtStart']) ? bx_process_input($_REQUEST['CmtStart'], BX_DATA_INT) : -1;
-        $aBp['per_view'] = isset($_REQUEST['CmtPerView']) ? bx_process_input($_REQUEST['CmtPerView'], BX_DATA_INT) : -1;
-
-        $aDp['type'] = isset($_REQUEST['CmtDisplay']) ? bx_process_input($_REQUEST['CmtDisplay'], BX_DATA_TEXT) : '';
-        $aDp['blink'] = isset($_REQUEST['CmtBlink']) ? bx_process_input($_REQUEST['CmtBlink'], BX_DATA_TEXT) : '';
+        //--- Process 'Browse' params. 
+        $aBp['parent_id'] = isset($aBp['parent_id']) ? (int)$aBp['parent_id'] : 0;
+
+        $aBp['vparent_id'] = isset($aBp['vparent_id']) ? (int)$aBp['vparent_id'] : 0;
+        if(bx_get('CmtParent') !== false)
+            $aBp['vparent_id'] = bx_process_input(bx_get('CmtParent'), BX_DATA_INT);
+
+    	$aBp['type'] = isset($aBp['type']) ? $aBp['type'] : '';
+    	if(bx_get('CmtBrowse') !== false) 
+        	$aBp['type'] = bx_process_input(bx_get('CmtBrowse'), BX_DATA_TEXT);
+
+    	$aBp['filter'] = isset($aBp['filter']) ? $aBp['filter'] : '';
+    	if(bx_get('CmtFilter') !== false) 
+    	    $aBp['filter'] = bx_process_input(bx_get('CmtFilter'), BX_DATA_TEXT);
+
+        $aBp['start'] = isset($aBp['start']) ? (int)$aBp['start'] : -1;
+        if(bx_get('CmtStart') !== false) 
+            $aBp['start'] = bx_process_input($_REQUEST['CmtStart'], BX_DATA_INT);
+
+        $aBp['per_view'] = isset($aBp['per_view']) ? (int)$aBp['per_view'] : -1;
+        if(bx_get('CmtPerView') !== false) 
+            $aBp['per_view'] = bx_process_input($_REQUEST['CmtPerView'], BX_DATA_INT);
+
+        //--- Process 'Display' params.
+        $aDp['type'] = isset($aDp['type']) ? $aDp['type'] : '';
+        if(bx_get('CmtDisplay') !== false) 
+            $aDp['type'] = bx_process_input($_REQUEST['CmtDisplay'], BX_DATA_TEXT);
+
+        $aDp['blink'] = isset($aDp['blink']) ? $aDp['blink'] : '';
+        if(bx_get('CmtBlink') !== false) 
+            $aDp['blink'] = bx_process_input($_REQUEST['CmtBlink'], BX_DATA_TEXT);
+
+        $aDp['in_designbox'] = isset($aDp['in_designbox']) ? (bool)$aDp['in_designbox'] : true;
+        $aDp['dynamic_mode'] = isset($aDp['dynamic_mode']) ? (bool)$aDp['dynamic_mode'] : false;
+        $aDp['show_empty'] = isset($aDp['show_empty']) ? (bool)$aDp['show_empty'] : false;
+            
     }
 
     protected function _prepareTextForEdit ($s)

+ 1 - 1
modules/base/text/classes/BxBaseModTextModule.php

@@ -209,7 +209,7 @@ class BxBaseModTextModule extends BxBaseModGeneralModule implements iBxDolConten
         if (!$oCmts || !$oCmts->isEnabled())
             return false;
 
-        return $oCmts->getCommentsBlock(0, 0, false);
+        return $oCmts->getCommentsBlock(array(), array('in_designbox' => false));
     }
 }
 

+ 2 - 2
modules/boonex/convos/classes/BxCnvCmts.php

@@ -60,9 +60,9 @@ class BxCnvCmts extends BxTemplCmts
         return $oForm;
     }
 
-    function getCommentsBlock($iParentId = 0, $iVParentId = 0, $bInDesignbox = true, $bDynamic = false)
+    function getCommentsBlock($aBp = array(), $aDp = array())
     {
-        $mixedBlock = parent::getCommentsBlock($iParentId, $iVParentId, $bInDesignbox, $bDynamic);
+        $mixedBlock = parent::getCommentsBlock($aBp, $aDp);
         if (is_array($mixedBlock) && isset($mixedBlock['title']))
             $mixedBlock['title'] = _t('_bx_cnv_page_block_title_entry_comments', $this->getCommentsCount());
         return $mixedBlock;

+ 2 - 2
modules/boonex/forum/classes/BxForumCmts.php

@@ -44,9 +44,9 @@ class BxForumCmts extends BxTemplCmts
             BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTION_SUBSCRIBERS'])->actionAdd((int)$this->getId(), (int)$this->_getAuthorId());
     }
 
-    public function getCommentsBlock($iParentId = 0, $iVParentId = 0, $bInDesignbox = true, $bDynamic = false)
+    public function getCommentsBlock($aBp = array(), $aDp = array())
     {
-        $mixedBlock = parent::getCommentsBlock($iParentId, $iVParentId, $bInDesignbox, $bDynamic);
+        $mixedBlock = parent::getCommentsBlock($aBp, $aDp);
         if (is_array($mixedBlock) && isset($mixedBlock['title']))
             $mixedBlock['title'] = _t('_bx_forum_page_block_title_entry_comments', $this->getCommentsCount());
         return $mixedBlock;

+ 1 - 1
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -368,7 +368,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         if($oCmts === false)
             return '';
 
-        $aComments = $oCmts->getCommentsBlock(0, 0, false, $bDynamic);
+        $aComments = $oCmts->getCommentsBlock(array(), array('in_designbox' => false, 'dynamic_mode' => $bDynamic));
         return $this->parseHtmlByName('comments.html', array(
             'style_prefix' => $sStylePrefix,
             'id' => $iId,

+ 4 - 10
template/scripts/BxBaseCmts.php

@@ -70,16 +70,10 @@ class BxBaseCmts extends BxDolCmts
     /**
      * get full comments block with initializations
      */
-    function getCommentsBlock($iParentId = 0, $iVParentId = 0, $bInDesignbox = true, $bDynamic = false)
+    function getCommentsBlock($aBp = array(), $aDp = array())
     {
-    	$aBp = $aDp = array();
 		$this->_getParams($aBp, $aDp);
 
-        $aBp['parent_id'] = $iParentId;
-        $aBp['vparent_id'] = $iVParentId;
-        $aDp['dynamic_mode'] = $bDynamic;
-        $aDp['show_empty'] = false;
-
 		//add live update
 		$this->actionResumeLiveUpdate();
 
@@ -93,13 +87,13 @@ class BxBaseCmts extends BxDolCmts
             'list_anchor' => $this->getListAnchor(),
             'id' => $this->getId(),
             'comments' => $this->getComments($aBp, $aDp),
-            'post_form_top' => $this->getFormBoxPost($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_TOP, 'dynamic_mode' => $bDynamic)),
-            'post_form_bottom'  => $this->getFormBoxPost($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_BOTTOM, 'dynamic_mode' => $bDynamic)),
+            'post_form_top' => $this->getFormBoxPost($aBp, array_merge($aDp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_TOP))),
+            'post_form_bottom'  => $this->getFormBoxPost($aBp, array_merge($aDp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_BOTTOM))),
         	'view_image_popup' => $this->_getViewImagePopup(),
             'script' => $this->getJsScript()
         ));
 
-        return $bInDesignbox ? DesignBoxContent($sCaption, $sContent, BX_DB_DEF, $this->_getControlsBox()) : array(
+        return $aDp['in_designbox'] ? DesignBoxContent($sCaption, $sContent, BX_DB_DEF, $this->_getControlsBox()) : array(
             'title' => $sCaption,
             'content' => $sContent,
             'menu' => $this->_getControlsBox(),