diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-05-24 21:49:10 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-05-24 21:49:10 +0000 |
commit | bfc897d533d9c9d2642c300bc771ca10e7ee8648 (patch) | |
tree | ab508dcf68508daa3a8da5a881d8a433a576514e /includes | |
parent | c9c14ca5938913afbfd775ab9dcc36db6901ccba (diff) | |
download | brdo-bfc897d533d9c9d2642c300bc771ca10e7ee8648.tar.gz brdo-bfc897d533d9c9d2642c300bc771ca10e7ee8648.tar.bz2 |
- Improved the rating module: made it possible to define "weights"
for the different content types. These weights are used when
calculating each user's gravity. This is a required step before
we can even think of "nodifying" the diary or headline module.
- Polished a bit more on the other modules' crons.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/user.inc | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/includes/user.inc b/includes/user.inc index 307a3f33c..0b99a6af5 100644 --- a/includes/user.inc +++ b/includes/user.inc @@ -63,32 +63,4 @@ function user_ban($mask, $type) { return db_fetch_object($result); } -function user_gravity($id) { - global $status; - - $period = 5184000; // maximum 60 days - $number = 30; // maximum 30 comments - - $r1 = db_query("SELECT COUNT(nid) AS number FROM node WHERE author = '$id' AND (". time() ." - timestamp < $period) AND status = '$status[posted]'"); - if ($story = db_fetch_object($r1)) { - $bonus += $story->number; - } - - $r2 = db_query("SELECT COUNT(nid) AS number FROM node WHERE author = '$id' AND (". time() ." - timestamp < $period) AND status = '$status[dumped]'"); - if ($story = db_fetch_object($r2)) { - $bonus -= $story->number; - } - - $r3 = db_query("SELECT score, votes FROM comments WHERE author = '$id' AND votes > 0 AND (". time() ." - timestamp < $period) ORDER BY timestamp LIMIT $number"); - while ($comment = db_fetch_object($r3)) { - $weight++; - $score += $weight * $comment->score; - $votes += $weight * $comment->votes; - } - - $bonus += $weight / 5; - - return ($votes ? ($score + $weight) / $votes + $bonus : $bonus); -} - ?>
\ No newline at end of file |