Parcourir la source

#1 - Minor fixes and improvements.

AntonLV il y a 13 ans
Parent
commit
7cdb07647e
2 fichiers modifiés avec 13 ajouts et 12 suppressions
  1. 1 1
      inc/classes/BxDolCmts.php
  2. 12 11
      template/scripts/BxBaseCmts.php

+ 1 - 1
inc/classes/BxDolCmts.php

@@ -748,7 +748,7 @@ class BxDolCmts extends BxDol
 
     protected function _getAuthorIp ()
     {
-        return $_SERVER['REMOTE_ADDR'];
+        return getVisitorIP();
     }
 
     

+ 12 - 11
template/scripts/BxBaseCmts.php

@@ -55,18 +55,19 @@ class BxBaseCmts extends BxDolCmts {
      */
     public function getJsScript()
     {
-        $this->addCssJs();
+        $aParams = array(
+        	'sObjName' => $this->_sJsObjName,
+        	'sRootUrl' => BX_DOL_URL_ROOT,
+        	'sSystem' => $this->getSystemName(),
+        	'iAuthorId' => $this->_getAuthorId(),
+        	'iObjId' => $this->getId(),
+        	'sPostFormPosition' => $this->_aSystem['post_form_position'],
+        	'sBrowseType' => $this->_sBrowseType,
+        	'sDisplayType' => $this->_sDisplayType
+        );
 
-        return BxDolTemplate::getInstance()->_wrapInTagJsCode("var " . $this->_sJsObjName . " = new BxDolCmts({
-        	sObjName: '" . $this->_sJsObjName . "',
-            sRootUrl: '" . BX_DOL_URL_ROOT . "',
-            sSystem: '" . $this->getSystemName() . "',
-            iAuthorId: '" . $this->_getAuthorId() . "',
-            iObjId: '" . $this->getId () . "',
-            sPostFormPosition: '" . $this->_aSystem['post_form_position'] . "',
-    		sBrowseType: '" . $this->_sBrowseType . "',
-    		sDisplayType: '" . $this->_sDisplayType . "'
-    	});");
+        $this->addCssJs();
+        return BxDolTemplate::getInstance()->_wrapInTagJsCode("var " . $this->_sJsObjName . " = new BxDolCmts(" . json_encode($aParams) . ");");
     }
 
     /**