Moved lists back to same folder as songs.
[songbook.git] / web / displayset.php
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2    "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6   <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
7   <title>Songbook List</title>
8   <link rel="stylesheet" type="text/css" media="screen" href="/css/Music.css">
9   <link rel="stylesheet" type="text/css" media="print" href="/css/Print.css">
10   <link rel="SHORTCUT ICON" href="http://defaria.com/favicon.ico" type="image/png">
11
12 <?php
13 include_once "songbook.php";
14 $set = $_REQUEST["set"];
15 ?>
16
17 <style>
18 li {
19 width: 100%;
20 }
21 </style>
22 </head>
23
24 <div class="heading">
25 <a href="/songbook"><img src="/Icons/Home.png" alt="Home"></a>
26   <h1 class="centered">Andrew DeFaria's Songbook</h1>
27
28   <h2 class="centered"><?php echo "Set: " . basename ($set, ".lst")?></h2>
29 </div>
30
31 <div id="content">
32
33 <?php
34 global $songDir, $artists;
35
36 print "<ol>";
37
38 $firstLine = true;
39
40 foreach (file("$songDir/$set") as $line) {
41   // Skip first line which is merely the set name again
42   if ($firstLine) {
43     $firstLine = false;
44     continue;
45   } // if
46
47   if (preg_match("/(.*)\s+-\s+(.*)/", $line, $matches)) {
48     $song   = trim($matches[1]);
49     $artist = trim($matches[2]);
50   } else {
51     $song   = trim($line);
52     $artist = '';
53   } // if
54
55   if (file_exists ("$songDir/$song.pro")) {
56     print "<li><a href=\"webchord.cgi?chordpro=$song.pro\">";
57     print basename($song);
58     print "</a>";
59   } else {
60     print "<li>";
61     print basename($song);
62   } // if
63
64   if ($artist == '') {
65     $artist = getArtist ("$songDir/$song.pro");
66   } // if
67
68   if ($artist != '') {
69     print " - ";
70
71     if (in_array ($artist, $artists)) {
72       print "<a href=\"displayartist.php?artist=$artist\">$artist</a>";
73     } else {
74        print $artist;
75     } // if
76   } // if
77
78   print "</li>";
79 } // foreach
80
81 print "</ol>";
82 ?>
83
84 </body>
85 </html>