Browse Source

php - add a public blocks page

master
kanoi 10 years ago
parent
commit
ad6f642129
  1. 16
      pool/page_blocks.php
  2. 15
      pool/page_pblocks.php
  3. 3
      pool/prime.php

16
pool/page_blocks.php

@ -44,12 +44,16 @@ function doblocks($data, $user)
$pg = '<h1>Blocks</h1>'; $pg = '<h1>Blocks</h1>';
$ans = getBlocks($user); if ($user === null)
$ans = getBlocks('Anon');
else
$ans = getBlocks($user);
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n"; $pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= "<tr class=title>"; $pg .= "<tr class=title>";
$pg .= "<td class=dl>Height</td>"; $pg .= "<td class=dl>Height</td>";
$pg .= "<td class=dl>Who</td>"; if ($user !== null)
$pg .= "<td class=dl>Who</td>";
$pg .= "<td class=dr>Reward</td>"; $pg .= "<td class=dr>Reward</td>";
$pg .= "<td class=dc>When</td>"; $pg .= "<td class=dc>When</td>";
$pg .= "<td class=dr>Status</td>"; $pg .= "<td class=dr>Status</td>";
@ -119,7 +123,8 @@ function doblocks($data, $user)
$pg .= "<tr class=$row>"; $pg .= "<tr class=$row>";
$pg .= "<td class=dl$ex>$hifld</td>"; $pg .= "<td class=dl$ex>$hifld</td>";
$pg .= "<td class=dl$ex>".htmlspecialchars($ans['workername:'.$i]).'</td>'; if ($user !== null)
$pg .= "<td class=dl$ex>".htmlspecialchars($ans['workername:'.$i]).'</td>';
$pg .= "<td class=dr$ex>".btcfmt($ans['reward:'.$i]).'</td>'; $pg .= "<td class=dr$ex>".btcfmt($ans['reward:'.$i]).'</td>';
$pg .= "<td class=dl$ex>".gmdate('Y-m-d H:i:s+00', $ans['firstcreatedate:'.$i]).'</td>'; $pg .= "<td class=dl$ex>".gmdate('Y-m-d H:i:s+00', $ans['firstcreatedate:'.$i]).'</td>';
$pg .= "<td class=dr$ex>".$stat.'</td>'; $pg .= "<td class=dr$ex>".$stat.'</td>';
@ -141,7 +146,10 @@ function doblocks($data, $user)
$bg = " bgcolor=$bg"; $bg = " bgcolor=$bg";
$pg .= "<tr class=$row>"; $pg .= "<tr class=$row>";
$pg .= "<td class=dl colspan=6></td>"; if ($user === null)
$pg .= "<td class=dl colspan=5></td>";
else
$pg .= "<td class=dl colspan=6></td>";
$pg .= "<td class=dr$bg>".$bpct.'</td>'; $pg .= "<td class=dr$bg>".$bpct.'</td>';
$pg .= "</tr>\n"; $pg .= "</tr>\n";
} }

15
pool/page_pblocks.php

@ -0,0 +1,15 @@
<?php
#
include_once('page_blocks.php');
#
function dopblocks($data, $user)
{
return doblocks($data, null);
}
#
function show_pblocks($page, $menu, $name, $user)
{
gopage(NULL, 'dopblocks', $page, $menu, $name, $user);
}
#
?>

3
pool/prime.php

@ -34,6 +34,9 @@ function process($p, $user, $menu)
function def_menu() function def_menu()
{ {
$dmenu = array('Home' => array('Home' => ''), $dmenu = array('Home' => array('Home' => ''),
'Pool' => array(
'Blocks' => 'pblocks'
),
'gap' => array( # options not shown 'gap' => array( # options not shown
'API' => 'api'), 'API' => 'api'),
'Help' => array('Help' => 'help', 'Help' => array('Help' => 'help',

Loading…
Cancel
Save