AntonLV 4 лет назад
Родитель
Сommit
b2372cf0ca

+ 11 - 0
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -890,6 +890,17 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
 
 
         return BxDolSession::getInstance()->getValue($this->$sField . $iUserId);
         return BxDolSession::getInstance()->getValue($this->$sField . $iUserId);
     }
     }
+
+    public function prepareParam($sName, $sPattern = "/^[\d\w_]+$/")
+    {
+        $mixedValue = bx_get($sName);
+        return $mixedValue !== false && preg_match($sPattern, $mixedValue) ? $mixedValue : '';
+    }
+
+    public function prepareParamWithDefault($sName, $sDefault, $sPattern = "/^[\d\w_]+$/")
+    {
+        return ($sValue = $this->prepareParam($sName, $sPattern)) != '' ? $sValue : $sDefault;
+    }
 }
 }
 
 
 /** @} */
 /** @} */

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

@@ -29,7 +29,7 @@ class BxTimelineMenuItemManage extends BxTimelineMenuItemActions
         $aBrowseParams = array('name' => '', 'view' => '', 'type' => '');
         $aBrowseParams = array('name' => '', 'view' => '', 'type' => '');
         foreach($aBrowseParams as $sKey => $sValue)
         foreach($aBrowseParams as $sKey => $sValue)
             if(bx_get($sKey) !== false)
             if(bx_get($sKey) !== false)
-                $aBrowseParams[$sKey] = bx_process_input(bx_get($sKey));
+                $aBrowseParams[$sKey] = $this->_oModule->_oConfig->prepareParam($sKey);
 
 
         $this->setEventById($iContentId, $aBrowseParams);
         $this->setEventById($iContentId, $aBrowseParams);
 
 

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

@@ -32,7 +32,7 @@ class BxTimelineMenuItemShare extends BxTemplMenu
         $aBrowseParams = array('name' => '', 'view' => '', 'type' => '');
         $aBrowseParams = array('name' => '', 'view' => '', 'type' => '');
         foreach($aBrowseParams as $sKey => $sValue)
         foreach($aBrowseParams as $sKey => $sValue)
             if(bx_get($sKey) !== false)
             if(bx_get($sKey) !== false)
-                $aBrowseParams[$sKey] = bx_process_input(bx_get($sKey));
+                $aBrowseParams[$sKey] = $this->_oModule->_oConfig->prepareParam($sKey);
 
 
         $this->setEventById($iContentId, $aBrowseParams);
         $this->setEventById($iContentId, $aBrowseParams);
     }
     }

+ 5 - 10
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -5036,16 +5036,11 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
 
 
     protected function _prepareParamsGet()
     protected function _prepareParamsGet()
     {
     {
-        $aParams = array();
-
-        $aParams['name'] = bx_get('name');
-        $aParams['name'] = $aParams['name'] !== false ? bx_process_input($aParams['name'], BX_DATA_TEXT) : '';
-
-        $aParams['view'] = bx_get('view');
-        $aParams['view'] = $aParams['view'] !== false ? bx_process_input($aParams['view'], BX_DATA_TEXT) : BX_TIMELINE_VIEW_DEFAULT;
-
-        $aParams['type'] = bx_get('type');
-        $aParams['type'] = $aParams['type'] !== false ? bx_process_input($aParams['type'], BX_DATA_TEXT) : BX_TIMELINE_TYPE_DEFAULT;
+        $aParams = [
+            'name' => $this->_oConfig->prepareParam('name'),
+            'view' => $this->_oConfig->prepareParamWithDefault('view', BX_TIMELINE_VIEW_DEFAULT),
+            'type' => $this->_oConfig->prepareParamWithDefault('type', BX_TIMELINE_TYPE_DEFAULT),
+        ];
 
 
         $aParams['owner_id'] = bx_get('owner_id');
         $aParams['owner_id'] = bx_get('owner_id');
         $aParams['owner_id'] = $aParams['owner_id'] !== false ? bx_process_input($aParams['owner_id'], BX_DATA_INT) : $this->getUserId();
         $aParams['owner_id'] = $aParams['owner_id'] !== false ? bx_process_input($aParams['owner_id'], BX_DATA_INT) : $this->getUserId();