From a3bd74eaa14b9f23cf2ff86698292ae563126722 Mon Sep 17 00:00:00 2001 From: kanoi Date: Mon, 22 Dec 2014 13:54:21 +1100 Subject: [PATCH] php - csv version of pblocks --- pool/page_blocks.php | 69 ++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/pool/page_blocks.php b/pool/page_blocks.php index 1bf6b9f3..af7394ff 100644 --- a/pool/page_blocks.php +++ b/pool/page_blocks.php @@ -49,22 +49,31 @@ function doblocks($data, $user) else $ans = getBlocks($user); - $pg .= "\n"; - $pg .= ""; - $pg .= ""; - if ($user !== null) - $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= "\n"; + if (nuem(getparam('csv', true))) + $wantcsv = false; + else + $wantcsv = true; + + if ($wantcsv === false) + { + $pg .= "
HeightWhoRewardWhenStatusDiff%CDF
\n"; + $pg .= ""; + $pg .= ""; + if ($user !== null) + $pg .= ""; + $pg .= ""; + $pg .= ""; + $pg .= ""; + $pg .= ""; + $pg .= ""; + $pg .= ""; + $pg .= "\n"; + } $blktot = 0; $nettot = 0; $i = 0; $orph = false; + $csv = "Height,Status,Timestamp,DiffAcc,NetDiff\n"; if ($ans['STATUS'] == 'ok') { $count = $ans['rows']; @@ -130,19 +139,35 @@ function doblocks($data, $user) $cdf = '?'; } - $pg .= ""; - $pg .= ""; - if ($user !== null) + if ($wantcsv === false) + { + $pg .= ""; + $pg .= ""; + if ($user !== null) $pg .= "'; - $pg .= "'; - $pg .= "'; - $pg .= "'; - $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= "\n"; + $pg .= "'; + $pg .= "'; + $pg .= "'; + $pg .= ""; + $pg .= ""; + $pg .= ""; + $pg .= "\n"; + } + else + { + $csv .= "$hi,"; + $csv .= "\"$stat\","; + $csv .= $ans['firstcreatedate:'.$i].','; + $csv .= "$diffacc,"; + $csv .= "$netdiff\n"; + } } } + if ($wantcsv === true) + { + echo $csv; + exit(0); + } if ($nettot > 0) { if (($i % 2) == 0)
HeightWhoRewardWhenStatusDiff%CDF
$hifld
$hifld".htmlspecialchars($ans['workername:'.$i]).'".btcfmt($ans['reward:'.$i]).'".gmdate('Y-m-d H:i:s+00', $ans['firstcreatedate:'.$i]).'".$stat.'$stara$acc$bpct$cdf
".btcfmt($ans['reward:'.$i]).'".gmdate('Y-m-d H:i:s+00', $ans['firstcreatedate:'.$i]).'".$stat.'$stara$acc$bpct$cdf