2 // Search the text of pages for a match.
3 rcs_id('$Id: fullsearch.php,v 1.4.2.5 2005-01-07 14:23:04 rurban Exp $');
5 if(get_magic_quotes_gpc())
6 $full = stripslashes($full);
10 . sprintf(gettext ("Searching for \"%s\" ....."),
11 htmlspecialchars($full))
17 // search matching pages
18 $query = InitFullSearch($dbi, $full);
20 // quote regexp chars (space are treated as "or" operator)
21 $full = preg_replace("/\s+/", "|", preg_quote($full));
23 while ($pagehash = FullSearchNextMatch($dbi, $query)) {
24 $html .= "<dt><b>" . LinkExistingWikiWord($pagehash["pagename"]) . "</b>\n";
27 // print out all matching lines, highlighting the match
28 for ($j = 0; $j < (count($pagehash["content"])); $j++) {
29 if ($hits = preg_match_all(":$full:i", $pagehash["content"][$j], $dummy)) {
30 $matched = preg_replace(":$full:i",
31 "${FieldSeparator}OT\\0${FieldSeparator}CT",
32 $pagehash["content"][$j]);
33 $matched = htmlspecialchars($matched);
34 $matched = str_replace("${FieldSeparator}OT", '<b>', $matched);
35 $matched = str_replace("${FieldSeparator}CT", '</b>', $matched);
36 $html .= "<dd><small>$matched</small></dd>\n";
43 $html .= "<dd>" . gettext("(You entered an empty search string)") . "</dd>\n";
46 $html .= "</dl>\n<hr noshade>"
47 . sprintf (gettext ("%d matches found in %d pages."),
51 GeneratePage('MESSAGE', $html, gettext ("Full Text Search Results"), 0);