Merge pull request #2738 from MPOS/development

UPDATE : Development to Master
This commit is contained in:
Sebastian Grewe 2018-05-24 14:12:01 +02:00 committed by GitHub
commit 236cccd5d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 177 additions and 116 deletions

View File

@ -1,13 +1,13 @@
{
"name": "delboy1978uk/mpos",
"name": "MPOS/php-mpos",
"description": "MPOS stands for Mining Portal Open Source. A unified mining interface for various Scrypt and SHA256d Crypto-currencies!",
"require-dev": {
"codeception/codeception": "~2.0"
},
"authors": [
{
"name": "Derek Stephen McLean",
"email": "delboy1978uk@gmail.com"
"name": "Sebastian Grewe",
"email": "sebastian.grewe@gmail.com"
}
],
"require": {

View File

@ -2,7 +2,11 @@
(SECURITY == "*)WT#&YHfd" && SECHASH_CHECK) ? die("public/index.php -> Set a new SECURITY value to continue") : 0;
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
require_once(INCLUDE_DIR . '/../vendor/autoload.php');
if (file_exists(INCLUDE_DIR . '/../vendor/autoload.php')) {
require_once(INCLUDE_DIR . '/../vendor/autoload.php');
} else {
die("Unable to load vendor libraries, please run `php composer.phar install` in root folder.");
}
// Default classes
require_once(INCLUDE_DIR . '/lib/KLogger.php');

4
include/classes/bitcoin.class.php Normal file → Executable file
View File

@ -284,13 +284,15 @@ class BitcoinClient extends jsonRPCClient {
* The check is done by calling the server's getinfo() method and checking
* for a fault.
*
* To turn code compatible with BTC >= 0.16, getmininginfo() method used instead of getinfo()
*
* @return mixed boolean TRUE if successful, or a fault string otherwise
* @access public
* @throws none
*/
public function can_connect() {
try {
$r = $this->getinfo();
$r = $this->getmininginfo();
} catch (Exception $e) {
return $e->getMessage();
}

18
include/classes/bitcoinwrapper.class.php Normal file → Executable file
View File

@ -24,13 +24,29 @@ class BitcoinWrapper extends BitcoinClient {
public function getinfo() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
try {
return $this->memcache->setCache(__FUNCTION__, parent::getnetworkinfo()+parent::getmininginfo()+parent::getwalletinfo(), 30);
} catch (Exception $e) {
$this->oDebug->append("DEPRECATED : RPC version < 0.16, fallback to `getinfo` RPC call", 2);
return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
}
}
public function is_testnet() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
if (!(parent::getblockchaininfo()))
return $this->memcache->setCache(__FUNCTION__, parent::is_testnet(), 30);
else
return $this->memcache->setCache(__FUNCTION__, parent::getblockchaininfo()['chain'] == 'test', 30);
}
public function getmininginfo() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
return $this->memcache->setCache(__FUNCTION__, parent::getmininginfo(), 30);
}
public function getblockcount() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;

View File

@ -237,7 +237,7 @@ class Block extends Base {
* @return bool
**/
public function setShares($block_id, $shares=NULL) {
$field = array( 'name' => 'shares', 'value' => $shares, 'type' => 'i');
$field = array( 'name' => 'shares', 'value' => $shares, 'type' => 'd');
return $this->updateSingle($block_id, $field);
}

View File

@ -60,7 +60,7 @@ class CoinBase extends Base {
* according to our configuration difficulty
**/
public function calcEstaimtedShares($dDifficulty) {
return (int)round(pow(2, (32 - $this->target_bits)) * $dDifficulty, 0);
return (float)round(pow(2, (32 - $this->target_bits)) * $dDifficulty, $this->share_difficulty_precision);
}
/**

View File

@ -111,7 +111,7 @@ class Statistics extends Base {
b.*,
a.username AS finder,
a.is_anonymous AS is_anonymous,
ROUND(difficulty * POW(2, 32 - " . $this->coin->getTargetBits() . "), 0) AS estshares
ROUND(difficulty * POW(2, 32 - " . $this->coin->getTargetBits() . "), " . $this->coin->getShareDifficultyPrecision() . ") AS estshares
FROM " . $this->block->getTableName() . " AS b
LEFT JOIN " . $this->user->getTableName() . " AS a
ON b.account_id = a.id
@ -203,7 +203,7 @@ class Statistics extends Base {
public function updateShareStatistics($aStats, $iBlockId) {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, valid, invalid, block_id) VALUES (?, ?, ?, ?)");
if ($this->checkStmt($stmt) && $stmt->bind_param('iiii', $aStats['id'], $aStats['valid'], $aStats['invalid'], $iBlockId) && $stmt->execute()) return true;
if ($this->checkStmt($stmt) && $stmt->bind_param('iddi', $aStats['id'], $aStats['valid'], $aStats['invalid'], $iBlockId) && $stmt->execute()) return true;
return $this->sqlError();
}
@ -213,7 +213,7 @@ class Statistics extends Base {
public function insertPPLNSStatistics($aStats, $iBlockId) {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, valid, invalid, pplns_valid, pplns_invalid, block_id) VALUES (?, ?, ?, ?, ?, ?)");
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiiii', $aStats['id'], $aStats['valid'], $aStats['invalid'], $aStats['pplns_valid'], $aStats['pplns_invalid'], $iBlockId) && $stmt->execute()) return true;
if ($this->checkStmt($stmt) && $stmt->bind_param('iddddi', $aStats['id'], $aStats['valid'], $aStats['invalid'], $aStats['pplns_valid'], $aStats['pplns_invalid'], $iBlockId) && $stmt->execute()) return true;
return $this->sqlError();
}
@ -261,12 +261,12 @@ class Statistics extends Base {
SELECT
(
(
SELECT ROUND(SUM(difficulty) / ?, 2) AS sharerate
SELECT ROUND(SUM(difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate
FROM " . $this->share->getTableName() . "
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND)
AND our_result = 'Y'
) + (
SELECT ROUND(SUM(difficulty) / ?, 2) AS sharerate
SELECT ROUND(SUM(difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate
FROM " . $this->share->getArchiveTableName() . "
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND)
AND our_result = 'Y'
@ -470,7 +470,7 @@ class Statistics extends Base {
a.username AS account,
COUNT(DISTINCT t1.username) AS workers,
IFNULL(SUM(t1.difficulty), 0) AS shares,
ROUND(SUM(t1.difficulty) / ?, 2) AS sharerate,
ROUND(SUM(t1.difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate,
IFNULL(AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 0) AS avgsharediff
FROM (
SELECT

View File

@ -174,7 +174,7 @@ class Worker extends Base {
while ($row = $result->fetch_assoc()) {
$row['hashrate'] = round($this->coin->calcHashrate($row['shares'], $interval), 2);
if ($row['count_all'] > 0) {
$row['difficulty'] = round($row['shares'] / $row['count_all'], 2);
$row['difficulty'] = round($row['shares'] / $row['count_all'], $this->coin->getShareDifficultyPrecision());
} else {
$row['difficulty'] = 0.00;
}

View File

@ -4,14 +4,14 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
/**
* Do not edit this unless you have confirmed that your config has been updated!
* Also the URL to check for the most recent upstream versions available
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#config-version
**/
$config['version'] = '1.0.1';
$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php';
/**
* Unless you disable this, we'll do a quick check on your config first.
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-check
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#config-check
*/
$config['skip_config_tests'] = false;
@ -24,7 +24,7 @@ $config['check_valid_coinaddress'] = true;
/**
* Defines
* Debug setting and salts for hashing passwords
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-defines--salts
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#defines--salts
*/
$config['DEBUG'] = 0;
$config['SALT'] = 'PLEASEMAKEMESOMETHINGRANDOM';
@ -33,7 +33,7 @@ $config['SALTY'] = 'THISSHOULDALSOBERRAANNDDOOM';
/**
* Coin Algorithm
* Algorithm used by this coin, sha256d or scrypt
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-algorithm
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#algorithm
**/
$config['algorithm'] = 'scrypt';
@ -47,7 +47,7 @@ $config['getbalancewithunconfirmed'] = true;
/**
* Database configuration
* MySQL database configuration
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-database-configuration
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#database-configuration
**/
$config['db']['host'] = 'localhost';
$config['db']['user'] = 'someuser';
@ -75,7 +75,7 @@ $config['db-ro']['name'] = 'mpos';
/**
* Local wallet RPC
* RPC configuration for your daemon/wallet
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#local-wallet-rpc
**/
$config['wallet']['type'] = 'http';
$config['wallet']['host'] = 'localhost:19334';
@ -85,7 +85,7 @@ $config['wallet']['password'] = 'testnet';
/**
* Swiftmailer configuration
* Configure your way to send mails
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-swiftmailer
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#swiftmailer
**/
$config['swiftmailer']['type'] = 'sendmail';
$config['swiftmailer']['sendmail']['path'] = '/usr/sbin/sendmail';
@ -100,7 +100,7 @@ $config['swiftmailer']['smtp']['throttle'] = 100;
/**
* Getting Started Config
* Shown to users in the 'Getting Started' section
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-getting-started
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#getting-started
**/
$config['gettingstarted']['coinname'] = 'Litecoin';
$config['gettingstarted']['coinurl'] = 'http://www.litecoin.org';
@ -110,7 +110,7 @@ $config['gettingstarted']['stratumport'] = '3333';
/**
* Ticker API
* Fetch exchange rates via an API
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-ticker-api
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#ticker-api
**/
$config['price']['enabled'] = false;
$config['price']['url'] = 'https://btc-e.nz';
@ -120,7 +120,7 @@ $config['price']['currency'] = 'USD';
/**
* Automatic Payout Thresholds
* Minimum and Maximum auto payout amount
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-automatic-payout-thresholds
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#automatic-payout-thresholds
**/
$config['ap_threshold']['min'] = 1;
$config['ap_threshold']['max'] = 250;
@ -128,49 +128,49 @@ $config['ap_threshold']['max'] = 250;
/**
* Minimum manual Payout Threshold
* Minimum manual payout amount
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-manual-payout-threshold
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#manual-payout-threshold
**/
$config['mp_threshold'] = 1;
/**
* Donation thresholds
* Minimum donation amount in percent
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-donation-thresholds
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#donation-thresholds
**/
$config['donate_threshold']['min'] = 1;
/**
* Account Specific Settings
* Settings for each user account
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-account-specific-settings
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#account-specific-settings
**/
$config['accounts']['invitations']['count'] = 5;
/**
* Currency
* Shorthand name for the currency
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-currency
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#currency
*/
$config['currency'] = 'LTC';
/**
* Coin Target
* Target time for coins to be generated
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-coin-target
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#coin-target
**/
$config['cointarget'] = '150';
/**
* Coin Diff Change
* Amount of blocks between difficulty changes
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-coin-diff-change
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#coin-diff-change
**/
$config['coindiffchangetarget'] = 2016;
/**
* TX Fees
* Fees applied to transactions
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-tx-fees
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#tx-fees
**/
$config['txfee_auto'] = 0.1;
$config['txfee_manual'] = 0.1;
@ -178,8 +178,8 @@ $config['txfee_manual'] = 0.1;
/**
* Block & Pool Bonus
* Bonus coins for blockfinder or a pool bonus for everyone
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-block-bonus
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pool-bonus
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#block-bonus
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pool-bonus
*/
$config['block_bonus'] = 0;
$config['pool_bonus'] = 0;
@ -188,14 +188,14 @@ $config['pool_bonus_type'] = 'payout';
/**
* Payout System
* Payout system chosen
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-payout-system
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#payout-system
**/
$config['payout_system'] = 'prop';
/**
* Sendmany Support
* Enable/Disable Sendmany RPC method
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-sendmany-support
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#sendmany-support
**/
$config['sendmany']['enabled'] = false;
@ -209,7 +209,7 @@ $config['payout']['txlimit_auto'] = 500;
/**
* Round Purging
* Round share purging configuration
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-round-purging
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#round-purging
**/
$config['purge']['sleep'] = 1;
$config['purge']['shares'] = 25000;
@ -217,7 +217,7 @@ $config['purge']['shares'] = 25000;
/**
* Share Archiving
* Share archiving configuration details
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-archiving
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#archiving
**/
$config['archive']['maxrounds'] = 10;
$config['archive']['maxage'] = 60 * 24;
@ -226,14 +226,14 @@ $config['archive']['maxage'] = 60 * 24;
/**
* Pool Fees
* Fees applied to users
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pool-fees
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pool-fees
*/
$config['fees'] = 0;
/**
* PPLNS
* Pay Per Last N Shares
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pplns-settings
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pplns-settings
*/
$config['pplns']['shares']['default'] = 4000000;
$config['pplns']['shares']['type'] = 'blockavg';
@ -244,14 +244,14 @@ $config['pplns']['dynamic']['percent'] = 30;
/**
* Difficulty
* Difficulty setting for stratum/pushpool
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pool-target-difficulty
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pool-target-difficulty
*/
$config['difficulty'] = 20;
/**
* Block Reward
* Block reward configuration details
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-reward-settings
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#reward-settings
**/
$config['reward_type'] = 'block';
$config['reward'] = 50;
@ -259,7 +259,7 @@ $config['reward'] = 50;
/**
* Confirmations
* Credit and Network confirmation settings
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-confirmations
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#confirmations
*/
$config['confirmations'] = 120;
$config['network_confirmations'] = 120;
@ -267,7 +267,7 @@ $config['network_confirmations'] = 120;
/**
* PPS
* Pay Per Share configuration details
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pps-settings
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pps-settings
**/
$config['pps']['reward']['default'] = 50;
$config['pps']['reward']['type'] = 'blockavg';
@ -276,7 +276,7 @@ $config['pps']['blockavg']['blockcount'] = 10;
/**
* Memcache
* Memcache configuration details
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#memcache
**/
$config['memcache']['enabled'] = true;
$config['memcache']['host'] = 'localhost';
@ -292,7 +292,7 @@ $config['memcache']['sasl']['password'] = '';
/**
* Cookies
* Cookie configuration details
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-cookies
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#cookies
**/
$config['cookie']['duration'] = '1440';
$config['cookie']['domain'] = '';
@ -303,7 +303,7 @@ $config['cookie']['secure'] = false;
/**
* Smarty Cache
* Enable smarty cache and cache length
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-smarty-cache
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#smarty-cache
**/
$config['smarty']['cache'] = 0;
$config['smarty']['cache_lifetime'] = 30;
@ -311,6 +311,6 @@ $config['smarty']['cache_lifetime'] = 30;
/**
* System load
* Disable some calls when high system load
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-system-load
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#system-load
**/
$config['system']['load']['max'] = 10.0;

View File

@ -23,7 +23,7 @@ $config['logging']['path'] = realpath(BASEPATH.'../logs');
/**
* Memcache Rate Limiting
* Rate limit requests using Memcache
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache-rate-limiting
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#memcache-rate-limiting
*/
$config['mc_antidos']['enabled'] = true;
$config['mc_antidos']['protect_ajax'] = true;
@ -38,14 +38,14 @@ $config['mc_antidos']['error_push_page'] = array('page' => 'error', 'action' =>
/**
* CSRF Protection
* Enable or disable CSRF protection
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-csrf-protection
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#csrf-protection
*/
$config['csrf']['enabled'] = true;
/**
* E-mail confirmations for user actions
* Two-factor confirmation for user actions
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-e-mail-confirmations
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#e-mail-confirmations
*/
$config['twofactor']['enabled'] = true;
$config['twofactor']['options']['details'] = true;
@ -55,7 +55,7 @@ $config['twofactor']['options']['changepw'] = true;
/**
* Lock account after X
* Lock accounts after X invalid logins or pins
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-lock-accounts-after-failed-logins
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#lock-accounts-after-failed-logins
**/
$config['maxfailed']['login'] = 3;
$config['maxfailed']['pin'] = 3;

View File

@ -20,8 +20,13 @@ if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) {
// Force limit
$limit = 100;
}
if (isset($_REQUEST['filter']) && is_array($_REQUEST['filter'])) {
$filter = $_REQUEST['filter'];
} else {
$filter = NULL;
}
$data['transactions'] = $transaction->getTransactions($start, NULL, $limit, $user_id);
$data['transactions'] = $transaction->getTransactions($start, $filter, $limit, $user_id);
// Fetch summary if enabled
if (!$setting->getValue('disable_transactionsummary')) {

View File

@ -9,7 +9,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
} else {
$dDifficulty = 1;
$iBlock = 0;
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to litecoind RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'alert alert-danger');
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'alert alert-danger');
}
$smarty->assign("CURRENTBLOCK", $iBlock);
$smarty->assign("DIFFICULTY", $dDifficulty);

View File

@ -1,8 +1,8 @@
<?php
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
define('MPOS_VERSION', '1.0.9');
define('DB_VERSION', '1.0.2');
define('MPOS_VERSION', '1.1.0');
define('DB_VERSION', '1.0.3');
define('CONFIG_VERSION', '1.0.1');
define('HASH_VERSION', 1);

View File

@ -43,7 +43,7 @@ CREATE TABLE IF NOT EXISTS `blocks` (
`accounted` tinyint(1) NOT NULL DEFAULT '0',
`account_id` int(255) unsigned DEFAULT NULL,
`worker_name` varchar(50) DEFAULT 'unknown',
`shares` bigint(30) unsigned DEFAULT NULL,
`shares` double unsigned DEFAULT NULL,
`share_id` bigint(30) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `height` (`height`,`blockhash`),
@ -142,7 +142,7 @@ CREATE TABLE IF NOT EXISTS `settings` (
UNIQUE KEY `setting` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '1.0.2');
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '1.0.3');
CREATE TABLE IF NOT EXISTS `shares` (
`id` bigint(30) NOT NULL AUTO_INCREMENT,
@ -182,10 +182,10 @@ CREATE TABLE IF NOT EXISTS `statistics_shares` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`account_id` int(10) unsigned NOT NULL,
`block_id` int(10) unsigned NOT NULL,
`valid` bigint(20) NOT NULL,
`invalid` bigint(20) NOT NULL DEFAULT '0',
`pplns_valid` bigint(20) NOT NULL,
`pplns_invalid` bigint(20) NOT NULL DEFAULT '0',
`valid` float unsigned NOT NULL DEFAULT '0',
`invalid` float unsigned NOT NULL DEFAULT '0',
`pplns_valid` float unsigned NOT NULL DEFAULT '0',
`pplns_invalid` float unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `account_id` (`account_id`),
KEY `block_id` (`block_id`)

View File

@ -26,8 +26,8 @@
<td class="text-right">{$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date}</td>
<td class="text-right">{$BLOCKSFOUND[block].difficulty|number_format:"4"}</td>
<td class="text-right">{$BLOCKSFOUND[block].amount|number_format:"2"}</td>
<td class="text-right">{$BLOCKSFOUND[block].estshares|number_format}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
<td class="text-right">{$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision}</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>
@ -46,4 +46,4 @@
{/if}
</div>
</div>
{/if}
{/if}

View File

@ -43,7 +43,7 @@ $(document).ready(function(){
// Load initial sparkline values
var storedPersonalHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.hashrate|round:"2"}{literal} ];
var storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|round:"2"}{literal} ];
var storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|round:$GLOBAL.config.sharediffprecision}{literal} ];
var storedPoolHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.hashrate|round:"2"}{literal} ];
var storedNetHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.nethashrate|round:"2"}{literal} ];
var storedPoolWorkers = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.workers}{literal} ];
@ -89,7 +89,7 @@ $(document).ready(function(){
storedPersonalHashrate.shift();
storedPersonalHashrate.push(parseFloat(data.getdashboarddata.data.personal.hashrate).toFixed(2))
storedPersonalSharerate.shift();
storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2))
storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal}))
storedPoolHashrate.shift();
storedPoolHashrate.push(parseFloat(data.getdashboarddata.data.pool.hashrate).toFixed(2))
storedNetHashrate.shift();
@ -122,7 +122,7 @@ $(document).ready(function(){
} else {
$('#b-nethashrate').html('n/a');
}
$('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2)));
$('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal})));
$('#b-yvalid').html(number_format(data.getdashboarddata.data.personal.shares.valid, {/literal}{$GLOBAL.config.sharediffprecision}{literal}));
$('#b-yivalid').html(number_format(data.getdashboarddata.data.personal.shares.invalid, {/literal}{$GLOBAL.config.sharediffprecision}{literal}));
if ( data.getdashboarddata.data.personal.shares.valid > 0 ) {

View File

@ -43,7 +43,7 @@
<div class="circle-tile-description text-faded">
<p class="h5 up-more">My Sharerate</p>
<div class="circle-tile-number text-faded up">
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:"2"}</span>
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision}</span>
<span class="overview-mhs"> S/s</span>
<br>
<span class="personal-sharerate-bar spark-18"></span>

View File

@ -43,7 +43,7 @@
<div class="circle-tile-description text-faded">
<p class="h5 up-more">My Sharerate</p>
<div class="circle-tile-number text-faded up">
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:"2"}</span>
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision}</span>
<span class="overview-mhs"> S/s</span>
<br>
<span class="personal-sharerate-bar spark-18"></span>

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.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p>
<p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget|default:2016 > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p>
</div>
</div>
</div>

