summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-01-03 09:21:29 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-01-03 09:21:29 +0000
commitdfbe65e1bf0a4d7cff1e2d31a2ade18de6756196 (patch)
tree1036034cfcb8653f37b2e690f8b83068f98fe509 /modules
parenta2cf31f96cd9ba28b1f5e7090208312a9e5b7ca9 (diff)
downloadampache-dfbe65e1bf0a4d7cff1e2d31a2ade18de6756196.tar.gz
ampache-dfbe65e1bf0a4d7cff1e2d31a2ade18de6756196.tar.bz2
ampache-dfbe65e1bf0a4d7cff1e2d31a2ade18de6756196.zip
whole new playlists files new coolness supported but not implmented, playback works but playlist edit functions are still untested...
Diffstat (limited to 'modules')
-rw-r--r--modules/init.php35
-rw-r--r--modules/lib.php135
2 files changed, 18 insertions, 152 deletions
diff --git a/modules/init.php b/modules/init.php
index 0fc904c4..0facedb0 100644
--- a/modules/init.php
+++ b/modules/init.php
@@ -152,23 +152,24 @@ require_once(libglue_param('libglue_path') . "/session.php");
require_once(libglue_param('libglue_path') . "/dbh.php");
// Librarys
-require_once(conf('prefix') . "/lib/album.lib.php");
-require_once(conf('prefix') . "/lib/artist.lib.php");
-require_once(conf('prefix') . "/lib/song.php");
-require_once(conf('prefix') . "/lib/search.php");
-require_once(conf('prefix') . "/lib/preferences.php");
-require_once(conf('prefix') . "/lib/rss.php");
-require_once(conf('prefix') . "/lib/log.lib.php");
-require_once(conf('prefix') . "/lib/mpd.php");
-require_once(conf('prefix') . "/lib/ui.lib.php");
-require_once(conf('prefix') . "/lib/gettext.php");
-require_once(conf('prefix') . "/lib/batch.lib.php");
-require_once(conf('prefix') . "/lib/themes.php");
-require_once(conf('prefix') . "/lib/stream.lib.php");
-require_once(conf('prefix') . "/modules/lib.php");
-require_once(conf('prefix') . "/modules/admin.php");
-require_once(conf('prefix') . "/modules/catalog.php");
-require_once(conf('prefix') . "/lib/upload.php");
+require_once(conf('prefix') . '/lib/album.lib.php');
+require_once(conf('prefix') . '/lib/artist.lib.php');
+require_once(conf('prefix') . '/lib/song.php');
+require_once(conf('prefix') . '/lib/search.php');
+require_once(conf('prefix') . '/lib/preferences.php');
+require_once(conf('prefix') . '/lib/rss.php');
+require_once(conf('prefix') . '/lib/log.lib.php');
+require_once(conf('prefix') . '/lib/mpd.php');
+require_once(conf('prefix') . '/lib/ui.lib.php');
+require_once(conf('prefix') . '/lib/gettext.php');
+require_once(conf('prefix') . '/lib/batch.lib.php');
+require_once(conf('prefix') . '/lib/themes.php');
+require_once(conf('prefix') . '/lib/stream.lib.php');
+require_once(conf('prefix') . '/lib/playlist.lib.php');
+require_once(conf('prefix') . '/modules/lib.php');
+require_once(conf('prefix') . '/modules/admin.php');
+require_once(conf('prefix') . '/modules/catalog.php');
+require_once(conf('prefix') . '/lib/upload.php');
// Modules (These are conditionaly included depending upon config values)
require_once(conf('prefix') . "/modules/id3/audioinfo.class.php");
diff --git a/modules/lib.php b/modules/lib.php
index e887ac54..b1eda672 100644
--- a/modules/lib.php
+++ b/modules/lib.php
@@ -539,141 +539,6 @@ function show_albums ($albums,$view=0) {
} // show_albums
-
-// Had to tweak this so it would show both public and private playlists
-// Defaults to showing both although you could pass type=private|adminprivate|public
-// to see only those
-function show_playlists ($type = 'all') {
-
- $dbh = dbh();
-
- $user = $GLOBALS['user'];
-
- $web_path = conf('web_path');
-
- // mapping of types to pretty names
- $typemap = array( "public" => _("Public"),
- "private" => _("Your Private"),
- "adminprivate" => _("Other Private")
- );
-
- if ($type == 'all') {
- show_playlists('private');
- if ( $user->access === 'admin' ) {
- show_playlists('adminprivate');
- }
- show_playlists('public');
- return true;
- }
- elseif ($type == 'public') {
- $sql = "SELECT id,name,user,date ".
- " FROM playlist ".
- " WHERE type='public'".
- " ORDER BY name";
- }
- elseif ($type == 'private') {
- $sql = "SELECT id,name,user,date ".
- " FROM playlist ".
- " WHERE type='private'" .
- " AND user = '$user->username'" .
- " AND name <> 'Temporary'".
- " ORDER BY name";
- }
- elseif ($type == 'adminprivate') {
- if ( $user->access === 'admin' ) {
- $sql = "SELECT id,name,user,date ".
- " FROM playlist ".
- " WHERE type='private'" .
- " AND username != '$user->username'" .
- " AND name <> 'Temporary'".
- " ORDER BY name";
- }
- else {
- // No admin access
- $sql = 'SELECT 1+1';
- }
- }
- else {
- echo "** Error ** Call to show_playlists with unknown type $type ".
- "in file ".$_SERVER['PHP_SELF']." ** <br />\n";
- $sql = 'SELECT 1+1';
- }
-
- $db_result = mysql_query($sql, $dbh);
-
- print <<<ECHO
-<h3>$typemap[$type] Playlists</h3>
-
-<table class="tabledata" cellspacing="0" cellpadding="0" border="0">
- <tr class="table-header">
- <th>Playlist Name</th>
- <th># Songs</th>
- <th>Owner</th>
- <th colspan="6">Actions</th>
- </tr>
-
-ECHO;
-
- flip_class(array('even','odd'));
-
- if ( mysql_num_rows($db_result) ) {
- while ( $r = mysql_fetch_array($db_result) ) {
- $plname = $r['name'];
- $plid = $r['id'];
- $pluser = new User($r['user']);
- $plfullname = $pluser->fullname;
- $plowner = $pluser->username;
-
- // find out how many songs in this playlist
- $count_query = "SELECT count(*) ".
- " FROM playlist_data ".
- " WHERE playlist = '$plid'";
- $count_result = mysql_query($count_query, $dbh);
- list($count) = mysql_fetch_row($count_result);
- $class = flip_class();
- echo " <tr class=\"$class\">\n";
- echo " <td><a href=\"$web_path/playlist.php?playlist_id=$plid&amp;action=view_list\">$plname</a></td>\n";
- echo " <td>$count</td>\n";
- echo " <td>$plfullname</td>\n";
- echo " <td><a href=\"$web_path/playlist.php?playlist_id=$plid&amp;action=view_list\">" . _("View") . "</a></td>\n";
-
- if ($user->username == $pluser->username || $user->has_access(100)) {
- echo " <td><a href=\"$web_path/playlist.php?playlist_id=$plid&amp;action=edit\">" . _("Edit") . "</a></td>\n";
- echo " <td><a href=\"$web_path/playlist.php?playlist_id=$plid&amp;action=delete_playlist\">" . _("Delete") . "</a></td>\n";
- }
- else {
- echo " <td>&nbsp;</td>\n";
- echo " <td>&nbsp;</td>\n";
- }
-
- if ( $count[0] ) {
- echo " <td><a href=\"$web_path/song.php?action=m3u&amp;playlist_id=$plid\">" . _("Play") . "</a> | " .
- "<a href=\"$web_path/song.php?action=random&amp;playlist_id=$plid\">" . _("Random") . "</a></td>\n";
- }
- else {
- echo " <td>&nbsp;</td>\n";
- }
- if( batch_ok() ) {
- echo" <td><a href=\"$web_path/batch.php?action=pl&amp;id=$plid\">" . _("Download") . "</a></td>\n";
- } else {
- echo" <td>&nbsp;</td>\n";
- }
-
- echo " </tr>\n";
- }
- echo "\n";
- } //if rows in result
- else {
- echo " <tr class=\"even\">\n";
- echo " <td colspan=\"7\">" . _("There are no playlists of this type") . "</td>\n";
- echo " </tr>\n";
- }
-
- echo "</table>\n";
- echo "<br />\n";
-
-}
-
function get_playlist_track_from_song ( $playlist_id, $song_id ) {
$dbh = dbh();