diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-08 06:38:06 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-08 06:38:06 +0000 |
commit | db10ee8e7883dc00c3e2f559532124f842f59e5d (patch) | |
tree | 45f82abd3c60ae598a9f829035d2424ffe0d5794 /playlist.php | |
parent | 2bb59dfa45f008846305c62962616bd3fff3884d (diff) | |
download | ampache-db10ee8e7883dc00c3e2f559532124f842f59e5d.tar.gz ampache-db10ee8e7883dc00c3e2f559532124f842f59e5d.tar.bz2 ampache-db10ee8e7883dc00c3e2f559532124f842f59e5d.zip |
a few tweaks
Diffstat (limited to 'playlist.php')
-rw-r--r-- | playlist.php | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/playlist.php b/playlist.php index 64be7f7e..5537867e 100644 --- a/playlist.php +++ b/playlist.php @@ -37,7 +37,7 @@ $playlist = new Playlist(scrub_in($_REQUEST['playlist_id'])); switch ($action) { case 'delete_playlist': /* Make sure they have the rights */ - if (!$GLOBALS['user']->has_access(100) AND $GLOBALS['user']->username != $playlist->user) { + if (!$playlist->has_access()) { access_denied(); break; } @@ -47,7 +47,7 @@ switch ($action) { break; case 'show_delete_playlist': /* Make sure they have the rights */ - if (!$GLOBALS['user']->has_access(100) AND $GLOBALS['user']->username != $playlist->user) { + if (!$playlist->has_access()) { access_denied(); break; } @@ -58,18 +58,18 @@ switch ($action) { break; case 'add_to': case 'add to': - /* Check to make sure they've got rights */ - if (!$GLOBALS['user']->has_access(25)) { - access_denied(); - break; - } /* If we don't already have a playlist */ - if (!$playlist->id) { + if (!$playlist->id && $GLOBALS['user']->has_access(25)) { $playlist_name = _('New Playlist') . " - " . date('m/j/y, g:i a'); $id = $playlist->create($playlist_name, 'private'); $playlist = new Playlist($id); } + if (!$playlist->has_access()) { + access_denied(); + break; + } + /* Must be admin or person who created this playlist */ if ($GLOBALS['user']->username != $playlist->user && !$GLOBALS['user']->has_access(100)) { access_denied(); @@ -89,7 +89,7 @@ switch ($action) { break; case 'add_dyn_song': /* Check Rights */ - if (!$GLOBALS['user']->has_access(100) && $GLOBALS['user']->username != $playlist->username) { + if (!$playlist->has_access()) { access_denied(); break; } @@ -120,7 +120,7 @@ switch ($action) { case 'remove_song': case _('Remote Selected Tracks'): /* Check em for rights */ - if (!$GLOBALS['user']->has_access(100) && $GLOBALS['user']->username != $playlist->user) { + if (!$playlist->has_access) { access_denied(); break; } @@ -129,7 +129,7 @@ switch ($action) { break; case 'update': /* Make sure they've got thems rights */ - if (!$GLOBALS['user']->has_access(100) && $GLOBALS['user']->username != $playlist->user) { + if (!$playlist->has_access()) { access_denied(); break; } @@ -138,10 +138,6 @@ switch ($action) { $playlist->update_name($_REQUEST['new_playlist_name']); show_confirmation(_('Playlist Updated'),$playlist_name . ' (' . $playlist_type . ') ' . _(' has been updated'),'playlist.php?action=show_playlist&playlist_id=' . $playlist->id); break; - //FIXME: WTF Mate? - case _('Update Selected'): - - break; case 'show_playlist': show_playlist($playlist); break; @@ -150,7 +146,7 @@ switch ($action) { break; case 'set_track_numbers': /* Make sure they have permission */ - if (!$GLOBALS['user']->has_access(100) && $GLOBALS['user']->username != $playlist->user) { + if (!$playlist->has_access()) { access_denied(); break; } @@ -164,6 +160,19 @@ switch ($action) { show_playlist($playlist); break; + case 'normalize_tracks': + /* Make sure they have permission */ + if (!$playlist->has_access()) { + access_denied(); + break; + } + + /* Normalize the tracks */ + $playlist->normalize_tracks(); + + /* Show our wonderful work */ + show_playlist($playlist); + break; default: show_playlists(); break; |