summaryrefslogtreecommitdiffstats
path: root/templates/show_now_playing.inc
diff options
context:
space:
mode:
authorxgizzmo <xgizzmo@ampache>2006-01-11 02:59:17 +0000
committerxgizzmo <xgizzmo@ampache>2006-01-11 02:59:17 +0000
commit603f145952f39164b961ac94a46b8a459e7adac0 (patch)
tree90fb10a0f1a1ea8396af8a41e629b1e63bac30d2 /templates/show_now_playing.inc
parent67d76f09c28d0c6abae6d966f4cc00a5428bdc74 (diff)
downloadampache-603f145952f39164b961ac94a46b8a459e7adac0.tar.gz
ampache-603f145952f39164b961ac94a46b8a459e7adac0.tar.bz2
ampache-603f145952f39164b961ac94a46b8a459e7adac0.zip
More code clean up this should about cover /templates
Diffstat (limited to 'templates/show_now_playing.inc')
-rw-r--r--templates/show_now_playing.inc81
1 files changed, 37 insertions, 44 deletions
diff --git a/templates/show_now_playing.inc b/templates/show_now_playing.inc
index 0569257d..e294510b 100644
--- a/templates/show_now_playing.inc
+++ b/templates/show_now_playing.inc
@@ -22,51 +22,44 @@
?>
<?php if (count($results)) { ?>
<table class="border" cellspacing="1" cellpadding="3" border="0" width="100%">
- <tr class="table-header">
- <td colspan="4"><?php echo _('Now Playing'); ?></td>
- </tr>
+<tr class="table-header">
+ <td colspan="4"><?php echo _('Now Playing'); ?></td>
+</tr>
<?php
- $user = $GLOBALS['user'];
- foreach($results as $item) {
- $song = $item['song'];
- $np_user = $item['user'];
- if (is_object($song)) {
- $artist = $song->f_artist;
- $album = $song->get_album_name();
- $text = "$song->f_title";
- if (!$np_user->fullname) { $np_user->fullname = "Unknown User"; }
- if ($GLOBALS['user']->username == $np_user->username)
- {
- $sql = "SELECT start_time FROM now_playing WHERE user ='".$user->username."'";
- $db_results = mysql_query($sql, dbh());
- while ($r = mysql_fetch_assoc($db_results)) {
- echo '<script language="JavaScript" type="text/javascript"> var mpd_elapsed = '.(time() - $r['start_time']).' </script>';
- echo '<script language="JavaScript" type="text/javascript"> var mpd_song_length = '. $song->time .' </script>';
- echo '<script language="JavaScript" type="text/javascript"> var mpd_state = "'. "play" .'" </script>';
- } // end while
- echo "<tr class=\"even\">\n"; }
- else
- { echo "<tr class=\"even\">\n"; }
- if (conf('use_auth')) {
- echo "\t<td valign=\"middle\">$np_user->fullname</td>\n";
- }
- echo "\t<td><a title=\"" . scrub_out($song->title) . "\" href=\"$web_path/song.php?action=m3u&amp;song=$song->id\">$text</a></td>\n";
- echo "\t<td><a title=\"" . scrub_out($song->f_artist) . "\" href=\"$web_path/artists.php?action=show&amp;artist=$song->artist\">$song->f_artist</a> / ";
- echo "\t<a title=\"" . scrub_out($album) . "\" href=\"$web_path/albums.php?action=show&amp;album=$song->album\">$song->f_album</a></td>";
- if (conf('play_album_art')) {
- echo "\t<td align=\"center\">";
- $aa_url = conf('web_path') . "/albumart.php?id=" . $song->album . "&amp;type=popup";
- echo "<a target=\"_blank\" href=\"$aa_url\" onclick=\"popup_art('$aa_url'); return false;\">";
- echo "<img align=\"middle\" border=\"0\" src=\"" . conf('web_path') . "/albumart.php?id=" . $song->album . "&amp;fast=1&amp;thumb=1\" alt=\"Album Art\" height=\"75\" />";
- echo "</a>\n";
- echo "\t</td>\n";
- echo "</tr>\n";
- } // if album art on now playing
- else {
- echo "\n</tr>";
- }
- } // if it's a song
- } // while we're getting songs
+$user = $GLOBALS['user'];
+foreach($results as $item) {
+ $song = $item['song'];
+ $np_user = $item['user'];
+ if (is_object($song)) {
+ $artist = $song->f_artist;
+ $album = $song->get_album_name();
+ $text = "$song->f_title";
+ if (!$np_user->fullname) { $np_user->fullname = "Unknown User"; }
+ if ($GLOBALS['user']->username == $np_user->username) {
+ $sql = "SELECT start_time FROM now_playing WHERE user ='".$user->username."'";
+ $db_results = mysql_query($sql, dbh());
+ echo "<tr class=\"even\">\n";
+ } else {
+ echo "<tr class=\"even\">\n";
+ }
+ if (conf('use_auth')) {
+ echo "\t<td valign=\"middle\">$np_user->fullname</td>\n";
+ }
+ echo "\t<td><a title=\"" . scrub_out($song->title) . "\" href=\"$web_path/song.php?action=m3u&amp;song=$song->id\">$text</a></td>\n";
+ echo "\t<td><a title=\"" . scrub_out($song->f_artist) . "\" href=\"$web_path/artists.php?action=show&amp;artist=$song->artist\">$song->f_artist</a> / ";
+ echo "\t<a title=\"" . scrub_out($album) . "\" href=\"$web_path/albums.php?action=show&amp;album=$song->album\">$song->f_album</a></td>";
+ if (conf('play_album_art')) {
+ echo "\t<td align=\"center\">";
+ $aa_url = $web_path . "/albumart.php?id=$song->album&amp;type=popup";
+ echo "<a target=\"_blank\" href=\"$aa_url\" onclick=\"popup_art('$aa_url'); return false;\">";
+ echo "<img align=\"middle\" border=\"0\" src=\"$web_path/albumart.php?id=$song->album&amp;fast=1&amp;thumb=1\" alt=\"Album Art\" height=\"75\" />";
+ echo "</a>\n";
+ echo "\t</td>\n";
+ echo "</tr>\n";
+ } // if album art on now playing
+ else { echo "\n</tr>"; }
+ } // if it's a song
+} // while we're getting songs
?>
</table>
<?php } ?>