Alex Trofimov před 4 roky
rodič
revize
596343e6b4

+ 1 - 1
inc/classes/BxDolAccount.php

@@ -343,7 +343,7 @@ class BxDolAccount extends BxDolFactory implements iBxDolSingleton
 
         $oKey = BxDolKey::getInstance();
         $sConfirmationCode = $oKey->getNewKey(array('account_id' => $iAccountId));
-        $sConfirmationLink = bx_append_url_params(BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=confirm-email'), array('code' => urlencode($sConfirmationCode)));
+        $sConfirmationLink = bx_append_url_params(BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=confirm-email'), array('code' => $sConfirmationCode));
 
         $aReplaceVars = array(
             'name' => $this->getDisplayName($iAccountId),

+ 1 - 1
inc/classes/BxDolPage.php

@@ -415,7 +415,7 @@ class BxDolPage extends BxDolFactory implements iBxDolFactoryObject, iBxDolRepla
         if (!$sSeoPageUri)
             return false;
 
-        return $sPrefix . bx_append_url_params($sSeoPageUri, array_merge($aQueryParams, $aParams));
+        return $sPrefix . bx_append_url_params($sSeoPageUri, array_merge($aQueryParams, $aParams), false);
     }
 
 	/**

+ 3 - 3
inc/classes/BxDolPermalinks.php

@@ -185,15 +185,15 @@ class BxDolPermalinks extends BxDolDb implements iBxDolSingleton
             $sPage = $this->getPageNameFromLink($sLink, $iLength);
 
             if (!$this->_isEnabled($sKey))
-                return bx_append_url_params($sLink, $aParams);
+                return bx_append_url_params($sLink, $aParams, false);
 
             $sUrl = $this->_fixUrlAmpersand($this->aLinksStandard[$sKey]['permalink'] . $sPage);
 
-            return $sPrefix . bx_append_url_params($sUrl, $aParams);
+            return $sPrefix . bx_append_url_params($sUrl, $aParams, false);
 
         }
 
-        return $sPrefix . bx_append_url_params($this->_isEnabled($sLink) ? $this->aLinksStandard[$sLink]['permalink'] : $sLink, $aParams);
+        return $sPrefix . bx_append_url_params($this->_isEnabled($sLink) ? $this->aLinksStandard[$sLink]['permalink'] : $sLink, $aParams, false);
     }
 
     /**

+ 15 - 2
inc/utils.inc.php

@@ -1406,7 +1406,7 @@ function bx_encode_url_params ($a, $aExcludeKeys = array (), $aOnlyKeys = false)
     return $s;
 }
 
-function bx_append_url_params ($sUrl, $mixedParams)
+function bx_append_url_params ($sUrl, $mixedParams, $bEncodeParams = true, $aIgnoreParams = [])
 {
     if (!$mixedParams)
         return $sUrl;
@@ -1416,11 +1416,24 @@ function bx_append_url_params ($sUrl, $mixedParams)
     if (is_array($mixedParams)) {
         foreach($mixedParams as $sKey => $sValue) {
             if (!is_array($sValue)) {
+                if ($bEncodeParams) {
+                    if (!in_array($sKey, $aIgnoreParams))
+                        $sKey = rawurlencode($sKey);
+                    if (!in_array($sValue, $aIgnoreParams))
+                        $sValue = rawurlencode($sValue);
+                }
                 $sParams .= $sKey . '=' . $sValue . '&';
             }
             else {
-                foreach($sValue as $sSubValue)
+                foreach($sValue as $sSubValue) {
+                    if ($bEncodeParams) {
+                        if (!in_array($sKey, $aIgnoreParams))
+                            $sKey = rawurlencode($sKey);
+                        if (!in_array($sSubValue, $aIgnoreParams))
+                            $sSubValue = rawurlencode($sSubValue);
+                    }
                     $sParams .= $sKey . '[]=' . $sSubValue . '&';
+                }
             }
         }
         $sParams = substr($sParams, 0, -1);

+ 1 - 1
modules/boonex/forum/classes/BxForumCategory.php

@@ -25,7 +25,7 @@ class BxForumCategory extends BxTemplCategory
 
         $this->_sBrowseUrl = bx_append_url_params(BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_CATEGORY_ENTRIES']), array(
 			'category' => '{keyword}'
-		));
+		), true, ['{keyword}']);
     }
 }
 

+ 1 - 1
modules/boonex/forum/classes/BxForumGrid.php

@@ -112,7 +112,7 @@ class BxForumGrid extends BxTemplGrid
                 list($sPageLink, $aPageParams) = bx_get_base_url_inline();
 
                 $aPageParams[$this->_aOptions['paginate_get_start']] = '{start}';
-                $this->_aOptions['paginate_url'] = BxDolPermalinks::getInstance()->permalink(bx_append_url_params($sPageLink, $aPageParams));
+                $this->_aOptions['paginate_url'] = BxDolPermalinks::getInstance()->permalink(bx_append_url_params($sPageLink, $aPageParams, true, ['{start}']));
             }
 
             unset($aParams['ajax_paginate']);

+ 1 - 1
modules/boonex/forum/classes/BxForumMetatags.php

@@ -25,7 +25,7 @@ class BxForumMetatags extends BxTemplMetatags
 
         $this->_sBrowseUrl = bx_append_url_params(BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_KEYWORD_ENTRIES']), array(
         	'keyword' => '{keyword}'
-        ));
+        ), true, ['{keyword}']);
     }
 }
 

+ 2 - 2
modules/boonex/payment/classes/BxPaymentProviderStripeV3.php

@@ -59,7 +59,7 @@ class BxPaymentProviderStripeV3 extends BxPaymentProviderStripeBasic implements
             'cancel_url' => $aItem['url'],
             'success_url' => bx_append_url_params($this->_oModule->_oConfig->getUrl('URL_SUBSCRIBE_JSON'), array_merge($aParams, array(
                 'session_id' => '{CHECKOUT_SESSION_ID}'
-            )))
+            )), false)
         );
 
         $sSessionId = $this->_createSession(BX_PAYMENT_TYPE_RECURRING, $aSessionParams, $aClient, $aCartInfo);
@@ -221,7 +221,7 @@ class BxPaymentProviderStripeV3 extends BxPaymentProviderStripeBasic implements
             'cancel_url' => $oCart->serviceGetCartUrl($aParams['seller_id']),
             'success_url' => bx_append_url_params($this->_oModule->_oConfig->getUrl('URL_CART_CHECKOUT'), array_merge($aParams, array(
                 'session_id' => '{CHECKOUT_SESSION_ID}'
-            )))
+            )), false)
         );
 
         $sSessionId = $this->_createSession(BX_PAYMENT_TYPE_SINGLE, $aSessionParams, $aClient, $aCartInfo);

+ 1 - 1
modules/boonex/reviews/classes/BxReviewsFormEntry.php

@@ -230,7 +230,7 @@ class BxReviewsFormEntry extends BxBaseModTextFormEntry
             return null;
 
         $sProduct = bx_process_output($aInput['value']);
-        $sProductUrlEncoded = urlencode($aInput['value']);
+        $sProductUrlEncoded = $aInput['value'];
         $sProductSearchUrl = BX_DOL_URL_ROOT . $this->_oModule->_oConfig->CNF['URI_SEARCH_PRODUCT'];
         $sProductSearchUrl = bx_append_url_params($sProductSearchUrl, ['keyword' => $sProductUrlEncoded]);
         return '<a href="'.$sProductSearchUrl.'">'.$sProduct.'</a>';

+ 1 - 2
modules/boonex/reviews/classes/BxReviewsTemplate.php

@@ -151,10 +151,9 @@ class BxReviewsTemplate extends BxBaseModTextTemplate
         $aProduct = [];
         if (!empty($aData[$CNF['FIELD_PRODUCT']])) {
             $sProduct = $aData[$CNF['FIELD_PRODUCT']];
-            $sProductUrlEncoded = urlencode($sProduct);
             $aProduct = [
                 'product_name' => bx_process_output($sProduct),
-                'product_link' => bx_append_url_params(BX_DOL_URL_ROOT . $this->_oModule->_oConfig->CNF['URI_SEARCH_PRODUCT'], ['keyword' => $sProductUrlEncoded]),
+                'product_link' => bx_append_url_params(BX_DOL_URL_ROOT . $this->_oModule->_oConfig->CNF['URI_SEARCH_PRODUCT'], ['keyword' => $sProduct]),
             ];
         }
 

+ 1 - 1
modules/boonex/stripe_connect/classes/BxStripeConnectTemplate.php

@@ -51,7 +51,7 @@ class BxStripeConnectTemplate extends BxBaseModConnectTemplate
 
     	$this->addCss(array('main.css'));
     	return $this->parseHtmlByName('block_connect.html', array(
-    		'link' => bx_append_url_params($CNF['URL_API_AUTHORIZE'], $aRequestParams)
+    		'link' => bx_append_url_params($CNF['URL_API_AUTHORIZE'], $aRequestParams, false)
     	));
     }
     

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

@@ -856,7 +856,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
 
     public function addBrowseParams($sUrl, $aParams, $sKey = 'bp')
     {
-        return bx_append_url_params($sUrl, array($sKey => urlencode(base64_encode(serialize($aParams)))));
+        return bx_append_url_params($sUrl, array($sKey => base64_encode(serialize($aParams))));
     }
 
     public function getBrowseParams($sValue)

+ 1 - 1
template/scripts/BxBaseCategory.php

@@ -28,7 +28,7 @@ class BxBaseCategory extends BxDolCategory
 		$this->_sBrowseUrl = bx_append_url_params('searchKeyword.php', array(
 			'cat' => '{category}',
 			'keyword' => '{keyword}'
-		)) . '{sections}' . '{context}';
+		), true, ['{category}', '{keyword}']) . '{sections}' . '{context}';
     }
 
     public function getCategoryTitle($sValue)

+ 1 - 1
template/scripts/BxBaseSearchResult.php

@@ -292,7 +292,7 @@ class BxBaseSearchResult extends BxDolSearchResult
                 'type' => $this->_sMetaType,
                 'start' => $bReplacePagesParams ? (int)$this->aCurrent['paginate']['start'] : '{start}',
                 'per_page' => $bReplacePagesParams ? (int)$this->aCurrent['paginate']['perPage'] : '{per_page}',
-            ));
+            ), false);
         }
 
         foreach ($this->aGetParams as $sGetParam) {