if (!check_perms('users_mod')) {
error(403);
}
$Title = "Unprocessed Bitcoin Donations";
View::show_header($Title);
// 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 (Total: =$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();