Merge branch 'development' of https://github.com/MPOS/php-mpos into development

This commit is contained in:
Dennis Ruhe 2018-03-07 12:44:08 +01:00
commit 467f8e5335
12 changed files with 103 additions and 85 deletions

View File

@ -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:

View File

@ -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 = '';

View File

@ -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;
}
/**

View File

@ -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){

View File

@ -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')) {

View File

@ -1,31 +1,35 @@
<div class="row">
<div class="col-lg-12">
<div class="panel panel-info">
<div class="panel-heading">
<i class="fa fa-connectdevelop fa-fw"></i> Peer Information
</div>
<div class="panel-body no-padding">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Host</th>
<th>Protocol</th>
<th>Identity</th>
<th>Connected</th>
<th>Traffic</th>
</tr>
</thead>
<tbody>
{foreach key=KEY item=ARRAY from=$PEERINFO}
<tr>
<td>{$ARRAY['addr']}</td>
<td>{$ARRAY['version']}</td>
<td>{$ARRAY['subver']|replace:'/':''}</td>
<td>{$ARRAY['conntime']|date_format:$GLOBAL.config.date}</td>
<td>{(($ARRAY['bytessent']|default:"0" + $ARRAY['bytesrecv']|default:"0") / 1024 / 1024)|number_format:"3"} MB</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-info">
<div class="panel-heading">
<i class="fa fa-connectdevelop fa-fw"></i> Peer Information
</div>
<div class="panel-body no-padding">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Host</th>
<th>Protocol</th>
<th>Identity</th>
<th>Connected</th>
<th>Traffic</th>
</tr>
</thead>
<tbody>
{foreach key=KEY item=ARRAY from=$PEERINFO}
<tr>
<td>{$ARRAY['addr']}</td>
<td>{$ARRAY['version']}</td>
<td>{$ARRAY['subver']|replace:'/':''}</td>
<td>{$ARRAY['conntime']|date_format:$GLOBAL.config.date}</td>
<td>{(($ARRAY['bytessent']|default:"0" + $ARRAY['bytesrecv']|default:"0") / 1024 / 1024)|number_format:"3"} MB</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,32 +1,35 @@
<div class="col-lg-8">
<div class="panel panel-info">
<div class="panel-heading">
<i class="fa fa-info fa-fw"></i> Wallet Status
</div>
<div class="panel-body no-padding">
<table class="table table-striped table-bordered table-hover">
<thead>
<th>Version</th>
<th>Protocol Version</th>
<th>Wallet Version</th>
<th>Peers</th>
<th>Status</th>
<th>Blocks</th>
<th>Accounts</th>
</thead>
<tbody>
<tr>
<td>{$COININFO.version|default:""}</td>
<td>{$COININFO.protocolversion|default:""}</td>
<td>{$COININFO.walletversion|default:""}</td>
<td>{$COININFO.connections|default:""}</td>
<td><font color="{if $COININFO.errors}red{else}green{/if}">{$COININFO.errors|default:"OK"}</font></td>
<td>{$COININFO.blocks|default:"0"}</td>
<td>{$ADDRESSCOUNT}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<div class="panel panel-info">
<div class="panel-heading">
<i class="fa fa-info fa-fw"></i> Wallet Status
</div>
<div class="panel-body no-padding">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Version</th>
<th>Protocol Version</th>
<th>Wallet Version</th>
<th>Peers</th>
<th>Status</th>
<th>Blocks</th>
<th>Accounts</th>
</tr>
</thead>
<tbody>
<tr>
<td>{$COININFO.version|default:""}</td>
<td>{$COININFO.protocolversion|default:""}</td>
<td>{$COININFO.walletversion|default:""}</td>
<td>{$COININFO.connections|default:""}</td>
<td><font color="{if $COININFO.errors}red{else}green{/if}">{$COININFO.errors|default:"OK"}</font></td>
<td>{$COININFO.blocks|default:"0"}</td>
<td>{$ADDRESSCOUNT}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@ -70,7 +70,7 @@
<p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p>
</div>
<div class="circle-tile-number text-faded">
<p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p>
<p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p>
</div>
</div>
</div>

View File

@ -130,7 +130,7 @@
<p id="b-nextdiff" class="h5">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p>
</div>
<div class="circle-tile-number text-faded">
<p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p>
<p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p>
</div>
</div>
</div>

View File

@ -70,7 +70,7 @@
<p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p>
</div>
<div class="circle-tile-number text-faded">
<p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p>
<p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p>
</div>
</div>
</div>

View File

@ -42,7 +42,7 @@
<td class="text-right">{$LASTBLOCKSBYTIME.TotalShares|number_format}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.TotalEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}%</font></b>
<font color="{if (($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}%</font></b>
{else}
0.00%
{/if}
@ -68,7 +68,7 @@
<td class="text-right">{$LASTBLOCKSBYTIME.1HourShares|number_format}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.1HourEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}%</font></b>
<font color="{if (($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}%</font></b>
{else}
0.00%
{/if}
@ -94,7 +94,7 @@
<td class="text-right">{$LASTBLOCKSBYTIME.24HourShares|number_format}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.24HourEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}%</font></b>
<font color="{if (($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}%</font></b>
{else}
0.00%
{/if}
@ -120,7 +120,7 @@
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysShares|number_format}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.7DaysEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}%</font></b>
<font color="{if (($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}%</font></b>
{else}
0.00%
{/if}
@ -146,7 +146,7 @@
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksShares|number_format}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.4WeeksEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}%</font></b>
<font color="{if (($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}%</font></b>
{else}
0.00%
{/if}
@ -172,7 +172,7 @@
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthShares|number_format}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.12MonthEstimatedShares > 0}
<font color="{if (($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100) <= 100)}green{else}red{/if}">{($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}%</font></b>
<font color="{if (($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}%</font></b>
{else}
0.00%
{/if}

View File

@ -59,7 +59,7 @@
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
<td class="text-right">
{math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares}
<font color="{if ($percentage <= 100)}green{else}red{/if}">{$percentage|number_format:"2"}</font>
<font color="{if ($percentage <= 100)}green{elseif ($percentage <= 115)}orange{else}red{/if}">{$percentage|number_format:"2"}</font>
</td>
</tr>
{/section}
@ -70,7 +70,7 @@
<td class="text-right">{$pplnsshares|number_format}</td>
{/if}
<td class="text-right">{$totalshares|number_format}</td>
<td class="text-right">{if $count > 0}<font color="{if (($totalshares / $totalexpectedshares * 100) <= 100)}green{else}red{/if}">{($totalshares / $totalexpectedshares * 100)|number_format:"2"}</font>{else}0{/if}</td>
<td class="text-right">{if $count > 0}<font color="{if (($totalshares / $totalexpectedshares * 100) <= 100)}green{elseif (($totalshares / $totalexpectedshares * 100) <= 115)}orange{else}red{/if}">{($totalshares / $totalexpectedshares * 100)|number_format:"2"}</font>{else}0{/if}</td>
</tr>
</tbody>
</table>