function musicLookup($type, $itemid) { global $mpd; mp3act_connect(); switch ($type) { case 'browse': $output = "<div class=\"head\">"; $output .= "<h2>Browse the Music Database</h2></div>"; $output .= "<p>"; $output .= "<strong>By Artist Beginning With</strong><br/>" . letters() . "<br/></p>\n"; $output .= "<p><strong>By Genre</strong><br/>\n"; $output .= genreForm() . "<br/><br/>\n"; $output .= "<input type='button' value='Browse All Albums' onclick=\"updateBox('all','All'); return false;\" class='btn2' />\n"; $output .= "</p>\n"; break; case 'search': $output = "<div class=\"head\">"; $output .= "<h2>Search the Music Database</h2></div>"; $output .= "<form onsubmit='return searchMusic(this)' method='get' action=''>\n"; $output .= "<p>\n\t\t\t\t<strong>Keywords</strong><br/>\n\t\t\t\t<input type='text' onfocus='this.select()' name='searchbox' size='35' id='searchbox' value='[enter your search terms]' />\n \t\t<br/><br/>\n \t\t<strong>Narrow Your Search</strong>\n \t\t<br/>\n \t\t<select name='search_options' size='1'>\n \t\t\t<option value='all'>All Fields</option>\n \t\t\t<option value='artists'>Artists</option>\n \t\t\t<option value='albums'>Albums</option>\n \t\t\t<option value='songs'>Songs</option>\n \t\t</select><br/><br/>\n \t\t<input type='submit' value='submit search' class='btn' /></form>"; $output .= "</p>\n"; break; case 'letter': if (inMpdMode()) { if (mpd_connect() == 0) { $head = "<div class=\"head\">"; $head .= "<h2>Can't connect to MPD server</h2></div>"; return $head; } /* got a list of artists, filter */ $output = "<div class=\"head\">"; $output .= "<h2>Artists Beginning with '" . strtoupper($itemid) . "'</h2></div>"; $output .= "<p><strong>Artist Listing</strong></p><ul>"; /* Retrieve all artists then filter locally */ if (!is_null($artists = $mpd->GetArtists())) { $count = 1; $artistid = 0; $c = count($artists); for ($i = 0; $i < $c; $i++) { $artist = $artists[$i]; $artist_upr = strtoupper($artist); $item_upr = strtoupper($itemid); $firstletter = $artist_upr[0]; $checkfor = $item_upr[0]; if ($checkfor == '#' && ctype_digit($firstletter) || $checkfor == $firstletter) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><a href=\"#\" onclick=\"updateBox('artist','{$i}'); return false;\" title=\"View Albums for {$artist}\">{$artist}</a></li>\n"; $count++; } } } $output .= "</ul>\n"; } else { if ($itemid == "#") { $query = "SELECT * FROM mp3act_artists \n\t\t WHERE artist_name \n\t\t LIKE '0%' \n\t\t OR artist_name LIKE '1%' \n\t\t OR artist_name LIKE '2%' \n\t\t OR artist_name LIKE '3%' \n\t\t OR artist_name LIKE '4%' \n\t\t OR artist_name LIKE '5%' \n\t\t OR artist_name LIKE '6%' \n\t\t OR artist_name LIKE '7%' \n\t\t OR artist_name LIKE '8%'\n\t\t OR artist_name LIKE '9%'\n\t\t ORDER BY artist_name"; } else { $query = "SELECT * FROM mp3act_artists\n\t\t WHERE artist_name LIKE '{$itemid}%'\n\t\t ORDER BY artist_name"; } $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<h2>Artists Beginning with '" . strtoupper($itemid) . "'</h2></div>"; $output .= "<p>\n\t\t\t\t\t\t<strong>Artist Listing</strong></p>\n\t\t\t\t\t\t<ul>"; $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><a href=\"#\" onclick=\"updateBox('artist','{$row['artist_id']}'); return false;\" title=\"View Albums for {$row['prefix']} {$row['artist_name']}\">{$row['prefix']} {$row['artist_name']}</a></li>\n"; $count++; } $output .= "</ul>\n"; } break; case 'all': if (inMpdMode()) { if (mpd_connect() == 0) { $head = "<div class=\"head\">"; $head .= "<h2>Can't connect to MPD server</h2></div>"; return $head; } $output = "<div class=\"head\">"; $output .= "<h2>All Albums</h2></div> "; $output .= "<p><strong>Album Listing</strong></p><ul>"; $count = 1; // we want a combination of artist/album if (is_null($artistalbums = mpdGetAllArtistAlbums())) { $output .= "</ul>"; return $output; } $numalbums = count($artistalbums); for ($albumidx = 0; $albumidx < $numalbums; $albumidx++) { $album = $artistalbums[$albumidx]; $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $album_name = $album['Artist'] . " - " . $album['Album']; $album_id = $album['AlbumId']; $output .= "<li {$alt}><a href=\"#\" onclick=\"pladd('album','{$album_id}'); return false;\" title=\"Add Album to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('album', '{$album_id}'); return false;\" title=\"Play this Album Now\"><img src=\"img/play.gif\" /></a> <a href=\"#\" onclick=\"updateBox('album', '{$album_id}'); return false;\" title=\"View Details of {$album_name}\"> {$album_name}</a></li>\n"; /* XXX add album year here if available! */ $count++; } $output .= "</ul>\n"; } else { $output = "<div class=\"head\">"; $output .= "<h2>All Albums</h2></div> "; $output .= "<p>\n\t\t\t\t<strong>Album Listing</strong></p>\n\t\t\t\t<ul>"; $start = $itemid; $query = "SELECT mp3act_artists.artist_name,mp3act_artists.prefix,mp3act_albums.* FROM mp3act_albums,mp3act_artists WHERE mp3act_albums.artist_id=mp3act_artists.artist_id ORDER BY artist_name,album_name"; /* LIMIT $start,30"; */ $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><a href=\"#\" onclick=\"pladd('album'," . $row['album_id'] . "); return false;\" title=\"Add Album to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('album'," . $row['album_id'] . "); return false;\" title=\"Play this Album Now\"><img src=\"img/play.gif\" /></a> <a href=\"#\" onclick=\"updateBox('album','" . $row['album_id'] . "'); return false;\" title=\"View Details of " . $row['album_name'] . "\">" . $row['prefix'] . " " . $row['artist_name'] . " - " . $row['album_name'] . " " . ($row['album_year'] != 0 ? "<em>(" . $row['album_year'] . ")</em>" : "") . "</a></li>\n"; $count++; } $output .= "</ul>\n"; } break; case 'album': // This is basically showing all the details of an album, including all the songs. if (inMpdMode()) { if (mpd_connect() == 0) { $head = "<div class=\"head\">"; $head .= "<h2>Can't connect to MPD server</h2></div>"; return $head; } // This query is a lot harder in MPD mode than in local-db mode... // stuff to retrieve // - artist name // - genre // - album art (not yet implemented in MPD mode) // - number of tracks // - all album tracks and their duration // - total duration // // input into this function is an album ID which in MPD case is // basically 'artist number, album number' // // so the first thing we do is extract the album/artist number, // then find the album name, then do a query for the album name // to find all artists, and select the right one from the list. // list($artistnum, $albumnum) = split(',', $itemid, 2); if (is_null($ar = $mpd->GetAlbums())) { $output = "MPD error: album not found\n"; return $output; } else { $album = $ar[$albumnum]; } $artists = $mpd->GetArtists(); if (count($artists) == 0 || $artistnum >= count($artists)) { $output .= "MPD error: artist for album {$album} not found\n"; return $output; } else { $artist = $artists[$artistnum]; } // // now find all the tracks on this album name and filter for // our artist // if (is_null($ar = $mpd->Find(MPD_SEARCH_ALBUM, $album))) { $output .= "MPD error: find failed<br/>\n"; return $output; } else { // got results, iterate and filter for the right artist $genre = ""; $count = 1; $numtracks = 0; $totalplaytime = 0; if (count($ar) > 0) { foreach ($ar as $track) { // we now have: // $track['Album'] // $track['Artist'] // $track['Track'] // $track['Title'] // $track['Genre'] // $track['Time'] // $track['file'] if ($track['Artist'] == $artist) { // this is one of ours! if ($genre == "") { $genre = $track['Genre']; } $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $song_id = "{$itemid},{$numtracks}"; // artistnr, albumnr, songnr $trackno = $track['Track']; // if (($trackno == "") || ($trackno == null)) $trackno = "1"; $time = $track['Time']; $min = (int) ($time / 60); $sec = (int) ($time % 60); $length = $min . ":" . ($sec < 10 ? "0" : "") . $sec; $name = $track['Title']; $tracklist .= "<li {$alt} ondblclick=\"pladd('song','{$song_id}'); return false;\" ><a href=\"#\" onclick=\"pladd('song','{$song_id}'); return false;\" title=\"Add Song to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('song','{$song_id}'); return false;\" title=\"Play this Song Now\"><img src=\"img/play.gif\" /></a> " . ($trackno != "" ? "{$trackno}. " : "") . "{$name}<p>0 Plays<br/><em>{$length}</em></p></li>\n"; $count++; $numtracks++; $totalplaytime += $time; } } } } $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"play('album','{$itemid}'); return false;\" title=\"Play this Album Now\">play</a> <a href=\"#\" onclick=\"pladd('album','{$itemid}'); return false;\" title=\"Add Album to Current Playlist\">add</a> " . (getSystemSetting("downloads") == 1 || getSystemSetting("downloads") == 2 && accessLevel(5) ? "<a href=\"#\" onclick=\"newWindow('download','{$itemid}'); return false;\" title=\"Download this Album Now\">download</a>" : "") . "</div>"; $output .= "<h2>{$album}</h2>{$artist}</div>"; $output .= "<p>\n"; $output .= "\t<strong>Tracks:</strong> {$numtracks}<br/>\n"; //$output .= (($row['album_year'] != 0) ? ("<strong>Year:</strong> " . $row['album_year'] . "<br/>\n") : ("")); $output .= "\t<strong>Genre:</strong> <a href=\"#\" onclick=\"updateBox('genre','{$genre}'); return false;\" title=\"View Artists from {$genre} Genre\">{$genre}</a><br/>\n"; $min = (int) ($totalplaytime / 60); $sec = (int) ($totalplaytime % 60); $length = $min . ":" . ($sec < 10 ? "0" : "") . $sec; $output .= "\t<strong>Play Time:</strong> {$length}\n"; $output .= "\t<br/><br/>\n"; $output .= "\t<strong>Album Tracks</strong></p>\n"; $output .= "<ul>\n"; //$output .= "<img id='bigart' src=\"art/$row[album_art]\" />\n"; $output .= $tracklist; $output .= "</ul>\n"; } else { // NOTE: albums.genre_id fixed here. $query = "SELECT mp3act_genres.genre, mp3act_albums.*,mp3act_artists.artist_name,mp3act_artists.prefix,COUNT(mp3act_songs.song_id) as tracks,SEC_TO_TIME(SUM(mp3act_songs.length)) as time FROM mp3act_albums,mp3act_artists,mp3act_songs,mp3act_genres WHERE mp3act_albums.album_genre_id = mp3act_genres.genre_id AND mp3act_albums.album_id={$itemid} AND mp3act_albums.artist_id=mp3act_artists.artist_id AND mp3act_songs.album_id={$itemid} GROUP BY mp3act_songs.album_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); $album_art = ''; if ($row['album_art'] == "") { $row['album_art'] = art_insert($row['album_id'], $row['artist_name'], $row['album_name']); if ($row['album_art'] != '') { $album_art = "<img onmouseover=\"showAlbumArt('block'); return false;\" onmouseout=\"showAlbumArt('none'); return false;\" src=\"art/{$row['album_art']}\" />\n"; } } elseif ($row['album_art'] != "fail") { $album_art = "<img onmouseover=\"showAlbumArt('block'); return false;\" onmouseout=\"showAlbumArt('none'); return false;\" src=\"art/{$row['album_art']}\" />\n"; } $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"play('album'," . $row['album_id'] . "); return false;\" title=\"Play this Album Now\">play</a> <a href=\"#\" onclick=\"pladd('album',{$row['album_id']}); return false;\" title=\"Add Album to Current Playlist\">add</a> " . (getSystemSetting("downloads") == 1 || getSystemSetting("downloads") == 2 && accessLevel(5) ? "<a href=\"#\" onclick=\"newWindow('download',{$row['album_id']}); return false;\" title=\"Download this Album Now\">download</a>" : "") . "</div>"; $output .= "<h2>" . $row['album_name'] . "</h2>" . $row['prefix'] . " " . $row['artist_name'] . "</div>"; $output .= "<p>{$album_art}\n"; $output .= "\t<strong>Tracks:</strong> {$row['tracks']}<br/>\n"; $output .= $row['album_year'] != 0 ? "<strong>Year:</strong> " . $row['album_year'] . "<br/>\n" : ""; $output .= "\t<strong>Genre:</strong> <a href=\"#\" onclick=\"updateBox('genre','{$row['album_genre_id']}'); return false;\" title=\"View Artists from {$row['genre']} Genre\">{$row['genre']}</a><br/>\n"; $output .= "\t<strong>Play Time:</strong> {$row['time']}\n"; $output .= "\t<br/><br/>\n"; $output .= "\t<strong>Album Tracks</strong></p>\n"; $output .= "<ul>\n"; $output .= "<img id='bigart' src=\"art/{$row['album_art']}\" />\n"; $query = "SELECT *,SEC_TO_TIME(length) as length FROM mp3act_songs WHERE album_id={$itemid} ORDER BY track"; $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt} ondblclick=\"pladd('song',{$row['song_id']}); return false;\" ><a href=\"#\" onclick=\"pladd('song',{$row['song_id']}); return false;\" title=\"Add Song to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('song',{$row['song_id']}); return false;\" title=\"Play this Song Now\"><img src=\"img/play.gif\" /></a> {$row['track']}. {$row['name']}<p>{$row['numplays']} Plays<br/><em>{$row['length']}</em></p></li>\n"; $count++; } $output .= "</ul>\n"; } break; case 'genre': // list artists for a given genre if (inMpdMode()) { if (mpd_connect() == 0) { $head = "<div class=\"head\">"; $head .= "<h2>Can't connect to MPD server</h2></div>"; return $head; } // a genre ID in this case is a genre name!! maybe change to a number later. name is ok since it's short and probably not with strange characters $artistsforgenre = $mpd->GetArtistsForGenre($itemid); if ($artistsforgenre == NULL) { $output = "MPD error: can't get artist list for genre {$itemid}"; return $output; } else { $artists = $mpd->GetArtists(); if ($artists == NULL) { $output = "MPD error: can't get artist list"; return $output; } /* list of artists returned, find their number in the global artist list */ $output = "<div class=\"head\">"; $output .= "<h2>Artists for Genre '{$itemid}'</h2></div>"; $output .= "<p><strong>Artist Listing</strong></p><ul>"; $count = 1; foreach ($artistsforgenre as $ga) { // find $ga in the big artist table $artistnum = binary_search($artists, $ga); if ($artistnum != -1) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><a href=\"#\" onclick=\"updateBox('artist','{$artistnum}'); return false;\" title=\"View Albums for {$ga}\">{$ga}</a></li>\n"; $count++; } else { $output .= "<li {$alt}>search failed, cant find artist {$ga} ?!</li>\n"; } } $output .= "</ul>\n"; } } else { // NOTE: albums genre_id fixed here (CHECK IT we're assuming a genre ID input, whereas we might have been given a name!!) $query = "SELECT mp3act_genres.genre FROM mp3act_genres WHERE mp3act_genres.genre_id={$itemid}"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>Artists for Genre '" . $row['genre'] . "'</h2></div>"; $output .= "<p><strong>Artist Listing</strong></p><ul>"; $query = "SELECT mp3act_artists.artist_id,mp3act_artists.artist_name,mp3act_artists.prefix FROM mp3act_artists,mp3act_songs WHERE mp3act_songs.genre_id={$itemid} AND mp3act_artists.artist_id=mp3act_songs.artist_id GROUP BY artist_id ORDER BY artist_name"; $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><a href=\"#\" onclick=\"updateBox('artist','{$row['artist_id']}'); return false;\" title=\"View Albums for {$row['artist_name']}\">{$row['prefix']} {$row['artist_name']}</a></li>\n"; $count++; } $output .= "</ul>\n"; } break; case 'artist': // list albums for artist, $itemid is the artist number if (inMpdMode()) { if (mpd_connect() == 0) { $head = "<div class=\"head\">"; $head .= "<h2>Can't connect to MPD server</h2></div>"; return $head; } // find artist name if (is_null($artists = $mpd->GetArtists())) { $output = "MPD error: Can't find artist name\n"; } $artist = $artists[$itemid]; if (is_null($allalbums = $mpd->GetAlbums())) { return "MPD error: can't get list of all albums"; } $output = "<div class=\"head\">"; $output .= "<h2>{$artist}</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Album Listing</strong></p>\n"; $output .= "<ul>\n"; // list albums for this artist if (!is_null($albums = $mpd->GetAlbumsForArtist($artist))) { if (count($albums) > 0) { $count = 1; foreach ($albums as $album) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $albumnum = binary_search($allalbums, $album); $album_id = "{$itemid},{$albumnum}"; $output .= "<li {$alt}><a href=\"#\" onclick=\"pladd('album', '{$album_id}'); return false;\" title=\"Add Album to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('album', '{$album_id}'); return false;\" title=\"Play this Album Now\"><img src=\"img/play.gif\" /></a> <a href=\"#\" onclick=\"updateBox('album', '{$album_id}'); return false;\" title=\"View Details of {$album}\">{$album}</a></li>\n"; $count++; } } } $output .= "</ul>\n"; } else { $query = "SELECT artist_id,artist_name,prefix FROM mp3act_artists WHERE artist_id={$itemid}"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>{$row['prefix']} {$row['artist_name']}</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Album Listing</strong></p>\n"; $output .= "<ul>\n"; $query = "SELECT mp3act_albums.* FROM mp3act_albums WHERE mp3act_albums.artist_id={$itemid} ORDER BY mp3act_albums.album_name"; $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><a href=\"#\" onclick=\"pladd('album'," . $row['album_id'] . "); return false;\" title=\"Add Album to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('album'," . $row['album_id'] . "); return false;\" title=\"Play this Album Now\"><img src=\"img/play.gif\" /></a> <a href=\"#\" onclick=\"updateBox('album','" . $row['album_id'] . "'); return false;\" title=\"View Details of " . $row['album_name'] . "\">" . $row['album_name'] . " " . ($row['album_year'] != 0 ? "<em>(" . $row['album_year'] . ")</em>" : "") . "</a></li>\n"; $count++; } $output .= "</ul>\n"; } break; case 'admin': $output = "<div class=\"head\">"; $output .= "<h2>Administration Panel</h2></div>"; $output .= "<p>\n"; $output .= "<strong>System Settings</strong><br/>\n"; $output .= "<a href='#' onclick=\"editSettings(0); return false;\" title='Edit System Systems'>Edit System Settings</a><br/>\n"; $output .= "</p>\n"; $output .= "<p>\n"; $output .= "<strong>Database Functions</strong><br/>\n"; if (inMpdMode()) { $output .= "<a href='#' onclick=\"mpd_updatedb(); return false;\" title='Update the MPD database'>Update the MPD database</a><br/>\n"; } $output .= "<a href='#' onclick=\"newWindow('add',0); return false;\" title='Add Music to the Database'>Add New Music to the Database</a><br/>\n"; $output .= "<a href='#' onclick=\"clearDB(); return false;\" title='Clear out the Database'>Clear Out the Music Database and Play History</a><br/>\n"; $output .= "</p>"; $output .= "<p>\n"; $output .= "<strong>User Functions</strong><br/>\n"; $output .= "<a href='#' onclick=\"adminEditUsers(0,'',''); return false;\" title='Edit User Permissions'>Edit User Accounts</a><br/>\n"; $output .= "<a href='#' onclick=\"adminAddUser(0); return false;\" title='Add New User Account'>Add New User Account</a><br/>\n"; $output .= "</p>"; if (getSystemSetting("invite_mode") == 1) { $output .= "<form onsubmit='return sendInvite(this)' method='get' action=''>\n"; $output .= "<p id='invite'>"; $output .= "<br/><strong>Send an Invitation for Registration<br/>\n"; $output .= "<input type='text' onfocus='this.select()' name='email' id='email' value='Enter Email Address of Recipient' size='32' /><br/>\n"; $output .= "<br/><input type='submit' value='send invite' class='btn' /></form>"; $output .= "</p>"; } break; case 'prefs': $query = "SELECT DATE_FORMAT(mp3act_users.date_created,'%M %D, %Y') as date_created FROM mp3act_users WHERE mp3act_users.user_id={$_SESSION['sess_userid']}"; $query2 = "SELECT COUNT(play_id) as playcount FROM mp3act_playhistory WHERE user_id={$_SESSION['sess_userid']} GROUP BY user_id"; $result = mysql_query($query); $result2 = mysql_query($query2); $row = mysql_fetch_array($result); $row2 = mysql_fetch_array($result2); if (mysql_num_rows($result2) == 0) { $row2['playcount'] = 0; } $dayssince = (time() - strtotime($row['date_created'])) / (60 * 60 * 24); $output = "<div class=\"head\">"; $output .= "<h2>{$_SESSION['sess_firstname']} {$_SESSION['sess_lastname']}'s Account ({$_SESSION['sess_username']})</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Date Joined:</strong> {$row['date_created']}<br/>\n"; $output .= "<strong>Songs Played:</strong> {$row2['playcount']}<br/>\n"; $output .= "<strong>Daily Average:</strong> " . round($row2['playcount'] / $dayssince, 2) . " songs/day<br/><br/>\n"; $output .= "<a href='#' onclick=\"editUser('info',0); return false;\" >Edit User Info</a><br/>"; $output .= "<a href='#' onclick=\"editUser('settings',0); return false;\" >Edit User Settings</a><br/>"; $output .= "<a href='#' onclick=\"editUser('pass',0); return false;\" >Change Password</a><br/><br/>"; if (hasScrobbler($_SESSION['sess_userid'])) { $as = getScrobblerStats($_SESSION['sess_userid']); $output .= "<strong>AudioScrobbler Submission Queue:</strong> {$as['count']} songs " . ($as['count'] > 0 ? "<a href='#' onclick=\"submitScrobbler({$_SESSION['sess_userid']}); return false;\" title='Force Submission to AudioScrobbler'>[submit]</a>" : "") . "<br/>\n"; $output .= "<strong>AudioScrobbler Response:</strong> {$as['last_result']}<br/>\n"; $output .= "<a href='http://www.audioscrobbler.com/user/{$as['username']}' target='_new' title='View Your AudioSrobbler Statistics Page'>View Your AudioSrobbler Statistics Page</a><br/><br/>\n"; } $output .= "</p>"; break; case 'random': $output = "<div class=\"head\">"; $output .= "<h2>Random Mix Maker</h2></div>"; $output .= "<form onsubmit='return randPlay(this)' method='get' action=''>\n<p>"; if ($_SESSION['sess_playmode'] == "streaming" || inMpdMode()) { $output .= "<strong>Number of Songs</strong><br/>\n\n\t\t\t\t<select name='random_count'>\n\t\t\t\t<option value=10>10 </option>\n\t\t\t\t<option value=20>20 </option>\n\t\t\t\t<option value=30>30 </option>\n\t\t\t\t<option value=40>40 </option>\n\t\t\t\t<option value=50>50 </option>\n </select><br/>\n"; } $output .= "<strong>Random Type</strong><br/>\n\n\t\t\t\t<select name='random_type' onchange=\"getRandItems(this.options[selectedIndex].value); return false;\" >\n\t\t\t\t<option value='' >Choose Type...</option>\n\t\t\t\t<option value='artists' >Artists</option>\n\t\t\t\t<option value='genre' >Genre</option>\n\t\t\t\t<option value='albums' >Albums</option>\n\t\t\t <option value='all' >Everything</option>\n \t\t</select><br/>\n"; $output .= "<strong>Random Items</strong>\n<span id='rand_items'></span>\n\t\t\t<br/><br/>"; $output .= "<input type='submit' value='play mix' class='btn' />"; $output .= "</form></p>\n"; break; case 'playlists': if (inMpdMode()) { if (mpd_connect() == 0) { $head = "<div class=\"head\">"; $head .= "<h2>Can't connect to MPD server</h2></div>"; return $head; } $playlists = $mpd->GetPlaylists(); $output = "<div class=\"head\">"; $output .= "<h2>Saved Playlists</h2></div>"; //$output .= "<p><strong>Public Playlists</strong></p>\n"; $output .= "<ul>\n"; $numplaylists = count($playlists); if ($numplaylists == 0) { $output .= "No Saved Playlists"; } for ($i = 0; $i < $numplaylists; $i++) { $plid = $i; $plname = $playlists[$i]; $output .= "<li><a href=\"#\" onclick=\"pladd('playlist',{$plid}); return false;\" title='Load this Saved Playlist'><img src=\"img/add.gif\" /></a> " . (accessLevel(10) ? "<a href=\"#\" onclick=\"deletePlaylist({$plid}); return false;\" title='DELETE this Saved Playlist'><img src=\"img/rem.gif\" /></a>" : "") . " {$plname}</li>"; } $output .= "</ul>\n"; } else { $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM mp3act_saved_playlists WHERE private=0"; $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<h2>Saved Playlists</h2></div>"; $output .= "<p><strong>Public Playlists</strong></p>\n"; $output .= "<ul>\n"; if (mysql_num_rows($result) == 0) { $output .= "No Public Playlists"; } while ($row = mysql_fetch_array($result)) { $output .= "<li><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title='Load this Saved Playlist'><img src=\"img/add.gif\" /></a> " . (accessLevel(10) ? "<a href=\"#\" onclick=\"deletePlaylist({$row['playlist_id']}); return false;\" title='DELETE this Saved Playlist'><img src=\"img/rem.gif\" /></a>" : "") . " <a onclick=\"updateBox('saved_pl','{$row['playlist_id']}'); \" title='Click to View Playlist' href='#'>{$row['playlist_name']} - {$row['songcount']} Songs ({$row['time2']})</a></li>"; } $output .= "</ul>\n"; $output .= "<p><strong>Your Private Playlists</strong></p>\n"; $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM mp3act_saved_playlists WHERE private=1 AND user_id={$_SESSION['sess_userid']} ORDER BY playlist_id DESC"; $result = mysql_query($query); $output .= "<ul>\n"; if (mysql_num_rows($result) == 0) { $output .= "No Private Playlists"; } while ($row = mysql_fetch_array($result)) { $output .= "<li><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title='Load this Saved Playlist'><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"deletePlaylist({$row['playlist_id']}); return false;\" title='DELETE this Saved Playlist'><img src=\"img/rem.gif\" /></a> <a onclick=\"updateBox('saved_pl','{$row['playlist_id']}'); \" title='Click to View Playlist' href='#'>{$row['playlist_name']} - {$row['songcount']} Songs ({$row['time2']})</a></li>"; } $output .= "</ul>\n"; } break; case 'saved_pl': if (inMpdMode()) { // TODO: implement view saved playlist // or maybe it's not supported in MPD?? } else { $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM mp3act_saved_playlists WHERE playlist_id={$itemid}"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title=\"Load Playlist\">load playlist</a></div>"; $output .= "<h2>View Saved Playlist</h2></div>"; $output .= "<p><strong>Playlist Info</strong><br/>{$row['songcount']} Songs<br/>{$row['time2']}</p>\n"; $output .= "<p><strong>Playlist Songs</strong></p>\n"; $output .= "<ul>\n"; $songs = explode(",", $row['playlist_songs']); $count = 0; foreach ($songs as $song) { $query = "SELECT mp3act_songs.*,SEC_TO_TIME(mp3act_songs.length) AS length,mp3act_artists.artist_name FROM mp3act_artists,mp3act_songs WHERE mp3act_songs.song_id={$song} AND mp3act_artists.artist_id=mp3act_songs.artist_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}>{$row['artist_name']} - {$row['name']}<p>{$row['numplays']} Plays<br/><em>{$row['length']}</em></p></li>"; $count++; } $output .= "</ul>\n"; } break; case 'about': $output = "<div class=\"head\">"; $output .= "<h2>mp3act Music System - v" . getSystemSetting("version") . "</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Date: </strong>July 31, 2005<br/>\n"; $output .= "<strong>Author: </strong><a href='http://www.jonbuda.com' target='_blank'>Jon Buda</a> | <a href='http://www.visiblebits.com' target='_blank'>A VisibleBits Production</a><br/>\n"; $output .= "<strong>Website: </strong><a href='http://www.mp3act.net' target='_blank'>http://www.mp3act.net</a><br/>\n"; $output .= "<strong>Support: </strong><a href='http://www.mp3act.net/support/' target='_blank'>http://www.mp3act.net/support/</a><br/>\n"; $output .= "<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\" target='_blank'>\n<input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\">\n<input class='noborder' title='Donate to mp3act!' type=\"image\" src=\"img/paypal_donate.gif\" border=\"0\" name=\"submit\" alt=\"Make payments with PayPal - it's fast, free and secure!\">\n<input type=\"hidden\" name=\"encrypted\" value=\"-----BEGIN PKCS7-----MIIHFgYJKoZIhvcNAQcEoIIHBzCCBwMCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYA4veI6qAxD/af5tw+U4bCCL6Dq/VKfbP7vqm2pH+IMxxiKfpDL4lq0rwKY53oZPbg7piEkawKT3/KUuCfx+HxgySt8baF2ebbK3AyKOmvFd2/eDyNTxRiS/tF0pNmW0DzE2JCoQW2HJajxXM5Z+UyJN0Z9v5FhPETMb8feDYo41jELMAkGBSsOAwIaBQAwgZMGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIjWvBHPqz4jiAcI2IZ5qVE6XWPHK7Y7bjlbSFiYqwwEDPiBqQlrSZE/qVfm5Q8kNsdtWXycfr6zeEd9AtHRdPV4l0Vao/IUJDj3pwGKtHjGcPXJW2kA4FzgAH4e+8zbQTTPbg/hNyh93xt8VJJZd7JQsc93UKwPzs5AigggOHMIIDgzCCAuygAwIBAgIBADANBgkqhkiG9w0BAQUFADCBjjELMAkGA1UEBh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9epdr4tJOUNiSojw7BHwYRiPh58S1xGlFgHFXwrEBb3dgNbMUa+u4qectsMAXpVHnD9wIyfmHMYIBmjCCAZYCAQEwgZQwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNTA0MTMxOTM3MDZaMCMGCSqGSIb3DQEJBDEWBBSEfLq1T8OGroO3jwycdLCxmwl7WTANBgkqhkiG9w0BAQEFAASBgLsYmppV3QgSoiPud2C7ZCh7NRBX/bPC4jgYT6Qf42vdh4mjAIptVJZn66HM8UQsKI9feP8x7+7g1S3/u+AoHVk5FQgaiRbGni2EKUO2il8YvjlwWLeRxJLuBPoTYeyMgGNFCTu/8TUSus0kpb8tpcFZWg1TGrhuX90XIbPjmisS-----END PKCS7-----\">\n</form>\n"; $output .= "</p>"; $output .= "<h3>Thanks to Contributors and Testers</h3>\n"; $output .= "<p>Ben Callam<br/>Joe Doss<br/>All of 708 Park St.</p>\n"; break; case 'stats': $query = "SELECT * FROM mp3act_stats"; $result = mysql_query($query); $row = mysql_fetch_array($result); $query = "SELECT COUNT(user_id) AS users FROM mp3act_users"; $result = mysql_query($query); $row2 = mysql_fetch_array($result); $query = "SELECT COUNT(play_id) AS songs FROM mp3act_playhistory"; $result = mysql_query($query); $row3 = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>Server Statistics</h2></div>"; $output .= "<p>\n"; $output .= "<a href='#' onclick=\"updateBox('recentadd','0'); return false;\" >Recently Added Albums</a><br/>"; $output .= "<a href='#' onclick=\"updateBox('recentplay','0'); return false;\" >Recently Played Songs</a><br/>"; $output .= "<a href='#' onclick=\"updateBox('topplay','0'); return false;\" >Top Played Songs</a><br/>"; $output .= "</p>\n"; $output .= "<h3>Local Server Statistics</h3>\n"; $output .= "<p><strong>Songs:</strong> {$row['num_songs']}<br/>\n"; $output .= "<strong>Albums:</strong> {$row['num_albums']}<br/>\n"; $output .= "<strong>Artists:</strong> {$row['num_artists']}<br/>\n"; $output .= "<strong>Genres:</strong> {$row['num_genres']}<br/><br/>\n"; $output .= "<strong>Total Time:</strong> {$row['total_time']}<br/>\n"; $output .= "<strong>Total Size:</strong> {$row['total_size']}<br/><br/>\n"; $output .= "<strong>Registered Users:</strong> {$row2['users']}<br/>\n"; $output .= "<strong>Songs Played:</strong> {$row3['songs']}<br/></p>\n"; break; case 'recentadd': $query = "SELECT mp3act_albums.album_name,mp3act_albums.album_id,\n\t\t\tmp3act_artists.artist_name, \n\t\t\tDATE_FORMAT(mp3act_songs.date_entered,'%m.%d.%Y') as pubdate \n\t\t\tFROM mp3act_songs,mp3act_albums,mp3act_artists \n\t\t\tWHERE mp3act_songs.album_id=mp3act_albums.album_id \n\t\t\tAND mp3act_artists.artist_id=mp3act_songs.artist_id \n\t\t\tGROUP BY mp3act_songs.album_id ORDER BY mp3act_songs.date_entered DESC LIMIT 40"; $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Recently Added Albums</h2></div><ul>"; $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><small>{$row['pubdate']}</small> <a href=\"#\" onclick=\"pladd('album',{$row['album_id']}); return false;\" title=\"Add Album to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('album',{$row['album_id']}); return false;\" title=\"Play this Album Now\"><img src=\"img/play.gif\" /></a> <a href=\"#\" onclick=\"updateBox('album','{$row['album_id']}'); return false;\" title=\"View Details of {$row['album_name']}\"><em>{$row['artist_name']}</em> - {$row['album_name']}</a></li>"; $count++; } $output .= "</ul>"; break; case 'topplay': $query = "SELECT mp3act_albums.album_name, mp3act_songs.numplays, mp3act_songs.name, \n\t\t\tmp3act_artists.artist_name,mp3act_songs.song_id \n\t\t\tFROM mp3act_songs,mp3act_albums,mp3act_artists \n\t\t\tWHERE mp3act_songs.album_id=mp3act_albums.album_id \n\t\t\tAND mp3act_artists.artist_id=mp3act_songs.artist_id \n\t\t\tAND mp3act_songs.numplays > 0 \n\t\t\tORDER BY mp3act_songs.numplays DESC LIMIT 40"; $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Top Played Songs</h2></div><ul>"; $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><small>{$row['numplays']} Plays</small> <a href=\"#\" onclick=\"pladd('song',{$row['song_id']}); return false;\" title=\"Add Song to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('song',{$row['song_id']}); return false;\" title=\"Play this Song Now\"><img src=\"img/play.gif\" /></a> <em>{$row['artist_name']}</em> - {$row['name']}</li>"; $count++; } $output .= "</ul>"; break; case 'recentplay': $query = "SELECT mp3act_songs.name, mp3act_songs.song_id, \n\t\t\tmp3act_artists.artist_name,\n\t\t\tDATE_FORMAT(mp3act_playhistory.date_played,'%m.%d.%Y') as playdate \n\t\t\tFROM mp3act_songs,mp3act_artists,mp3act_playhistory \n\t\t\tWHERE mp3act_songs.song_id=mp3act_playhistory.song_id\n\t\t\tAND mp3act_artists.artist_id=mp3act_songs.artist_id \n\t\t\tORDER BY mp3act_playhistory.play_id DESC LIMIT 40"; $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Recently Played Songs</h2></div><ul>"; $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><small>{$row['playdate']}</small> <a href=\"#\" onclick=\"pladd('song',{$row['song_id']}); return false;\" title=\"Add Song to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('song',{$row['song_id']}); return false;\" title=\"Play this Song Now\"><img src=\"img/play.gif\" /></a> <em>{$row['artist_name']}</em> - {$row['name']}</li>"; $count++; } $output .= "</ul>"; break; } return $output; }
function musicLookup($type, $itemid) { mp3act_connect(); switch ($type) { case 'browse': $output = "<div class=\"head\">"; $output .= "<h2>Browse the Music Database</h2></div>"; $output .= "<p>"; $output .= "<strong>By Artist Beginning With</strong><br/>" . letters() . "<br/></p>\n"; $output .= "<p><strong>By Genre</strong><br/>\n"; $output .= genreForm() . "<br/><br/>\n"; $output .= "<input type='button' value='Browse All Albums' onclick=\"updateBox('all','All'); return false;\" class='btn2' />\n"; $output .= "</p>\n"; break; case 'search': $output = "<div class=\"head\">"; $output .= "<h2>Search the Music Database</h2></div>"; $output .= "<form onsubmit='return searchMusic(this)' method='get' action=''>\n"; $output .= "<p>\n <strong>Keywords</strong><br/>\n <input type='text' onfocus='this.select()' name='searchbox' size='35' id='searchbox' value='[enter your search terms]' />\n <br/><br/>\n <strong>Narrow Your Search</strong>\n <br/>\n <select name='search_options' size='1'>\n <option value='all'>All Fields</option>\n <option value='artists'>Artists</option>\n <option value='albums'>Albums</option>\n <option value='songs'>Songs</option>\n </select><br/><br/>\n <input type='submit' value='submit search' class='btn' /></form>"; $output .= "</p>\n"; break; case 'letter': if ($itemid == "#") { $query = "SELECT * FROM mp3act_artists \n WHERE artist_name \n LIKE '0%' \n OR artist_name LIKE '1%' \n OR artist_name LIKE '2%' \n OR artist_name LIKE '3%' \n OR artist_name LIKE '4%' \n OR artist_name LIKE '5%' \n OR artist_name LIKE '6%' \n OR artist_name LIKE '7%' \n OR artist_name LIKE '8%'\n OR artist_name LIKE '9%'\n ORDER BY artist_name"; } else { $query = "SELECT * FROM mp3act_artists\n WHERE artist_name LIKE '{$itemid}%'\n ORDER BY artist_name"; } $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<h2>Artists Beginning with '" . strtoupper($itemid) . "'</h2></div>"; $output .= "<p>\n <strong>Artist Listing</strong></p>\n <ul>"; $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><a href=\"#\" onclick=\"updateBox('artist',{$row['artist_id']}); return false;\" title=\"View Albums for {$row['prefix']} {$row['artist_name']}\">{$row['prefix']} {$row['artist_name']}</a></li>\n"; $count++; } $output .= "</ul>\n"; break; case 'all': $output = "<div class=\"head\">"; //$output .= "<div class=\"right\"><a href='#' onclick=\"updateBox('all',$itemid-30); return false;\">Prev Page</a> <a href='#' onclick=\"updateBox('all',$itemid+30); return false;\">Next Page</a> </div>"; $output .= "<h2>All Albums</h2></div> "; $output .= "<p>\n <strong>Album Listing</strong></p>\n <ul>"; $start = $itemid; $query = "SELECT mp3act_artists.artist_name,mp3act_artists.prefix,mp3act_albums.* FROM mp3act_albums,mp3act_artists WHERE mp3act_albums.artist_id=mp3act_artists.artist_id ORDER BY artist_name,album_name"; /* LIMIT $start,30"; */ $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><a href=\"#\" onclick=\"pladd('album'," . $row['album_id'] . "); return false;\" title=\"Add Album to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('album'," . $row['album_id'] . "); return false;\" title=\"Play this Album Now\"><img src=\"img/play.gif\" /></a> <a href=\"#\" onclick=\"updateBox('album'," . $row['album_id'] . "); return false;\" title=\"View Details of " . $row['album_name'] . "\">" . $row['prefix'] . " " . $row['artist_name'] . " - " . $row['album_name'] . " " . ($row['album_year'] != 0 ? "<em>(" . $row['album_year'] . ")</em>" : "") . "</a></li>\n"; $count++; } $output .= "</ul>\n"; break; case 'album': $query = "SELECT mp3act_albums.*,mp3act_artists.artist_name,mp3act_artists.prefix,COUNT(mp3act_songs.song_id) as tracks,SEC_TO_TIME(SUM(mp3act_songs.length)) as time FROM mp3act_albums,mp3act_artists,mp3act_songs WHERE mp3act_albums.album_id={$itemid} AND mp3act_albums.artist_id=mp3act_artists.artist_id AND mp3act_songs.album_id={$itemid} GROUP BY mp3act_songs.album_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); $album_art = ''; if ($row['album_art'] == "") { $row['album_art'] = art_insert($row['album_id'], $row['artist_name'], $row['album_name']); if ($row['album_art'] != '') { $album_art = "<img onmouseover=\"showAlbumArt('block'); return false;\" onmouseout=\"showAlbumArt('none'); return false;\" src=\"art/{$row['album_art']}\" />\n"; } } elseif ($row['album_art'] != "fail") { $album_art = "<img onmouseover=\"showAlbumArt('block'); return false;\" onmouseout=\"showAlbumArt('none'); return false;\" src=\"art/{$row['album_art']}\" />\n"; } $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"play('album'," . $row['album_id'] . "); return false;\" title=\"Play this Album Now\">play</a> <a href=\"#\" onclick=\"pladd('album',{$row['album_id']}); return false;\" title=\"Add Album to Current Playlist\">add</a> " . (getSystemSetting("downloads") == 1 || getSystemSetting("downloads") == 2 && accessLevel(5) ? "<a href=\"#\" onclick=\"newWindow('download',{$row['album_id']}); return false;\" title=\"Download this Album Now\">download</a>" : "") . "</div>"; $output .= "<h2>" . $row['album_name'] . "</h2>" . $row['prefix'] . " " . $row['artist_name'] . "</div>"; $output .= "<p>{$album_art}\n"; $output .= "\t<strong>Tracks:</strong> {$row['tracks']}<br/>\n"; $output .= $row['album_year'] != 0 ? "<strong>Year:</strong> " . $row['album_year'] . "<br/>\n" : ""; $output .= "\t<strong>Genre:</strong> <a href=\"#\" onclick=\"updateBox('genre','{$row['album_genre']}'); return false;\" title=\"View Artists from {$row['album_genre']} Genre\">{$row['album_genre']}</a><br/>\n"; $output .= "\t<strong>Play Time:</strong> {$row['time']}\n"; $output .= "\t<br/><br/>\n"; $output .= "\t<strong>Album Tracks</strong></p>\n"; $output .= "<ul>\n"; $output .= "<img id='bigart' src=\"art/{$row['album_art']}\" />\n"; $query = "SELECT *,SEC_TO_TIME(length) as length FROM mp3act_songs WHERE album_id={$itemid} ORDER BY track"; $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt} ondblclick=\"pladd('song',{$row['song_id']}); return false;\" ><a href=\"#\" onclick=\"pladd('song',{$row['song_id']}); return false;\" title=\"Add Song to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('song',{$row['song_id']}); return false;\" title=\"Play this Song Now\"><img src=\"img/play.gif\" /></a> {$row['track']}. {$row['name']}<p>{$row['numplays']} Plays<br/><em>{$row['length']}</em></p></li>\n"; $count++; } $output .= "</ul>\n"; break; case 'genre': $query = "SELECT mp3act_artists.artist_id,mp3act_artists.artist_name,mp3act_artists.prefix FROM mp3act_artists,mp3act_albums WHERE mp3act_albums.album_genre='{$itemid}' AND mp3act_artists.artist_id=mp3act_albums.artist_id GROUP BY mp3act_artists.artist_id ORDER BY mp3act_artists.artist_name"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>Artists for Genre '{$itemid}'</h2></div>"; $output .= "<p>\n <strong>Artist Listing</strong></p>\n <ul>"; $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><a href=\"#\" onclick=\"updateBox('artist',{$row['artist_id']}); return false;\" title=\"View Albums for {$row['artist_name']}\">{$row['prefix']} {$row['artist_name']}</a></li>\n"; $count++; } $output .= "</ul>\n"; break; case 'artist': $query = "SELECT artist_id,artist_name,prefix FROM mp3act_artists WHERE artist_id={$itemid}"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>{$row['prefix']} {$row['artist_name']}</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Album Listing</strong></p>\n"; $output .= "<ul>\n"; $query = "SELECT mp3act_albums.* FROM mp3act_albums WHERE mp3act_albums.artist_id={$itemid} ORDER BY mp3act_albums.album_name"; $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><a href=\"#\" onclick=\"pladd('album'," . $row['album_id'] . "); return false;\" title=\"Add Album to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('album'," . $row['album_id'] . "); return false;\" title=\"Play this Album Now\"><img src=\"img/play.gif\" /></a> <a href=\"#\" onclick=\"updateBox('album'," . $row['album_id'] . "); return false;\" title=\"View Details of " . $row['album_name'] . "\">" . $row['album_name'] . " " . ($row['album_year'] != 0 ? "<em>(" . $row['album_year'] . ")</em>" : "") . "</a></li>\n"; $count++; } $output .= "</ul>\n"; break; case 'admin': $output = "<div class=\"head\">"; $output .= "<h2>Administration Panel</h2></div>"; $output .= "<p>\n"; $output .= "<strong>System Settings</strong><br/>\n"; $output .= "<a href='#' onclick=\"editSettings(0); return false;\" title='Edit System Systems'>Edit System Settings</a><br/>\n"; $output .= "</p>\n"; $output .= "<p>\n"; $output .= "<strong>Database Functions</strong><br/>\n"; $output .= "<a href='#' onclick=\"newWindow('add',0); return false;\" title='Add Music to the Database'>Add New Music to the Database</a><br/>\n"; $output .= "<a href='#' onclick=\"clearDB(); return false;\" title='Clear out the Database'>Clear Out the Music Database and Play History</a><br/>\n"; $output .= "</p>"; $output .= "<p>\n"; $output .= "<strong>User Functions</strong><br/>\n"; $output .= "<a href='#' onclick=\"adminEditUsers(0,'',''); return false;\" title='Edit User Permissions'>Edit User Accounts</a><br/>\n"; $output .= "<a href='#' onclick=\"adminAddUser(0); return false;\" title='Add New User Account'>Add New User Account</a><br/>\n"; $output .= "</p>"; if (getSystemSetting("invite_mode") == 1) { $output .= "<form onsubmit='return sendInvite(this)' method='get' action=''>\n"; $output .= "<p id='invite'>"; $output .= "<br/><strong>Send an Invitation for Registration<br/>\n"; $output .= "<input type='text' onfocus='this.select()' name='email' id='email' value='Enter Email Address of Recipient' size='32' /><br/>\n"; $output .= "<br/><input type='submit' value='send invite' class='btn' /></form>"; $output .= "</p>"; } break; case 'prefs': $query = "SELECT DATE_FORMAT(mp3act_users.date_created,'%M %D, %Y') as date_created FROM mp3act_users WHERE mp3act_users.user_id={$_SESSION['sess_userid']}"; $query2 = "SELECT COUNT(play_id) as playcount FROM mp3act_playhistory WHERE user_id={$_SESSION['sess_userid']} GROUP BY user_id"; $result = mysql_query($query); $result2 = mysql_query($query2); $row = mysql_fetch_array($result); $row2 = mysql_fetch_array($result2); if (mysql_num_rows($result2) == 0) { $row2['playcount'] = 0; } $dayssince = (time() - strtotime($row['date_created'])) / (60 * 60 * 24); $output = "<div class=\"head\">"; $output .= "<h2>{$_SESSION['sess_firstname']} {$_SESSION['sess_lastname']}'s Account ({$_SESSION['sess_username']})</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Date Joined:</strong> {$row['date_created']}<br/>\n"; $output .= "<strong>Songs Played:</strong> {$row2['playcount']}<br/>\n"; $output .= "<strong>Daily Average:</strong> " . round($row2['playcount'] / $dayssince, 2) . " songs/day<br/><br/>\n"; $output .= "<a href='#' onclick=\"editUser('info',0); return false;\" >Edit User Info</a><br/>"; $output .= "<a href='#' onclick=\"editUser('settings',0); return false;\" >Edit User Settings</a><br/>"; $output .= "<a href='#' onclick=\"editUser('pass',0); return false;\" >Change Password</a><br/><br/>"; if (hasScrobbler($_SESSION['sess_userid'])) { $as = getScrobblerStats($_SESSION['sess_userid']); $output .= "<strong>AudioScrobbler Submission Queue:</strong> {$as['count']} songs " . ($as['count'] > 0 ? "<a href='#' onclick=\"submitScrobbler({$_SESSION['sess_userid']}); return false;\" title='Force Submission to AudioScrobbler'>[submit]</a>" : "") . "<br/>\n"; $output .= "<strong>AudioScrobbler Response:</strong> {$as['last_result']}<br/>\n"; $output .= "<a href='http://www.audioscrobbler.com/user/{$as['username']}' target='_new' title='View Your AudioSrobbler Statistics Page'>View Your AudioSrobbler Statistics Page</a><br/><br/>\n"; } $output .= "</p>"; break; case 'random': $output = "<div class=\"head\">"; $output .= "<h2>Random Mix Maker</h2></div>"; $output .= "<form onsubmit='return randPlay(this)' method='get' action=''>\n<p>"; if ($_SESSION['sess_playmode'] == "streaming") { $output .= "<strong>Number of Songs</strong><br/>\n\n <select name='random_count'>\n <option value=10>10 </option>\n <option value=20>20 </option>\n <option value=30>30 </option>\n <option value=40>40 </option>\n <option value=50>50 </option>\n </select><br/>\n"; } $output .= "<strong>Random Type</strong><br/>\n\n <select name='random_type' onchange=\"getRandItems(this.options[selectedIndex].value); return false;\" >\n <option value='' >Choose Type...</option>\n <option value='artists' >Artists</option>\n <option value='genre' >Genre</option>\n <option value='albums' >Albums</option>\n <option value='all' >Everything</option>\n </select><br/>\n"; $output .= "<strong>Random Items</strong>\n<span id='rand_items'></span>\n <br/><br/>"; $output .= "<input type='submit' value='play mix' class='btn' />"; $output .= "</form></p>\n"; break; case 'playlists': $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM mp3act_saved_playlists WHERE private=0"; $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<h2>Saved Playlists</h2></div>"; $output .= "<p><strong>Public Playlists</strong></p>\n"; $output .= "<ul>\n"; if (mysql_num_rows($result) == 0) { $output .= "No Public Playlists"; } while ($row = mysql_fetch_array($result)) { $output .= "<li><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title='Load this Saved Playlist'><img src=\"img/add.gif\" /></a> " . (accessLevel(10) ? "<a href=\"#\" onclick=\"deletePlaylist({$row['playlist_id']}); return false;\" title='DELETE this Saved Playlist'><img src=\"img/rem.gif\" /></a>" : "") . " <a onclick=\"updateBox('saved_pl',{$row['playlist_id']}); \" title='Click to View Playlist' href='#'>{$row['playlist_name']} - {$row['songcount']} Songs ({$row['time2']})</a></li>"; } $output .= "</ul>\n"; $output .= "<p><strong>Your Private Playlists</strong></p>\n"; $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM mp3act_saved_playlists WHERE private=1 AND user_id={$_SESSION['sess_userid']} ORDER BY playlist_id DESC"; $result = mysql_query($query); $output .= "<ul>\n"; if (mysql_num_rows($result) == 0) { $output .= "No Private Playlists"; } while ($row = mysql_fetch_array($result)) { $output .= "<li><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title='Load this Saved Playlist'><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"deletePlaylist({$row['playlist_id']}); return false;\" title='DELETE this Saved Playlist'><img src=\"img/rem.gif\" /></a> <a onclick=\"updateBox('saved_pl',{$row['playlist_id']}); \" title='Click to View Playlist' href='#'>{$row['playlist_name']} - {$row['songcount']} Songs ({$row['time2']})</a></li>"; } $output .= "</ul>\n"; break; case 'saved_pl': $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM mp3act_saved_playlists WHERE playlist_id={$itemid}"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title=\"Load Playlist\">load playlist</a></div>"; $output .= "<h2>View Saved Playlist</h2></div>"; $output .= "<p><strong>Playlist Info</strong><br/>{$row['songcount']} Songs<br/>{$row['time2']}</p>\n"; $output .= "<p><strong>Playlist Songs</strong></p>\n"; $output .= "<ul>\n"; $songs = explode(",", $row['playlist_songs']); $count = 0; foreach ($songs as $song) { $query = "SELECT mp3act_songs.*,SEC_TO_TIME(mp3act_songs.length) AS length,mp3act_artists.artist_name FROM mp3act_artists,mp3act_songs WHERE mp3act_songs.song_id={$song} AND mp3act_artists.artist_id=mp3act_songs.artist_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}>{$row['artist_name']} - {$row['name']}<p>{$row['numplays']} Plays<br/><em>{$row['length']}</em></p></li>"; $count++; } $output .= "</ul>\n"; break; case 'about': $output = "<div class=\"head\">"; $output .= "<h2>GrammaFone Music System - svn version</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Date: </strong>October 27, 2007<br/>\n"; $output .= "<strong>Website: </strong><a href='http://www.grammafone.com' target='_blank'>http://www.grammafone.com</a><br/>\n"; $output .= "<strong>Support: </strong><a href='http://trac.grammafone.com' target='_blank'>http://trac.grammafone.com</a><br/>\n"; $output .= "<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\" target='_blank'>\n<input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\">\n<input type=\"image\" src=\"https://www.paypal.com/en_US/i/btn/x-click-but21.gif\" border=\"0\" name=\"submit\" alt=\"Make payments with PayPal - it's fast, free and secure!\">\n<img alt=\"\" border=\"0\" src=\"https://www.paypal.com/en_AU/i/scr/pixel.gif\" width=\"1\" height=\"1\">\n<input type=\"hidden\" name=\"encrypted\" value=\"-----BEGIN PKCS7-----MIIHVwYJKoZIhvcNAQcEoIIHSDCCB0QCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYAJBtzpANBhSaIZTvkhGR3593GW/s4qVqCczeHYIcaeiXGDlqUPYexaoVE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5ROkJazUA1z8paDvmrwAsM=-----END PKCS7-----\n\"></form>\n"; $output .= "</p>"; $output .= "<h3>Thanks to:</h3>\n"; $output .= "<p>Jon Buda</p>\n"; break; case 'stats': $query = "SELECT * FROM mp3act_stats"; $result = mysql_query($query); $row = mysql_fetch_array($result); $query = "SELECT COUNT(user_id) AS users FROM mp3act_users"; $result = mysql_query($query); $row2 = mysql_fetch_array($result); $query = "SELECT COUNT(play_id) AS songs FROM mp3act_playhistory"; $result = mysql_query($query); $row3 = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>Server Statistics</h2></div>"; $output .= "<p>\n"; $output .= "<a href='#' onclick=\"updateBox('recentadd',0); return false;\" >Recently Added Albums</a><br/>"; $output .= "<a href='#' onclick=\"updateBox('recentplay',0); return false;\" >Recently Played Songs</a><br/>"; $output .= "<a href='#' onclick=\"updateBox('topplay',0); return false;\" >Top Played Songs</a><br/>"; $output .= "</p>\n"; $output .= "<h3>Local Server Statistics</h3>\n"; $output .= "<p><strong>Songs:</strong> {$row['num_songs']}<br/>\n"; $output .= "<strong>Albums:</strong> {$row['num_albums']}<br/>\n"; $output .= "<strong>Artists:</strong> {$row['num_artists']}<br/>\n"; $output .= "<strong>Genres:</strong> {$row['num_genres']}<br/><br/>\n"; $output .= "<strong>Total Time:</strong> {$row['total_time']}<br/>\n"; $output .= "<strong>Total Size:</strong> {$row['total_size']}<br/><br/>\n"; $output .= "<strong>Registered Users:</strong> {$row2['users']}<br/>\n"; $output .= "<strong>Songs Played:</strong> {$row3['songs']}<br/></p>\n"; break; case 'recentadd': $query = "SELECT mp3act_albums.album_name,mp3act_albums.album_id,\n\t\t\tmp3act_artists.artist_name, \n\t\t\tDATE_FORMAT(mp3act_songs.date_entered,'%m.%d.%Y') as pubdate \n\t\t\tFROM mp3act_songs,mp3act_albums,mp3act_artists \n\t\t\tWHERE mp3act_songs.album_id=mp3act_albums.album_id \n\t\t\tAND mp3act_artists.artist_id=mp3act_songs.artist_id \n\t\t\tGROUP BY mp3act_songs.album_id ORDER BY mp3act_songs.date_entered DESC LIMIT 40"; $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Recently Added Albums</h2></div><ul>"; $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><small>{$row['pubdate']}</small> <a href=\"#\" onclick=\"pladd('album',{$row['album_id']}); return false;\" title=\"Add Album to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('album',{$row['album_id']}); return false;\" title=\"Play this Album Now\"><img src=\"img/play.gif\" /></a> <a href=\"#\" onclick=\"updateBox('album',{$row['album_id']}); return false;\" title=\"View Details of {$row['album_name']}\"><em>{$row['artist_name']}</em> - {$row['album_name']}</a></li>"; $count++; } $output .= "</ul>"; break; case 'topplay': $query = "SELECT mp3act_albums.album_name, mp3act_songs.numplays, mp3act_songs.name, \n\t\t\tmp3act_artists.artist_name,mp3act_songs.song_id \n\t\t\tFROM mp3act_songs,mp3act_albums,mp3act_artists \n\t\t\tWHERE mp3act_songs.album_id=mp3act_albums.album_id \n\t\t\tAND mp3act_artists.artist_id=mp3act_songs.artist_id \n\t\t\tAND mp3act_songs.numplays > 0 \n\t\t\tORDER BY mp3act_songs.numplays DESC LIMIT 40"; $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Top Played Songs</h2></div><ul>"; $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><small>{$row['numplays']} Plays</small> <a href=\"#\" onclick=\"pladd('song',{$row['song_id']}); return false;\" title=\"Add Song to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('song',{$row['song_id']}); return false;\" title=\"Play this Song Now\"><img src=\"img/play.gif\" /></a> <em>{$row['artist_name']}</em> - {$row['name']}</li>"; $count++; } $output .= "</ul>"; break; case 'recentplay': $query = "SELECT mp3act_songs.name, mp3act_songs.song_id, \n\t\t\tmp3act_artists.artist_name,\n\t\t\tDATE_FORMAT(mp3act_playhistory.date_played,'%m.%d.%Y') as playdate \n\t\t\tFROM mp3act_songs,mp3act_artists,mp3act_playhistory \n\t\t\tWHERE mp3act_songs.song_id=mp3act_playhistory.song_id\n\t\t\tAND mp3act_artists.artist_id=mp3act_songs.artist_id \n\t\t\tORDER BY mp3act_playhistory.play_id DESC LIMIT 40"; $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Recently Played Songs</h2></div><ul>"; $count = 1; while ($row = mysql_fetch_array($result)) { $count % 2 == 0 ? $alt = "class=\"alt\"" : ($alt = ''); $output .= "<li {$alt}><small>{$row['playdate']}</small> <a href=\"#\" onclick=\"pladd('song',{$row['song_id']}); return false;\" title=\"Add Song to Current Playlist\"><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"play('song',{$row['song_id']}); return false;\" title=\"Play this Song Now\"><img src=\"img/play.gif\" /></a> <em>{$row['artist_name']}</em> - {$row['name']}</li>"; $count++; } $output .= "</ul>"; break; } return $output; }
function musicLookup($type, $itemid) { mp3act_connect(); switch ($type) { case 'browse': $output = "<div class=\"head\">"; $output .= "<h2>Browse the Music Database</h2></div>"; $output .= "<p>"; $output .= "<strong>By Artist Beginning With</strong><br/>" . letters() . "<br/></p>\n"; $output .= "<p><strong>By Genre</strong><br/>\n"; $output .= genreForm() . "<br/><br/>\n"; $output .= "<input type='button' value='Browse All Albums' onclick=\"updateBox('all','All'); return false;\" class='btn2' />\n"; $output .= "</p>\n"; break; case 'search': $output = "<div class=\"head\">"; $output .= "<h2>Search the Music Database</h2></div>"; $output .= "<form onsubmit='return searchMusic(this)' method='get' action=''>\n"; $output .= "<p>\n\t\t\t\t<strong>Keywords</strong><br/>\n\t\t\t\t<input type='text' onfocus='this.select()' name='searchbox' size='35' id='searchbox' value='[enter your search terms]' />\n \t\t<br/><br/>\n \t\t<strong>Narrow Your Search</strong>\n \t\t<br/>\n \t\t<select name='search_options' size='1'>\n \t\t\t<option value='all'>All Fields</option>\n \t\t\t<option value='artists'>Artists</option>\n \t\t\t<option value='albums'>Albums</option>\n \t\t\t<option value='songs'>Songs</option>\n \t\t</select><br/><br/>\n \t\t<input type='submit' value='submit search' class='btn' /></form>"; $output .= "</p>\n"; break; case 'letter': if ($itemid == "#") { $query = "SELECT * FROM mp3act_artists \n WHERE artist_name \n LIKE '0%' \n OR artist_name LIKE '1%' \n OR artist_name LIKE '2%' \n OR artist_name LIKE '3%' \n OR artist_name LIKE '4%' \n OR artist_name LIKE '5%' \n OR artist_name LIKE '6%' \n OR artist_name LIKE '7%' \n OR artist_name LIKE '8%'\n OR artist_name LIKE '9%'\n ORDER BY artist_name"; } else { $query = "SELECT * FROM mp3act_artists\n WHERE artist_name LIKE '{$itemid}%'\n ORDER BY artist_name"; } $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<h2>Artists Beginning with '" . strtoupper($itemid) . "'</h2></div>"; $output .= "<p>\n\t\t\t\t<strong>Artist Listing</strong></p>\n\t\t\t\t<ul>"; $count = 1; while ($row = mysql_fetch_array($result)) { $alt = getAlt($count); $output .= "<li {$alt}><a href=\"#\" onclick=\"updateBox('artist',{$row['artist_id']}); return false;\" title=\"View Albums for {$row['prefix']} {$row['artist_name']}\">{$row['prefix']} {$row['artist_name']}</a></li>\n"; $count++; } $output .= "</ul>\n"; break; case 'all': $output = "<div class=\"head\">"; //$output .= "<div class=\"right\"><a href='#' onclick=\"updateBox('all',$itemid-30); return false;\">Prev Page</a> <a href='#' onclick=\"updateBox('all',$itemid+30); return false;\">Next Page</a> </div>"; $output .= "<h2>All Albums</h2></div> "; $output .= "<p>\n\t\t\t\t<strong>Album Listing</strong></p>"; // $start = $itemid; $query = "SELECT mp3act_artists.artist_name,mp3act_artists.prefix,mp3act_albums.* FROM mp3act_albums,mp3act_artists WHERE mp3act_albums.artist_id=mp3act_artists.artist_id ORDER BY artist_name,album_name"; /* LIMIT $start,30"; */ $output = buildAlbumList($output, $query); break; case 'album': $query = "SELECT mp3act_albums.*,mp3act_artists.artist_name,mp3act_artists.prefix,COUNT(mp3act_songs.song_id) as tracks,SEC_TO_TIME(SUM(mp3act_songs.length)) as time FROM mp3act_albums,mp3act_artists,mp3act_songs WHERE mp3act_albums.album_id={$itemid} AND mp3act_albums.artist_id=mp3act_artists.artist_id AND mp3act_songs.album_id={$itemid} GROUP BY mp3act_songs.album_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); $album_art = ''; if ($row['album_art'] == "") { $row['album_art'] = art_insert($row['album_id'], $row['artist_name'], $row['album_name']); if ($row['album_art'] != '') { $album_art = "<img onmouseover=\"showAlbumArt('block'); return false;\" onmouseout=\"showAlbumArt('none'); return false;\" src=\"art/{$row['album_art']}\" />\n"; } } elseif ($row['album_art'] != "fail") { $album_art = "<img onmouseover=\"showAlbumArt('block'); return false;\" onmouseout=\"showAlbumArt('none'); return false;\" src=\"art/{$row['album_art']}\" />\n"; } $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"play('album'," . $row['album_id'] . "); return false;\" title=\"Play this Album Now\">play</a> <a href=\"#\" onclick=\"pladd('album',{$row['album_id']}); return false;\" title=\"Add Album to Current Playlist\">add</a> " . (getSystemSetting("downloads") == 1 || getSystemSetting("downloads") == 2 && accessLevel(5) ? "<a href=\"#\" onclick=\"newWindow('download',{$row['album_id']}); return false;\" title=\"Download this Album Now\">download</a>" : "") . "</div>"; $output .= "<h2>" . $row['album_name'] . "</h2>" . $row['prefix'] . " " . $row['artist_name'] . "</div>"; $output .= "<p>{$album_art}\n"; $output .= "\t<strong>Tracks:</strong> {$row['tracks']}<br/>\n"; $output .= $row['album_year'] != 0 ? "<strong>Year:</strong> " . $row['album_year'] . "<br/>\n" : ""; $output .= "\t<strong>Genre:</strong> <a href=\"#\" onclick=\"updateBox('genre','{$row['album_genre']}'); return false;\" title=\"View Artists from {$row['album_genre']} Genre\">{$row['album_genre']}</a><br/>\n"; $output .= "\t<strong>Play Time:</strong> {$row['time']}\n"; $output .= "\t<br/><br/>\n"; $output .= "\t<strong>Album Tracks</strong></p>\n"; $output .= "<img id='bigart' src=\"art/{$row['album_art']}\" />\n"; $query = "SELECT *,SEC_TO_TIME(length) as length FROM mp3act_songs WHERE album_id={$itemid} ORDER BY track"; $output = buildSongList($output, mysql_query($query)); break; case 'genre': $query = "SELECT mp3act_artists.artist_id,mp3act_artists.artist_name,mp3act_artists.prefix FROM mp3act_artists,mp3act_albums WHERE mp3act_albums.album_genre='{$itemid}' AND mp3act_artists.artist_id=mp3act_albums.artist_id GROUP BY mp3act_artists.artist_id ORDER BY mp3act_artists.artist_name"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>Artists for Genre '{$itemid}'</h2></div>"; $output .= "<p>\n\t\t\t\t<strong>Artist Listing</strong></p>\n\t\t\t\t<ul>"; $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $alt = getAlt($count); $output .= "<li {$alt}><a href=\"#\" onclick=\"updateBox('artist',{$row['artist_id']}); return false;\" title=\"View Albums for {$row['artist_name']}\">{$row['prefix']} {$row['artist_name']}</a></li>\n"; $count++; } $output .= "</ul>\n"; break; case 'artist': $query = "SELECT artist_id,artist_name,prefix FROM mp3act_artists WHERE artist_id={$itemid}"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>{$row['prefix']} {$row['artist_name']}</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Album Listing</strong></p>\n"; $query = "SELECT mp3act_albums.* FROM mp3act_albums WHERE mp3act_albums.artist_id={$itemid} ORDER BY mp3act_albums.album_name"; $output = buildAlbumList($output, $query); break; case 'admin': $output = "<div class=\"head\">"; $output .= "<h2>Administration Panel</h2></div>"; $output .= "<p>\n"; $output .= "<strong>System Settings</strong><br/>\n"; $output .= "<a href='#' onclick=\"editSettings(0); return false;\" title='Edit System Systems'>Edit System Settings</a><br/>\n"; $output .= "</p>\n"; $output .= "<p>\n"; $output .= "<strong>Database Functions</strong><br/>\n"; $output .= "<a href='#' onclick=\"newWindow('add',0); return false;\" title='Add Music to the Database'>Add New Music to the Database</a><br/>\n"; $output .= "<a href='#' onclick=\"clearDB(); return false;\" title='Clear out the Database'>Clear Out the Music Database and Play History</a><br/>\n"; $output .= "</p>"; $output .= "<p>\n"; $output .= "<strong>User Functions</strong><br/>\n"; $output .= "<a href='#' onclick=\"adminEditUsers(0,'',''); return false;\" title='Edit User Permissions'>Edit User Accounts</a><br/>\n"; $output .= "<a href='#' onclick=\"adminAddUser(0); return false;\" title='Add New User Account'>Add New User Account</a><br/>\n"; $output .= "</p>"; if (getSystemSetting("invite_mode") == 1) { $output .= "<form onsubmit='return sendInvite(this)' method='get' action=''>\n"; $output .= "<p id='invite'>"; $output .= "<br/><strong>Send an Invitation for Registration<br/>\n"; $output .= "<input type='text' onfocus='this.select()' name='email' id='email' value='Enter Email Address of Recipient' size='32' /><br/>\n"; $output .= "<br/><input type='submit' value='send invite' class='btn' /></form>"; $output .= "</p>"; } break; case 'prefs': $query = "SELECT DATE_FORMAT(mp3act_users.date_created,'%M %D, %Y') as date_created FROM mp3act_users WHERE mp3act_users.user_id={$_SESSION['sess_userid']}"; $query2 = "SELECT COUNT(play_id) as playcount FROM mp3act_playhistory WHERE user_id={$_SESSION['sess_userid']} GROUP BY user_id"; $result = mysql_query($query); $result2 = mysql_query($query2); $row = mysql_fetch_array($result); $row2 = mysql_fetch_array($result2); if (mysql_num_rows($result2) == 0) { $row2['playcount'] = 0; } $dayssince = (time() - strtotime($row['date_created'])) / (60 * 60 * 24); $output = "<div class=\"head\">"; $output .= "<h2>{$_SESSION['sess_firstname']} {$_SESSION['sess_lastname']}'s Account ({$_SESSION['sess_username']})</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Date Joined:</strong> {$row['date_created']}<br/>\n"; $output .= "<strong>Songs Played:</strong> {$row2['playcount']}<br/>\n"; $output .= "<strong>Daily Average:</strong> " . round($row2['playcount'] / $dayssince, 2) . " songs/day<br/><br/>\n"; $output .= "<a href='#' onclick=\"editUser('info',0); return false;\" >Edit User Info</a><br/>"; $output .= "<a href='#' onclick=\"editUser('settings',0); return false;\" >Edit User Settings</a><br/>"; $output .= "<a href='#' onclick=\"editUser('pass',0); return false;\" >Change Password</a><br/>"; $output .= "</p>"; break; case 'random': $output = "<div class=\"head\">"; $output .= "<h2>Random Mix Maker</h2></div>"; $output .= "<form onsubmit='return randPlay(this)' method='get' action=''>\n<p>"; if ($_SESSION['sess_playmode'] == "streaming") { $output .= "<strong>Number of Songs</strong><br/>\n\n\t\t\t\t<select name='random_count'>\n\t\t\t\t<option value=10>10 </option>\n\t\t\t\t<option value=20>20 </option>\n\t\t\t\t<option value=30>30 </option>\n\t\t\t\t<option value=40>40 </option>\n\t\t\t\t<option value=50>50 </option>\n </select><br/>\n"; } $output .= "<strong>Random Type</strong><br/>\n\n\t\t\t\t<select name='random_type' onchange=\"getRandItems(this.options[selectedIndex].value); return false;\" >\n\t\t\t\t<option value='' >Choose Type...</option>\n\t\t\t\t<option value='artists' >Artists</option>\n\t\t\t\t<option value='genre' >Genre</option>\n\t\t\t\t<option value='albums' >Albums</option>\n\t\t\t\t<option value='all' >Everything</option>\n </select><br/>\n"; $output .= "<strong>Random Items</strong>\n<span id='rand_items'></span>\n\t\t\t<br/><br/>"; $output .= "<input type='submit' value='play mix' class='btn' />"; $output .= "</form></p>\n"; break; case 'playlists': $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM mp3act_saved_playlists WHERE private=0"; $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<h2>Saved Playlists</h2></div>"; $output .= "<p><strong>Public Playlists</strong></p>\n"; $output .= "<ul>\n"; if (mysql_num_rows($result) == 0) { $output .= "Zero Saved Playlists"; } while ($row = mysql_fetch_array($result)) { $output .= "<li><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title='Load this Saved Playlist'><img src=\"img/add.gif\" /></a> <a onclick=\"updateBox('saved_pl',{$row['playlist_id']}); \" title='Click to View Playlist' href='#'>{$row['playlist_name']} - {$row['songcount']} Songs ({$row['time2']})</a></li>"; } $output .= "</ul>\n"; $output .= "<p><strong>Your Private Playlists</strong></p>\n"; $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM mp3act_saved_playlists WHERE private=1 AND user_id={$_SESSION['sess_userid']} ORDER BY playlist_id DESC"; $result = mysql_query($query); $output .= "<ul>\n"; if (mysql_num_rows($result) == 0) { $output .= "Zero Saved Playlists"; } while ($row = mysql_fetch_array($result)) { $output .= "<li><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title='Load this Saved Playlist'><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"deletePlaylist({$row['playlist_id']}); return false;\" title='DELETE this Saved Playlist'><img src=\"img/rem.gif\" /></a> <a onclick=\"updateBox('saved_pl',{$row['playlist_id']}); \" title='Click to View Playlist' href='#'>{$row['playlist_name']} - {$row['songcount']} Songs ({$row['time2']})</a></li>"; } $output .= "</ul>\n"; break; case 'saved_pl': $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM mp3act_saved_playlists WHERE playlist_id={$itemid}"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title=\"Load Playlist\">load playlist</a></div>"; $output .= "<h2>View Saved Playlist</h2></div>"; $output .= "<p><strong>Playlist Info</strong><br/>{$row['songcount']} Songs<br/>{$row['time2']}</p>\n"; $output .= "<p><strong>Playlist Songs</strong></p>\n"; $output .= "<ul>\n"; $songs = explode(",", $row['playlist_songs']); $count = 0; foreach ($songs as $song) { $query = "SELECT mp3act_songs.*,SEC_TO_TIME(mp3act_songs.length) AS length,mp3act_artists.artist_name FROM mp3act_artists,mp3act_songs WHERE mp3act_songs.song_id={$song} AND mp3act_artists.artist_id=mp3act_songs.artist_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); $alt = getAlt($count); $output .= "<li {$alt}>{$row['artist_name']} - {$row['name']}<p>{$row['numplays']} Plays<br/><em>{$row['length']}</em></p></li>"; $count++; } $output .= "</ul>\n"; break; case 'about': $output = "<div class=\"head\">"; $output .= "<h2>mp3act Music System - v" . getSystemSetting("version") . "</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Date: </strong>May 31, 2005<br/>\n"; $output .= "<strong>Author: </strong><a href='http://www.jonbuda.com' target='_blank'>Jon Buda</a> | <a href='http://www.visiblebits.com' target='_blank'>A VisibleBits Production</a><br/>\n"; $output .= "<strong>Website: </strong><a href='http://www.mp3act.net' target='_blank'>http://www.mp3act.net</a><br/>\n"; $output .= "<strong>Support: </strong><a href='http://www.mp3act.net/support/' target='_blank'>http://www.mp3act.net/support/</a><br/>\n"; $output .= "<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\" target='_blank'>\n<input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\">\n<input class='noborder' title='Donate to mp3act!' type=\"image\" src=\"img/paypal_donate.gif\" border=\"0\" name=\"submit\" alt=\"Make payments with PayPal - it's fast, free and secure!\">\n<input type=\"hidden\" name=\"encrypted\" value=\"-----BEGIN PKCS7-----MIIHFgYJKoZIhvcNAQcEoIIHBzCCBwMCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0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feP8x7+7g1S3/u+AoHVk5FQgaiRbGni2EKUO2il8YvjlwWLeRxJLuBPoTYeyMgGNFCTu/8TUSus0kpb8tpcFZWg1TGrhuX90XIbPjmisS-----END PKCS7-----\">\n</form>\n"; $output .= "</p>"; $output .= "<h3>Thanks to Contributors and Testers</h3>\n"; $output .= "<p>Ben Callam<br/>Joe Doss<br/>All of 708 Park St.</p>\n"; break; case 'stats': $query = "SELECT * FROM mp3act_stats"; $result = mysql_query($query); $row = mysql_fetch_array($result); $query = "SELECT COUNT(user_id) AS users FROM mp3act_users"; $result = mysql_query($query); $row2 = mysql_fetch_array($result); $query = "SELECT COUNT(play_id) AS songs FROM mp3act_playhistory"; $result = mysql_query($query); $row3 = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>Server Statistics</h2></div>"; $output .= "<p>\n"; $output .= "<a href='#' onclick=\"updateBox('recentadd',0); return false;\" >Recently Added Albums</a><br/>"; $output .= "<a href='#' onclick=\"updateBox('recentplay',0); return false;\" >Recently Played Songs</a><br/>"; $output .= "<a href='#' onclick=\"updateBox('topplay',0); return false;\" >Top Played Songs</a><br/>"; $output .= "</p>\n"; $output .= "<h3>Local Server Statistics</h3>\n"; $output .= "<p><strong>Songs:</strong> {$row['num_songs']}<br/>\n"; $output .= "<strong>Albums:</strong> {$row['num_albums']}<br/>\n"; $output .= "<strong>Artists:</strong> {$row['num_artists']}<br/>\n"; $output .= "<strong>Genres:</strong> {$row['num_genres']}<br/><br/>\n"; $output .= "<strong>Total Time:</strong> {$row['total_time']}<br/>\n"; $output .= "<strong>Total Size:</strong> {$row['total_size']}<br/><br/>\n"; $output .= "<strong>Registered Users:</strong> {$row2['users']}<br/>\n"; $output .= "<strong>Songs Played:</strong> {$row3['songs']}<br/></p>\n"; break; case 'recentadd': $query = "SELECT mp3act_albums.album_name,mp3act_albums.album_id,\n\t\t\tmp3act_artists.artist_name, \n\t\t\tDATE_FORMAT(mp3act_songs.date_entered,'%m.%d.%Y') as pubdate \n\t\t\tFROM mp3act_songs,mp3act_albums,mp3act_artists \n\t\t\tWHERE mp3act_songs.album_id=mp3act_albums.album_id \n\t\t\tAND mp3act_artists.artist_id=mp3act_songs.artist_id \n\t\t\tGROUP BY mp3act_songs.album_id ORDER BY mp3act_songs.date_entered DESC LIMIT 40"; $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Recently Added Albums</h2></div>"; $output = buildAlbumList($output, $query, 'pubdate'); break; case 'topplay': $query = "SELECT mp3act_albums.album_name, mp3act_songs.numplays, mp3act_songs.name, \n\t\t\tmp3act_artists.artist_name,mp3act_songs.song_id \n\t\t\tFROM mp3act_songs,mp3act_albums,mp3act_artists \n\t\t\tWHERE mp3act_songs.album_id=mp3act_albums.album_id \n\t\t\tAND mp3act_artists.artist_id=mp3act_songs.artist_id \n\t\t\tAND mp3act_songs.numplays > 0 \n\t\t\tORDER BY mp3act_songs.numplays DESC LIMIT 40"; $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Top Played Songs</h2></div>"; $output = buildSongList($output, mysql_query($query), 'numplays'); break; case 'recentplay': $query = "SELECT mp3act_songs.name, mp3act_songs.song_id, \n\t\t\tmp3act_artists.artist_name,\n\t\t\tDATE_FORMAT(mp3act_playhistory.date_played,'%m.%d.%Y') as playdate \n\t\t\tFROM mp3act_songs,mp3act_artists,mp3act_playhistory \n\t\t\tWHERE mp3act_songs.song_id=mp3act_playhistory.song_id\n\t\t\tAND mp3act_artists.artist_id=mp3act_songs.artist_id \n\t\t\tORDER BY mp3act_playhistory.play_id DESC LIMIT 40"; $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Recently Played Songs</h2></div>"; $output = buildSongList($output, mysql_query($query)); break; } return $output; }
function musicLookup($type, $itemid) { grammafone_connect(); switch ($type) { case 'browse': $query = "SELECT * FROM grammafone_stats"; $result = mysql_query($query); $row = mysql_fetch_array($result); $query = "SELECT COUNT(user_id) AS users FROM grammafone_users"; $result = mysql_query($query); $row2 = mysql_fetch_array($result); $query = "SELECT COUNT(play_id) AS songs FROM grammafone_playhistory"; $result = mysql_query($query); $row3 = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>Browse the Music Collection</h2>"; $output .= browseSelection() . "</div>"; $output .= "<h3>Local Server Statistics</h3>\n"; $output .= "<p><strong>Songs:</strong> {$row['num_songs']}<br/>\n"; $output .= "<strong>Albums:</strong> {$row['num_albums']}<br/>\n"; $output .= "<strong>Artists:</strong> {$row['num_artists']}<br/>\n"; $output .= "<strong>Genres:</strong> {$row['num_genres']}<br/><br/>\n"; $output .= "<strong>Total Time:</strong> {$row['total_time']}<br/>\n"; $output .= "<strong>Total Size:</strong> {$row['total_size']}<br/><br/>\n"; $output .= "<strong>Registered Users:</strong> {$row2['users']}<br/>\n"; $output .= "<strong>Songs Played:</strong> {$row3['songs']}<br/></p>\n"; $output .= "<p>"; // $output .= "<strong>By Artist Beginning With</strong><br/>" . letters() . "<br/></p>\n"; // $output .= "<p><strong>By Genre</strong><br/>\n"; // $output .= genreForm() . "<br/><br/>\n"; // $output .= "<input type='button' value='Browse All Albums' onclick=\"updateBox('all','All'); return false;\" class='btn2' />\n"; $output .= "</p>\n"; break; case 'search': $output = "<div class=\"head\">"; $output .= "<h2>Search the Music Collection</h2>"; $output .= "<form onsubmit='return searchMusic(this)' method='get' action=''>\n"; $output .= "\n\t\t\t<input type='text' onfocus='this.select()' name='searchbox' size='25' id='searchbox' value='[enter your search terms]' />\n\t\t\t<select name='search_options' size='1'>\n\t\t\t <option value='all'>Narrow Search By...</option>\n\t\t\t <option value='artists'>Artists</option>\n\t\t\t <option value='albums'>Albums</option>\n\t\t\t <option value='songs'>Songs</option>\n\t\t\t</select>\n\t\t\t<input type='submit' value='GO' class='btn' /></form>"; $output .= "</div>"; break; case 'letter': if ($itemid == "#") { $query = "SELECT * FROM grammafone_artists \n\t\tWHERE artist_name \n\t\tLIKE '0%' \n\t\tOR artist_name LIKE '1%' \n\t\tOR artist_name LIKE '2%' \n\t\tOR artist_name LIKE '3%' \n\t\tOR artist_name LIKE '4%' \n\t\tOR artist_name LIKE '5%' \n\t\tOR artist_name LIKE '6%' \n\t\tOR artist_name LIKE '7%' \n\t\tOR artist_name LIKE '8%'\n\t\tOR artist_name LIKE '9%'\n\t\tORDER BY artist_name"; } else { $query = "SELECT * FROM grammafone_artists\n\t\tWHERE artist_name LIKE '{$itemid}%'\n\t\tORDER BY artist_name"; } $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<h2>Artists Beginning with '" . strtoupper($itemid) . "'</h2></div>"; $output .= "<h2 id=\"breadcrumb\"></h2>"; $output .= "<p>\n\t\t\t\t<strong>Artist Listing</strong></p>" . letters() . "\n\t\t\t\t\n\t\t\t\t<ul>"; $count = 1; while ($row = mysql_fetch_array($result)) { $alt = getAlt($count); $output .= "<li {$alt}><a href=\"#\" onclick=\"updateBox('artist',{$row['artist_id']}); return false;\" title=\"View Albums for {$row['prefix']} {$row['artist_name']}\">{$row['prefix']} {$row['artist_name']}</a></li>\n"; $count++; } $output .= "</ul>\n"; break; case 'all': $output = "<div class=\"head\">"; $output .= "<h2>Browsing All Albums</h2>"; $output .= browseSelection() . "</div>"; // $output .= "<strong><h3>All Album Listing (Sorted by Album Name):</strong></h3>"; $query = "SELECT \n\t\t\tgrammafone_artists.artist_name,\n\t\t\tgrammafone_artists.prefix,\n\t\t\tgrammafone_albums.* \n\t\t FROM \n\t\t\tgrammafone_albums,\n\t\t\tgrammafone_artists \n\t\t WHERE \n\t\t\tgrammafone_albums.artist_id=grammafone_artists.artist_id \n\t\t ORDER BY \n\t\t album_name"; $output = buildAlbumList($output, $query); break; case 'album': $query = "SELECT grammafone_albums.*,grammafone_artists.artist_name,grammafone_artists.prefix,COUNT(grammafone_songs.song_id) as tracks,SEC_TO_TIME(SUM(grammafone_songs.length)) as time FROM grammafone_albums,grammafone_artists,grammafone_songs WHERE grammafone_albums.album_id={$itemid} AND grammafone_albums.artist_id=grammafone_artists.artist_id AND grammafone_songs.album_id={$itemid} GROUP BY grammafone_songs.album_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); $album_art = ''; if ($row['album_art'] == "") { $row['album_art'] = art_insert($row['album_id'], $row['artist_name'], $row['album_name']); if ($row['album_art'] != '') { $album_art = "<img onmouseover=\"showAlbumArt('block'); return false;\" onmouseout=\"showAlbumArt('none'); return false;\" src=\"art/{$row['album_art']}\" />\n"; } } elseif ($row['album_art'] != "fail") { $album_art = "<img onmouseover=\"showAlbumArt('block'); return false;\" onmouseout=\"showAlbumArt('none'); return false;\" src=\"art/{$row['album_art']}\" />\n"; } $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"stream('album'," . $row['album_id'] . "); return false;\" title=\"Stream this Album Now\">stream</a> <a href=\"#\" onclick=\"pladd('album',{$row['album_id']}); return false;\" title=\"Add Album to Current Playlist\">add</a> " . (getSystemSetting("downloads") == 1 || getSystemSetting("downloads") == 2 && accessLevel(5) ? "<a href=\"#\" onclick=\"newWindow('download',{$row['album_id']}); return false;\" title=\"Download this Album Now\">download</a>" : "") . "</div>"; $output .= "<h2>" . $row['album_name'] . "</h2>" . $row['prefix'] . " " . $row['artist_name'] . "</div>"; $output .= "<h2 id=\"breadcrumb\"></h2>"; $output .= "<p>{$album_art}\n"; $output .= " <strong>Tracks:</strong> {$row['tracks']}<br/>\n"; $output .= $row['album_year'] != 0 ? "<strong>Year:</strong> " . $row['album_year'] . "<br/>\n" : ""; $output .= " <strong>Genre:</strong> <a href=\"#\" onclick=\"updateBox('genre','{$row['album_genre']}'); return false;\" title=\"View Artists from {$row['album_genre']} Genre\">{$row['album_genre']}</a><br/>\n"; $output .= " <strong>Play Time:</strong> {$row['time']}\n"; $output .= " <br/><br/>\n"; $output .= " <strong>Album Tracks</strong></p>\n"; $output .= "<img id='bigart' src=\"art/{$row['album_art']}\" />\n"; $query = "SELECT *,SEC_TO_TIME(length) as length FROM grammafone_songs WHERE album_id={$itemid} ORDER BY track"; $output = buildSongList($output, mysql_query($query)); break; case 'genre': $query = "SELECT grammafone_artists.artist_id,grammafone_artists.artist_name,grammafone_artists.prefix FROM grammafone_artists,grammafone_albums WHERE grammafone_albums.album_genre='{$itemid}' AND grammafone_artists.artist_id=grammafone_albums.artist_id GROUP BY grammafone_artists.artist_id ORDER BY grammafone_artists.artist_name"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>Artists for Genre '{$itemid}'</h2></div>"; $output .= "<p>\n\t\t\t\t<strong>Artist Listing</strong></p>" . letters() . "\n\t\t\t\t<ul>"; $result = mysql_query($query); $count = 1; while ($row = mysql_fetch_array($result)) { $alt = getAlt($count); $output .= "<li {$alt}><a href=\"#\" onclick=\"updateBox('artist',{$row['artist_id']}); return false;\" title=\"View Albums for {$row['artist_name']}\">{$row['prefix']} {$row['artist_name']}</a></li>\n"; $count++; } $output .= "</ul>\n"; break; case 'artist': $query = "SELECT artist_id,artist_name,prefix FROM grammafone_artists WHERE artist_id={$itemid}"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<h2>{$row['prefix']} {$row['artist_name']}</h2></div>"; $output .= "<h2 id=\"breadcrumb\"></h2>"; $output .= "<p>\n"; $output .= "<strong>Album Listing</strong></p>\n"; $query = "SELECT grammafone_albums.* FROM grammafone_albums WHERE grammafone_albums.artist_id={$itemid} ORDER BY grammafone_albums.album_name"; $output = buildAlbumList($output, $query); break; case 'admin': $output = "<div class=\"head\">"; $output .= "<h2>Administration Panel</h2></div>"; $output .= "<p>\n"; $output .= "<strong>System Settings</strong><br/>\n"; $output .= "<a href='#' onclick=\"editSettings(0); return false;\" title='Edit System Systems'>Edit System Settings</a><br/>\n"; $output .= "</p>\n"; $output .= "<p>\n"; $output .= "<strong>Database Functions</strong><br/>\n"; $output .= "<a href='#' onclick=\"newWindow('add',0); return false;\" title='Add Music to the Database'>Add New Music to the Database</a><br/>\n"; $output .= "<a href='#' onclick=\"clearDB(); return false;\" title='Clear out the Database'>Clear Out the Music Database and Play History</a><br/>\n"; $output .= "</p>"; $output .= "<p>\n"; $output .= "<strong>User Functions</strong><br/>\n"; $output .= "<a href='#' onclick=\"adminEditUsers(0,'',''); return false;\" title='Edit User Permissions'>Edit User Accounts</a><br/>\n"; $output .= "<a href='#' onclick=\"adminAddUser(0); return false;\" title='Add New User Account'>Add New User Account</a><br/>\n"; $output .= "</p>"; if (getSystemSetting("invite_mode") == 1) { $output .= "<form onsubmit='return sendInvite(this)' method='get' action=''>\n"; $output .= "<p id='invite'>"; $output .= "<br/><strong>Send an Invitation for Registration<br/>\n"; $output .= "<input type='text' onfocus='this.select()' name='email' id='email' value='Enter Email Address of Recipient' size='32' /><br/>\n"; $output .= "<br/><input type='submit' value='send invite' class='btn' /></form>"; $output .= "</p>"; } break; case 'prefs': $query = "SELECT DATE_FORMAT(grammafone_users.date_created,'%M %D, %Y') as date_created FROM grammafone_users WHERE grammafone_users.user_id={$_SESSION['sess_userid']}"; $query2 = "SELECT COUNT(play_id) as playcount FROM grammafone_playhistory WHERE user_id={$_SESSION['sess_userid']} GROUP BY user_id"; $result = mysql_query($query); $result2 = mysql_query($query2); $row = mysql_fetch_array($result); $row2 = mysql_fetch_array($result2); if (mysql_num_rows($result2) == 0) { $row2['playcount'] = 0; } $dayssince = (time() - strtotime($row['date_created'])) / (60 * 60 * 24); $output = "<div class=\"head\">"; $output .= "<h2>{$_SESSION['sess_firstname']} {$_SESSION['sess_lastname']}'s Account ({$_SESSION['sess_username']})</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Date Joined:</strong> {$row['date_created']}<br/>\n"; $output .= "<strong>Songs Played:</strong> {$row2['playcount']}<br/>\n"; $output .= "<strong>Daily Average:</strong> " . round($row2['playcount'] / $dayssince, 2) . " songs/day<br/><br/>\n"; $output .= "<a href='#' onclick=\"editUser('info',0); return false;\" >Edit User Info</a><br/>"; $output .= "<a href='#' onclick=\"editUser('settings',0); return false;\" >Edit User Settings</a><br/>"; $output .= "<a href='#' onclick=\"editUser('pass',0); return false;\" >Change Password</a><br/>"; if (hasScrobbler($_SESSION['sess_userid'])) { $as = getScrobblerStats($_SESSION['sess_userid']); $output .= "<strong>AudioScrobbler Submission Queue:</strong> {$as['count']} songs " . ($as['count'] > 0 ? "<a href='#' onclick=\"submitScrobbler({$_SESSION['sess_userid']}); return false;\" title='Force Submission to AudioScrobbler'>[submit]</a>" : "") . "<br/>\n"; $output .= "<strong>AudioScrobbler Response:</strong> {$as['last_result']}<br/>\n"; $output .= "<a href='http://www.audioscrobbler.com/user/{$as['username']}' target='_new' title='View Your AudioSrobbler Statistics Page'>View Your AudioSrobbler Statistics Page</a><br/><br/>\n"; } $output .= "</p>"; break; case 'random': $output = "<div class=\"head\">"; $output .= "<h2>Random Mix Maker</h2></div>"; $output .= "<form onsubmit='return randPlay(this)' method='get' action=''>\n<p>"; if ($_SESSION['sess_playmode'] == "streaming") { $output .= "<strong>Number of Songs</strong><br/>\n\n\t\t\t\t<select name='random_count'>\n\t\t\t\t<option value=10>10 </option>\n\t\t\t\t<option value=20>20 </option>\n\t\t\t\t<option value=30>30 </option>\n\t\t\t\t<option value=40>40 </option>\n\t\t\t\t<option value=50>50 </option>\n\t </select><br/>\n"; } $output .= "<strong>Random Type</strong><br/>\n\n\t\t\t\t<select name='random_type' onchange=\"getRandItems(this.options[selectedIndex].value); return false;\" >\n\t\t\t\t<option value='' >Choose Type...</option>\n\t\t\t\t<option value='artists' >Artists</option>\n\t\t\t\t<option value='genre' >Genre</option>\n\t\t\t\t<option value='albums' >Albums</option>\n\t\t\t\t<option value='all' >Everything</option>\n\t </select><br/>\n"; $output .= "<strong>Random Items</strong>\n<span id='rand_items'></span>\n\t\t\t<br/><br/>"; $output .= "<input type='submit' value='play mix' class='btn' />"; $output .= "</form></p>\n"; break; case 'playlists': $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM grammafone_saved_playlists WHERE private=0"; $result = mysql_query($query); $output = "<div class=\"head\">"; $output .= "<h2>Saved Playlists</h2></div>"; $output .= "<p><strong>Public Playlists</strong></p>\n"; $output .= "<ul>\n"; if (mysql_num_rows($result) == 0) { $output .= "No Public Playlists"; } while ($row = mysql_fetch_array($result)) { $output .= "<li><a href=\"#\" onclick=\"deletePlaylist({$row['playlist_id']}); return false;\" title='Delete this Saved Playlist'><img src=\"img/rem.gif\" /></a> <a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title='Load this Saved Playlist'><img src=\"img/add.gif\" /></a> <a onclick=\"updateBox('saved_pl',{$row['playlist_id']}); \" title='Click to View Playlist' href='#'>{$row['playlist_name']} - {$row['songcount']} Songs ({$row['time2']})</a></li>"; } $output .= "</ul>\n"; $output .= "<p><strong>Your Private Playlists</strong></p>\n"; $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM grammafone_saved_playlists WHERE private=1 AND user_id={$_SESSION['sess_userid']} ORDER BY playlist_id DESC"; $result = mysql_query($query); $output .= "<ul>\n"; if (mysql_num_rows($result) == 0) { $output .= "No Private Playlists"; } while ($row = mysql_fetch_array($result)) { $output .= "<li><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title='Load this Saved Playlist'><img src=\"img/add.gif\" /></a> <a href=\"#\" onclick=\"deletePlaylist({$row['playlist_id']}); return false;\" title='DELETE this Saved Playlist'><img src=\"img/rem.gif\" /></a> <a onclick=\"updateBox('saved_pl',{$row['playlist_id']}); \" title='Click to View Playlist' href='#'>{$row['playlist_name']} - {$row['songcount']} Songs ({$row['time2']})</a></li>"; } $output .= "</ul>\n"; break; case 'saved_pl': $query = "SELECT *,SEC_TO_TIME(time) AS time2 FROM grammafone_saved_playlists WHERE playlist_id={$itemid}"; $result = mysql_query($query); $row = mysql_fetch_array($result); $output = "<div class=\"head\">"; $output .= "<div class=\"right\"><a href=\"#\" onclick=\"pladd('playlist',{$row['playlist_id']}); return false;\" title=\"Load Playlist \">load playlist</a></div>"; $output .= "<h2>View Saved Playlist</h2></div>"; $output .= "<p><strong>Playlist Info</strong><br/>{$row['songcount']} Songs<br/>{$row['time2']}</p>\n"; $output .= "<p><strong>Playlist Songs</strong></p>\n"; $output .= "<ul>\n"; $songs = explode(",", $row['playlist_songs']); $count = 0; foreach ($songs as $song) { $query = "SELECT grammafone_songs.*,SEC_TO_TIME(grammafone_songs.length) AS length,grammafone_artists.artist_name FROM grammafone_artists,grammafone_songs WHERE grammafone_songs.song_id={$song} AND grammafone_artists.artist_id=grammafone_songs.artist_id"; $result = mysql_query($query); $row = mysql_fetch_array($result); $alt = getAlt($count); $output .= "<li {$alt}>{$row['artist_name']} - {$row['name']}<p>{$row['numplays']} Plays<br/><em>{$row['length']}</em></p></li>"; $count++; } $output .= "</ul>\n"; break; case 'about': $output = "<div class=\"head\">"; $output .= "<h2>Gramophone.FM Music System - v" . getSystemSetting("version") . "</h2></div>"; $output .= "<p>\n"; $output .= "<strong>Date: </strong>2008<br/>\n"; $output .= "<strong>Website: </strong><a href='http://www.gramophone.fm' target='_blank'>http://www.gramophone.fm</a><br/>\n"; $output .= "<strong>Support: </strong><a href='http://forum.gramophone.fm' target='_blank'>http://forum.gramophone.fm</a><br/>\n"; $output .= "\n<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\" target=\"new\">\n<input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\">\n<input class='noborder' title='Donate to GrammaFone!' type=\"image\" src=\"https://www.paypal.com/en_AU/i/btn/btn_donate_LG.gif\" border=\"0\" name=\"submit\" alt=\"Make payments with PayPal - it's fast, free and secure!\">\n<img alt=\"\" border=\"0\" src=\"https://www.paypal.com/en_AU/i/scr/pixel.gif\" width=\"1\" height=\"1\">\n<input type=\"hidden\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IbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA4MDIxNzExMzIzMFowIwYJKoZIhvcNAQkEMRYEFC0FeVNe86b8gqiBmxEzD9ufQ1rLMA0GCSqGSIb3DQEBAQUABIGAeaPZKokjj7W19S2rHGNAulxTsyZqhyIwsm8wO89zDjpXpHQBZrbr1+T4M3SNk9bpePtAggHG49M+XwBUsQ/xebYvxeIWTCezhIEdt5tCjSQR2kE6jK/QrTfE6MTUzrh+K+AP9tkBafqOHN052LPBTFTzHmQFXhZVAMFF5CvW4Jw=-----END PKCS7-----\">\n</form>\n"; $output .= "</p>"; $output .= "<h3>Thanks to:</h3>\n"; $output .= "<p>Jon Buda</p>\n"; break; case 'recentadd': $query = "SELECT grammafone_albums.album_name,grammafone_albums.album_id,\n\t\t\tgrammafone_artists.artist_name, \n\t\t\tDATE_FORMAT(grammafone_songs.date_entered,'%m.%d.%Y') as pubdate \n\t\t\tFROM grammafone_songs,grammafone_albums,grammafone_artists \n\t\t\tWHERE grammafone_songs.album_id=grammafone_albums.album_id \n\t\t\tAND grammafone_artists.artist_id=grammafone_songs.artist_id \n\t\t\tGROUP BY grammafone_songs.album_id ORDER BY grammafone_songs.date_entered DESC LIMIT 40"; $output = "<div class=\"head\">"; // $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Recently Added Albums</h2>"; $output .= browseSelection() . "</div>"; $output = buildAlbumList($output, $query, 'pubdate'); break; case 'topplay': $query = "SELECT grammafone_albums.album_name, grammafone_songs.numplays, grammafone_songs.name, \n\t\t\tgrammafone_artists.artist_name,grammafone_songs.song_id \n\t\t\tFROM grammafone_songs,grammafone_albums,grammafone_artists \n\t\t\tWHERE grammafone_songs.album_id=grammafone_albums.album_id \n\t\t\tAND grammafone_artists.artist_id=grammafone_songs.artist_id \n\t\t\tAND grammafone_songs.numplays > 0 \n\t\t\tORDER BY grammafone_songs.numplays DESC LIMIT 40"; $output = "<div class=\"head\">"; // $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Top Played Songs</h2>"; $output .= browseSelection() . "</div>"; $output = buildSongList($output, mysql_query($query), 'numplays'); break; case 'recentplay': $query = "SELECT grammafone_songs.name, grammafone_songs.song_id, \n\t\t\tgrammafone_artists.artist_name,\n\t\t\tDATE_FORMAT(grammafone_playhistory.date_played,'%m.%d.%Y') as playdate \n\t\t\tFROM grammafone_songs,grammafone_artists,grammafone_playhistory \n\t\t\tWHERE grammafone_songs.song_id=grammafone_playhistory.song_id\n\t\t\tAND grammafone_artists.artist_id=grammafone_songs.artist_id \n\t\t\tORDER BY grammafone_playhistory.play_id DESC LIMIT 40"; $output = "<div class=\"head\">"; // $output .= "<div class=\"right\"><a href=\"#\" onclick=\"switchPage('stats'); return false;\" title=\"Return to Statistics Page\">back</a></div>"; $output .= "<h2>Recently Played Songs</h2>"; $output .= browseSelection() . "</div>"; $output = buildSongList($output, mysql_query($query)); break; } return $output; }