Last Update:2014-12-23
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;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP} else { return $keyword; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP} &NBSP;&NBSP;&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;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP} else { $restr .= ' '; &NBSP;&NBSP;&NBSP} &NBSP;&NBSP} else {&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&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;&NBSP;&NBSP} else { $restr .= $keyword [$i]; &NBSP;&NBSP;&NBSP} &NBSP;&NBSP}     return $restr; &NBSP;&NBSP;&NBSP;&NBSP;&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!