summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-01-17 14:25:12 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-01-17 14:25:12 +0000
commit9f87707043594ec990e1c96fe806c93869387c8d (patch)
tree5762b9f07c7c10f7bec49585cd4afb347bc7f7cd
parent66ff3d58dfe8d601acbc0e70c095e6f59a3512ad (diff)
downloadampache-9f87707043594ec990e1c96fe806c93869387c8d.tar.gz
ampache-9f87707043594ec990e1c96fe806c93869387c8d.tar.bz2
ampache-9f87707043594ec990e1c96fe806c93869387c8d.zip
fixed a clean issue with rated items
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--images/icon_flag_off.pngbin0 -> 3530 bytes
-rw-r--r--lib/class/catalog.class.php38
-rw-r--r--templates/show_songs.inc10
4 files changed, 27 insertions, 22 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 3ad9c7ef..c3d6f84b 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.3.3
+ - Fixed a flagged and rated item clean issue with catalogs
- Fixed some minor issues in HttpQ and MPD localplay controllers
- Fixed Album Art search on Catalog add so that it only searches
albums that currently don't have art
diff --git a/images/icon_flag_off.png b/images/icon_flag_off.png
new file mode 100644
index 00000000..5eade6b5
--- /dev/null
+++ b/images/icon_flag_off.png
Binary files differ
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index bbb6c329..1f4f308b 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -1358,7 +1358,7 @@ class Catalog {
function clean_flagged() {
/* Do a complex delete to get flagged items where the songs are now gone */
- $sql = "DELETE FROM flagged USING flagged LEFT JOIN song ON song.id = flagged.song WHERE song.id IS NULL";
+ $sql = "DELETE FROM flagged USING flagged LEFT JOIN song ON song.id = flagged.object_id WHERE song.id IS NULL AND object_type='song'";
$db_results = mysql_query($sql, dbh());
} // clean_flagged
@@ -1435,6 +1435,22 @@ class Catalog {
$sql = "DELETE FROM object_count USING object_count LEFT JOIN live_stream ON live_stream.id=object_count.object_id WHERE object_type='live_stream' AND live_stream.id IS NULL";
$db_results = mysql_query($sql,dbh());
+ // Delete Song Ratings information
+ $sql = "DELETE FROM ratings USING ratings LEFT JOIN song ON song.id=ratings.object_id WHERE object_type='song' AND song.id IS NULL";
+ $db_results = mysql_query($sql,dbh());
+
+ // Delete Genre Ratings Information
+ $sql = "DELETE FROM ratings USING ratings LEFT JOIN genre ON genre.id=ratings.object_id WHERE object_type='genre' AND genre.id IS NULL";
+ $db_results = mysql_query($sql,dbh());
+
+ // Delete Album Rating Information
+ $sql = "DELETE FROM ratings USING ratings LEFT JOIN album ON album.id=ratings.object_id WHERE object_type='album' AND album.id IS NULL";
+ $db_results = mysql_query($sql,dbh());
+
+ // Delete Artist Rating Information
+ $sql = "DELETE FROM ratings USING ratings LEFT JOIN artist ON artist.id=ratings.object_id WHERE object_type='artist' AND artist.id IS NULL";
+ $db_results = mysql_query($sql,dbh());
+
} // clean_stats
/*!
@@ -2125,24 +2141,6 @@ class Catalog {
*/
function delete_catalog() {
- // Do some crazyness to delete all the songs in this catalog
- // from playlists...
- $sql = "SELECT playlist_data.song FROM song,playlist_data,catalog WHERE catalog.id=song.catalog AND playlist_data.song=song.id AND catalog.id='$this->id'";
- $db_results = mysql_query($sql, dbh());
-
- $results = array();
-
- while ($r = mysql_fetch_object($db_results)) {
- $results[] = $r;
- }
-
- foreach ($results as $r) {
- // Clear Playlist Data
- $sql = "DELETE FROM playlist_data WHERE song='$r->song'";
- $db_results = mysql_query($sql, dbh());
-
- } // End Foreach
-
// First remove the songs in this catalog
$sql = "DELETE FROM song WHERE catalog = '$this->id'";
$db_results = mysql_query($sql, dbh());
@@ -2155,8 +2153,8 @@ class Catalog {
$this->clean_albums();
$this->clean_artists();
$this->clean_playlists();
- $this->clean_flagged();
$this->clean_genres();
+ $this->clean_flagged();
$this->clean_stats();
$this->clean_ext_info();
diff --git a/templates/show_songs.inc b/templates/show_songs.inc
index a88b7708..5f7b711d 100644
--- a/templates/show_songs.inc
+++ b/templates/show_songs.inc
@@ -130,7 +130,14 @@ foreach ($song_ids as $song_id) {
</td>
<td>
<a href="<?php echo $web_path; ?>/flag.php?action=show_flag&amp;type=song&amp;id=<?php echo $song->id; ?>">
- <?php echo get_user_icon('flag'); ?>
+ <?
+ if ($song->has_flag()) {
+ echo get_user_icon('flag');
+ }
+ else {
+ echo get_user_icon('flag_off');
+ }
+ ?>
</a>
<?php if ($GLOBALS['user']->has_access('100')) { ?>
<a href="<?php echo $web_path; ?>/admin/flag.php?action=show_edit_song&amp;song=<?php echo $song->id; ?>">
@@ -191,7 +198,6 @@ $num = count($song_ids);
</tr>
<?php } ?>
</table>
-<p class="header2"><?php echo _('** Indicates flagged songs'); ?></p>
<br />
<?php show_play_selected(); ?>
</form>