"rating_cron", "help" => "rating_help", "page" => "rating_page", "block" => "rating_block"); function rating_cron() { $r1 = db_query("SELECT id FROM users ORDER BY rating DESC"); while ($account = db_fetch_object($r1)) { db_query("UPDATE users SET rating = '". user_gravity($account->id) ."' WHERE id = '$account->id'"); $rating[$account->id] = ++$i; } db_query("DELETE FROM rating"); $r2 = db_query("SELECT id FROM users ORDER BY rating DESC"); while ($account = db_fetch_object($r2)) { db_query("INSERT INTO rating (user, new, old) VALUES ('$account->id', '". ++$j ."', '". $rating[$account->id] ."')"); } } function rating_help() { ?>

The rating cron will periodically calculate each user's gravity, the overall time-weighted rating of each user's contributions.

\n"; while ($account = db_fetch_object($result)) { $ranking = $account->old - $account->new; $output .= "". ++$i ."". format_username($account->userid) ."". check_output($account->rating) ."(". ($ranking < 0 ? "" : "+") ."$ranking)"; } $output .= "\n"; return $output; } function rating_page() { global $theme; $theme->header(); $theme->box("Top 100 users", rating_list(100)); $theme->footer(); } function rating_block() { $block[0][subject] = "Top 10:
users"; $block[0][content] = rating_list(10); $block[0][info] = "Top 10: users"; return $block; } ?>