View File

@ -38,8 +38,8 @@
0
{/if}
</td>
<td class="text-right">{$LASTBLOCKSBYTIME.TotalEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.TotalShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.TotalEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.TotalShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.TotalEstimatedShares > 0}
<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>
@ -64,8 +64,8 @@
0
{/if}
</td>
<td class="text-right">{$LASTBLOCKSBYTIME.1HourEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.1HourShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.1HourEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.1HourShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.1HourEstimatedShares > 0}
<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>
@ -90,8 +90,8 @@
0
{/if}
</td>
<td class="text-right">{$LASTBLOCKSBYTIME.24HourEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.24HourShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.24HourEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.24HourShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.24HourEstimatedShares > 0}
<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>
@ -116,8 +116,8 @@
0
{/if}
</td>
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.7DaysEstimatedShares > 0}
<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>
@ -142,8 +142,8 @@
0
{/if}
</td>
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.4WeeksEstimatedShares > 0}
<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>
@ -168,8 +168,8 @@
0
{/if}
</td>
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthEstimatedShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthShares|number_format}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthShares|number_format:$GLOBAL.config.sharediffprecision}</td>
<td class="text-right">
{if $LASTBLOCKSBYTIME.12MonthEstimatedShares > 0}
<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>

View File

