]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/lily_index_search.php
Add '-dcrop' option to ps and svg backends
[lilypond.git] / Documentation / lily_index_search.php
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");
4
5   $lang = $languages[$_REQUEST['lang']];
6   $man = $manuals[$_REQUEST['manual']];
7   if (!$man) {
8     echo "<p>Invalid manual " . $_REQUEST['lang'] . "</p>";
9     exit ();
10   }
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'];
15
16
17   $relpath = "";
18   if ($form_submitted) {
19     if (! $bigpage) {
20       $relpath = "$man/";
21     }
22     echo "<html><body>\n";
23   }
24
25   $filename = "./$man";
26   if ($bigpage) { $filename .= "-big-page"; }
27   $filename .= ".$lang.idx";
28
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;
42         }
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++;
47       }
48     }
49     if ($found > 0) {
50       echo "</table>\n";
51     } else {
52       echo "No results found in the index.\n";
53     }
54     echo "</p>";
55     fclose($file);
56   } else {
57     echo "<p>Unable to open search index $filename</p>";
58   }
59   if ($form_submitted) {
60     echo "</body></html>\n";
61   }
62 ?>