Exemplo n.º 1
0
            }
            echo "</a><br/>";
        }
        echo "</p>";
    }
    // close databse
    mysql_close($db_connection);
}
?>

<?php 
// PHP to display letters at the bottom
echo "<h3>View Actors or Directors (by First Name): </h3>";
$some = array(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z);
foreach ($some as $l) {
    letters($l);
}
function letters($letter)
{
    echo " <a href=./actors.php?first={$letter}>" . $letter . "</a> ";
    if ($letter != Z) {
        echo "|";
    }
}
?>

<p><p><p>



Exemplo n.º 2
0
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-----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-----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;
}
Exemplo n.º 3
0
 function show()
 {
     global $set, $apx, $db, $html;
     //Suche durchführen
     if ($_REQUEST['item'] && ($_REQUEST['name'] || $_REQUEST['profile']) || $_POST['sgroupid']) {
         $where = '';
         if ($_REQUEST['item']) {
             if ($_REQUEST['name']) {
                 $sc[] = "username LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "username_login LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             }
             if ($_REQUEST['profile']) {
                 $sc[] = "email LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "homepage LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "icq LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "aim LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "yim LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "msn LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "skype LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "realname LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "city LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "plz LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "interests LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "work LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "city LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "custom1 LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "custom2 LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "custom3 LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "custom4 LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "custom5 LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "custom6 LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "custom7 LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "custom8 LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "custom9 LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
                 $sc[] = "custom10 LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             }
             if (is_array($sc)) {
                 $where .= ' AND ( ' . implode(' OR ', $sc) . ' )';
             }
         }
         if ($_REQUEST['sgroupid']) {
             $where .= " AND a.groupid='" . intval($_REQUEST['sgroupid']) . "'";
         }
         $data = $db->fetch("SELECT userid FROM " . PRE . "_user AS a LEFT JOIN " . PRE . "_user_groups AS b USING(groupid) WHERE 1 " . $where);
         $ids = get_ids($data, 'userid');
         $ids[] = -1;
         $searchid = saveSearchResult('admin_user', $ids, array('item' => $_REQUEST['item'], 'name' => $_REQUEST['name'], 'profile' => $_REQUEST['profile'], 'groupid' => $_REQUEST['sgroupid']));
         header("HTTP/1.1 301 Moved Permanently");
         header('Location: action.php?action=user.show&who=' . $_REQUEST['who'] . '&searchid=' . $searchid);
         return;
     }
     //Voreinstellungen
     $_REQUEST['name'] = 1;
     quicklink('user.add');
     $layerdef[] = array('LAYER_TEAM', 'action.php?action=user.show', !$_REQUEST['who']);
     $layerdef[] = array('LAYER_ALL', 'action.php?action=user.show&amp;who=all', $_REQUEST['who'] == 'all');
     $layerdef[] = array('LAYER_ACTIVATE', 'action.php?action=user.show&amp;who=activate', $_REQUEST['who'] == 'activate');
     //Layer Header ausgeben
     $html->layer_header($layerdef);
     $orderdef[0] = 'user_login';
     $orderdef['active'] = array('a.active', 'DESC', 'COL_ACTIVE');
     $orderdef['user_login'] = array('a.username_login', 'ASC', 'COL_USER_LOGIN');
     $orderdef['user'] = array('a.username', 'ASC', 'COL_USER');
     $orderdef['regtime'] = array('a.reg_time', 'DESC', 'COL_REGTIME');
     $orderdef['lastactive'] = array('a.lastactive', 'DESC', 'COL_LASTACTIVE');
     $orderdef['group'] = array('b.name', 'ASC', 'COL_GROUP');
     //Suchergebnis?
     $resultFilter = '';
     if ($_REQUEST['searchid']) {
         $searchRes = getSearchResult('admin_user', $_REQUEST['searchid']);
         if ($searchRes) {
             list($resultIds, $resultMeta) = $searchRes;
             $_REQUEST['item'] = $resultMeta['item'];
             $_REQUEST['name'] = $resultMeta['name'];
             $_REQUEST['profile'] = $resultMeta['profile'];
             $_REQUEST['sgroupid'] = $resultMeta['groupid'];
             $resultFilter = " AND a.userid IN (" . implode(', ', $resultIds) . ")";
         } else {
             $_REQUEST['searchid'] = '';
         }
     }
     //Suchformular
     $data = $db->fetch("SELECT groupid,name FROM " . PRE . "_user_groups ORDER BY name ASC");
     if (count($data)) {
         foreach ($data as $res) {
             $grouplist .= '<option value="' . $res['groupid'] . '"' . iif($_REQUEST['sgroupid'] == $res['groupid'], ' selected="selected"') . '>' . replace($res['name']) . '</option>';
         }
     }
     $apx->tmpl->assign('ITEM', compatible_hsc($_REQUEST['item']));
     $apx->tmpl->assign('SNAME', $_REQUEST['name']);
     $apx->tmpl->assign('SPROFILE', $_REQUEST['profile']);
     $apx->tmpl->assign('GROUPS', $grouplist);
     $apx->tmpl->assign('WHO', $_REQUEST['who']);
     $apx->tmpl->parse('search');
     $layerFilter = '';
     if ($_REQUEST['who'] == 'all') {
         //$layerFilter = ""; //Nix :)
     } elseif ($_REQUEST['who'] == 'activate') {
         $layerFilter = " AND reg_key!='' ";
     } else {
         $admingroups = array();
         $data = $db->fetch("SELECT groupid FROM " . PRE . "_user_groups WHERE ( gtype='admin' OR gtype='indiv' )");
         if (count($data)) {
             foreach ($data as $res) {
                 $admingroups[] = $res['groupid'];
             }
         }
         $layerFilter = " AND a.groupid IN (" . implode(',', $admingroups) . ") ";
     }
     letters('action.php?action=user.show&amp;who=' . $_REQUEST['who'] . iif($_REQUEST['searchid'], '&amp;searchid=' . $_REQUEST['searchid']));
     $letterfilter = '';
     if ($_REQUEST['letter'] == 'spchar') {
         $letterfilter = " AND username NOT REGEXP(\"^[a-zA-Z]\") ";
     } elseif ($_REQUEST['letter']) {
         $letterfilter = " AND username LIKE '" . addslashes($_REQUEST['letter']) . "%' ";
     }
     list($count) = $db->first("SELECT count(userid) FROM " . PRE . "_user AS a WHERE 1 " . $layerFilter . $letterfilter . $resultFilter);
     pages('action.php?action=user.show&amp;who=' . $_REQUEST['who'] . '&amp;letter=' . $_REQUEST['letter'] . '&amp;sortby=' . $_REQUEST['sortby'] . iif($_REQUEST['searchid'], '&amp;searchid=' . $_REQUEST['searchid']), $count);
     $data = $db->fetch("SELECT a.userid,a.username_login,a.username,a.active,a.reg_key,a.lastactive,b.name FROM " . PRE . "_user AS a LEFT JOIN " . PRE . "_user_groups AS b USING(groupid) WHERE 1 " . $layerFilter . $letterfilter . $resultFilter . " " . getorder($orderdef) . getlimit());
     $this->show_print($data);
     orderstr($orderdef, 'action.php?action=user.show&amp;who=' . $_REQUEST['who'] . '&amp;letter=' . $_REQUEST['letter'] . iif($_REQUEST['searchid'], '&amp;searchid=' . $_REQUEST['searchid']));
     save_index($_SERVER['REQUEST_URI']);
     //Layer-Footer ausgeben
     $html->layer_footer();
 }
Exemplo n.º 4
0
 function ushow()
 {
     global $set, $db, $apx, $html;
     //Suche durchführen
     if ($_REQUEST['item'] && ($_REQUEST['title'] || $_REQUEST['text'])) {
         $where = '';
         //Suche wird ausgeführt...
         if ($_REQUEST['title']) {
             $sc[] = "title LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "fullname LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
         }
         if ($_REQUEST['text']) {
             $sc[] = "text LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
         }
         if ($_REQUEST['else']) {
             $sc[] = "address LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "email LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "phone LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "website LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "founder LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "founding_year LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "founding_country LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "legalform LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "headquaters LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "executive LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "sector LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
             $sc[] = "products LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
         }
         if (is_array($sc)) {
             $where .= ' AND ( ' . implode(' OR ', $sc) . ' )';
         }
         $data = $db->fetch("SELECT id FROM " . PRE . "_products_units WHERE 1 " . $where);
         $ids = get_ids($data, 'id');
         $ids[] = -1;
         $searchid = saveSearchResult('admin_products_units', $ids, array('title' => $_REQUEST['title'], 'text' => $_REQUEST['text'], 'else' => $_REQUEST['else'], 'item' => $_REQUEST['item']));
         header("HTTP/1.1 301 Moved Permanently");
         header('Location: action.php?action=products.ushow&what=' . $_REQUEST['what'] . '&searchid=' . $searchid);
         return;
     }
     //Vorgaben
     $_REQUEST['title'] = 1;
     $_REQUEST['text'] = 1;
     quicklink('products.uadd');
     //Layer Header ausgeben
     $layerdef[] = array('UNITTYPE_ALL', 'action.php?action=products.ushow', !$_REQUEST['what']);
     $layerdef[] = array('UNITTYPE_PERSON', 'action.php?action=products.ushow&amp;what=person', $_REQUEST['what'] == 'person');
     $layerdef[] = array('UNITTYPE_COMPANY', 'action.php?action=products.ushow&amp;what=company', $_REQUEST['what'] == 'company');
     $html->layer_header($layerdef);
     $typeFilter = '';
     if (in_array($_REQUEST['what'], array('company', 'person'))) {
         $typeFilter = " AND type='" . $_REQUEST['what'] . "' ";
     }
     $orderdef[0] = 'title';
     $orderdef['title'] = array('title', 'ASC', 'COL_TITLE');
     //Suchergebnis?
     $resultFilter = '';
     if ($_REQUEST['searchid']) {
         $searchRes = getSearchResult('admin_products_units', $_REQUEST['searchid']);
         if ($searchRes) {
             list($resultIds, $resultMeta) = $searchRes;
             $_REQUEST['item'] = $resultMeta['item'];
             $_REQUEST['title'] = $resultMeta['title'];
             $_REQUEST['text'] = $resultMeta['text'];
             $_REQUEST['else'] = $resultMeta['else'];
             $resultFilter = " AND id IN (" . implode(', ', $resultIds) . ")";
         } else {
             $_REQUEST['searchid'] = '';
         }
     }
     $apx->tmpl->assign('ITEM', compatible_hsc($_REQUEST['item']));
     $apx->tmpl->assign('STITLE', (int) $_REQUEST['title']);
     $apx->tmpl->assign('STEXT', (int) $_REQUEST['text']);
     $apx->tmpl->assign('SELSE', (int) $_REQUEST['else']);
     $apx->tmpl->assign('WHAT', $_REQUEST['what']);
     $apx->tmpl->parse('usearch');
     //Letters
     letters('action.php?action=products.ushow&amp;what=' . $_REQUEST['what'] . iif($_REQUEST['searchid'], '&amp;searchid=' . $_REQUEST['searchid']));
     if (!$_REQUEST['letter']) {
         $_REQUEST['letter'] = 0;
     }
     $letterfilter = '';
     if ($_REQUEST['letter'] === 'spchar') {
         $letterfilter = " AND title NOT REGEXP(\"^[a-zA-Z]\") ";
     } elseif ($_REQUEST['letter']) {
         $letterfilter = " AND title LIKE '" . addslashes($_REQUEST['letter']) . "%' ";
     }
     list($count) = $db->first("SELECT count(id) FROM " . PRE . "_products_units WHERE 1 " . $typeFilter . $resultFilter . $letterfilter);
     pages('action.php?action=products.ushow&amp;what=' . $_REQUEST['what'] . iif($_REQUEST['searchid'], '&amp;searchid=' . $_REQUEST['searchid']) . '&amp;letter=' . $_REQUEST['letter'] . '&amp;sortby=' . $_REQUEST['sortby'], $count);
     $data = $db->fetch("SELECT * FROM " . PRE . "_products_units WHERE 1 " . $typeFilter . $resultFilter . $letterfilter . getorder($orderdef) . getlimit());
     $this->ushow_print($data);
     orderstr($orderdef, 'action.php?action=products.ushow&amp;what=' . $_REQUEST['what'] . iif($_REQUEST['searchid'], '&amp;searchid=' . $_REQUEST['searchid']) . '&amp;letter=' . $_REQUEST['letter']);
     save_index($_SERVER['REQUEST_URI']);
     //Layer-Footer ausgeben
     $html->layer_footer();
 }
Exemplo n.º 5
0
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-----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-----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;
}
Exemplo n.º 6
0
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\" name=\"encrypted\" value=\"-----BEGIN PKCS7-----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-----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;
}
Exemplo n.º 7
0
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-----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-----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;
}
Exemplo n.º 8
0
 } else {
     $number = $_GET['number'];
     $start = ($number - 1) * $lectors4page;
 }
 echo '<div class="main">Расписание <span class=warning>';
 if ($gr_mode == 1) {
     echo ' <a href="?' . reset_param_name($query_string, 'gr_mode') . '" class=success>по преподавателям</a> &nbsp; <b>по группе</b>';
 } else {
     echo ' <b>по преподавателям</b> <a href="?' . reset_param_name($query_string, 'gr_mode') . '&gr_mode=1" class=success>по группе</a>';
 }
 echo '</span>';
 if (isset($_SESSION['auth']) && $_SESSION['userType'] == 'преподаватель') {
     echo '<a href="lect_time_table.php" class=text title="' . $_SESSION['FIO'] . '"> добавить  расписание</a>';
 }
 echo '</div><div class="middle2">' . $sess . ' &nbsp;' . $def_settings['year_name'] . ' года</div><br>';
 letters();
 if ($gr_mode != 1) {
     $res05 = mysql_query('select count(if(status!="администратор",1,NULL)) from users');
 } else {
     $res05 = mysql_query('select count(*) from study_groups where year_id=' . $def_settings['year_id']);
 }
 $count = mysql_result($res05, 0, 0);
 $pages = $count / $lectors4page;
 $pages_and = $pages;
 $pages_and = intval($pages_and);
 if ($pages_and == $pages) {
     $pages = $pages_and;
 } else {
     $pages = $pages_and + 1;
 }
 if ($number > $pages || $number < 1) {
Exemplo n.º 9
0
                }
                $tabledata[$i]['RATING'] = $rate->display();
                $tabledata[$i]['RATING_VOTES'] = $rate->count();
                $tabledata[$i]['DISPLAY_RATING'] = 1;
            }
        }
    }
    $apx->tmpl->assign('PICTURE', $tabledata);
    $apx->tmpl->parse('gallery');
    require 'lib/_end.php';
}
//////////////////////////////////////////////////////////////////////////////////////////////////////// GALERIEN AUFLISTEN
//Verwendete Variablen auslesen
$parse = $apx->tmpl->used_vars('index');
//Letters
letters(mklink('gallery.php', 'gallery,{LETTER},1.html'));
if ($_REQUEST['letter']) {
    if ($_REQUEST['letter'] == 'spchar') {
        $where = "AND title NOT REGEXP(\"^[a-zA-Z]\")";
    } else {
        $where = "AND title LIKE '" . addslashes($_REQUEST['letter']) . "%'";
    }
}
if (!$_REQUEST['letter']) {
    $_REQUEST['letter'] = 0;
}
//Seitenzahlen
if ($set['gallery']['subgals']) {
    list($count) = $db->first("SELECT count(id) FROM " . PRE . "_gallery WHERE ( '" . time() . "' BETWEEN starttime AND endtime AND parents='|' " . section_filter() . " )");
} else {
    list($count) = $db->first("SELECT count(id) FROM " . PRE . "_gallery WHERE ( ( '" . time() . "' BETWEEN starttime AND endtime ) " . $where . " " . section_filter() . " )");
Exemplo n.º 10
0
function persian_normalizer($str)
{
    $str = numbers($str);
    return letters($str);
}
Exemplo n.º 11
0
$searchlink = mklink('user.php?action=search', 'user,search.html');
$apx->tmpl->assign('LINK_SEARCH', $searchlink);
//Anzahl
if (in_array('USERCOUNT', $parse)) {
    list($totalcount) = $db->first("SELECT count(*) FROM " . PRE . "_user WHERE active=1");
    $apx->tmpl->assign('USERCOUNT', $totalcount);
}
if (in_array('TODAYCOUNT', $parse)) {
    list($todaycount) = $db->first("SELECT count(*) FROM " . PRE . "_user WHERE active=1 AND reg_time>='" . mktime(0, 0, 0, date('n', time() - TIMEDIFF), date('d', time() - TIMEDIFF), date('Y', time() - TIMEDIFF)) . "'");
    $apx->tmpl->assign('TODAYCOUNT', $todaycount);
}
if (!$_REQUEST['letter']) {
    $_REQUEST['letter'] = '0';
}
//Buchstaben-Liste
letters(mklink('user.php?action=list&amp;sortby=' . $_REQUEST['sortby'], 'user,list,{LETTER},1.html' . iif($_REQUEST['sortby'], '?sortby=' . $_REQUEST['sortby'])));
if ($_REQUEST['letter']) {
    if ($_REQUEST['letter'] == 'spchar') {
        $where = "AND username NOT REGEXP(\"^[a-zA-Z]\")";
    } else {
        $where = "AND username LIKE '" . addslashes($_REQUEST['letter']) . "%'";
    }
}
if ($set['user']['listactiveonly']) {
    $where .= " AND reg_key='' ";
}
//Seitenzahlen
list($count) = $db->first("SELECT count(userid) FROM " . PRE . "_user WHERE ( active='1' " . $where . " )");
$pagelink = mklink('user.php?action=list&amp;sortby=' . $_REQUEST['sortby'] . '&amp;letter=' . $_REQUEST['letter'], 'user,list,' . $_REQUEST['letter'] . ',{P}.html' . iif($_REQUEST['sortby'], '?sortby=' . $_REQUEST['sortby']));
pages($pagelink, $count, $set['user']['userlistepp']);
//Orderby
Exemplo n.º 12
0
function musicLookup($type, $itemid)
{
    global $db;
    $sql_itemid = "'" . $db->escape($itemid) . "'";
    switch ($type) {
        case 'browse':
            $output = '<div class="head">
        <h2 class="music">' . t('Browse the Music Database') . '</h2></div>
        <p>
        <strong>' . t('By Artist Beginning With') . '</strong><br/>' . letters() . '<br/></p>
        <p><strong>' . t('By Genre') . '</strong><br/>
        ' . genreForm() . '<br/><br/>
        <input type="button" value="' . t('Browse All Albums') . '" onclick="updateBox(\'all\',\'All\'); return false;" class="btn2">
        </p>';
            break;
        case 'search':
            $output = '<div class="head">
        <h2 class="music">' . t('Search the Music Database') . '</h2></div>
        <form onsubmit="return searchMusic(this)" method="get" action="">
        <p>
        <strong>' . t('Keywords') . '</strong><br/>
        <input type="text" onfocus="this.select()" name="searchbox" size="35" id="searchbox" value="[' . t('Enter your search terms') . ']">
        <br/><br/>
        <strong>' . t('Narrow Your Search') . '</strong>
        <br/>
        <select name="search_options" size="1">
          <option value="all">' . t('All Fields') . '</option>
          <option value="artists">' . t('Artists') . '</option>
          <option value="albums">' . t('Albums') . '</option>
          <option value="songs">' . t('Songs') . '</option>
        </select><br/><br/>
        <input type="submit" value="' . t('Submit Search') . '" class="btn"></form>
        </p>';
            break;
        case 'letter':
            // Define the list of prefixes we wish to ignore (perhaps define them as database item(s) somewhere so users can extend them)
            $prefixes = explode(' ', t('MythMusic_Prefixes_To_Ignore'));
            if ($itemid == "#") {
                $query = "SELECT artist_id, artist_name, " . "LOWER(CASE WHEN SUBSTRING_INDEX(artist_name, ' ', 1) IN ('" . implode("', '", $prefixes) . "') " . "THEN " . "CONCAT( SUBSTRING(artist_name, INSTR(artist_name , ' ') + 1), ' (', SUBSTRING_INDEX(artist_name, ' ', 1), ')' ) " . "ELSE artist_name END) " . "AS artist_name_sort " . "FROM music_artists " . "GROUP BY artist_name_sort " . "HAVING artist_name REGEXP '^[0-9].*' " . "ORDER BY artist_name_sort";
            } else {
                $query = "SELECT artist_id, artist_name, " . "LOWER(CASE WHEN SUBSTRING_INDEX(artist_name, ' ', 1) IN ('" . implode("', '", $prefixes) . "') " . "THEN " . "CONCAT( SUBSTRING(artist_name, INSTR(artist_name , ' ') + 1), ' (', SUBSTRING_INDEX(artist_name, ' ', 1), ')' ) " . "ELSE artist_name END) " . "AS artist_name_sort " . "FROM music_artists " . "GROUP BY artist_name_sort " . "HAVING artist_name_sort " . "LIKE '" . $db->escape($itemid . '%') . "' " . "ORDER BY artist_name_sort";
            }
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $output = '<div class="head">
        <div class="right">
        <a class="music" href="#" onclick="updateBox(\'browse\',0); return false;"
         title="' . t('Browse') . '">' . t('Back') . '</a></div>
        <h2 class="music">' . sprintf(t('Artists Beginning with %s'), "'" . strtoupper($itemid) . "'") . '</h2></div>
        <p>
        <strong>' . t('Artist Listing') . '</strong></p>
        <ul class="music">';
            $alt = false;
            while ($row = $sh->fetch_array()) {
                $output .= '<li' . ($alt ? ' class="alt"' : '') . '>
          <a class="music" href="#"
           onclick="updateBox(\'artist\',' . $row['artist_id'] . '); return false;"
           title="' . sprintf(t('View Albums by %s'), $row['artist_name']) . '">' . $row['artist_name'] . '</a></li>';
                $alt = !$alt;
            }
            $sh->finish();
            $output .= '</ul>';
            break;
        case 'all':
            $output = '<div class="head">
        <div class="right">
        <a class="music" href="#" onclick="updateBox(\'browse\',0); return false;"
         title="' . t('Browse') . '">' . t('Back') . '</a></div>
        <h2 class="music">' . t('All Albums') . '</h2></div>
        <p>
        <strong>' . t('Album Listing') . '</strong></p>
        <ul class="music">';
            $start = $itemid;
            $query = 'SELECT ma.album_id, ma.album_name, mt.artist_name ' . 'FROM music_albums AS ma ' . 'LEFT JOIN music_artists AS mt ON ma.artist_id=mt.artist_id ' . 'ORDER BY album_name, artist_name';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $alt = false;
            while ($row = $sh->fetch_array()) {
                $output .= getHtmlAlbum($row['album_id'], $row['album_name'], $row['artist_name']);
            }
            $sh->finish();
            $output .= '</ul>';
            break;
        case 'album':
            // Get some statistics about the album
            $query = 'SELECT COUNT(*), SEC_TO_TIME(SUM(music_songs.length)/1000) ' . 'FROM music_songs ' . 'WHERE music_songs.album_id=' . $sql_itemid . ' ' . 'GROUP BY music_songs.album_id;';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $row = $sh->fetch_array();
            $sh->finish();
            $num_tracks = $row[0];
            $length = $row[1];
            // Attempt to find some album art.
            $query = 'SELECT ms.filename, ms.album_id, md.path, ma.artist_name, ma.artist_id, ms.directory_id, mal.album_name
                FROM music_songs AS ms
                     LEFT JOIN music_directories AS md
                            ON ms.directory_id=md.directory_id
                     LEFT JOIN music_artists AS ma
                            ON ms.artist_id=ma.artist_id
                     LEFT JOIN music_albums AS mal
                            ON ms.album_id=mal.album_id
               WHERE ms.album_id=' . $sql_itemid . '
               LIMIT 1';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $row = $sh->fetch_array();
            $sh->finish();
            // Load album art
            $art_id = $db->query_col('SELECT ma.albumart_id
                                    FROM music_albumart AS ma
                                         LEFT JOIN music_directories AS md
                                                ON ma.directory_id=md.directory_id
                                   WHERE ma.directory_id = ?
                                   AND ma.imagetype = 1
                                   LIMIT 1', $row['directory_id']);
            $output = '<div class="head">
        <div class="right">
        <a class="music" href="#"
         onclick="play(\'album\',' . $row['album_id'] . '); return false;"
         title="' . t('Play this Album Now') . '">' . t('Play') . '</a>
        <a class="music" href="#"
         onclick="pladd(\'album\',' . $row['album_id'] . '); return false;"
         title="' . t('Add Album to Current Playlist') . '">' . t('Add') . '</a>
        <a class="music" href="#" onclick="updateBox(\'artist\',' . $row['artist_id'] . '); return false;"
         title="' . $row['artist_name'] . '">' . t('Back') . '</a>
        </div>
        <h2 class="music">' . $row['album_name'] . '</h2>
        </div>' . (!empty($art_id) ? '<center><img width="200" src="' . stream_url() . 'stream?a=' . $art_id . '" /></center><br>' : '') . '<strong>' . t('Play Time') . ':</strong> ' . $length . '<br><br>
        <strong>' . t('Album Tracks') . '</strong>
        <ul class="music">';
            $query = 'SELECT ms.song_id, ms.track, ms.name, ms.length, ms.numplays, ms.rating, ' . 'SEC_TO_TIME(ms.length/1000) AS length, artist_name, genre ' . 'FROM music_songs AS ms ' . 'LEFT JOIN music_artists ON ms.artist_id=music_artists.artist_id ' . 'LEFT JOIN music_genres ON ms.genre_id=music_genres.genre_id ' . 'WHERE ms.album_id=' . $sql_itemid . ' ' . 'ORDER BY ms.track';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            while ($row = $sh->fetch_array()) {
                $output .= getHtmlSong($row['song_id'], $row['artist_name'], '', $row['track'], $row['name'], $row['length'], $row['numplays'], $row['genre'], $row['rating']);
            }
            $sh->finish();
            $output .= '</ul>';
            break;
        case 'genre':
            $output = '<div class="head">
        <div class="right">
        <a class="music" href="#" onclick="updateBox(\'browse\',0); return false;"
         title="' . t('Browse') . '">' . t('Back') . '</a></div>
        <h2 class="music">' . t('Songs for Genre') . " '" . utf8_encode($itemid) . "'</h2></div>\n        <p><strong>" . t('Songs') . '</strong></p>
        <ul class="music">';
            $query = 'SELECT ms.song_id, ms.name, SEC_TO_TIME(ms.length/1000) AS length, ms.numplays, ms.rating, ma.artist_name, mg.genre ' . 'FROM music_songs AS ms ' . 'LEFT JOIN music_artists AS ma ON ms.artist_id=ma.artist_id ' . 'LEFT JOIN music_genres AS mg ON ms.genre_id=mg.genre_id ' . 'WHERE genre=' . utf8_encode($sql_itemid);
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            while ($row = $sh->fetch_array()) {
                $output .= getHtmlSong($row['song_id'], $row['artist_name'], '', '', $row['name'], $row['length'], $row['numplays'], '', $row['rating']);
            }
            $sh->finish();
            $output .= '</ul>';
            break;
        case 'artist':
            $query = 'SELECT artist_name ' . 'FROM music_artists ' . 'WHERE artist_id=' . $sql_itemid;
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $row = $sh->fetch_array();
            $sh->finish();
            $artist = $row['artist_name'];
            $letter = !preg_match('/^[0-9]/', $artist) ? strtoupper($artist[0]) : '#';
            $output = '<div class="head">
        <div class="right">
        <a class="music" href="#" onclick="updateBox(\'letter\',\'' . $letter . '\'); return false;"
         title="' . sprintf(t('Artists Beginning with %s'), "'" . $letter . "'") . '">' . t('Back') . '</a></div>
        <h2 class="music">' . $artist . '</h2></div>
        <p><strong>' . sprintf(t('Albums with songs by %s'), '<i>' . $artist . '</i>') . '</strong></p>
        <ul class="music">';
            $query = 'SELECT ma.album_id, album_name, ma.year, ma.artist_id, artist_name' . ',SEC_TO_TIME(SUM(ms.length)/1000) AS length, COUNT(ms.song_id) AS num_tracks ' . 'FROM music_songs AS ms ' . 'LEFT JOIN music_albums AS ma ON ms.album_id=ma.album_id ' . 'LEFT JOIN music_artists AS mt ON ma.artist_id=mt.artist_id ' . 'WHERE ms.artist_id=' . $sql_itemid . ' ' . 'GROUP BY ma.album_id;';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            while ($row = $sh->fetch_array()) {
                $artist = '';
                if ($itemid != $row['artist_id']) {
                    $artist = $row['artist_name'];
                }
                $output .= getHtmlAlbum($row['album_id'], $row['album_name'], $artist, $row['year'], $row['num_tracks'], $row['length']);
            }
            $sh->finish();
            $output .= '</ul><p><strong>' . t('Songs') . '</strong></p>
        <ul class="music">';
            $query = 'SELECT ms.song_id, ms.track, ms.name, ms.length, ms.numplays, ms.rating, ' . 'SEC_TO_TIME(ms.length/1000) AS length, music_artists.artist_name, track, ' . 'music_albums.album_name, genre ' . 'FROM music_songs AS ms ' . 'LEFT JOIN music_artists ON ms.artist_id=music_artists.artist_id ' . 'LEFT JOIN music_albums ON ms.album_id=music_albums.album_id ' . 'LEFT JOIN music_genres ON ms.genre_id=music_genres.genre_id ' . 'WHERE ms.artist_id=' . $sql_itemid . ';';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            while ($row = $sh->fetch_array()) {
                $output .= getHtmlSong($row['song_id'], '', $row['album_name'], $row['track'], $row['name'], $row['length'], $row['numplays'], $row['genre'], $row['rating']);
            }
            $sh->finish();
            $output .= '</ul>';
            break;
        case 'random':
            $output = '<div class="head">
        <h2 class="music">' . t('Random Mix Maker') . '</h2></div>
        <form onsubmit="return randAdd(this)" method="get" action="">
        <strong>' . t('Number of Songs') . '</strong><br>
        <select name="random_count">
        <option>5</option>
        <option>10</option>
        <option>20</option>
        <option>30</option>
        <option>40</option>
        <option>50</option>
        <option>100</option>
        </select><br />

        <strong>' . t('Rating') . '</strong><br />
        <select name="rating">
        <option value="all">All</option>
        <option value=">">></option>
        <option value="=">=</option>
        <option value="<"><</option>
        </select>

        <select name="rating_value">
        <option value="9">9</option>
        <option value="8">8</option>
        <option value="7">7</option>
        <option value="6">6</option>
        <option value="5">5</option>
        <option value="4">4</option>
        <option value="3">3</option>
        <option value="2">2</option>
        <option value="1">1</option>
        </select><br />

        <strong>' . t('Random Type') . '</strong><br />

        <select name="random_type" onchange="getRandItems(this.options[selectedIndex].value); return false;">
        <option value="">' . t('Choose Type') . '...</option>
        <option value="artists">' . t('Artists') . '</option>
        <option value="genre">' . t('Genre') . '</option>
        <option value="albums">' . t('Albums') . '</option>
        <option value="all">' . t('Everything') . '</option>
        </select><br>
        <strong>' . t('Random Items') . '</strong>
        <span id="rand_items"></span>
        <br><br>
        <input type="submit" value="' . t('Add Mix') . '" class="btn">
        </form>';
            break;
        case 'playlists':
            $query = 'SELECT playlist_id, playlist_name, songcount, hostname, SEC_TO_TIME(length/1000) AS length ' . 'FROM music_playlists ' . 'WHERE hostname=\'\'';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $output = '<div class="head">
        <h2 class="music">' . t('Saved Playlists') . '</h2></div><br>';
            if ($sh->num_rows == 0) {
                $output .= t('No Public Playlists');
            } else {
                $unsaved_id = 0;
                $pl = internalGetPlaylist();
                if (!empty($pl['playlist_name']) && MYTH_WEB_PLAYLIST_NAME == $pl['playlist_name']) {
                    $unsaved_id = $pl['playlist_id'];
                }
                $output .= '<ul class="music">';
                while ($row = $sh->fetch_array()) {
                    $output .= getHtmlPlaylist($row['playlist_id'], $row['playlist_name'], $row['songcount'], $row['length'], $unsaved_id);
                }
                $output .= '</ul>';
            }
            $sh->finish();
            break;
        case 'saved_pl':
            $query = 'SELECT playlist_id, playlist_name, playlist_songs, songcount, SEC_TO_TIME(length/1000) AS length ' . 'FROM music_playlists ' . 'WHERE playlist_id=' . $sql_itemid;
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $row = $sh->fetch_array();
            $sh->finish();
            $unsaved_id = 0;
            $pl = internalGetPlaylist();
            if (!empty($pl['playlist_name']) && MYTH_WEB_PLAYLIST_NAME == $pl['playlist_name']) {
                $unsaved_id = $pl['playlist_id'];
            }
            $output = '<div class="head">
        <div class="right">
        <a class="music" href="#"
          onclick="checkPlaylistLoad(\'' . $row['playlist_id'] . '\', ' . $unsaved_id . ')' . ' && pladd(\'loadplaylist\',' . $row['playlist_id'] . '); return false;"
          title="' . t('Load Playlist') . '">' . t('Load') . '</a>
        <a class="music" href="#"
          onclick="pladd(\'playlist\',' . $row['playlist_id'] . '); return false;"
          title="' . t('Append to Current Playlist') . '">' . t('Append') . '</a>
        <a class="music" href="#"
          onclick="play(\'pl\',' . $row['playlist_id'] . '); return false;"
          title="' . t('Play this Playlist Now') . '">' . t('Play') . '</a>
        </div>
        <h2 class="music">' . t('View Saved Playlist') . '</h2></div>
        <p><strong>' . t('Playlist Info') . '</strong><br>' . sprintf('%s Songs', $row['songcount']) . '<br>' . $row['length'] . '</p>
        <p><strong>' . t('Playlist Items') . '</strong></p>';
            if (empty($row['playlist_songs'])) {
                $output = '<b>' . t('There are no items in this Playlist!') . '</b>';
            } else {
                // Load the song information
                $query = 'SELECT ms.song_id, mt.artist_name, ms.name, ma.album_name, ms.track' . ', SEC_TO_TIME(ms.length/1000) AS length ' . 'FROM music_songs AS ms ' . 'LEFT JOIN music_artists AS mt ON ms.artist_id=mt.artist_id ' . 'LEFT JOIN music_albums AS ma ON ms.album_id=ma.album_id ' . 'WHERE ms.song_id IN (' . $row['playlist_songs'] . ');';
                $sh = $db->query($query);
                if (!$sh) {
                    return;
                }
                $song_info = array();
                while ($row2 = $sh->fetch_array()) {
                    $song_info[$row2['song_id']] = $row2;
                }
                $sh->finish();
                // Load the sub-playlist information
                // NB: MySQL 3.xx cannot use the CAST() function hense the negative number decimal
                // conversion hack as outlined on: http://dev.mysql.com/doc/refman/4.1/en/cast-functions.html
                $query = 'SELECT playlist_id, playlist_name, SEC_TO_TIME(length/1000) AS length, songcount ' . 'FROM music_playlists ' . 'WHERE (-1.0 * (playlist_id+0.0)) IN (' . $row['playlist_songs'] . ');';
                $sh = $db->query($query);
                if (!$sh) {
                    return;
                }
                $pl_info = array();
                while ($row2 = $sh->fetch_array()) {
                    $pl_info[$row2['playlist_id']] = $row2;
                }
                $sh->finish();
                $songs = explode(',', $row['playlist_songs']);
                $output .= '<ul class="music">';
                foreach ($songs as $song_id) {
                    if ($song_id > 0) {
                        $row = $song_info[$song_id];
                        $output .= getHtmlSong($row['song_id'], $row['artist_name'], '', '', $row['name'], $row['length'], $row['numplays'], '', '');
                    } else {
                        if ($song_id < 0) {
                            $row = $pl_info[-1 * $song_id];
                            $output .= getHtmlPlaylist($row['playlist_id'], $row['playlist_name'], $row['songcount'], $row['length'], $unsaved_id, false);
                        }
                    }
                }
                $output .= '</ul>';
            }
            break;
        case 'stats':
            $query = 'SELECT * FROM music_stats';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $row = $sh->fetch_array();
            $sh->finish();
            $query = 'SELECT COUNT(*) AS songs FROM music_songs WHERE numplays>0';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $row2 = $sh->fetch_array();
            $sh->finish();
            $output = '<div class="head">
        <h2 class="music">' . t('Server Statistics') . '</h2></div>
        <p><a class="music" href="#" onclick="updateBox(\'recentadd\',0); return false;">' . t('Recently Added Albums') . '</a><br>
        <a class="music" href="#" onclick="updateBox(\'recentplay\',0); return false;">' . t('Recently Played Songs') . '</a><br>
        <a class="music" href="#" onclick="updateBox(\'topplay\',0); return false;">' . t('Top Played Songs') . '</a><br>
        <a class="music" href="#" onclick="updateBox(\'toprated\',0); return false;">' . t('Top Rated Songs') . '</a><br>
        </p>
        <h3>' . t('Local Server Statistics') . '</h3>
        <p>';
            foreach (array('music_songs' => t('Songs'), 'music_albums' => t('Albums'), 'music_artists' => t('Artists'), 'music_genres' => t('Genres')) as $table => $title) {
                $sh = $db->query('SELECT COUNT(*) FROM ' . $table . ';');
                if (!$sh) {
                    continue;
                }
                $count = $sh->fetch_array();
                $sh->finish();
                $output .= '<strong>' . $title . ':</strong> ' . $count[0] . '<br>';
            }
            $output .= '<br><strong>' . t('Songs Played') . ':</strong> ' . $row2['songs'] . '<br>';
            $sh = $db->query('SELECT COUNT(*) AS songs FROM music_songs WHERE rating > 0;');
            if (!$sh) {
                break;
            }
            $row3 = $sh->fetch_array();
            $sh->finish();
            $output .= '<strong>' . t('Songs Rated') . ':</strong> ' . $row3['songs'] . '<br></p>';
            break;
        case 'recentadd':
            $query = 'SELECT ma.album_name, ma.album_id, mt.artist_name, UNIX_TIMESTAMP(ms.date_entered) AS pubdate ' . 'FROM music_songs AS ms ' . 'LEFT JOIN music_albums AS ma ON ms.album_id=ma.album_id ' . 'LEFT JOIN music_artists AS mt ON ms.artist_id=mt.artist_id ' . 'GROUP BY ms.album_id ' . 'ORDER BY ms.date_entered DESC ' . 'LIMIT 40';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $output = '<div class="head">
        <div class="right">
        <a class="music" href="#"
          onclick="switchPage(\'stats\'); return false;"
          title="' . t('Return to Statistics Page') . '">' . t('Back') . '</a></div>
        <h2 class="music">' . t('Recently Added Albums') . '</h2></div>
        <ul class="music">';
            while ($row = $sh->fetch_array()) {
                $output .= getHtmlAlbum($row['album_id'], $row['album_name'], $row['artist_name'], '', '', '', date('m.d.Y', $row['pubdate']));
            }
            $sh->finish();
            $output .= '</ul>';
            break;
        case 'topplay':
            $query = 'SELECT ma.album_name, ms.numplays, ms.name, mt.artist_name, ms.song_id ' . 'FROM music_songs AS ms ' . 'LEFT JOIN music_albums AS ma ON ms.album_id=ma.album_id ' . 'LEFT JOIN music_artists AS mt ON ms.artist_id=mt.artist_id ' . 'WHERE ms.numplays > 0 ' . 'ORDER BY ms.numplays DESC ' . 'LIMIT 40';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $output = '<div class="head">
        <div class="right">
        <a class="music" href="#"
          onclick="switchPage(\'stats\'); return false;"
          title="' . t('Return to Statistics Page') . '">' . t('Back') . '</a></div>
        <h2 class="music">' . t('Top Played Songs') . '</h2></div>
        <ul class="music">';
            while ($row = $sh->fetch_array()) {
                $output .= getHtmlSong($row['song_id'], $row['artist_name'], '', '', $row['name'], '', '', '', '');
            }
            $sh->finish();
            $output .= '</ul>';
            break;
        case 'recentplay':
            $query = 'SELECT ms.name, ms.song_id, mt.artist_name, UNIX_TIMESTAMP(ms.lastplay) AS playdate ' . 'FROM music_songs AS ms ' . 'LEFT JOIN music_artists AS mt ON ms.artist_id=mt.artist_id ' . 'WHERE ms.numplays > 0 ' . 'ORDER BY ms.lastplay DESC ' . 'LIMIT 40';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $output = '<div class="head">
        <div class="right">
        <a class="music" href="#"
          onclick="switchPage(\'stats\'); return false;"
          title="' . t('Return to Statistics Page') . '">' . t('Back') . '</a></div>
        <h2 class="music">' . t('Recently Played Songs') . '</h2></div>
        <ul class="music">';
            while ($row = $sh->fetch_array()) {
                $output .= getHtmlSong($row['song_id'], $row['artist_name'], '', '', $row['name'], '', '', '', '');
            }
            $output .= '</ul>';
            break;
        case 'toprated':
            $query = 'SELECT ms.name, ms.song_id, ms.rating, mt.artist_name ' . 'FROM music_songs AS ms ' . 'LEFT JOIN music_artists AS mt ON ms.artist_id=mt.artist_id ' . 'ORDER BY ms.rating DESC ' . 'LIMIT 40';
            $sh = $db->query($query);
            if (!$sh) {
                break;
            }
            $output = '<div class="head">
          <div class="right">
            <a class="music" href="#"
              onclick="switchPage(\'stats\'); return false;"
              title="' . t('Return to Statistics Page') . '">' . t('Back') . '</a></div>
            <h2 class="music">' . t('Top Rated Songs') . '</h2></div>
            <ul class="music">';
            while ($row = $sh->fetch_array()) {
                $output .= getHtmlSong($row['song_id'], $row['artist_name'], '', '', $row['name'], '', '', '', $row['rating']);
            }
            $output .= '</ul>';
            break;
    }
    return $output;
}
Exemplo n.º 13
0
            $apx->tmpl->assign('RATING_NOFORM', 1);
        }
    }
    $apx->tmpl->parse($template);
    require 'lib/_end.php';
}
//////////////////////////////////////////////////////////////////////////////////////////////////////// ARTIKEL AUFLISTEN
//Headline + Titlebar
headline($apx->lang->get('HEADLINE_' . strtoupper($arttype)), mklink($link2file . '.php', $link2file . '.html'));
titlebar($apx->lang->get('HEADLINE_' . strtoupper($arttype)));
//Verwendete Variablen auslesen
$parse = $apx->tmpl->used_vars('index' . iif($arttype != 'normal', '_' . $arttype . 's'));
//Baum holen, wenn nur eine bestimmte Kategorie gezeigt werden soll
$cattree = articles_tree($_REQUEST['catid']);
//Letters
letters(mklink($link2file . '.php?catid=' . $_REQUEST['catid'], $link2file . ',{LETTER},' . $_REQUEST['catid'] . ',1.html'));
if (!$_REQUEST['letter']) {
    $_REQUEST['letter'] = 0;
}
if ($_REQUEST['letter']) {
    if ($_REQUEST['letter'] == 'spchar') {
        $where = "AND title NOT REGEXP(\"^[a-zA-Z]\")";
    } else {
        $where = "AND title LIKE '" . addslashes($_REQUEST['letter']) . "%'";
    }
}
//Seitenzahlen
list($count) = $db->first("SELECT count(id) FROM " . PRE . "_articles WHERE ( '" . time() . "' BETWEEN starttime AND endtime " . $where . " " . iif(count($cattree), "AND catid IN (" . @implode(',', $cattree) . ")") . " " . $artfilter . " " . section_filter() . " )");
pages(mklink($link2file . '.php?catid=' . $_REQUEST['catid'] . '&amp;letter=' . $_REQUEST['letter'], $link2file . ',' . $_REQUEST['letter'] . ',' . $_REQUEST['catid'] . ',{P}.html'), $count, $set['articles']['epp']);
//Ausgabe erfolgt
$data = $db->fetch("SELECT a.*,IF(a.sticky>=" . time() . ",1,0) AS sticky,b.username,b.email,b.pub_hidemail FROM " . PRE . "_articles AS a LEFT JOIN " . PRE . "_user AS b USING(userid) WHERE ( '" . time() . "' BETWEEN starttime AND endtime " . $where . " " . iif(count($cattree), "AND catid IN (" . @implode(',', $cattree) . ")") . " " . $artfilter . " " . section_filter() . " ) ORDER BY sticky DESC,starttime DESC " . getlimit($set['articles']['epp']));
Exemplo n.º 14
0
            header("HTTP/1.1 301 Moved Permanently");
            header('Location: ' . str_replace('&amp;', '&', mklink('manufacturers.php?action=search&searchid=' . $searchid, 'manufacturers.html?action=search&searchid=' . $searchid)));
        }
    }
    require 'lib/_end.php';
}
////////////////////////////////////////////////////////////////////////////////////////// HERSTELLER-LISTE
$apx->lang->drop('manusearch');
//Verwendete Variablen auslesen
$parse = $apx->tmpl->used_vars('manufacturers_index');
$where = '';
if (!$_REQUEST['letter']) {
    $_REQUEST['letter'] = '0';
}
//Buchstaben-Liste
letters(mklink('manufacturers.php?sortby=' . $_REQUEST['sortby'], 'manufacturers,{LETTER},1.html' . iif($_REQUEST['sortby'], '?sortby=' . $_REQUEST['sortby'])));
if ($_REQUEST['letter']) {
    if ($_REQUEST['letter'] == 'spchar') {
        $where .= " AND title NOT REGEXP(\"^[a-zA-Z]\") ";
    } else {
        $where .= " AND title LIKE '" . addslashes($_REQUEST['letter']) . "%' ";
    }
}
//Seitenzahlen
list($count) = $db->first("SELECT count(id) FROM " . PRE . "_products_units WHERE 1 " . $where);
$pagelink = mklink('manufacturers.php?sortby=' . $_REQUEST['sortby'] . '&amp;letter=' . $_REQUEST['letter'], 'manufacturers,' . $_REQUEST['letter'] . ',{P}.html' . iif($_REQUEST['sortby'], '?sortby=' . $_REQUEST['sortby']));
pages($pagelink, $count, $set['products']['manu_epp']);
//Orderby
$orderdef[0] = 'title';
$orderdef['title'] = array('title', 'ASC');
//Hersteller auslesen
Exemplo n.º 15
0
    $_REQUEST['type'] = 0;
}
//Typ-Filter
if ($_REQUEST['type']) {
    $where .= " AND type='" . addslashes($_REQUEST['type']) . "' ";
}
//System-Filter
if ($_REQUEST['system']) {
    $where .= " AND systems LIKE '%|" . $_REQUEST['system'] . "|%' ";
}
//Genere-Filter
if ($_REQUEST['genre']) {
    $where .= " AND genre='" . $_REQUEST['genre'] . "' ";
}
//Buchstaben-Liste
letters(mklink('releases.php?type=' . $_REQUEST['type'] . '&amp;sortby=' . $_REQUEST['sortby'], 'releases,' . $_REQUEST['type'] . ',{LETTER},1.html' . iif($_REQUEST['sortby'], '?sortby=' . $_REQUEST['sortby'])));
if ($_REQUEST['letter']) {
    if ($_REQUEST['letter'] == 'spchar') {
        $where .= " AND title NOT REGEXP(\"^[a-zA-Z]\") ";
    } else {
        $where .= " AND title LIKE '" . addslashes($_REQUEST['letter']) . "%' ";
    }
}
//Seitenzahlen
list($count) = $db->first("SELECT count(DISTINCT b.id) FROM " . PRE . "_products_releases AS a LEFT JOIN " . PRE . "_products AS b ON a.prodid=b.id WHERE b.active='1' AND a.stamp>='" . date('Ymd', time() - TIMEDIFF) . "' " . $where);
$pagelink = mklink('releases.php?type=' . $_REQUEST['type'] . '&amp;sortby=' . $_REQUEST['sortby'] . '&amp;letter=' . $_REQUEST['letter'], 'releases,' . $_REQUEST['type'] . ',' . $_REQUEST['letter'] . ',{P}.html' . iif($_REQUEST['sortby'], '?sortby=' . $_REQUEST['sortby']));
pages($pagelink, $count, $set['products']['relepp']);
//Produkte auslesen
$data = $db->fetch("SELECT DISTINCT a.stamp AS releasestamp,b.* FROM " . PRE . "_products_releases AS a LEFT JOIN " . PRE . "_products AS b ON a.prodid=b.id WHERE b.active='1' AND a.stamp>='" . date('Ymd', time() - TIMEDIFF) . "' " . $where . " ORDER BY a.stamp ASC " . getlimit($set['products']['relepp']));
$ids = get_ids($data, 'id');
$types = get_ids($data, 'type');
Exemplo n.º 16
0
 function show()
 {
     global $set, $db, $apx, $html;
     //Struktur reparieren
     if ($_REQUEST['repair'] && $set['gallery']['subgals']) {
         $this->cat->repair();
         echo 'Repair done!';
         return;
     }
     //Suche durchführen
     if (!$set['gallery']['subgals'] && $_REQUEST['item']) {
         $where = '';
         //Suchbegriff
         if ($_REQUEST['item']) {
             $where .= " AND title LIKE '%" . addslashes_like($_REQUEST['item']) . "%'";
         }
         $data = $db->fetch("SELECT id FROM " . PRE . "_gallery WHERE 1 " . $where);
         $ids = get_ids($data, 'id');
         $ids[] = -1;
         $searchid = saveSearchResult('admin_gallery', $ids, array('item' => $_REQUEST['item']));
         header("HTTP/1.1 301 Moved Permanently");
         header('Location: action.php?action=gallery.show&what=' . $_REQUEST['what'] . '&searchid=' . $searchid);
         return;
     }
     quicklink('gallery.add');
     //DnD-Hinweis
     if ($apx->user->has_right('gallery.edit') && ($set['gallery']['subgals'] || $set['gallery']['ordergal'] == 3)) {
         echo '<p class="hint">' . $apx->lang->get('USEDND') . '</p>';
     }
     $orderdef[0] = 'title';
     $orderdef['title'] = array('title', 'ASC', 'COL_TITLE');
     $orderdef['addtime'] = array('addtime', 'DESC', 'SORT_ADDTIME');
     $orderdef['starttime'] = array('starttime', 'DESC', 'COL_STARTTIME');
     //Suchergebnis?
     $resultFilter = '';
     if (!$set['gallery']['subgals'] && $_REQUEST['searchid']) {
         $searchRes = getSearchResult('admin_gallery', $_REQUEST['searchid']);
         if ($searchRes) {
             list($resultIds, $resultMeta) = $searchRes;
             $_REQUEST['item'] = $resultMeta['item'];
             $resultFilter = " AND a.id IN (" . implode(', ', $resultIds) . ")";
         } else {
             $_REQUEST['searchid'] = '';
         }
     }
     $col[] = array('&nbsp;', 0, '');
     $col[] = array('ID', 0, 'align="center"');
     $col[] = array('COL_TITLE', 60, 'class="title"');
     $col[] = array('COL_STARTTIME', 25, 'align="center"');
     $col[] = array('COL_COUNT', 15, 'align="center"');
     if (!$set['gallery']['subgals']) {
         $apx->tmpl->assign('ITEM', compatible_hsc($_REQUEST['item']));
         $apx->tmpl->parse('search');
         letters('action.php?action=gallery.show' . iif($_REQUEST['searchid'], '&amp;searchid=' . $_REQUEST['searchid']));
         if ($_REQUEST['letter'] == 'spchar') {
             $where = " AND title NOT REGEXP(\"^[a-zA-Z]\") ";
         } elseif ($_REQUEST['letter']) {
             $where = " AND title LIKE '" . addslashes($_REQUEST['letter']) . "%' ";
         }
         list($count) = $db->first("SELECT count(id) FROM " . PRE . "_gallery AS a WHERE 1 " . $resultFilter . $where . section_filter(true, 'secid'));
         pages('action.php?action=gallery.show' . iif($_REQUEST['searchid'], '&amp;searchid=' . $_REQUEST['searchid']) . '&amp;sortby=' . $_REQUEST['sortby'] . '&amp;letter=' . $_REQUEST['letter'], $count);
         //Orderby
         if ($set['gallery']['ordergal'] == 3) {
             $sortby = ' ORDER BY ord ASC ';
             $orderdef = array();
         } else {
             $sortby = getorder($orderdef);
         }
         $data = $db->fetch("SELECT id,secid,title,starttime,endtime FROM " . PRE . "_gallery AS a WHERE 1 " . $resultFilter . $where . section_filter(true, 'secid') . $sortby . getlimit());
     } else {
         $data = $this->cat->getTree(array('*'), null, section_filter(false, 'secid'));
     }
     if (count($data)) {
         //Untergalerien?
         if ($set['gallery']['subgals']) {
             list($space, $follow) = parse_tree($data);
             $isactive[0] = true;
             //Root ist immer aktiv ;)
         }
         $i = ($_REQUEST['p'] - 1) * $set['admin_epp'];
         foreach ($data as $res) {
             ++$i;
             if ($res['level'] == 1) {
                 ++$tree;
             }
             $isactive[$res['level']] = $res['starttime'];
             if (!$res['starttime']) {
                 $tabledata[$i]['COL1'] = '<img src="design/reddot.gif" alt="' . $apx->lang->get('CORE_INACTIVE') . '" title="' . $apx->lang->get('CORE_INACTIVE') . '" />';
             } elseif ($res['endtime'] < time()) {
                 $tabledata[$i]['COL1'] = '<img src="design/greendotcross.gif" alt="' . $apx->lang->get('CORE_INACTIVE') . '" title="' . $apx->lang->get('CORE_INACTIVE') . '" />';
             } elseif ($res['starttime'] > time()) {
                 $tabledata[$i]['COL1'] = '<img src="design/greendotwait.gif" alt="' . $apx->lang->get('CORE_ACTIVE') . '" title="' . $apx->lang->get('CORE_ACTIVE') . '" />';
             } else {
                 $tabledata[$i]['COL1'] = '<img src="design/greendot.gif" alt="' . $apx->lang->get('CORE_ACTIVE') . '" title="' . $apx->lang->get('CORE_ACTIVE') . '" />';
             }
             $tmp = unserialize_section($res['secid']);
             $title = replace(strip_tags($res['title']));
             $link = mklink('gallery.php?id=' . $res['id'], 'gallery,list' . $res['id'] . ',1' . urlformat($res['title']) . '.html', iif($set['main']['forcesection'], iif(unserialize_section($res['secid']) == array('all'), $apx->section_default, array_shift($tmp)), 0));
             list($pics) = $db->first("SELECT count(id) FROM " . PRE . "_gallery_pics WHERE galid='" . $res['id'] . "'");
             list($activepics) = $db->first("SELECT count(id) FROM " . PRE . "_gallery_pics WHERE ( galid='" . $res['id'] . "' AND active='1' )");
             $tabledata[$i]['COL2'] = $res['id'];
             $tabledata[$i]['COL3'] = '<a href="' . $link . '" target="_blank">' . $title . '</a>';
             $tabledata[$i]['COL4'] = iif($res['starttime'], mkdate($res['starttime'], '<br />'), '&nbsp;');
             $tabledata[$i]['COL5'] = number_format($pics, 0, '', '.');
             $tabledata[$i]['CLASS'] = 'l' . ($res['level'] - 1) . ($res['children'] ? ' haschildren' : '') . ($res['level'] > 1 ? ' hidden' : '');
             $tabledata[$i]['ID'] = 'node:' . $res['id'];
             //Optionen
             if ($apx->user->has_right('gallery.edit')) {
                 $tabledata[$i]['OPTIONS'] .= optionHTML('edit.gif', 'gallery.edit', 'id=' . $res['id'], $apx->lang->get('CORE_EDIT'));
             } else {
                 $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
             }
             if ($apx->user->has_right('gallery.del')) {
                 $tabledata[$i]['OPTIONS'] .= '<span class="ifhasnochildren">' . optionHTMLOverlay('del.gif', 'gallery.del', 'id=' . $res['id'], $apx->lang->get('CORE_DEL')) . '</span><span class="ifhaschildren"><img alt="" src="design/ispace.gif"/></span>';
             } else {
                 $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
             }
             if ((!$res['starttime'] || $res['endtime'] < time()) && $apx->user->has_right('gallery.enable') && (!$set['gallery']['subgals'] || $isactive[$res['level'] - 1])) {
                 $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('enable.gif', 'gallery.enable', 'id=' . $res['id'], $apx->lang->get('CORE_ENABLE'));
             } elseif ($res['starttime'] && $apx->user->has_right('gallery.disable')) {
                 $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('disable.gif', 'gallery.disable', 'id=' . $res['id'], $apx->lang->get('CORE_DISABLE'));
             } else {
                 $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
             }
             $tabledata[$i]['OPTIONS'] .= '&nbsp;';
             if ($apx->user->has_right('gallery.pshow')) {
                 $tabledata[$i]['OPTIONS'] .= optionHTML('pic.gif', 'gallery.pshow', 'id=' . $res['id'], $apx->lang->get('SHOWPICS'));
             }
             if ($apx->user->has_right('gallery.padd')) {
                 $tabledata[$i]['OPTIONS'] .= optionHTML('picadd.gif', 'gallery.padd', 'id=' . $res['id'], $apx->lang->get('ADDPICS'));
             }
             //Kommentare + Bewertungen
             if ($apx->is_module('comments')) {
                 $tabledata[$i]['OPTIONS'] .= '&nbsp;';
                 list($comments) = $db->first("SELECT count(id) FROM " . PRE . "_comments WHERE ( module='galleryself' AND mid='" . $res['id'] . "' )");
                 if ($comments && $set['gallery']['galcoms'] && $res['allowcoms'] && $apx->user->has_right('comments.show')) {
                     $tabledata[$i]['OPTIONS'] .= optionHTML('comments.gif', 'comments.show', 'module=galleryself&mid=' . $res['id'], $apx->lang->get('COMMENTS') . ' (' . $comments . ')');
                 } else {
                     $tabledata[$i]['OPTIONS'] .= '<img src="design/ispace.gif" alt="" />';
                 }
             }
             //Anordnen: Untergalerien
             /*if ( $set['gallery']['subgals'] ) {
             			$tabledata[$i]['OPTIONS'].='&nbsp;';
             			if ( $apx->user->has_right('gallery.move') && $follow[$res['id']]['prev'] ) $tabledata[$i]['OPTIONS'].=optionHTML('moveup.gif', 'gallery.move', 'direction=up&id='.$res['id'].'&sectoken='.$apx->session->get('sectoken'), $apx->lang->get('MOVEUP'));
             			else $tabledata[$i]['OPTIONS'].='<img src="design/ispace_small.gif" alt="" style="vertical-align:middle;" />';
             			if ( $apx->user->has_right('gallery.move') && $follow[$res['id']]['next'] ) $tabledata[$i]['OPTIONS'].=optionHTML('movedown.gif', 'gallery.move', 'direction=down&id='.$res['id'].'&sectoken='.$apx->session->get('sectoken'), $apx->lang->get('MOVEDOWN'));
             			else $tabledata[$i]['OPTIONS'].='<img src="design/ispace_small.gif" alt="" style="vertical-align:middle;" />';
             		}
             		
             		//Anordnen: Einfach
             		elseif ( !$set['gallery']['subgals'] && $set['gallery']['ordergal']==3 ) {
             			$tabledata[$i]['OPTIONS'].='&nbsp;';
             			if ( $apx->user->has_right('gallery.move') && $i!=1 ) $tabledata[$i]['OPTIONS'].=optionHTML('moveup.gif', 'gallery.move', 'direction=up&id='.$res['id'].'&sectoken='.$apx->session->get('sectoken'), $apx->lang->get('MOVEUP'));
             			else $tabledata[$i]['OPTIONS'].='<img src="design/ispace_small.gif" alt="" style="vertical-align:middle;" />';
             			if ( $apx->user->has_right('gallery.move') && $i!=$count ) $tabledata[$i]['OPTIONS'].=optionHTML('movedown.gif', 'gallery.move', 'direction=down&id='.$res['id'].'&sectoken='.$apx->session->get('sectoken'), $apx->lang->get('MOVEDOWN'));
             			else $tabledata[$i]['OPTIONS'].='<img src="design/ispace_small.gif" alt="" style="vertical-align:middle;" />';
             		}*/
             if ($res['level'] == 1) {
                 ++$pdone[0];
             } else {
                 ++$pdone[$tree][$res['level']];
             }
         }
     }
     $apx->tmpl->assign('TABLE', $tabledata);
     if ($set['gallery']['subgals']) {
         echo '<div class="treeview" id="tree">';
         $html->table($col);
         echo '</div>';
         $open = $apx->session->get('gallery_open');
         $open = dash_unserialize($open);
         $opendata = array();
         foreach ($open as $catid) {
             $opendata[] = array('ID' => $catid);
         }
         $apx->tmpl->assign('OPEN', $opendata);
         $apx->tmpl->assign('EDIT_ALLOWED', $apx->user->has_Right('gallery.edit'));
         $apx->tmpl->parse('show_js');
     } elseif ($set['gallery']['ordergal'] == 3) {
         echo '<div class="listview" id="list">';
         $html->table($col);
         echo '</div>';
         $apx->tmpl->parse('show_listjs');
     } else {
         $html->table($col);
         orderstr($orderdef, 'action.php?action=gallery.show' . iif($_REQUEST['searchid'], '&amp;searchid=' . $_REQUEST['searchid']) . '&amp;letter=' . $_REQUEST['letter']);
     }
     save_index($_SERVER['REQUEST_URI']);
 }