diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-31 04:08:35 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-31 04:08:35 +0000 |
commit | 65bc8762b1dbcfd267555d11fc933418168110d5 (patch) | |
tree | ce451b79d7a0cf0060e81d423aa7fbe56c40bcc8 /lib/class | |
parent | 748e50ade1b0c7034eddaadbe2285e5bf3a20fc6 (diff) | |
download | ampache-65bc8762b1dbcfd267555d11fc933418168110d5.tar.gz ampache-65bc8762b1dbcfd267555d11fc933418168110d5.tar.bz2 ampache-65bc8762b1dbcfd267555d11fc933418168110d5.zip |
fixed flag management interface, and potentially fixed an issue with use_auth=false
Diffstat (limited to 'lib/class')
-rw-r--r-- | lib/class/catalog.class.php | 9 | ||||
-rw-r--r-- | lib/class/flag.class.php | 27 |
2 files changed, 27 insertions, 9 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index fffcb302..34747853 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -1134,7 +1134,14 @@ class Catalog { * updates the song info based on tags, this is called from a bunch of different places * and passes in a full fledged song object, so it's a static function */ - public static function update_song_from_tags($song,$sort_pattern,$rename_pattern) { + public static function update_song_from_tags($song,$sort_pattern='',$rename_pattern='') { + + // If the patterns aren't passed go look them up + if (!$sort_pattern OR !$rename_pattern) { + $catalog = new Catalog($song->catalog); + $sort_pattern = $catalog->sort_pattern; + $rename_pattern = $catalog->rename_pattern; + } /* Record the reading of these tags */ debug_event('tag-read',"Reading Tags from $song->file",'5','ampache-catalog'); diff --git a/lib/class/flag.class.php b/lib/class/flag.class.php index d3f5ba56..28d7313a 100644 --- a/lib/class/flag.class.php +++ b/lib/class/flag.class.php @@ -182,28 +182,39 @@ class Flag { } // add /** - * delete_flag + * delete * This deletes the flagged entry and rescans the file to revert to the origional * state, in a perfect world, I could just roll the changes back... not until 3.4 + * or.. haha 3.5! */ - function delete_flag() { + public function delete() { - $sql = "DELETE FROM flagged WHERE id='$this->id'"; - $db_results = mysql_query($sql, dbh()); + // Re-scan the file + $song = new Song($this->object_id); + $info = Catalog::update_song_from_tags($song); + + // Delete the row + $sql = "DELETE FROM `flagged` WHERE `id`='$this->id'"; + $db_results = Dba::query($sql); + + // Reset the Last-Updated date so that it'll get re-scaned + $song->update_utime($song->id,1); return true; - } // delete_flag + } // delete /** * approve * This approves the current flag object ($this->id) by setting approved to * 1 */ - function approve() { + public function approve() { - $sql = "UPDATE flagged SET approved='1' WHERE id='$this->id'"; - $db_results = mysql_query($sql, dbh()); + $sql = "UPDATE `flagged` SET `approved`='1' WHERE `id`='$this->id'"; + $db_results = Dba::query($sql); + + $this->approved = 1; return true; |