@ -51,12 +51,12 @@
<td class="text-right">{$BLOCKSFOUND[block].amount|number_format:"2"}</td>
<td class="text-right">
{assign var="totalexpectedshares" value=$totalexpectedshares+$BLOCKSFOUND[block].estshares}
{$BLOCKSFOUND[block].estshares|number_format}
{$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision}
</td>
{if $GLOBAL.config.payout_system == 'pplns'}
<td class="text-right">{$BLOCKSFOUND[block].pplns_shares|number_format}</td>
<td class="text-right">{$BLOCKSFOUND[block].pplns_shares|number_format:$GLOBAL.config.sharediffprecision}</td>
{/if}
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision}</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{elseif ($percentage <= 115)}orange{else}red{/if}">{$percentage|number_format:"2"}</font>
@ -65,11 +65,11 @@
{/section}
<tr>
<td colspan="6"><b>Totals</b></td>
<td class="text-right">{$totalexpectedshares|number_format}</td>
<td class="text-right">{$totalexpectedshares|number_format:$GLOBAL.config.sharediffprecision}</td>
{if $GLOBAL.config.payout_system == 'pplns'}
<td class="text-right">{$pplnsshares|number_format}</td>
<td class="text-right">{$pplnsshares|number_format:$GLOBAL.config.sharediffprecision}</td>
{/if}
<td class="text-right">{$totalshares|number_format}</td>
<td class="text-right">{$totalshares|number_format:$GLOBAL.config.sharediffprecision}</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>

