From 4a0e498f52106b29d4adae0aaf7e1a6d55f8fd68 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 27 Sep 2001 20:51:26 +0000 Subject: - a batch of updates, including some experimental changes to the moderation of comments and nodes. --- includes/node.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'includes/node.inc') diff --git a/includes/node.inc b/includes/node.inc index 76aa83586..bc138b34d 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -4,7 +4,10 @@ $status = array(dumped => 0, expired => 1, queued => 2, posted => 3); $rstatus = array(0 => dumped, 1 => expired, 2 => queued, 3 => posted); function _node_get($conditions) { - foreach ($conditions as $key=>$value) $cond[] = "n.". check_query($key) ." = '". check_query($value) ."'"; + foreach ($conditions as $key=>$value) { + $cond[] = "n.". check_query($key) ." = '". check_query($value) ."'"; + } + $where = implode(" AND ", $cond); if ($conditions[type]) { @@ -16,7 +19,7 @@ function _node_get($conditions) { } if ($type) { - return db_query("SELECT n.*, l.*, u.uid, u.name FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN user u ON n.author = u.uid WHERE $where ORDER BY n.timestamp DESC"); + return db_query("SELECT n.*, l.*, u.uid, u.name, SUM(m.score) / COUNT(m.cid) AS score, COUNT(m.cid) AS votes FROM node n LEFT JOIN $type l ON n.lid = l.lid AND n.nid = l.nid LEFT JOIN user u ON n.author = u.uid LEFT JOIN moderate m ON m.nid = n.nid WHERE $where GROUP BY n.nid ORDER BY n.timestamp DESC"); } } @@ -267,7 +270,8 @@ function node_moderation($nid) { $options .= " \n"; } - $output .= " (". ($node->score ? $node->score : "--") ." / $node->votes)"; + $output .= "accumulated rating: ". ($node->score ? $node->score : "--") ." / $node->votes
"; + $output .= ""; return $output; } -- cgit v1.2.3