has_access()) { access_denied(); break; } /* Go for it! */ $playlist->delete(); show_confirmation(_('Playlist Deleted'),_('The Requested Playlist has been deleted'),'/playlist.php'); break; case 'show_delete_playlist': /* Make sure they have the rights */ if (!$playlist->has_access()) { access_denied(); break; } /* Show Confirmation Question */ $message = _('Are you sure you want to delete this playlist') . " " . $playlist->name . "?"; show_confirm_action($message,'playlist.php','action=delete_playlist&playlist_id=' . $playlist->id); break; case 'add_to': case 'add to': /* If we don't already have a playlist */ 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(); } if ($_REQUEST['type'] == 'album') { $song_ids = get_songs_from_type($_REQUEST['type'],$_REQUEST['song'],$_REQUEST['artist_id']); } else { $song_ids = $_REQUEST['song']; } /* Add the songs */ $playlist->add_songs($song_ids); /* Show the Playlist */ $_REQUEST['playlist_id'] = $playlist->id; /* Store this new id in the session for later use */ $_SESSION['data']['playlist_id'] = $playlist->id; show_playlist($playlist); break; case 'add_dyn_song': /* Check Rights */ if (!$playlist->has_access()) { access_denied(); break; } $playlist->add_dyn_song(); $_SESSION['data']['playlist_id'] = $playlist->id; show_playlist($playlist); break; case 'create_playlist': case 'create': /* Check rights */ if (!$GLOBALS['user']->has_access(25)) { access_denied(); break; } $playlist_name = scrub_in($_REQUEST['playlist_name']); $playlist_type = scrub_in($_REQUEST['type']); $playlist->create($playlist_name,$playlist_type); $_SESSION['data']['playlist_id'] = $playlist->id; show_confirmation(_('Playlist Created'),$playlist_name . ' (' . $playlist_type . ') ' . _(' has been created'),'playlist.php'); break; case 'edit': show_playlist_edit($_REQUEST['playlist_id']); break; case 'new': require (conf('prefix') . '/templates/show_add_playlist.inc.php'); break; case 'remove_song': case _('Remote Selected Tracks'): /* Check em for rights */ if (!$playlist->has_access()) { access_denied(); break; } $playlist->remove_songs($_REQUEST['song']); show_playlist($playlist); break; case 'update_playlist': /* Make sure they've got thems rights */ if (!$playlist->has_access()) { access_denied(); break; } $playlist->update_type($_REQUEST['type']); $playlist->update_name($_REQUEST['playlist_name']); $url = conf('web_path') . '/playlist.php?action=show_playlist&playlist_id=' . $playlist->id; $title = _('Playlist Updated'); $body = "$playlist->name " . _('has been updated and is now') . " $playlist->type"; show_confirmation($title,$body,$url); break; case 'show_playlist': show_playlist($playlist); break; case 'show_import_playlist': show_import_playlist(); break; case 'import_playlist': $catalog = new Catalog(); $catalog->import_m3u(scrub_in($_REQUEST['filename'])); $url = conf('web_path') . '/playlist.php'; $title = _('Playlist Imported'); $body = ''; show_confirmation($title,$body,$url); break; case 'set_track_numbers': /* Make sure they have permission */ if (!$playlist->has_access()) { access_denied(); break; } $song_ids = scrub_in($_REQUEST['song']); foreach ($song_ids as $song_id) { $track = scrub_in($_REQUEST['tr_' . $song_id]); $changes[] = array('song_id' => $song_id, 'track' => $track); } $playlist->update_track_numbers($changes); show_playlist($playlist); break; case 'prune_empty': /* Make sure they have permission */ if (!$GLOBALS['user']->has_access(100)) { access_denied(); break; } prune_empty_playlists(); $url = conf('web_path') . '/playlist.php'; $title = _('Empty Playlists Deleted'); $body = ''; show_confirmation($title,$body,$url); 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; } // switch on the action show_footer(); ?>