"en", "cs"=>"cs", "de"=>"de", "nl"=>"nl", "ja"=>"ja", "hu"=>"hu", "fr"=>"fr", "zh"=>"zh", ""=>"en"); $manuals = array ("essay"=>"essay", "extending"=>"extending", "learning"=>"learning", "notation"=>"notation", "usage"=>"usage"); $lang = $languages[$_REQUEST['lang']]; $man = $manuals[$_REQUEST['manual']]; if (!$man) { echo "

Invalid manual " . $_REQUEST['lang'] . "

"; exit (); } $bigpage = ($_REQUEST['bigpage'] == "1"); $search_string = $_REQUEST['q']; // If enter was pressed, browsers will use the returned HTML for a complete page! $form_submitted = $_REQUEST['form_submitted']; $relpath = ""; if ($form_submitted) { if (! $bigpage) { $relpath = "$man/"; } echo "\n"; } $filename = "./$man"; if ($bigpage) { $filename .= "-big-page"; } $filename .= ".$lang.idx"; $found = 0; $file = @fopen($filename, "r"); if ($file ) { while ( (($line=fgets($file)) !== false) ) { $line = rtrim($line); $entries = split ("\t", $line); if (stripos ($entries[0], $search_string) !== false) { if ($found == 0) { echo "

Search results for "".htmlentities($search_string, ENT_QUOTES)."":
\n"; echo "\n"; } else if ($found > 50) { echo "\n"; break; } // format the entry and print it out echo "\n"; echo " \n"; $found++; } } if ($found > 0) { echo "
Too many hits, displaying only 50 results
$entries[1]$entries[3]
\n"; } else { echo "No results found in the index.\n"; } echo "

"; fclose($file); } else { echo "

Unable to open search index $filename

"; } if ($form_submitted) { echo "\n"; } ?>