Răsfoiți Sursa

#32 - Minor fixes and improvements.

AntonLV 13 ani în urmă
părinte
comite
dcaa41e44b
2 a modificat fișierele cu 13 adăugiri și 15 ștergeri
  1. 1 1
      inc/classes/BxDolVote.php
  2. 12 14
      template/scripts/BxBaseVote.php

+ 1 - 1
inc/classes/BxDolVote.php

@@ -398,7 +398,7 @@ class BxDolVote extends BxDol
 
     protected function _getAuthorIp ()
     {
-        return $_SERVER['REMOTE_ADDR'];
+        return getVisitorIP();
     }
 
 	protected function _getAuthorInfo($iAuthorId = 0)

+ 12 - 14
template/scripts/BxBaseVote.php

@@ -75,21 +75,19 @@ class BxBaseVote extends BxDolVote
 
 	public function getJsScript()
     {
-        $this->addCssJs();
+        $aParams = array(
+        	'sObjName' => $this->_sJsObjName,
+        	'sSystem' => $this->getSystemName(),
+        	'iAuthorId' => $this->_getAuthorId(),
+        	'iObjId' => $this->getId(),
+        	'iLikeMode' => $this->isLikeMode() ? 1 : 0,
+        	'sRootUrl' => BX_DOL_URL_ROOT,
+        	'sStylePrefix' => $this->_sStylePrefix,
+        	'aHtmlIds' => $this->_aHtmlIds
+        );
 
-        require_once(BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php');
-        $oJson = new Services_JSON();
-
-        return BxDolTemplate::getInstance()->_wrapInTagJsCode("var " . $this->_sJsObjName . " = new BxDolVote({
-        	sObjName: '" . $this->_sJsObjName . "',
-            sSystem: '" . $this->getSystemName() . "',
-            iAuthorId: '" . $this->_getAuthorId() . "',
-            iObjId: '" . $this->getId() . "',
-            iLikeMode: " . ($this->isLikeMode() ? 1 : 0) . ",
-            sRootUrl: '" . BX_DOL_URL_ROOT . "',
-            sStylePrefix: '" . $this->_sStylePrefix . "',
-            aHtmlIds: " . $oJson->encode($this->_aHtmlIds) . ",
-    	});");
+        $this->addCssJs();
+        return BxDolTemplate::getInstance()->_wrapInTagJsCode("var " . $this->_sJsObjName . " = new BxDolVote(" . json_encode($aParams) . ");");
     }
 
     public function getJsClick()