summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-03-27 08:16:02 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-03-27 08:16:02 +0000
commit0bacebf1eb56430e0c0013be1604045ca25246ef (patch)
treefa6e24332b918dac039e000da50e61e8ec7b872d
parent664bd9a28aa10eedee3deb82cda9b99b91b51fa0 (diff)
downloadampache-0bacebf1eb56430e0c0013be1604045ca25246ef.tar.gz
ampache-0bacebf1eb56430e0c0013be1604045ca25246ef.tar.bz2
ampache-0bacebf1eb56430e0c0013be1604045ca25246ef.zip
fixed a problem where it would redirect you back to an empty album/artist view
-rw-r--r--admin/flag.php5
-rw-r--r--lib/class/catalog.class.php7
2 files changed, 10 insertions, 2 deletions
diff --git a/admin/flag.php b/admin/flag.php
index f3de980a..695d90d0 100644
--- a/admin/flag.php
+++ b/admin/flag.php
@@ -85,13 +85,16 @@ switch ($action) {
/* Now that it's been updated clean old junk entries */
$catalog = new Catalog();
- $catalog->clean_single_song($old_song);
+ $cleaned = $catalog->clean_single_song($old_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');
}
+
+ if (isset($cleaned['artist']) || isset($cleaned['album'])) { $_SESSION['source'] = conf('web_path') . '/index.php'; }
+
show_confirmation(_('Song Updated'),_('The requested song has been updated'),$_SESSION['source']);
break;
case 'reject_flag':
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index c2af2cda..66b675b4 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -1263,6 +1263,8 @@ class Catalog {
*/
function clean_single_song($song) {
+ $results = array();
+
/* A'right let's check genre first */
$sql = "SELECT song.genre FROM song WHERE genre='" . $song->genre . "'";
$db_results = mysql_query($sql, dbh());
@@ -1270,6 +1272,7 @@ class Catalog {
if (!mysql_num_rows($db_results)) {
$sql = "DELETE FROM genre WHERE id='" . $song->genre . "'";
$db_results = mysql_query($sql, dbh());
+ $results['genre'] = true;
}
/* Now for the artist */
@@ -1279,6 +1282,7 @@ class Catalog {
if (!mysql_num_rows($db_results)) {
$sql = "DELETE FROM artist WHERE id='" . $song->artist . "'";
$db_results = mysql_query($sql, dbh());
+ $results['artist'] = true;
}
/* Now for the album */
@@ -1288,9 +1292,10 @@ class Catalog {
if (!mysql_num_rows($db_results)) {
$sql = "DELETE FROM album WHERE id='" . $song->album . "'";
$db_results = mysql_query($sql, dbh());
+ $results['album'] = true;
}
- return true;
+ return $results;
} // clean_single_song