Revision 442
Added by Matthias over 18 years ago
| search.php | ||
|---|---|---|
| 28 | 28 |
exit(0); |
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 |
// Include the WB functions file |
|
| 32 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 33 |
|
|
| 31 | 34 |
// Check if search is enabled |
| 32 | 35 |
if(SHOW_SEARCH != true) {
|
| 33 | 36 |
echo $TEXT['SEARCH'].' '.$TEXT['DISABLED']; |
| ... | ... | |
| 55 | 58 |
// Double backslashes (mySQL needs doubly escaped backslashes in LIKE comparisons) |
| 56 | 59 |
$string = addslashes($wb->escape_backslashes($original_string)); |
| 57 | 60 |
// convert a copy of $string to HTML-ENTITIES |
| 58 |
$string_entities=mb_convert_encoding($string, 'UTF-8', 'HTML-ENTITIES'); |
|
| 59 |
$string_entities=htmlspecialchars($string_entities,ENT_QUOTES); |
|
| 60 |
$string_entities=mb_convert_encoding($string_entities, 'HTML-ENTITIES', 'UTF-8'); |
|
| 61 |
$string_entities = umlauts_to_entities($string); |
|
| 61 | 62 |
// and do some convertion to both |
| 62 | 63 |
require(WB_PATH.'/search/search_convert.php'); |
| 63 |
$string=strtr($string,$string_conv); |
|
| 64 |
$string_entities=strtr($string_entities,$string_entities_conv); |
|
| 64 |
if(strcmp(DEFAULT_CHARSET, "iso-8859-1") == 0) {
|
|
| 65 |
$string=strtr($string,$string_conv_iso88591); |
|
| 66 |
$string_entities=strtr($string_entities,$string_entities_conv_iso88591); |
|
| 67 |
} |
|
| 65 | 68 |
$search_string = $string_entities; |
| 66 | 69 |
} else {
|
| 67 | 70 |
$string = ''; |
| ... | ... | |
| 181 | 184 |
$link = page_link($page['link']); |
| 182 | 185 |
|
| 183 | 186 |
//Add search string for highlighting |
| 184 |
$sstring = implode(" ", array_merge($string,$string_entities));
|
|
| 185 |
//$link = $link."?searchresult=1&sstring=".$sstring; |
|
| 186 |
$link = $link."?searchresult=1&sstring=".urlencode($sstring); |
|
| 187 |
if ($match!='exact') {
|
|
| 188 |
$sorted=array_merge($string,$string_entities); |
|
| 189 |
sort($sorted); |
|
| 190 |
$sstring = implode(" ", $sorted);
|
|
| 191 |
$link = $link."?searchresult=1&sstring=".urlencode($sstring); |
|
| 192 |
} |
|
| 193 |
else {
|
|
| 194 |
$sstring = strtr($string[0], " ", "_")." ".strtr($string_entities[0], " ","_"); |
|
| 195 |
$link = $link."?searchresult=2&sstring=".urlencode($sstring); |
|
| 196 |
} |
|
| 187 | 197 |
|
| 188 | 198 |
// Set vars to be replaced by values |
| 189 | 199 |
$vars = array('[LINK]', '[TITLE]', '[DESCRIPTION]', '[USERNAME]','[DISPLAY_NAME]','[DATE]','[TIME]','[TEXT_LAST_UPDATED_BY]','[TEXT_ON]');
|
| ... | ... | |
| 268 | 278 |
$link = page_link($page[$fields['link']]); |
| 269 | 279 |
|
| 270 | 280 |
//Add search string for highlighting |
| 271 |
$sstring = implode(" ", array_merge($string,$string_entities));
|
|
| 272 |
//$link = $link."?searchresult=1&sstring=".$sstring; |
|
| 273 |
$link = $link."?searchresult=1&sstring=".urlencode($sstring); |
|
| 281 |
if ($match!='exact') {
|
|
| 282 |
$sorted=array_merge($string,$string_entities); |
|
| 283 |
sort($sorted); |
|
| 284 |
$sstring = implode(" ", $sorted);
|
|
| 285 |
$link = $link."?searchresult=1&sstring=".urlencode($sstring); |
|
| 286 |
} |
|
| 287 |
else {
|
|
| 288 |
$sstring = strtr($string[0], " ", "_")." ".strtr($string_entities[0], " ","_"); |
|
| 289 |
$link = $link."?searchresult=2&sstring=".urlencode($sstring); |
|
| 290 |
} |
|
| 274 | 291 |
|
| 275 | 292 |
// Set vars to be replaced by values |
| 276 | 293 |
$vars = array('[LINK]', '[TITLE]', '[DESCRIPTION]', '[USERNAME]','[DISPLAY_NAME]','[DATE]','[TIME]','[TEXT_LAST_UPDATED_BY]','[TEXT_ON]');
|
Also available in: Unified diff
Fixed issues with some languages when UTF8 is used.
Removed all htmlentites from the code (revoked changeset [396]) and added new functions instead.
Adapted the search and the highlighting to use the new functions.
With this changes WB can now be used with charset UTF8 for all languages.