is there somebody with 4.4 < php < 5.2, who
can test this new version of the file class/ajaxSearchResults.class.inc.php
[Ed
it] Tested with PHP 5.1.6. It works. Is there somebody for a test with Php 4.x ?
To test this new file:
1/ rename your class/ajaxSearchResults.inc.class.php as class/ajaxSearchResults.class.inc.php.txt
2/ unzip the attached file and drop the file ajaxSearchResults.class.inc.php in ajaxSearch/classes
3/ run a search with a possible search term => you should get results without error
4/ run a search with "src" => you should get no results (if this text is included only in html tags)
Let me know the results. Thanks
In class/ajaxSearchResults.class.inc.php I replace:
/*
* Filter the search results when the search terms are found inside HTML or MODx tags
*/
function _doFilterTags($results, $searchString, $advSearch) {
$filteredResults = array();
$nbr = count($results);
for($i=0;$i<$nbr;$i++) {
if ($advSearch === NOWORDS) $found = true;
else {
$text = implode(' ',$results[$i]);
$text = $this->defaultStripOutput($text);
$found = true;
if ($searchString !== '') {
if (($this->asCfg->dbCharset == 'utf8') && ($this->asCfg->cfg['mbstring'])) {
$text = $this->_html_entity_decode($text, ENT_QUOTES, 'UTF-8');
$mbStrpos = 'mb_stripos';
mb_internal_encoding('UTF-8');
}
else {
$text = html_entity_decode($text, ENT_QUOTES);
$mbStrpos = 'stripos';
}
$searchList = $this->asCtrl->getSearchWords($searchString, $advSearch);
foreach ($searchList as $searchTerm) {
$found = $mbStrpos($text, $searchTerm);
if ($found !== false) break;
}
}
}
if ($found) $filteredResults[] = $results[$i];
}
return $filteredResults;
}by
/*
* Filter the search results when the search terms are found inside HTML or MODx tags
*/
function _doFilterTags($results, $searchString, $advSearch) {
$filteredResults = array();
$nbr = count($results);
for($i=0;$i<$nbr;$i++) {
if ($advSearch === NOWORDS) $found = true;
else {
$text = implode(' ',$results[$i]);
$text = $this->defaultStripOutput($text);
$found = true;
if ($searchString !== '') {
if (($this->asCfg->dbCharset == 'utf8') && ($this->asCfg->cfg['mbstring'])) {
$text = $this->_html_entity_decode($text, ENT_QUOTES, 'UTF-8');
}
else {
$text = html_entity_decode($text, ENT_QUOTES);
}
$searchList = $this->asCtrl->getSearchWords($searchString, $advSearch);
$pcreModifier = $this->asCfg->pcreModifier;
foreach ($searchList as $searchTerm) {
$pattern = '/' . preg_quote($searchTerm, '/') . '/' . $pcreModifier;
$matches = array();
$found = preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE);
if ($found) break;
}
}
}
if ($found) $filteredResults[] = $results[$i];
}
return $filteredResults;
}