]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/search.php
patch #496654, added nntp to list of allowed protocols.\r(also added tiff to list...
[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.2 2001-11-07 21:42:34 dairiki 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 ?>