Sfoglia il codice sorgente

#3507 Disable Profanity filter for login form

RomanL 5 anni fa
parent
commit
5f9ce74553
2 ha cambiato i file con 8 aggiunte e 5 eliminazioni
  1. 7 4
      inc/classes/BxDolForm.php
  2. 1 1
      template/scripts/BxBaseFormLogin.php

+ 7 - 4
inc/classes/BxDolForm.php

@@ -734,6 +734,7 @@ class BxDolForm extends BxDol implements iBxDolReplaceable
     public $id; ///< Form element id
 
     protected $_aFieldsCheckForSpam = array(); ///< additional fields names to check for spam(profanity filter), now only fields with 'textarea' and 'text' are checked for spam, 'textarea' fields are checked for spam and filter for profanity, while 'text' fields are filtetered for profanity only
+    protected $_aFieldsExcludeFromCheckForSpam = array(); ///<  fields names('textarea' and 'text') to exclude from  check for spam(profanity filter)
 
     
     protected $_iAuthorId;
@@ -820,7 +821,7 @@ class BxDolForm extends BxDol implements iBxDolReplaceable
         $oChecker = new $this->_sChecker($this->_sCheckerHelper);
         $oChecker->setFormMethod($this->aFormAttrs['method'], $aSpecificValues);
         $oChecker->setFormParams($this->aParams);
-        $oChecker->setFieldsCheckForSpam($this->_aFieldsCheckForSpam);
+        $oChecker->setFieldsCheckForSpam($this->_aFieldsCheckForSpam, $this->_aFieldsExcludeFromCheckForSpam);
 
         // init form with default values
 
@@ -1212,6 +1213,7 @@ class BxDolFormChecker
     protected $_bFormCsrfChecking;
     protected $_aSpecificValues;
     protected $_aFieldsCheckForSpam;
+    protected $_aFieldsExcludeFromCheckForSpam;
 
     function __construct ($sHelper = '')
     {
@@ -1233,9 +1235,10 @@ class BxDolFormChecker
         $this->_aFormParams = $aParams;
     }
 
-    function setFieldsCheckForSpam($a)
+    function setFieldsCheckForSpam($aFieldsCheckForSpam, $aFieldsExcludeFromCheckForSpam)
     {
-        $this->_aFieldsCheckForSpam = $a;
+        $this->_aFieldsCheckForSpam = $aFieldsCheckForSpam;
+        $this->_aFieldsExcludeFromCheckForSpam = $aFieldsExcludeFromCheckForSpam;
     }
     
     function enableFormCsrfChecking($bFormCsrfChecking)
@@ -1385,7 +1388,7 @@ class BxDolFormChecker
 
                 $a['name'] = str_replace('[]', '', $a['name']);
 
-                if ($a['type'] != 'textarea' && $a['type'] != 'text' && !in_array($a['name'], $this->_aFieldsCheckForSpam))
+                if ($a['type'] != 'textarea' && $a['type'] != 'text' && !in_array($a['name'], $this->_aFieldsCheckForSpam) || in_array($a['name'], $this->_aFieldsExcludeFromCheckForSpam))
                     continue;
                 
                 $val = BxDolForm::getSubmittedValue($a['name'], $this->_sFormMethod, $this->_aSpecificValues);

+ 1 - 1
template/scripts/BxBaseFormLogin.php

@@ -51,7 +51,7 @@ class BxBaseFormLogin extends BxTemplFormView
     public function __construct($aInfo, $oTemplate)
     {
         parent::__construct($aInfo, $oTemplate);
-
+        $this->_aFieldsExcludeFromCheckForSpam = array("ID");
         $aNoRelocatePages = array('forgot-password', 'login', 'create-account', 'logout');
 
         if (isset($this->aInputs['ID']))