Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / Documentation / lily_index_search.php
blob518654dacbb54a14db5f0e60e39a9af8ef3beab8
1 <?php
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']];
7 if (!$man) {
8 echo "<p>Invalid manual " . $_REQUEST['lang'] . "</p>";
9 exit ();
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'];
17 $relpath = "";
18 if ($form_submitted) {
19 if (! $bigpage) {
20 $relpath = "$man/";
22 echo "<html><body>\n";
25 $filename = "./$man";
26 if ($bigpage) { $filename .= "-big-page"; }
27 $filename .= ".$lang.idx";
29 $found = 0;
30 $file = @fopen($filename, "r");
31 if ($file ) {
32 while ( (($line=fgets($file)) !== false) ) {
33 $line = rtrim($line);
34 $entries = split ("\t", $line);
35 if (stripos ($entries[0], $search_string) !== false) {
36 if ($found == 0) {
37 echo "<p><b>Search results for &quot;".htmlentities($search_string, ENT_QUOTES)."&quot;:</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";
41 break;
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";
46 $found++;
49 if ($found > 0) {
50 echo "</table>\n";
51 } else {
52 echo "No results found in the index.\n";
54 echo "</p>";
55 fclose($file);
56 } else {
57 echo "<p>Unable to open search index $filename</p>";
59 if ($form_submitted) {
60 echo "</body></html>\n";