break; } $song = new Song($_REQUEST['song_id']); if (!Catalog::can_remove($song)) { debug_event('song', 'Unauthorized to remove the song `.' . $song->id . '`.', 1); UI::access_denied(); exit; } if ($song->remove_from_disk()) { show_confirmation(T_('Song Deletion'), T_('Song has been deleted.'), AmpConfig::get('web_path')); } else { show_confirmation(T_('Song Deletion'), T_('Cannot delete this song.'), AmpConfig::get('web_path')); } break; case 'show_lyrics': $song = new Song($_REQUEST['song_id']); $song->format(); $song->fill_ext_info(); $lyrics = $song->get_lyrics(); require_once AmpConfig::get('prefix') . UI::find_template('show_lyrics.inc.php'); break; case 'show_song': default: $song = new Song($_REQUEST['song_id']); $song->format(); $song->fill_ext_info(); require_once AmpConfig::get('prefix') . UI::find_template('show_song.inc.php'); break; } // end data collection UI::show_footer();
public static function addLyrics($xml, $artist, $title, $song_id) { $song = new Song($song_id); $song->format(); $song->fill_ext_info(); $lyrics = $song->get_lyrics(); if ($lyrics && $lyrics['text']) { $text = preg_replace('/\\<br(\\s*)?\\/?\\>/i', "\n", $lyrics['text']); $text = str_replace("\r", '', $text); $xlyrics = $xml->addChild("lyrics", $text); if ($artist) { $xlyrics->addAttribute("artist", $artist); } if ($title) { $xlyrics->addAttribute("title", $title); } } }