]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - wiki_search.php3
This commit was generated by cvs2svn to compensate for changes in r2,
[SourceForge/phpwiki.git] / wiki_search.php3
1 <?
2 /*
3    Title search:
4    This file will return the results of the search. It will: display 
5    the logo, the title "Search Results," then a list of all Wiki 
6    pages that match seperated by five dots and the text that matched;
7    an HR tag, and then a statement:
8       32 pages found out of 94 pages searched.
9    where the numbers are correct.
10
11    The online classic Wiki has both full search and title search.
12    Title search is a good idea; it doesn't come with the script you 
13    download from c2.com.
14 */
15
16    WikiHeader("Search Results");
17    echo "<h1>$LogoImage Search Results</h1>\n";
18
19    $found = $count = 0;
20
21    // from classic wiki: $pat =~ s/[+?.*()[\]{}|\\]/\\$&/g;
22
23    $search = preg_replace("/[+?.*()[\]{}|\\\]/", "", $search);
24
25    // looping through all keys
26    $key = dbmfirstkey($dbi);
27    while ($key) {
28       if (eregi("$search", $key)) {
29          $found++;
30          echo LinkExistingWikiWord($key), "<br>\n";
31       }
32       $count++;
33       $key = dbmnextkey($dbi, $key);
34    }
35
36    echo "<hr>\n";
37    echo "$found pages found out of $count titles searched.\n";
38    WikiFooter();
39
40 ?>