diff --git a/.travis.yml b/.travis.yml index 274298ef..8747dad6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,6 +34,7 @@ before_script: - nohup php -S bone:8000 public/index.php & script: + - php vendor/bin/codecept build - php vendor/bin/codecept run unit --coverage --coverage-html --coverage-xml --env travis after_script: diff --git a/cronjobs/tables_cleanup.php b/cronjobs/tables_cleanup.php index b47918ae..c2f42780 100755 --- a/cronjobs/tables_cleanup.php +++ b/cronjobs/tables_cleanup.php @@ -59,7 +59,7 @@ if ($oToken->cleanupTokens()) { } $log->logInfo(sprintf($strLogMask, 'cleanupTokens', $affected, number_format(microtime(true) - $start, 3), $status, $message)); -// Clenaup shares archive +// Cleanup shares archive $start = microtime(true); $status = 'OK'; $message = ''; @@ -73,7 +73,7 @@ if ($affected === false) { } $log->logInfo(sprintf($strLogMask, 'purgeArchive', $affected, number_format(microtime(true) - $start, 3), $status, $message)); -// Clenaup shares archive +// Cleanup shares archive $start = microtime(true); $status = 'OK'; $message = ''; diff --git a/include/classes/csrftoken.class.php b/include/classes/csrftoken.class.php index 373a1210..130b4280 100644 --- a/include/classes/csrftoken.class.php +++ b/include/classes/csrftoken.class.php @@ -16,19 +16,22 @@ class CSRFToken Extends Base { } /** - * Returns +1 min and +1 hour rollovers hashes + * Returns +1 min up to +15 min rollovers hashes * @param string $user user or IP/host address * @param string $type page name or other unique per-page identifier - * @return array 1min and 1hour hashes + * @return array 1 minute ago up to 15 minute ago hashes */ + public function checkAdditional($user, $type) { $date = date('m/d/y/H/i'); $d = explode('/', $date); - // minute may have rolled over - $seed1 = $this->buildSeed($user.$type, $d[0], $d[1], $d[2], $d[3], ($d[4]-1)); - // hour may have rolled over - $seed2 = $this->buildSeed($user.$type, $d[0], $d[1], $d[2], ($d[3]-1), 59); - return array($this->getHash($seed1), $this->getHash($seed2)); + $hashes = array(); + for ($x = 1; $x < 16; $x++){ + for ($y = 4;$d[$y]-- == 0;$y--); + if ($d[4] < 0) { $d[4] = 59; } + $hashes[$x-1] = $this->getHash($this->buildSeed($user.$type, $d[0], $d[1], $d[2], $d[3], $d[4])); + } + return $hashes; } /** diff --git a/include/pages/api/getpoolstatus.inc.php b/include/pages/api/getpoolstatus.inc.php index 915132e0..dd48358f 100644 --- a/include/pages/api/getpoolstatus.inc.php +++ b/include/pages/api/getpoolstatus.inc.php @@ -12,7 +12,7 @@ $aLastBlock = $block->getLast(); // Efficiency $aShares = $statistics->getRoundShares(); -$aShares['valid'] > 0 ? $dEfficiency = round((100 - (100 / $aShares['valid'] * $aShares['invalid'])), 2) : $dEfficiency = 0; +$aShares['invalid'] > 0 ? $dEfficiency = round((1 - ($aShares['invalid'] / ($aShares['valid'] + $aShares['invalid']))) * 100, 2) : $dEfficiency = 100; // Fetch RPC data if ($bitcoin->can_connect() === true){ diff --git a/include/pages/api/getusertransactions.inc.php b/include/pages/api/getusertransactions.inc.php index 62f60e19..956ca668 100644 --- a/include/pages/api/getusertransactions.inc.php +++ b/include/pages/api/getusertransactions.inc.php @@ -8,13 +8,20 @@ $api->isActive(); $user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']); // Fetch transactions +if (isset($_REQUEST['start'])) { + $start = $_REQUEST['start']; +} else { + // start at the beginning + $start = 0; +} if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) { $limit = $_REQUEST['limit']; } else { // Force limit $limit = 100; } -$data['transactions'] = $transaction->getTransactions(0, NULL, $limit, $user_id); + +$data['transactions'] = $transaction->getTransactions($start, NULL, $limit, $user_id); // Fetch summary if enabled if (!$setting->getValue('disable_transactionsummary')) { diff --git a/templates/bootstrap/admin/wallet/peers.tpl b/templates/bootstrap/admin/wallet/peers.tpl index 50770d3f..bccd331c 100644 --- a/templates/bootstrap/admin/wallet/peers.tpl +++ b/templates/bootstrap/admin/wallet/peers.tpl @@ -1,31 +1,35 @@ -
-
-
-
- Peer Information -
-
- - - - - - - - - - - -{foreach key=KEY item=ARRAY from=$PEERINFO} - - - - - - - -{/foreach} - -
HostProtocolIdentityConnectedTraffic
{$ARRAY['addr']}{$ARRAY['version']}{$ARRAY['subver']|replace:'/':''}{$ARRAY['conntime']|date_format:$GLOBAL.config.date}{(($ARRAY['bytessent']|default:"0" + $ARRAY['bytesrecv']|default:"0") / 1024 / 1024)|number_format:"3"} MB
-
-
+
+
+
+
+ Peer Information +
+
+
+ + + + + + + + + + + + {foreach key=KEY item=ARRAY from=$PEERINFO} + + + + + + + + {/foreach} + +
HostProtocolIdentityConnectedTraffic
{$ARRAY['addr']}{$ARRAY['version']}{$ARRAY['subver']|replace:'/':''}{$ARRAY['conntime']|date_format:$GLOBAL.config.date}{(($ARRAY['bytessent']|default:"0" + $ARRAY['bytesrecv']|default:"0") / 1024 / 1024)|number_format:"3"} MB
+
+
+
+
+
diff --git a/templates/bootstrap/admin/wallet/status.tpl b/templates/bootstrap/admin/wallet/status.tpl index 87566e13..c1d2f477 100644 --- a/templates/bootstrap/admin/wallet/status.tpl +++ b/templates/bootstrap/admin/wallet/status.tpl @@ -1,32 +1,35 @@ -
-
-
- Wallet Status -
-
- - - - - - - - - - - - - - - - - - - - - -
VersionProtocol VersionWallet VersionPeersStatusBlocksAccounts
{$COININFO.version|default:""}{$COININFO.protocolversion|default:""}{$COININFO.walletversion|default:""}{$COININFO.connections|default:""}{$COININFO.errors|default:"OK"}{$COININFO.blocks|default:"0"}{$ADDRESSCOUNT}
-
-
-
-
+
+
+
+ Wallet Status +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
VersionProtocol VersionWallet VersionPeersStatusBlocksAccounts
{$COININFO.version|default:""}{$COININFO.protocolversion|default:""}{$COININFO.walletversion|default:""}{$COININFO.connections|default:""}{$COININFO.errors|default:"OK"}{$COININFO.blocks|default:"0"}{$ADDRESSCOUNT}
+
+
+
+
diff --git a/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl b/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl index 234e31ce..dfa26040 100644 --- a/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl @@ -70,7 +70,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/dashboard/round_statistics/pps/round.tpl b/templates/bootstrap/dashboard/round_statistics/pps/round.tpl index 7fc95e6c..7ed86472 100644 --- a/templates/bootstrap/dashboard/round_statistics/pps/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/pps/round.tpl @@ -130,7 +130,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl index 1fe67f59..8ea54a2e 100644 --- a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl @@ -70,7 +70,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/statistics/blocks/block_overview_time.tpl b/templates/bootstrap/statistics/blocks/block_overview_time.tpl index 61bae492..7fb9941b 100644 --- a/templates/bootstrap/statistics/blocks/block_overview_time.tpl +++ b/templates/bootstrap/statistics/blocks/block_overview_time.tpl @@ -42,7 +42,7 @@ {$LASTBLOCKSBYTIME.TotalShares|number_format} {if $LASTBLOCKSBYTIME.TotalEstimatedShares > 0} - {($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -68,7 +68,7 @@ {$LASTBLOCKSBYTIME.1HourShares|number_format} {if $LASTBLOCKSBYTIME.1HourEstimatedShares > 0} - {($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -94,7 +94,7 @@ {$LASTBLOCKSBYTIME.24HourShares|number_format} {if $LASTBLOCKSBYTIME.24HourEstimatedShares > 0} - {($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -120,7 +120,7 @@ {$LASTBLOCKSBYTIME.7DaysShares|number_format} {if $LASTBLOCKSBYTIME.7DaysEstimatedShares > 0} - {($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -146,7 +146,7 @@ {$LASTBLOCKSBYTIME.4WeeksShares|number_format} {if $LASTBLOCKSBYTIME.4WeeksEstimatedShares > 0} - {($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -172,7 +172,7 @@ {$LASTBLOCKSBYTIME.12MonthShares|number_format} {if $LASTBLOCKSBYTIME.12MonthEstimatedShares > 0} - {($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} diff --git a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl index 834c0fe2..1f054a86 100644 --- a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl +++ b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl @@ -59,7 +59,7 @@ {$BLOCKSFOUND[block].shares|number_format} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares} - {$percentage|number_format:"2"} + {$percentage|number_format:"2"} {/section} @@ -70,7 +70,7 @@ {$pplnsshares|number_format} {/if} {$totalshares|number_format} - {if $count > 0}{($totalshares / $totalexpectedshares * 100)|number_format:"2"}{else}0{/if} + {if $count > 0}{($totalshares / $totalexpectedshares * 100)|number_format:"2"}{else}0{/if}