]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/search.php
PhpWiki 1.2.7 backport cvs release-1_2-branch enhancements never released with 1...
[SourceForge/phpwiki.git] / lib / search.php
1 <?php
2    // Title search: returns pages having a name matching the search term
3    rcs_id('$Id: search.php,v 1.3.2.5 2005-01-07 14:23:05 rurban Exp $');
4
5    if(get_magic_quotes_gpc())
6       $search = stripslashes($search);
7
8    $html = "<p><b>"
9            . sprintf(gettext ("Searching for \"%s\" ....."),
10                      htmlspecialchars($search))
11            . "</b></p>\n";
12
13    // quote regexp chars (backends should do this...) 
14    //$search = preg_quote($search);
15
16    // search matching pages
17    $found = 0;
18    if (strlen($search)) {           
19       $query = InitTitleSearch($dbi, $search);
20       while ($page = TitleSearchNextMatch($dbi, $query)) {
21          $found++;
22          $html .= LinkExistingWikiWord($page) . "<br />\n";
23       }
24    }
25    else {
26       $html .= gettext("(You entered an empty search string)") . "<br />\n";
27    }   
28      
29    $html .= "<hr noshade>\n"
30             . sprintf(gettext ("%d pages match your query."), $found)
31             . "\n";
32
33    GeneratePage('MESSAGE', $html, gettext ("Title Search Results"), 0);
34 ?>