From 4fe68f56c481cb3904142f1077754b52cb9370a4 Mon Sep 17 00:00:00 2001 From: e107steved Date: Wed, 10 Jan 2007 21:31:12 +0000 Subject: [PATCH] Bugtracker #3657 - confusion on rated items - thanks V3 (and didn't mess up Sweetas changes!) --- e107_handlers/rate_class.php | 12 ++++++------ rate.php | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/e107_handlers/rate_class.php b/e107_handlers/rate_class.php index 7d731f098..74fa9d9bb 100644 --- a/e107_handlers/rate_class.php +++ b/e107_handlers/rate_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/rate_class.php,v $ -| $Revision: 1.2 $ -| $Date: 2006-12-07 17:47:20 $ -| $Author: sweetas $ +| $Revision: 1.3 $ +| $Date: 2007-01-10 21:31:12 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -162,11 +162,11 @@ class rater { $sep = chr(1); $voter = USERID.$sep.intval($qs[3]); - if ($sql->db_Select("rate", "*", "rate_table='$table' AND rate_itemid='$itemid' ")) { + if ($sql->db_Select("rate", "*", "rate_table='{$table}' AND rate_itemid='{$itemid}' ")) { $row = $sql->db_Fetch(); $rate_voters = $row['rate_voters'].".".$voter."."; - $sql->db_Update("rate", "rate_votes=rate_votes+1, rate_rating=rate_rating+'$rate', rate_voters='$rate_voters' WHERE rate_itemid='$itemid' "); - } else { + $sql->db_Update("rate", "rate_votes=rate_votes+1, rate_rating=rate_rating+'{$rate}', rate_voters='{$rate_voters}' WHERE rate_id='{$row['rate_id']}' "); + } else { $sql->db_Insert("rate", " 0, '$table', '$itemid', '$rate', '1', '.".$voter.".' "); } } diff --git a/rate.php b/rate.php index 2653b1f72..e26929dec 100644 --- a/rate.php +++ b/rate.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/rate.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:33:09 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2007-01-10 21:31:12 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -41,7 +41,7 @@ if ($sql -> db_Select("rate", "*", "rate_table='{$table}' AND rate_itemid='{$ite { $rate_voters = $row['rate_voters'].".".USERID."."; $new_rating = $row['rate_rating']+$rate; - $sql -> db_Update("rate", "rate_votes=rate_votes+1, rate_rating='{$new_rating}', rate_voters='{$rate_voters}' WHERE rate_itemid='{$itemid}' "); + $sql -> db_Update("rate", "rate_votes=rate_votes+1, rate_rating='{$new_rating}', rate_voters='{$rate_voters}' WHERE rate_id='{$row['rate_id']}' "); } else {