session_begin(); $auth->acl($user->data); $user->setup(''); $sql = "SELECT * FROM phpbb_rating"; $result = $db->sql_query($sql); while($row = $db->sql_fetchrow($result)) { // okay looping through the old ratings, now obtain topic id and copy. $sql = "SELECT topic_id FROM " . POSTS_TABLE . " WHERE post_id = '" . $row['post_id'] . "'"; $new_result = $db->sql_query($sql); $new_row = $db->sql_fetchrow($new_result); /* 16 = 0 15 = 5 14 = 4 13 = 2 12 = 3 11 = 1 */ switch($row['option_id']) { case "16": case "11": $ev = "1"; break; case "15": $ev = "5"; break; case "14": $ev = "4"; break; case "13": $ev = "2"; break; case "12": $ev = "3"; break; } // insert $sql = "INSERT INTO phpbb_topics_evaluation (topic_id, evaluation, user_id) VALUES ('" . $new_row['topic_id'] . "', '" . $ev . "', '" . $row['user_id'] . "');"; $db->sql_query($sql); } ?>