View File

@ -24,7 +24,7 @@
{/if}
<td>{if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if}</td>
<td>{$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision}</td>
</tr>
{/section}
</tbody>

View File

@ -1,8 +1,9 @@
<script>
$(function () {
var miningstats = {$YOURMININGSTATS nofilter};
var hashChart = Morris.Line({
element: 'hashrate-area-chart',
data: {$YOURMININGSTATS nofilter},
data: miningstats,
xkey: 'time',
ykeys: ['hashrate'],
labels: ['Hashrate'],
@ -17,7 +18,7 @@ $(function () {
var workersChart = Morris.Line({
element: 'workers-area-chart',
data: {$YOURMININGSTATS nofilter},
data: miningstats,
xkey: 'time',
ykeys: ['workers'],
labels: ['Workers'],
@ -32,7 +33,7 @@ $(function () {
var shareCharts= Morris.Line({
element: 'sharerate-area-chart',
data: {$YOURMININGSTATS nofilter},
data: miningstats,
xkey: 'time',
ykeys: ['sharerate'],
labels: ['Sharerate'],

View File

@ -35,7 +35,7 @@
{/section}
{if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.rawhashrate|default:"0" > 0}
{math assign="myestday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.rawhashrate}
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
<td>n/a</td>
<td>{if $GLOBAL.userdata.donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td>
<td>{$GLOBAL.userdata.username|escape}</td>

View File

@ -21,15 +21,15 @@
<td>{$rank++}</td>
<td>{if $CONTRIBSHARES[shares].donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{else if $CONTRIBSHARES[shares].donate_percent|default:"0" < 2 AND $CONTRIBSHARES[shares].donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td>
<td>{if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if}</td>
<td class="text-right">{$CONTRIBSHARES[shares].shares|number_format}</td>
<td class="text-right">{$CONTRIBSHARES[shares].shares|number_format:$GLOBAL.config.sharediffprecision}</td>
</tr>
{/section}
{if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.shares.valid|default:"0" > 0}
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
<td>n/a</td>
<td>{if $GLOBAL.userdata.donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td>
<td>{$GLOBAL.userdata.username|escape}</td>
<td class="text-right">{$GLOBAL.userdata.shares.valid|number_format}</td>
<td class="text-right">{$GLOBAL.userdata.shares.valid|number_format:$GLOBAL.config.sharediffprecision}</td>
</tr>
{/if}
</tbody>

View File

@ -44,7 +44,7 @@
</tr>
<tr>
<th>Est. Shares this Round</th>
<td id="b-target">{$ESTIMATES.shares|number_format} (done: {$ESTIMATES.percent}%)</td>
<td id="b-target">{$ESTIMATES.shares|number_format:$GLOBAL.config.sharediffprecision} (done: {$ESTIMATES.percent}%)</td>
</tr>
{if ! $GLOBAL.website.blockexplorer.disabled}
<tr>

View File

@ -38,7 +38,7 @@
<td>Time</td>
<td>{$BLOCKDETAILS.time|default:"0"}</td>
<td>Shares</td>
<td>{$BLOCKDETAILS.shares|number_format:"0"|default:"0"}</td>
<td>{$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
<td>Finder</td>
<td>{$BLOCKDETAILS.finder|default:"unknown"}</td>
</tr>

View File

@ -18,7 +18,7 @@
<td>ID</td>
<td>{$BLOCKDETAILS.id|number_format:"0"|default:"0"}</td>
<td>PPLNS Shares</td>
<td>{$PPLNSSHARES|number_format:"0"|default:"0"}</td>
<td>{$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
</tr>
<tr class="even">
<td>Height</td>
@ -28,7 +28,7 @@
<td>{$BLOCKDETAILS.height|number_format:"0"|default:"0"}</td>
{/if}
<td>Estimated Shares</td>
<td>{$BLOCKDETAILS.estshares|number_format|default:"0"}</td>
<td>{$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
</tr>
<tr class="odd">
<td>Amount</td>
@ -64,7 +64,7 @@
</tr>
<tr class="odd">
<td>Shares</td>
<td>{$BLOCKDETAILS.shares|number_format:"0"|default:"0"}</td>
<td>{$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
<td>Seconds This Round</td>
<td>{$BLOCKDETAILS.round_time|number_format:"0"|default:"0"}</td>
</tr>

View File

@ -30,9 +30,9 @@
<td>{$BLOCKDETAILS.height|number_format:"0"|default:"0"}</td>
{/if}
<td>PPLNS Shares</td>
<td>{$PPLNSSHARES|number_format:"0"|default:"0"}</td>
<td>{$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
<td>Estimated Shares</td>
<td>{$BLOCKDETAILS.estshares|number_format|default:"0"}</td>
<td>{$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
</tr>
<tr class="odd">
<td>Amount</td>
@ -61,7 +61,7 @@
</tr>
<tr class="odd">
<td>Shares</td>
<td>{$BLOCKDETAILS.shares|number_format:"0"|default:"0"}</td>
<td>{$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
<td>Finder</td>
<td>{$BLOCKDETAILS.finder|default:"unknown"}</td>
<td>Seconds This Round</td>

View File

@ -21,8 +21,8 @@
<tr{if $GLOBAL.userdata.username|default:"" == $PPLNSROUNDSHARES[contrib].username} style="background-color:#99EB99;"{else}{/if}>
<td>{$rank++}</td>
<td>{if $PPLNSROUNDSHARES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$PPLNSROUNDSHARES[contrib].username|default:"unknown"|escape}{/if}</td>
<td>{$PPLNSROUNDSHARES[contrib].pplns_valid|number_format}</td>
<td>{$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format}</td>
<td>{$PPLNSROUNDSHARES[contrib].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
<td>{$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
<td>{if $PPLNSROUNDSHARES[contrib].pplns_invalid > 0 && $PPLNSROUNDSHARES[contrib].pplns_valid > 0}{($PPLNSROUNDSHARES[contrib].pplns_invalid / $PPLNSROUNDSHARES[contrib].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
</tr>
{/section}

View File

@ -23,9 +23,9 @@
{section txs $ROUNDTRANSACTIONS}
<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>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</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>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|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}
<font color="{if ($percentage1 >= 100)}green{else}red{/if}">{$percentage1|number_format:"2"}</font></b></td>

View File

@ -26,12 +26,12 @@
{section txs $ROUNDTRANSACTIONS}
<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>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format}</td>
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format}</td>
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format:$GLOBAL.config.sharediffprecision}</td>
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format:$GLOBAL.config.sharediffprecision}</td>
<td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid > 0 }{($SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid / $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
<td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{(( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid)|number_format:"2"}{else}0.00{/if}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_invalid|number_format}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision}</td>
<td>{$PPLNSROUNDSHARES[txs].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision}</td>
<td>{if $PPLNSROUNDSHARES[txs].pplns_invalid > 0 }{($PPLNSROUNDSHARES[txs].pplns_invalid / $PPLNSROUNDSHARES[txs].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
<td>{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"}</td>
<td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if}

View File

@ -22,8 +22,8 @@
<tr{if $GLOBAL.userdata.username|default:"" == $data.username}{assign var=listed value=1} style="background-color:#99EB99;"{else}{/if}>
<td>{$rank++}</td>
<td>{if $data.is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$data.username|default:"unknown"|escape}{/if}</td>
<td>{$data.valid|number_format}</td>
<td>{$data.invalid|number_format}</td>
<td>{$data.valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
<td>{$data.invalid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
<td>{if $data.invalid > 0 }{($data.invalid / $data.valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
</tr>
{/foreach}

View File

@ -20,7 +20,7 @@
<tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username} 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>{$ROUNDTRANSACTIONS[txs].type|default:""}</td>
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format}</td>
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
<td>{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|default:"0"|number_format:"2"}</td>
<td>{$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"}</td>
</tr>

View File

@ -0,0 +1,33 @@
<?php
function run_103() {
// Ugly but haven't found a better way
global $setting, $config, $coin_address, $user, $mysqli;
// Version information
$db_version_old = '1.0.2'; // What version do we expect
$db_version_new = '1.0.3'; // What is the new version we wish to upgrade to
$db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed
// Upgrade specific variables
$aSql[] = "ALTER TABLE `blocks` CHANGE `shares` `shares` DOUBLE UNSIGNED DEFAULT NULL;";
$aSql[] = "UPDATE `statistics_shares` SET `valid` = '0' WHERE `valid` IS NULL;";
$aSql[] = "UPDATE `statistics_shares` SET `pplns_valid` = '0' WHERE `pplns_valid` IS NULL;";
$aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `invalid` `invalid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `pplns_invalid` `pplns_invalid` FLOAT UNSIGNED NOT NULL DEFAULT '0';";
$aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '" . $db_version_new . "' WHERE name = 'DB_VERSION';";
if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) {
// Run the upgrade
echo '- Starting database migration to version ' . $db_version_new . PHP_EOL;
foreach ($aSql as $sql) {
echo '- Preparing: ' . $sql . PHP_EOL;
$stmt = $mysqli->prepare($sql);
if ($stmt && $stmt->execute()) {
echo '- success' . PHP_EOL;
} else {
echo '- failed: ' . $mysqli->error . PHP_EOL;
exit(1);
}
}
}
}
?>