diff options
author | flashk <flashk@ampache> | 2007-12-30 00:41:53 +0000 |
---|---|---|
committer | flashk <flashk@ampache> | 2007-12-30 00:41:53 +0000 |
commit | 7cdf1e980d294085fd1053a1c50cede127bf1352 (patch) | |
tree | febade156a521701e10f42c8308d098c61fb89e1 /lib/class/rating.class.php | |
parent | 51c14c05da738e11162af88cb17eb46f45d4999d (diff) | |
download | ampache-7cdf1e980d294085fd1053a1c50cede127bf1352.tar.gz ampache-7cdf1e980d294085fd1053a1c50cede127bf1352.tar.bz2 ampache-7cdf1e980d294085fd1053a1c50cede127bf1352.zip |
Removing rating of object will actually remove it from rating table
Diffstat (limited to 'lib/class/rating.class.php')
-rw-r--r-- | lib/class/rating.class.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/class/rating.class.php b/lib/class/rating.class.php index ff7b940d..f981fc4e 100644 --- a/lib/class/rating.class.php +++ b/lib/class/rating.class.php @@ -117,6 +117,14 @@ class Rating { $score = Dba::escape($score); + // If score is -1, then remove rating + 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); + 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) . "'"; |