if (!check_perms('users_mod')) {
error(403);
}
View::show_header('Unprocessed Bitcoin donations');
// Find all donors
$AllDonations = DonationsBitcoin::get_received();
$DB->query("
SELECT BitcoinAddress, SUM(Amount)
FROM donations_bitcoin
GROUP BY BitcoinAddress");
$OldDonations = G::$DB->to_pair(0, 1, false);
?>
Do not process these donations manually! The bitcoin parser will get them sooner or later (poke a developer if something seems broken).
$NewDonations = array();
$TotalUnproc = 0;
foreach ($AllDonations as $Address => $Amount) {
if (isset($OldDonations[$Address])) {
if ($Amount == $OldDonations[$Address]) { // Direct comparison should be fine as everything comes from bitcoind
continue;
}
$Debug->log_var(array('old' => $OldDonations[$Address], 'new' => $Amount), "New donations from $Address");
// PHP doesn't do fixed-point math, and json_decode has already botched the precision
// so let's just round this off to satoshis and pray that we're on a 64 bit system
$Amount = round($Amount - $OldDonations[$Address], 8);
}
$TotalUnproc += $Amount;
$NewDonations[$Address] = $Amount;
}
?>
Bitcoin address |
User |
Unprocessed amount (=$TotalUnproc ?: '0'?>) |
Total amount |
Donor rank |
Special rank |
if (!empty($NewDonations)) {
foreach(DonationsBitcoin::get_userids(array_keys($NewDonations)) as $Address => $UserID) {
?>
=$Address?> |
=Users::format_username($UserID, true, false, false)?> |
=$NewDonations[$Address]?> |
=$AllDonations[$Address]?> |
=(int)Donations::get_rank($UserID)?> |
=(int)Donations::get_special_rank($UserID)?> |
}
} else { ?>
No unprocessed Bitcoin donations |
} ?>
View::show_footer();