diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-07-09 11:57:48 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-07-09 11:57:48 +0000 |
commit | 7d63859ce355870942a3f648cff6be57e43451ea (patch) | |
tree | a97ef5585aa2395b6a1d7d14270f915674951b9a /lib/class/rating.class.php | |
parent | abc051ec758b38a709ccde8d9ce7dd9a988fbec7 (diff) | |
download | ampache-7d63859ce355870942a3f648cff6be57e43451ea.tar.gz ampache-7d63859ce355870942a3f648cff6be57e43451ea.tar.bz2 ampache-7d63859ce355870942a3f648cff6be57e43451ea.zip |
add rating to single song view, and include caching fix
Diffstat (limited to 'lib/class/rating.class.php')
-rw-r--r-- | lib/class/rating.class.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/class/rating.class.php b/lib/class/rating.class.php index 045be750..9348c4e7 100644 --- a/lib/class/rating.class.php +++ b/lib/class/rating.class.php @@ -190,23 +190,23 @@ class Rating extends database_object { if ($score == '-1') { $sql = "DELETE FROM `rating` WHERE `object_id`='$this->id' AND `object_type`='$this->type' " . "AND `user`='" . Dba::escape($GLOBALS['user']->id) . "'"; - $db_results = Dba::query($sql); + $db_results = Dba::read($sql); return true; } /* Check if it exists */ $sql = "SELECT `id` FROM `rating` WHERE `object_id`='$this->id' AND `object_type`='$this->type' " . "AND `user`='" . Dba::escape($GLOBALS['user']->id) . "'"; - $db_results = Dba::query($sql); + $db_results = Dba::read($sql); if ($existing = Dba::fetch_assoc($db_results)) { $sql = "UPDATE `rating` SET `rating`='$score' WHERE `id`='" . $existing['id'] . "'"; - $db_results = Dba::query($sql); + $db_results = Dba::write($sql); } else { $sql = "INSERT INTO `rating` (`object_id`,`object_type`,`rating`,`user`) VALUES " . " ('$this->id','$this->type','$score','" . $GLOBALS['user']->id . "')"; - $db_results = Dba::query($sql); + $db_results = Dba::write($sql); } return true; |