Example #1
0
     /* Make sure they have permission */
     if (!$playlist->has_access()) {
         UI::access_denied();
         break;
     }
     // Retrieving final song order from url
     foreach ($_GET as $key => $data) {
         $_GET[$key] = unhtmlentities(scrub_in($data));
         debug_event('playlist', $key . '=' . $_GET[$key], '5');
     }
     if (isset($_GET['order'])) {
         $songs = explode(";", $_GET['order']);
         $track = $_GET['offset'] ? intval($_GET['offset']) + 1 : 1;
         foreach ($songs as $song_id) {
             if ($song_id != '') {
                 $playlist->update_track_number($song_id, $track);
                 ++$track;
             }
         }
     }
     break;
 case 'add_song':
     $playlist = new Playlist($_REQUEST['playlist_id']);
     if (!$playlist->has_access()) {
         UI::access_denied();
         break;
     }
     $playlist->add_songs(array($_REQUEST['song_id']), true);
     break;
 case 'prune_empty':
     if (!$GLOBALS['user']->has_access(100)) {