function flag_music_controler() { if (isset($_POST['importfolder']) && $_POST['importfolder']) { check_admin_referer('flag_addmp3'); $mp3folder = $_POST['mp3folder']; if (!empty($mp3folder)) { flagAdmin::import_mp3($mp3folder); } } $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'main'; $action = isset($_REQUEST['bulkaction']) ? $_REQUEST['bulkaction'] : false; if ($action == 'no_action') { $action = false; } switch ($mode) { case 'sort': check_admin_referer('flag_sort'); include_once dirname(__FILE__) . '/playlist-sort.php'; flag_playlist_order(); break; case 'edit': $file = sanitize_flagname($_GET['playlist']); if (isset($_POST['updatePlaylist'])) { check_admin_referer('flag_update'); $title = esc_html($_POST['playlist_title']); $descr = esc_html($_POST['playlist_descr']); $data = array(); foreach ($_POST['item_a'] as $item_id => $item) { if ($action == 'delete_items' && in_array($item_id, $_POST['doaction'])) { continue; } $data[] = $item_id; } flagGallery::flagSaveWpMedia(); flagSavePlaylist($title, $descr, $data, $file); } if (isset($_POST['updatePlaylistSkin'])) { check_admin_referer('flag_update'); flagSavePlaylistSkin($file); } include_once dirname(__FILE__) . '/manage-playlist.php'; flag_playlist_edit(); break; case 'save': if (isset($_POST['items_array'])) { check_admin_referer('flag_update'); $title = esc_html($_POST['playlist_title']); $descr = esc_html($_POST['playlist_descr']); $data = $_POST['items_array']; $file = isset($_REQUEST['playlist']) ? sanitize_flagname($_REQUEST['playlist']) : false; flagGallery::flagSaveWpMedia(); flagSavePlaylist($title, $descr, $data, $file); } if (isset($_GET['playlist'])) { include_once dirname(__FILE__) . '/manage-playlist.php'; flag_playlist_edit(); } else { flag_created_playlists(); flag_music_wp_media_lib(); } break; case 'add': check_admin_referer('flag_add'); if (isset($_POST['items']) && isset($_GET['playlist'])) { $added = $_POST['items']; } elseif (isset($_GET['playlist'])) { $added = $_COOKIE['musicboxplaylist_' . sanitize_flagname($_GET['playlist'])]; } else { $added = false; } flag_music_wp_media_lib($added); break; case 'delete': check_admin_referer('flag_delete'); flag_playlist_delete(sanitize_flagname($_GET['playlist'])); case 'main': if (isset($_POST['updateMedia'])) { check_admin_referer('flag_update'); flagGallery::flagSaveWpMedia(); flagGallery::show_message(__('Media updated', 'flash-album-gallery')); } default: flag_created_playlists(); flag_music_wp_media_lib(); break; } }