- Made the rating module and its SQL table ASNI compliant. Patch by jaa.
parent
fc143e79a7
commit
e04f6d2328
|
@ -318,8 +318,8 @@ CREATE TABLE poll_choices (
|
|||
|
||||
CREATE TABLE rating (
|
||||
uid int(10) NOT NULL default '0',
|
||||
new int(6) NOT NULL default '0',
|
||||
old int(6) NOT NULL default '0',
|
||||
current int(6) NOT NULL default '0',
|
||||
previous int(6) NOT NULL default '0',
|
||||
PRIMARY KEY (uid)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ function rating_cron() {
|
|||
|
||||
$r2 = db_query("SELECT uid FROM users ORDER BY rating DESC");
|
||||
while ($account = db_fetch_object($r2)) {
|
||||
db_query("INSERT INTO rating (uid, new, old) VALUES ('$account->uid', '". ++$j ."', '". $rating[$account->uid] ."')");
|
||||
db_query("INSERT INTO rating (uid, current, previous) VALUES ('$account->uid', '". ++$j ."', '". $rating[$account->uid] ."')");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ function rating_list($limit) {
|
|||
|
||||
$output .= "<table cellpadding=\"1\" cellspacing=\"1\">\n";
|
||||
while ($account = db_fetch_object($result)) {
|
||||
$ranking = $account->old - $account->new;
|
||||
$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";
|
||||
|
|
|
@ -47,7 +47,8 @@ $mysql_updates = array(
|
|||
"2002-06-22" => "update_32",
|
||||
"2002-07-07" => "update_33",
|
||||
"2002-07-31" => "update_34",
|
||||
"2002-08-10" => "update_35"
|
||||
"2002-08-10" => "update_35",
|
||||
"2002-08-16" => "update_36"
|
||||
);
|
||||
|
||||
// Update functions
|
||||
|
@ -502,6 +503,11 @@ function update_35() {
|
|||
update_sql("ALTER TABLE poll_choices ADD INDEX (nid);");
|
||||
}
|
||||
|
||||
function update_36() {
|
||||
update_sql("ALTER TABLE rating CHANGE old previous int(6) NOT NULL default '0';");
|
||||
update_sql("ALTER TABLE rating CHANGE new current int(6) NOT NULL default '0';");
|
||||
}
|
||||
|
||||
function update_upgrade3() {
|
||||
update_sql("INSERT INTO system VALUES ('archive.module','archive','module','',1);");
|
||||
update_sql("INSERT INTO system VALUES ('block.module','block','module','',1);");
|
||||
|
|
Loading…
Reference in New Issue