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