Просмотр исходного кода

Ticket #4971 - Build-in API support: Get rid of validation. Browsing.

AntonLV 11 месяцев назад
Родитель
Сommit
0a080719f8

+ 0 - 21
inc/classes/BxDolSearch.php

@@ -388,7 +388,6 @@ class BxDolSearchResult implements iBxDolReplaceable
     protected $_aParams = [];
     protected $_sCategoryObject = '';
     protected $_aCustomSearchCondition = array();
-    protected $_bValidate = false;
 
     protected $_aMarkers = array (); ///< markers to replace somewhere, usually title and browse url (defined in custom class)
     
@@ -558,9 +557,6 @@ class BxDolSearchResult implements iBxDolReplaceable
         if($this->_bIsApi)
             return $this->processingAPI();
 
-        if($this->_bValidate)
-            return $this->getSearchData();
-
         $sCode = $this->displayResultBlock();
         if ($this->aCurrent['paginate']['num'] > 0) {
             $sPaginate = $this->showPagination();
@@ -798,16 +794,6 @@ class BxDolSearchResult implements iBxDolReplaceable
 
         $this->setConditionParams();
         $aData = $this->aCurrent['paginate']['num'] > 0 ? $this->getSearchDataByParams() : [];
-        
-        if($this->_bValidate) {
-            $aIds = array_map(function($aItem) {
-                return $aItem['id'];
-            }, $aData);
-
-            sort($aIds);
-            sort($this->_aParams['validate']);
-            $aData = $aIds == $this->_aParams['validate'] ? 'valid' : 'invalid';
-        }
 
         /**
          * @hooks
@@ -1320,13 +1306,6 @@ class BxDolSearchResult implements iBxDolReplaceable
      */
     function setPaginate ()
     {
-        if($this->_bValidate) {
-            $this->aCurrent['paginate']['start'] = 0;
-            $this->aCurrent['paginate']['perPage'] = count($this->_aParams['validate']);
-
-            return;
-        }
-
         $iStart = 0;
         $iPerPage = 0;
 

+ 0 - 3
inc/utils.inc.php

@@ -2734,9 +2734,6 @@ function bx_api_get_browse_params($sParams, $bParamsOnly = false)
         return [];
 
     $aParams = json_decode($sParams, true);
-    if(isset($aParams['params']['validate']) && !is_array($aParams['params']['validate']))
-        $aParams['params']['validate'] = !empty($aParams['params']['validate']) ? explode(',', $aParams['params']['validate']) : [];
-
     if(!$bParamsOnly)
         return $aParams;
 

+ 0 - 3
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -1362,9 +1362,6 @@ class BxBaseModGeneralModule extends BxDolModule
                         'values' => $aParams['params']['filters']
                     ];
                 }
-
-                if(isset($aParams['params']['validate']) && !is_array($aParams['params']['validate']))
-                    $aParams['params']['validate'] = !empty($aParams['params']['validate']) ? explode(',', $aParams['params']['validate']) : [];
             }
         }
 

+ 0 - 2
modules/base/general/classes/BxBaseModGeneralSearchResult.php

@@ -24,8 +24,6 @@ class BxBaseModGeneralSearchResult extends BxTemplSearchResult
         $this->_sMode = $sMode;
         $this->_aParams = $aParams;
 
-        $this->_bValidate = isset($this->_aParams['validate']) && is_array($this->_aParams['validate']);
-
         parent::__construct();
     }
 

+ 0 - 2
template/scripts/BxBaseProfileSearchResult.php

@@ -19,8 +19,6 @@ class BxBaseProfileSearchResult extends BxTemplSearchResult
         $this->_sMode = $sMode;
         $this->_aParams = $aParams;
 
-        $this->_bValidate = isset($this->_aParams['validate']) && is_array($this->_aParams['validate']);
-
         parent::__construct();
 
         $this->_bIsApi = bx_is_api();