1 <!-- $Id: wiki_fullsearch.php3,v 1.7 2000-06-21 23:34:08 ahollosi Exp $ -->
4 Search the text of pages for a match.
5 A few too many regexps for my liking, but it works.
11 if(get_magic_quotes_gpc())
12 $full = stripslashes($full);
14 $result = "<P><B>Searching for \"" . htmlspecialchars($full) .
15 "\" ....</B></P>\n<DL>\n";
18 $full = preg_quote($full);
20 // search matching pages
21 $query = InitFullSearch($dbi, $full);
22 while ($pagehash = FullSearchNextMatch($dbi, $query)) {
23 $result .= "<DT><B>" . LinkExistingWikiWord($pagehash["pagename"]) . "</B>\n";
26 // print out all matching lines, highlighting the match
27 for ($j = 0; $j < (count($pagehash["content"])); $j++) {
28 if ($hits = preg_match_all("/$full/i", $pagehash["content"][$j], $dummy)) {
29 $matched = preg_replace("/$full/i", "<b>\\0</b>",
30 $pagehash["content"][$j]);
31 $result .= "<dd><small>$matched</small></dd>\n";
37 $result .= "</dl>\n<hr noshade>$found matches found in $count pages.\n";
38 GeneratePage('MESSAGE', $result, "Full Text Search Results", 0);