diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-09-27 20:51:26 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-09-27 20:51:26 +0000 |
commit | 4a0e498f52106b29d4adae0aaf7e1a6d55f8fd68 (patch) | |
tree | c3611570a31af3bce1042d62affa6a38c8678292 /includes/node.inc | |
parent | 6cde632962a461d2dc2acef0917b592823e123f8 (diff) | |
download | brdo-4a0e498f52106b29d4adae0aaf7e1a6d55f8fd68.tar.gz brdo-4a0e498f52106b29d4adae0aaf7e1a6d55f8fd68.tar.bz2 |
- a batch of updates, including some experimental changes to the moderation
of comments and nodes.
Diffstat (limited to 'includes/node.inc')
-rw-r--r-- | includes/node.inc | 10 |
1 files changed, 7 insertions, 3 deletions
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 .= " <option value=\"$key\"". ($moderate->score == $key ? " selected=\"selected\"" : "") .">$value</option>\n"; } - $output .= " <select name=\"moderate[node][$node->nid]\">$options</select> (". ($node->score ? $node->score : "--") ." / $node->votes)"; + $output .= "accumulated rating: ". ($node->score ? $node->score : "--") ." / $node->votes<br />"; + $output .= "<select name=\"moderate[node][$node->nid]\">$options</select>"; return $output; } |