diff --git a/database/database.mysql b/database/database.mysql index d962a7f0d8eadc45385a32af61b0c7fee1004377..672edd03b54dbc7a4af86d5cc5db4702a9ab39e0 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -333,17 +333,6 @@ CREATE TABLE poll_choices ( KEY nid (nid) ) TYPE=MyISAM; --- --- Table structure for table 'rating' --- - -CREATE TABLE rating ( - uid int(10) NOT NULL default '0', - current int(6) NOT NULL default '0', - previous int(6) NOT NULL default '0', - PRIMARY KEY (uid) -) TYPE=MyISAM; - -- -- Table structure for table 'role' -- diff --git a/database/database.pgsql b/database/database.pgsql index 5ae053806cf0cd4afd1f930601483ed1af0f0e19..780af623326775e955c602e262ef9ee736e43d7d 100644 --- a/database/database.pgsql +++ b/database/database.pgsql @@ -330,17 +330,6 @@ CREATE TABLE poll_choices ( ); CREATE INDEX poll_choices_nid_idx ON poll_choices(nid); --- --- Table structure for rating --- - -CREATE TABLE rating ( - uid integer NOT NULL default '0', - current integer NOT NULL default '0', - previous integer NOT NULL default '0', - PRIMARY KEY (uid) -); - -- -- Table structure for role -- @@ -560,30 +549,14 @@ CREATE TABLE watchdog ( -- Insert some default values -- - -INSERT INTO system VALUES ('archive.module','archive','module','',1); -INSERT INTO system VALUES ('block.module','block','module','',1); -INSERT INTO system VALUES ('blog.module','blog','module','',1); -INSERT INTO system VALUES ('book.module','book','module','',1); -INSERT INTO system VALUES ('cloud.module','cloud','module','',1); -INSERT INTO system VALUES ('comment.module','comment','module','',1); -INSERT INTO system VALUES ('forum.module','forum','module','',1); -INSERT INTO system VALUES ('help.module','help','module','',1); -INSERT INTO system VALUES ('import.module','import','module','',1); -INSERT INTO system VALUES ('node.module','node','module','',1); -INSERT INTO system VALUES ('page.module','page','module','',1); -INSERT INTO system VALUES ('poll.module','poll','module','',1); -INSERT INTO system VALUES ('queue.module','queue','module','',1); -INSERT INTO system VALUES ('rating.module','rating','module','',1); -INSERT INTO system VALUES ('search.module','search','module','',1); -INSERT INTO system VALUES ('statistics.module','statistics','module','',1); -INSERT INTO system VALUES ('story.module','story','module','',1); -INSERT INTO system VALUES ('taxonomy.module','taxonomy','module','',1); -INSERT INTO system VALUES ('themes/example/example.theme','example','theme','Internet explorer, Netscape, Opera, Lynx',1); -INSERT INTO system VALUES ('themes/goofy/goofy.theme','goofy','theme','Internetexplorer, Netscape, Opera',1); +INSERT INTO system VALUES ('modules/block.module','block','module','',1); +INSERT INTO system VALUES ('modules/comment.module','comment','module','',1); +INSERT INTO system VALUES ('modules/help.module','help','module','',1); +INSERT INTO system VALUES ('modules/node.module','node','module','',1); +INSERT INTO system VALUES ('modules/page.module','page','module','',1); +INSERT INTO system VALUES ('modules/story.module','story','module','',1); +INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1); INSERT INTO system VALUES ('themes/marvin/marvin.theme','marvin','theme','Internet explorer, Netscape, Opera',1); -INSERT INTO system VALUES ('themes/unconed/unconed.theme','unconed','theme','Internet explorer, Netscape, Opera',1); -INSERT INTO system VALUES ('tracker.module','tracker','module','',1); INSERT INTO variable(name,value) VALUES('update_start', '2002-05-15'); INSERT INTO variable(name,value) VALUES('theme_default','s:6:"marvin";'); diff --git a/modules/rating.module b/modules/rating.module deleted file mode 100644 index 8fa5954a589e7327b4cd3cc253e2471c1eb21285..0000000000000000000000000000000000000000 --- a/modules/rating.module +++ /dev/null @@ -1,118 +0,0 @@ -<?php -// $Id$ - -function rating_help() { - $output .= "<p>Drupal uses <i>gravity</i> as an indication for each user's contributed value. The system can be compared with <a href=\"http://www.slashcode.com/\">SlashCode</a>'s Karma and is - in fact - even more similar to <a href=\"http://scoop.kuro5hin.org/\">Scoop</a>'s Mojo.</p>"; - $output .= "<p>Gravity is calculated based on the moderation done to a user's nodes: you gain or loose points based on the fact your nodes got approved/promoted or rejected/declined. The sampling period could be an arbitrary number of days (by default set to 60 days) or an arbitrary number of nodes (by default set to 30), whatever comes first. Thus, you lose one point for each node being rejected during the past 60 days and you gain one point for each node being approved. You don't gain nor loose points for nodes that have been replaced or expired. Cron will periodically re-calculate each user's gravity.</p>"; - $output .= "<p>By default, Drupal does not use gravity but it can be used by module builders to automatically assign access rights or editorial priveledges to users or to limit or eliminate potential abuse by limiting the rate of posting or the ability to post at all. Aside from that, it can be used to play point games but that is, needless to say, not the goal gravity aspires to.</p>"; - return $output; -} - -function rating_system($field){ - $system["description"] = t("Enables ranking of users based on the rating of their submissions."); - return $system[$field]; -} - -function rating_perm() { - return array("access user ratings"); -} - -function rating_link($type) { - if ($type == "page" && user_access("access user ratings")) { - $links[] = lm(t("user ratings"), array("mod" => "rating"), "", array("title" => t("Display an overview of the user ratings."))); - } - - return $links ? $links : array(); -} - -function rating_conf_options() { - $period = array(3600 => format_interval(3600), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 1000000000 => "Never"); - $output .= form_select("Update interval", "rating_cron_time" , variable_get("rating_cron_time", 86400), $period, "The update interval for the user ratings. Requires crontab."); - - $weight = array("Disabled", 1, 2, 3, 4, 5, 6, 7, 9, 10); - foreach (module_list() as $name) { - if (module_hook($name, "user")) { - $output .= form_select("Weight of a $name", "rating_weight_$name", variable_get("rating_weight_$name", 0), $weight, "The weight of a $name."); - } - } - return $output; -} - -function rating_cron() { - if (time() - variable_get("rating_cron_last", 0) > variable_get("rating_cron_time", time())) { - variable_set("rating_cron_last", time()); - - $r1 = db_query("SELECT uid FROM users ORDER BY rating DESC"); - while ($account = db_fetch_object($r1)) { - db_query("UPDATE users SET rating = '". rating_gravity($account->uid) ."' WHERE uid = '$account->uid'"); - $rating[$account->uid] = ++$i; - } - - db_query("DELETE FROM rating"); - - $r2 = db_query("SELECT uid FROM users ORDER BY rating DESC"); - while ($account = db_fetch_object($r2)) { - db_query("INSERT INTO rating (uid, current, previous) VALUES ('$account->uid', '". ++$j ."', '". $rating[$account->uid] ."')"); - } - } -} - -function rating_gravity($uid) { - $period = 5184000; // maximum 60 days - $number = 30; // maximum 30 nodes - - $gravity = 0; - - $r1 = db_query("SELECT nid, type FROM node WHERE uid = '$uid' AND (". time() ." - created < $period) AND moderate = 0 AND promote = 1 AND status = 1 LIMIT $number"); - while ($node = db_fetch_object($r1)) { - $gravity += 1; - } - - $r2 = db_query("SELECT nid, type FROM node WHERE uid = '$uid' AND (". time() ." - created < $period) AND status = 0 LIMIT $number"); - while ($node = db_fetch_object($r1)) { - $gravity -= 1; - } - - return $gravity; -} - -function rating_list($limit) { - $result = db_query("SELECT u.rating, u.name, u.uid, r.* FROM users u LEFT JOIN rating r ON u.uid = r.uid ORDER BY u.rating DESC LIMIT $limit"); - - $output .= "<table cellpadding=\"1\" cellspacing=\"1\">\n"; - while ($account = db_fetch_object($result)) { - $ranking = $account->previous - $account->current; - $output .= "<tr><td align=\"right\">". ++$i .".</td><td>". format_name($account) ."</td><td align=\"right\">". check_output($account->rating) ."</td><td>(". ($ranking < 0 ? "" : "+") ."$ranking)</td></tr>"; - } - $output .= "</table>\n"; - return $output; -} - -function rating_page() { - global $user, $theme; - - $theme->header(); - - if (user_access("access user ratings")) { - $theme->box(t("Top 100 users"), rating_list(100)); - } - else { - $theme->box(t("Access denied"), message_access()); - } - - $theme->footer(); -} - -function rating_block($op = "list", $delta = 0) { - if ($op == "list") { - $blocks[0]["info"] = t("Top 10: users"); - return $blocks; - } - else { - $block["subject"] = t("Top 10: users"); - $block["content"] = rating_list(10); - return $block; - } -} - -?> \ No newline at end of file