[MERGE] Fix conflicts with development

This commit is contained in:
Sebastian Grewe 2014-05-03 12:18:30 +02:00
commit fcaffe7fc0
11 changed files with 34 additions and 128 deletions

View File

@ -17,6 +17,7 @@ require_once(INCLUDE_DIR . '/config/error_codes.inc.php');
require_once(CLASS_DIR . '/base.class.php');
require_once(CLASS_DIR . '/coins/coin_base.class.php');
require_once(CLASS_DIR . '/setting.class.php');
require_once(INCLUDE_DIR . '/version.inc.php');
if (PHP_OS == 'WINNT') require_once(CLASS_DIR . '/memcached.class.php');
// Now decide on which coin class to load and instantiate

View File

@ -141,6 +141,7 @@ class Worker extends Base {
FROM $this->table AS w
WHERE account_id = ?");
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiii', $interval, $interval, $interval, $interval, $account_id) && $stmt->execute() && $result = $stmt->get_result()) {
$aData = array();
while ($row = $result->fetch_assoc()) {
$row['hashrate'] = round($this->coin->calcHashrate($row['shares'], $interval), 2);
if ($row['count_all'] > 0) {

View File

@ -364,20 +364,6 @@ $aSettings['system'][] = array(
'name' => 'disable_dashboard_api', 'value' => $setting->getValue('disable_dashboard_api'),
'tooltip' => 'Disable dashboard API entirely to reduce server load.'
);
$aSettings['system'][] = array(
'display' => 'Disable Live Navbar', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes'),
'default' => 0,
'name' => 'disable_navbar', 'value' => $setting->getValue('disable_navbar'),
'tooltip' => 'Disable live updates on the navbar to reduce server load.'
);
$aSettings['system'][] = array(
'display' => 'Disable Navbar API', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes'),
'default' => 0,
'name' => 'disable_navbar_api', 'value' => $setting->getValue('disable_navbar_api'),
'tooltip' => 'Disable navbar API entirely to reduce server load. Used in pool stats and navbar mini stats.'
);
$aSettings['system'][] = array(
'display' => 'Disable TX Summaries', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes'),

View File

@ -1,76 +0,0 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
// Check if the system is enabled
if ($setting->getValue('disable_navbar_api')) {
echo $api->get_json(array('error' => 'disabled'));
die();
}
// System load check
if ($load = @sys_getloadavg()) {
if (isset($config['system']['load']['max']) && $load[0] > $config['system']['load']['max']) {
header('HTTP/1.1 503 Too busy, try again later');
die('Server too busy. Please try again later.');
}
}
// Fetch RPC information
if ($bitcoin->can_connect() === true) {
$dNetworkHashrate = $bitcoin->getnetworkhashps();
$dDifficulty = $bitcoin->getdifficulty();
$iBlock = $bitcoin->getblockcount();
} else {
$dNetworkHashrate = 0;
$dDifficulty = 1;
$iBlock = 0;
}
// Some settings
if ( ! $interval = $setting->getValue('statistics_ajax_data_interval')) $interval = 300;
if ( ! $dPoolHashrateModifier = $setting->getValue('statistics_pool_hashrate_modifier') ) $dPoolHashrateModifier = 1;
if ( ! $dNetworkHashrateModifier = $setting->getValue('statistics_network_hashrate_modifier') ) $dNetworkHashrateModifier = 1;
// Fetch raw data
$statistics->setGetCache(false);
$dPoolHashrate = $statistics->getCurrentHashrate($interval);
if ($dPoolHashrate > $dNetworkHashrate) $dNetworkHashrate = $dPoolHashrate;
$statistics->setGetCache(true);
// Small helper
$aHashunits = array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s' );
// Apply pool modifiers
$dPoolHashrateAdjusted = $dPoolHashrate * $dPoolHashrateModifier;
$dNetworkHashrateAdjusted = $dNetworkHashrate / 1000 * $dNetworkHashrateModifier;
// Use caches for this one
$aRoundShares = $statistics->getRoundShares();
$iTotalRoundShares = $aRoundShares['valid'] + $aRoundShares['invalid'];
if ($iTotalRoundShares > 0) {
$dPoolInvalidPercent = round($aRoundShares['invalid'] / $iTotalRoundShares * 100, 2);
} else {
$dUserInvalidPercent = 0;
$dPoolInvalidPercent = 0;
}
// Round progress
$iEstShares = $statistics->getEstimatedShares($dDifficulty);
if ($iEstShares > 0 && $aRoundShares['valid'] > 0) {
$dEstPercent = round(100 / $iEstShares * $aRoundShares['valid'], 2);
} else {
$dEstPercent = 0;
}
// Output JSON format
$data = array(
'raw' => array( 'workers' => $worker->getCountAllActiveWorkers(), 'pool' => array( 'hashrate' => $dPoolHashrate ) ),
'pool' => array( 'workers' => $worker->getCountAllActiveWorkers(), 'hashrate' => $dPoolHashrateAdjusted, 'estimated' => $iEstShares, 'progress' => $dEstPercent ),
'network' => array( 'hashrate' => $dNetworkHashrateAdjusted, 'difficulty' => $dDifficulty, 'block' => $iBlock )
);
echo $api->get_json($data);
// Supress master template
$supress_master = 1;
?>

View File

@ -0,0 +1,16 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/**
* We extend our CoinBase class
* No need to change anything, base class supports
* scrypt and sha256d
*
* Note: This is exactly the same as Scrypt, but it's
* here to let MPOS api report the correct coin algorithm.
**/
class Coin extends CoinBase {
protected $target_bits = 16;
}
?>

View File

@ -0,0 +1,13 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/**
* We extend our CoinBase class
* No need to change anything, base class supports
* scrypt and sha256d
**/
class Coin extends CoinBase {
protected $target_bits = 24;
}
?>

View File

@ -101,7 +101,6 @@ if (count(@$_SESSION['last_ip_pop']) == 2) {
// version check and config check if not disabled
if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA']['id'])) {
require_once(INCLUDE_DIR . '/version.inc.php');
if (!@$config['skip_config_tests']) {
require_once(INCLUDE_DIR . '/admin_checks.php');
}

View File

@ -33,14 +33,14 @@
<div class="form-group">
<label>Timezone</label>
{nocache}
<select class="form-control" name="timezone">
<select class="form-control select-mini" name="timezone" {if $GLOBAL.twofactor.enabled && $GLOBAL.twofactor.options.details && !$DETAILSUNLOCKED}id="disabledInput" disabled{/if}>
{html_options options=$TIMEZONES selected=$GLOBAL.userdata.timezone}
</select>
{/nocache}
</div>
<div class="form-group">
<label>Payment Address</label>
{nocache}<input class="form-control" type="text" name="paymentAddress" value="{$smarty.request.paymentAddress|default:$GLOBAL.userdata.coin_address|escape}" size="40" {if $GLOBAL.twofactor.enabled && $GLOBAL.twofactor.options.details && !$DETAILSUNLOCKED}id="disabledInput" disabled{/if}/>{/nocache}
{nocache}<input class="form-control" type="text" name="paymentAddress" value="{$smarty.request.paymentAddress|default:$GLOBAL.userdata.coin_address|escape}" size="40" {if $GLOBAL.twofactor.enabled && $GLOBAL.twofactor.options.details && !$DETAILSUNLOCKED}id="disabledInput" disabled{/if}/>{/nocache}
</div>
<div class="form-group">
<label>Donation Percentage</label>

View File

@ -1,30 +0,0 @@
<script>
{literal}
$(document).ready(function(){
// Ajax API URL
var url = "{/literal}{$smarty.server.SCRIPT_NAME}?page=api&action=getnavbardata{literal}";
function refreshStaticData(data) {
$('#b-workers').html((parseFloat(data.getnavbardata.data.pool.workers).toFixed(0)));
$('#b-hashrate').html((parseFloat(data.getnavbardata.data.pool.hashrate).toFixed(3)));
$('#b-target').html(data.getnavbardata.data.pool.estimated + " (done: " + data.getnavbardata.data.pool.progress + "%)");
$('#b-diff').html(data.getnavbardata.data.network.difficulty);
}
// Our worker process to keep gauges and graph updated
(function worker() {
$.ajax({
url: url,
dataType: 'json',
success: function(data) {
refreshStaticData(data);
},
complete: function() {
setTimeout(worker, {/literal}{($GLOBAL.config.statistics_ajax_refresh_interval * 1000)|default:"10000"}{literal})
}
});
})();
});
{/literal}
</script>

View File

@ -8,7 +8,3 @@
{include file="statistics/pool/general_stats.tpl"}
{include file="statistics/blocks/small_table.tpl"}
</div>
{if !$GLOBAL.website.api.disabled && !$GLOBAL.config.disable_navbar && !$GLOBAL.config.disable_navbar_api}
{include file="statistics/js.tpl"}
{/if}

View File

@ -24,7 +24,7 @@
<tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username}{assign var=listed value=1} style="background-color:#99EB99;"{else}{/if}>
<td>{if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if}</td>
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format|default:0}</td>
<td>{if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if}</td>
<td>{if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format|default:"0"}</td>
<td>{if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0 }{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"|default:"0"}{else}0{/if}</td>
<td>{if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 && $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0}{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if}