From 9660f55c27239edc3dfc4d7c29f8665dbf5e96cc Mon Sep 17 00:00:00 2001 From: kanoi Date: Fri, 2 Oct 2015 16:01:32 +1000 Subject: [PATCH] ckdb/php - define a limit for multi-address accounts --- pool/page_addrmgt.php | 46 ++++++++++++++++++++++++++++--------------- src/ckdb.h | 5 ++++- src/ckdb_cmd.c | 27 +++++++++++++++++++++---- src/ckdb_dbio.c | 17 +++++++++------- 4 files changed, 67 insertions(+), 28 deletions(-) diff --git a/pool/page_addrmgt.php b/pool/page_addrmgt.php index fe886b44..7e4c639b 100644 --- a/pool/page_addrmgt.php +++ b/pool/page_addrmgt.php @@ -10,6 +10,7 @@ function addrmgtuser($data, $user, $err) $pg .= makeForm('addrmgt'); $pg .= "\n"; $pg .= ''; + $pg .= ''; $pg .= ''; $pg .= ''; $pg .= ''; @@ -18,6 +19,7 @@ function addrmgtuser($data, $user, $err) # new row template for '+' $pg .= ''; + $pg .= ''; $pg .= ''; @@ -38,7 +40,12 @@ function addrmgtuser($data, $user, $err) $count = 0; if ($ans['STATUS'] == 'ok') { + if (isset($ans['limit'])) + $limit = $ans['limit']; + else + $limit = 1; $count = $ans['rows']; + # this will output any DB rows > limit but DB update will ignore extras for ($i = 0; $i < $count; $i++) { if ((($offset) % 2) == 0) @@ -48,6 +55,7 @@ function addrmgtuser($data, $user, $err) $pg .= ""; $addr = $ans['addr:'.$i]; + $pg .= ''; $pg .= ''; @@ -66,20 +74,22 @@ function addrmgtuser($data, $user, $err) $offset++; } - if ((($offset++) % 2) == 0) - $row = 'even'; - else - $row = 'odd'; - $pg .= ""; - $pg .= ''; + if ($offset < $limit) { + if ((($offset++) % 2) == 0) + $row = 'even'; + else + $row = 'odd'; + $pg .= ""; + } if ((($offset++) % 2) == 0) $row = 'even'; else $row = 'odd'; $pg .= ""; + $pg .= ''; $pg .= ''; $pg .= ''; $pg .= ''; @@ -89,28 +99,32 @@ function addrmgtuser($data, $user, $err) else $row = 'odd'; $pg .= ""; + $pg .= ''; $pg .= ''; $pg .= ''; $pg .= ''; - $pg .= "'; + $pg .= 'A ratio of 0, will remove the address from the payouts'; } $pg .= "
#AddressIDRatio
'; $pg .= ""; $pg .= '
'.($i+1).''; $pg .= ""; $pg .= '
'; - $pg .= ""; - $pg .= '
"; + $pg .= ""; + $pg .= "limit $limit
 Password: 
 *2nd Authentication:'; $pg .= '  
"; + $pg .= '
'; $pg .= "*Leave blank if you haven't enabled it
"; $pg .= 'You must enter your password to save changes
'; - $pg .= 'A ratio of 0, will remove the address from the payouts
\n"; + # TODO - adrw() update the odd/even class for the new row and rows below it + # TODO - move the js functions into inc.php $pg .= "