has_access('100')) {
access_denied();
exit();
}
show_template('header');
$action = scrub_in($_REQUEST['action']);
switch ($action) {
case 'edit_song':
$catalog = new Catalog();
$song = new Song($_REQUEST['song_id']);
$new_song = $song;
/* Setup the vars so we can use the update_song function */
$new_song->title = scrub_in($_REQUEST['title']);
$new_song->track = scrub_in($_REQUEST['track']);
$new_song->year = scrub_in($_REQUEST['year']);
$new_song->comment = scrub_in($_REQUEST['comment']);
$new_song->genre = scrub_in($_REQUEST['genre']);
$new_song->album = scrub_in($_REQUEST['album']);
$new_song->artist = scrub_in($_REQUEST['artist']);
/* Check the drop down vs string bs */
if (strlen($_REQUEST['genre_string'])) {
$new_song->genre = $catalog->check_genre($_REQUEST['genre_string']);
}
if (strlen($_REQUEST['album_string'])) {
$new_song->album = $catalog->check_album($_REQUEST['album_string']);
}
if (strlen($_REQUEST['artist_string'])) {
$new_song->artist = $catalog->check_artist($_REQUEST['artist_string']);
}
/* Update this mofo */
$song->update_song($song->id,$new_song);
/* Add a tagging record of this so we can fix the file */
if ($_REQUEST['flag']) {
$flag = new Flag();
$flag->add($song->id,'song','retag','Edited Song, auto-tag');
}
show_confirmation(_('Song Updated'),_('The requested song has been updated'),$_SESSION['source']);
break;
case 'show_edit_song':
$_SESSION['source'] = return_referer();
$song = new Song($_REQUEST['song']);
$song->format_song();
require_once (conf('prefix') . '/templates/show_edit_song.inc.php');
break;
case 'disable':
$song_obj = new Song();
// If we pass just one, make it still work
if (!is_array($_REQUEST['song_ids'])) { $song_obj->update_enabled(0,$_REQUEST['song_ids']); }
else {
foreach ($_REQUEST['song_ids'] as $song_id) {
$song_obj->update_enabled(0,$song_id);
} // end foreach
} // end else
show_confirmation(_('Songs Disabled'),_('The requested song(s) have been disabled'),return_referer());
break;
case "enabled":
$song_obj = new Song();
// If we pass just one, make it still work
if (!is_array($_REQUEST['song_ids'])) { $song_obj->update_enabled(1,$_REQUEST['song_ids']); }
else {
foreach ($_REQUEST['song_ids'] as $song_id) {
$song_obj->update_enabled(1,$song_id);
} // end foreach
} // end else
show_confirmation(_('Songs Enabled'),_('The requested song(s) have been enabled'),return_referer());
break;
default:
break;
} // end switch
/*
@function edit_song_info
@discussion yea this is just wrong
*/
function edit_song_info($song) {
$info = new Song($song);
preg_match("/^.*\/(.*?)$/",$info->file, $short);
$filename = htmlspecialchars($short[1]);
if(preg_match('/\.ogg$/',$short[1]))
{
$ogg = TRUE;
$oggwarn = "
This file is an OGG file, which Ampache only has limited support for.
";
$oggwarn .= "You can make changes to the database here, but Ampache will not change the actual file's information.
";
}
echo <<