Dedecms v5.7 Search for a solution that does not recognize uppercase letters

Source: Internet
Author: User
Keywords DEDECMS capital letters

When we use Dedecms v5.7 to search in English, we find that if you enter uppercase letters, DEDECMS will automatically be out of the box and search only lowercase letters and numbers, so it is often not very satisfying to get the search results, and to find out why Dedecms/include/ helpers/filter.helper.php file in the formal expression does not add a-Z rule, immediately to solve this small bug!

For example: We searched for "Ithov", but only the "HOV" was retained in the search results, and the screenshot of uppercase letters was filtered as follows:

First download your/include/helpers/filter.helper.php file to the local computer, and open it with the editor, find the 169th line of the program, the code is as follows:

if (Preg_match ("/[^0-9a-z@#\.") /", $keyword [$i]) &http://www.aliyun.com/zixun/aggregation/37954.html" >nbsp;

Modify it to:

if (Preg_match ("/[^0-9a-za-z@#\.") /", $keyword [$i])

The complete code of change is as follows:

/**   *   filter string for search   *   *  @param       string   $keyword    keywords   *  @return     string   * / if  ( ! function_exists (' Filtersearch '))  {     function  filtersearch ($keyword)      {          global  $cfg _soft_lang;          if ($cfg _soft_lang== ' utf-8 ')           {             $ Keyword = preg_replace ("/[\" \r\n\t\$\\>< ']/", ",  $keyword);              if ($keyword  !=  Stripslashes ($keyword))              {                  return  ';             &NBSP}               else               {                  return  $keyword;             &NBSP}          &NBSP}          else           {             $ restr =  ';              for ($i =0;isset ($keyword [$i]); $i + +)              {                  if (Ord ($keyword [$i])  > 0x80)                   {                      if (Isset ($keyword [$i +1])  && ord ( $keyword [$i +1])               > 0x40)          {                           $restr  .=   $keyword [$i]. $keyword [$i +1];                            $i + +;                     &NBSP}                       else                       {                           $restr  .=  '   ';                      &NBSP}                  &NBSP}                   else                   {     &NBsp;               if (Preg_match) ("/ [^0-9a-za-z@#\.] /", $keyword [$i])  /*  will change here to" if (Preg_match/[^0-9a-za-z@#\.] /", $keyword [$i])"  */                      {                           $restr  .=  '   ';                      &NBSP}                       else                       {                           $restr  .=  $keyword [$i];                      &NBSP}                  &NBSP}             &nbsp          &nbsp          return  $restr;     &NBSP}  } 

Upload and overwrite the original file, and test the search results again!

Ha ha! Finally normal! Let's hurry up and solve this little bug!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.