2 $languages = array ("en"=>"en", "cs"=>"cs", "de"=>"de", "nl"=>"nl", "ja"=>"ja", "hu"=>"hu", "fr"=>"fr", "zh"=>"zh", ""=>"en");
3 $manuals = array ("essay"=>"essay", "extending"=>"extending", "learning"=>"learning", "notation"=>"notation", "usage"=>"usage");
5 $lang = $languages[$_REQUEST['lang']];
6 $man = $manuals[$_REQUEST['manual']];
8 echo "<p>Invalid manual " . $_REQUEST['lang'] . "</p>";
11 $bigpage = ($_REQUEST['bigpage'] == "1");
12 $search_string = $_REQUEST['q'];
13 // If enter was pressed, browsers will use the returned HTML for a complete page!
14 $form_submitted = $_REQUEST['form_submitted'];
18 if ($form_submitted) {
22 echo "<html><body>\n";
26 if ($bigpage) { $filename .= "-big-page"; }
27 $filename .= ".$lang.idx";
30 $file = @fopen($filename, "r");
32 while ( (($line=fgets($file)) !== false) ) {
34 $entries = split ("\t", $line);
35 if (stripos ($entries[0], $search_string) !== false) {
37 echo "<p><b>Search results for "".htmlentities($search_string, ENT_QUOTES)."":</b><br>\n";
38 echo "<table id=\"search_result_table\">\n";
39 } else if ($found > 50) {
40 echo "<tr><td colspan=2>Too many hits, displaying only 50 results</td></tr>\n";
43 // format the entry and print it out
44 echo "<tr><td><a href=\"$relpath$entries[2]\">$entries[1]</a></td>\n";
45 echo " <td><a href=\"$relpath$entries[4]\">$entries[3]</a></td></tr>\n";
52 echo "No results found in the index.\n";
57 echo "<p>Unable to open search index $filename</p>";
59 if ($form_submitted) {
60 echo "</body></html>\n";