diff --git a/POOLS.md b/POOLS.md index f8321f31..42ffd0b4 100644 --- a/POOLS.md +++ b/POOLS.md @@ -96,3 +96,18 @@ Small Time Miners are running various stratum only pools for different coins. | -------- | ---- | ------------: | ------------------: | ----- | | http://www.litecoinfor.me | Litecoin | 0 | 0 | | | http://www.fastcoinfor.me | Fastcoin | 0.830 MHash | 2 | | + +### ZC + +| Pool URL | Coin | Avg. Hashrate | Avg. Active Workers | Notes | +| -------- | ---- | ------------: | ------------------: | ----- | +| https://ltc.hashfaster.com | LTC | 70 MHash | 80 | Custom Template | + +### nutnut + + +| Pool URL | Coin | Avg. Hashrate | Avg. Active Workers | Notes | +| -------- | ---- | ------------: | ------------------: | ----- | +| http://ftc.nut2pools.com | Feathercoin | 45-50Mhs | 25 workers | New style, PPLNS | +| http://wdc.nut2pools.com | Worldcoin | 3.5 Mhs | 3 workers | New style, PPLNS | +| http://pxc.nut2pools.com | Phenixcoin | 0 | 0 | New style | PPLNS | diff --git a/cronjobs/auto_payout.php b/cronjobs/auto_payout.php index 49984be6..5d646185 100755 --- a/cronjobs/auto_payout.php +++ b/cronjobs/auto_payout.php @@ -70,7 +70,7 @@ if (! empty($users)) { // Send balance, fees are reduced later by RPC Server try { - $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance); + $bitcoin->sendtoaddress($aUserData['coin_address'], $dBalance - $config['txfee']); } catch (BitcoinClientException $e) { $log->logError('Failed to send requested balance to coin address, please check payout process'); continue; diff --git a/cronjobs/manual_payout.php b/cronjobs/manual_payout.php index 4624fc93..094d4c02 100755 --- a/cronjobs/manual_payout.php +++ b/cronjobs/manual_payout.php @@ -62,7 +62,7 @@ if (count($aPayouts) > 0) { continue; } try { - $bitcoin->sendtoaddress($aData['coin_address'], $dBalance); + $bitcoin->sendtoaddress($aData['coin_address'], $dBalance - $config['txfee']); } catch (BitcoinClientException $e) { $log->logError('Failed to send requested balance to coin address, please check payout process'); continue; diff --git a/cronjobs/notifications.php b/cronjobs/notifications.php index c3f2f29c..4a8931d6 100755 --- a/cronjobs/notifications.php +++ b/cronjobs/notifications.php @@ -58,7 +58,7 @@ if (!empty($aNotifications)) { $aData = json_decode($aNotification['data'], true); $aWorker = $worker->getWorker($aData['id']); $log->logInfo(" " . $aWorker['username'] . " ..."); - if ($aWorker['active'] == 1) { + if ($aWorker['hashrate'] > 0) { if ($notification->setInactive($aNotification['id'])) { $log->logInfo(" updated #" . $aNotification['id'] . " for " . $aWorker['username'] . " as inactive\n"); } else { diff --git a/cronjobs/pplns_payout.php b/cronjobs/pplns_payout.php index d6d00c9d..c71f5659 100755 --- a/cronjobs/pplns_payout.php +++ b/cronjobs/pplns_payout.php @@ -73,6 +73,8 @@ foreach ($aAllBlocks as $iIndex => $aBlock) { $monitoring->setStatus($cron_name . "_status", "okerror", 1); exit(1); } + $log->logInfo('Adjusting round target to PPLNS target ' . $pplns_target); + $iRoundShares = $pplns_target; } else { $log->logDebug("Not able to match PPLNS target of $pplns_target with $iRoundShares"); // We need to fill up with archived shares @@ -124,26 +126,26 @@ foreach ($aAllBlocks as $iIndex => $aBlock) { // Loop through all accounts that have found shares for this round foreach ($aAccountShares as $key => $aData) { // Payout based on PPLNS target shares, proportional payout for all users - $aData['percentage'] = number_format(round(( 100 / $iRoundShares) * $aData['valid'], 8), 8); - $aData['payout'] = number_format(round(( $aData['percentage'] / 100 ) * $dReward, 8), 8); + $aData['percentage'] = round(( 100 / $iRoundShares) * $aData['valid'], 8); + $aData['payout'] = round(( $aData['percentage'] / 100 ) * $dReward, 8); // Defaults $aData['fee' ] = 0; $aData['donation'] = 0; if ($config['fees'] > 0 && $aData['no_fees'] == 0) - $aData['fee'] = number_format(round($config['fees'] / 100 * $aData['payout'], 8), 8); + $aData['fee'] = round($config['fees'] / 100 * $aData['payout'], 8); // Calculate donation amount, fees not included - $aData['donation'] = number_format(round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8), 8); + $aData['donation'] = round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8); // Verbose output of this users calculations $log->logInfo($aData['id'] . "\t" . $aData['username'] . "\t" . $aData['valid'] . "\t" . $aData['invalid'] . "\t" . - $aData['percentage'] . "\t" . - $aData['payout'] . "\t" . - $aData['donation'] . "\t" . - $aData['fee']); + number_format($aData['percentage'], 8) . "\t" . + number_format($aData['payout'], 8) . "\t" . + number_format($aData['donation'], 8) . "\t" . + number_format($aData['fee'], 8)); // Add full round share statistics, not just PPLNS foreach ($aRoundAccountShares as $key => $aRoundData) { diff --git a/cronjobs/pps_payout.php b/cronjobs/pps_payout.php index fc66ecff..a02b8fd2 100755 --- a/cronjobs/pps_payout.php +++ b/cronjobs/pps_payout.php @@ -44,13 +44,13 @@ if ( $bitcoin->can_connect() === true ){ // Value per share calculation if ($config['reward_type'] != 'block') { - $pps_value = number_format(round($config['reward'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12); + $pps_value = round($config['reward'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12); } else { // Try to find the last block value and use that for future payouts, revert to fixed reward if none found if ($aLastBlock = $block->getLast()) { - $pps_value = number_format(round($aLastBlock['amount'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12); + $pps_value = round($aLastBlock['amount'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12); } else { - $pps_value = number_format(round($config['reward'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12); + $pps_value = round($config['reward'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12); } } @@ -65,7 +65,7 @@ $log->logInfo("ID\tUsername\tInvalid\tValid\t\tPPS Value\t\tPayout\t\tDonation\t foreach ($aAccountShares as $aData) { // Take our valid shares and multiply by per share value - $aData['payout'] = number_format(round($aData['valid'] * $pps_value, 8), 8); + $aData['payout'] = round($aData['valid'] * $pps_value, 8); // Defaults $aData['fee' ] = 0; @@ -73,18 +73,18 @@ foreach ($aAccountShares as $aData) { // Calculate block fees if ($config['fees'] > 0 && $aData['no_fees'] == 0) - $aData['fee'] = number_format(round($config['fees'] / 100 * $aData['payout'], 8), 8); + $aData['fee'] = round($config['fees'] / 100 * $aData['payout'], 8); // Calculate donation amount - $aData['donation'] = number_format(round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8), 8); + $aData['donation'] = round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8); $log->logInfo($aData['id'] . "\t" . $aData['username'] . "\t" . $aData['invalid'] . "\t" . $aData['valid'] . "\t*\t" . - $pps_value . "\t=\t" . - $aData['payout'] . "\t" . - $aData['donation'] . "\t" . - $aData['fee']); + number_format($pps_value, 12) . "\t=\t" . + number_format($aData['payout'], 8) . "\t" . + number_format($aData['donation'], 8) . "\t" . + number_format($aData['fee']), 8); // Add new credit transaction if (!$transaction->addTransaction($aData['id'], $aData['payout'], 'Credit_PPS')) diff --git a/cronjobs/proportional_payout.php b/cronjobs/proportional_payout.php index 47e55dc3..a591da22 100755 --- a/cronjobs/proportional_payout.php +++ b/cronjobs/proportional_payout.php @@ -60,26 +60,26 @@ foreach ($aAllBlocks as $iIndex => $aBlock) { // Loop through all accounts that have found shares for this round foreach ($aAccountShares as $key => $aData) { // Payout based on shares, PPS system - $aData['percentage'] = number_format(round(( 100 / $iRoundShares ) * $aData['valid'], 8), 8); - $aData['payout'] = number_format(round(( $aData['percentage'] / 100 ) * $dReward, 8), 8); + $aData['percentage'] = round(( 100 / $iRoundShares ) * $aData['valid'], 8); + $aData['payout'] = round(( $aData['percentage'] / 100 ) * $dReward, 8); // Defaults $aData['fee' ] = 0; $aData['donation'] = 0; if ($config['fees'] > 0 && $aData['no_fees'] == 0) - $aData['fee'] = number_format(round($config['fees'] / 100 * $aData['payout'], 8), 8); + $aData['fee'] = round($config['fees'] / 100 * $aData['payout'], 8); // Calculate donation amount, fees not included - $aData['donation'] = number_format(round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8), 8); + $aData['donation'] = round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8); // Verbose output of this users calculations $log->logInfo($aData['id'] . "\t" . $aData['username'] . "\t" . $aData['valid'] . "\t" . $aData['invalid'] . "\t" . - $aData['percentage'] . "\t" . - $aData['payout'] . "\t" . - $aData['donation'] . "\t" . - $aData['fee']); + number_format($aData['percentage'], 8) . "\t" . + number_format($aData['payout'], 8) . "\t" . + number_format($aData['donation'], 8) . "\t" . + number_format($aData['fee']), 8); // Update user share statistics if (!$statistics->updateShareStatistics($aData, $aBlock['id'])) diff --git a/public/include/classes/base.class.php b/public/include/classes/base.class.php index aea25d60..6dc88b02 100644 --- a/public/include/classes/base.class.php +++ b/public/include/classes/base.class.php @@ -103,6 +103,9 @@ class Base { } public function getParam() { $array = array_merge(array($this->types), $this->values); + // Clear the data + $this->values = NULL; + $this->types = NULL; // See here why we need this: http://stackoverflow.com/questions/16120822/mysqli-bind-param-expected-to-be-a-reference-value-given if (strnatcmp(phpversion(),'5.3') >= 0) { $refs = array(); diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index 1452db89..e4e06167 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -402,10 +402,11 @@ class Statistics { AND a.id = ? GROUP BY HOUR(time)"); if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $account_id, $account_id) && $stmt->execute() && $result = $stmt->get_result()) { - $aData = array(); - while ($row = $result->fetch_assoc()) { - $aData[$row['hour']] = $row['hashrate']; - } + $iStartHour = date('G'); + for ($i = $iStartHour; $i < 24; $i++) $aData[$i] = 0; + while ($row = $result->fetch_assoc()) $aData[$row['hour']] = $row['hashrate']; + // Fill any non-existing hours with 0 hashrate + for ($i = 0; $i < 24; $i++) if (!array_key_exists($i, $aData)) $aData[$i] = 0; return $this->memcache->setCache(__FUNCTION__ . $account_id, $aData); } // Catchall @@ -438,10 +439,12 @@ class Statistics { AND time > NOW() - INTERVAL 25 HOUR GROUP BY HOUR(time)"); if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) { - while ($row = $result->fetch_assoc()) { - $aData[$row['hour']] = $row['hashrate']; - } - return $this->memcache->setCache(__FUNCTION__, @$aData); + $iStartHour = date('G'); + for ($i = $iStartHour; $i < 24; $i++) $aData[$i] = 0; + while ($row = $result->fetch_assoc()) $aData[$row['hour']] = (int) $row['hashrate']; + // Fill any non-existing hours with 0 hashrate + for ($i = 0; $i < 24; $i++) if (!array_key_exists($i, $aData)) $aData[$i] = 0; + return $this->memcache->setCache(__FUNCTION__, $aData); } // Catchall $this->debug->append("Failed to fetch hourly hashrate: " . $this->mysqli->error); diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 6da0ee49..b706f7e4 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -47,6 +47,38 @@ class Transaction extends Base { return false; } + /** + * Fetch a transaction summary by type with total amounts + * @param account_id int Account ID, NULL for all + * @return data array type and total + **/ + public function getTransactionSummary($account_id=NULL) { + $sql = "SELECT SUM(t.amount) AS total, t.type AS type FROM $this->table AS t"; + if (!empty($account_id)) { + $sql .= " WHERE t.account_id = ? "; + $this->addParam('i', $account_id); + } + $sql .= " GROUP BY t.type"; + $stmt = $this->mysqli->prepare($sql); + if (!empty($account_id)) { + if (!($this->checkStmt($stmt) && call_user_func_array( array($stmt, 'bind_param'), $this->getParam()) && $stmt->execute())) + return false; + $result = $stmt->get_result(); + } else { + if (!($this->checkStmt($stmt) && $stmt->execute())) + return false; + $result = $stmt->get_result(); + } + if ($result) { + $aData = NULL; + while ($row = $result->fetch_assoc()) { + $aData[$row['type']] = $row['total']; + } + return $aData; + } + return false; + } + /** * Get all transactions from start for account_id * @param start int Starting point, id of transaction @@ -72,52 +104,50 @@ class Transaction extends Base { FROM $this->table AS t LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id LEFT JOIN " . $this->user->getTableName() . " AS a ON t.account_id = a.id"; + if (!empty($account_id)) { + $sql .= " WHERE ( t.account_id = ? ) "; + $this->addParam('i', $account_id); + } if (is_array($filter)) { $aFilter = array(); foreach ($filter as $key => $value) { if (!empty($value)) { switch ($key) { case 'type': - $aFilter[] = "t.type = ?"; + $aFilter[] = "( t.type = ? )"; $this->addParam('s', $value); break; case 'status': switch ($value) { case 'Confirmed': if (empty($filter['type']) || ($filter['type'] != 'Debit_AP' && $filter['type'] != 'Debit_MP' && $filter['type'] != 'TXFee' && $filter['type'] != 'Credit_PPS' && $filter['type'] != 'Fee_PPS' && $filter['type'] != 'Donation_PPS')) { - $aFilter[] = "b.confirmations >= " . $this->config['confirmations'] . " OR ISNULL(b.confirmations)"; + $aFilter[] = "( b.confirmations >= " . $this->config['confirmations'] . " OR ISNULL(b.confirmations) )"; } break; case 'Unconfirmed': - $aFilter[] = "b.confirmations < " . $this->config['confirmations'] . " AND b.confirmations >= 0"; + $aFilter[] = "( b.confirmations < " . $this->config['confirmations'] . " AND b.confirmations >= 0 )"; break; case 'Orphan': - $aFilter[] = "b.confirmations = -1"; + $aFilter[] = "( b.confirmations = -1 )"; break; } break; case 'account': - $aFilter[] = "LOWER(a.username) = LOWER(?)"; + $aFilter[] = "( LOWER(a.username) = LOWER(?) )"; $this->addParam('s', $value); break; case 'address': - $aFilter[] = "t.coin_address = ?"; + $aFilter[] = "( t.coin_address = ? )"; $this->addParam('s', $value); break; } } } if (!empty($aFilter)) { - $sql .= " WHERE " . implode(' AND ', $aFilter); + empty($account_id) ? $sql .= " WHERE " : $sql .= " AND "; + $sql .= implode(' AND ', $aFilter); } } - if (is_int($account_id) && empty($aFilter)) { - $sql .= " WHERE a.id = ?"; - $this->addParam('i', $account_id); - } else if (is_int($account_id)) { - $sql .= " AND a.id = ?"; - $this->addParam('i', $account_id); - } $sql .= " ORDER BY id DESC LIMIT ?,? diff --git a/public/include/classes/worker.class.php b/public/include/classes/worker.class.php index 7643a6d1..88999e1c 100644 --- a/public/include/classes/worker.class.php +++ b/public/include/classes/worker.class.php @@ -75,14 +75,15 @@ class Worker { $this->debug->append("STA " . __METHOD__, 4); $stmt = $this->mysqli->prepare(" SELECT account_id, id, username - FROM " . $this->table . " - WHERE monitor = 1 AND ( SELECT SIGN(COUNT(id)) FROM " . $this->share->getTableName() . " WHERE username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) = 0"); - + FROM " . $this->table . " AS w + WHERE monitor = 1 + AND ( + SELECT IFNULL(SIGN(IF(our_result = 'Y', COUNT(id), 0)), 0) FROM " . $this->share->getTableName() . " WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE) + ) = 0"); if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); // Catchall $this->setErrorMessage("Unable to fetch IDLE, monitored workers"); - echo $this->mysqli->error; return false; } @@ -95,15 +96,27 @@ class Worker { $this->debug->append("STA " . __METHOD__, 4); $stmt = $this->mysqli->prepare(" SELECT id, username, password, monitor, - ( SELECT SIGN(COUNT(id)) FROM " . $this->share->getTableName() . " WHERE username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS active, - ( SELECT ROUND(COUNT(id) * POW(2, " . $this->config['difficulty'] . ")/600/1000) FROM " . $this->share->getTableName() . " WHERE username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS hashrate - FROM $this->table + ( + SELECT + IFNULL(IF(our_result='Y', ROUND(COUNT(id) * POW(2, " . $this->config['difficulty'] . ") / 600 / 1000), 0), 0) AS hashrate + FROM " . $this->share->getTableName() . " + WHERE + username = w.username + AND time > DATE_SUB(now(), INTERVAL 10 MINUTE) + ) + ( + SELECT + IFNULL(IF(our_result='Y', ROUND(COUNT(id) * POW(2, " . $this->config['difficulty'] . ") / 600 / 1000), 0), 0) AS hashrate + FROM " . $this->share->getArchiveTableName() . " + WHERE + username = w.username + AND time > DATE_SUB(now(), INTERVAL 10 MINUTE) + ) AS hashrate + FROM $this->table AS w WHERE id = ? "); if ($this->checkStmt($stmt) && $stmt->bind_param('i', $id) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_assoc(); // Catchall - echo $this->mysqli->error; return false; } @@ -116,9 +129,22 @@ class Worker { $this->debug->append("STA " . __METHOD__, 4); $stmt = $this->mysqli->prepare(" SELECT id, username, password, monitor, - ( SELECT SIGN(COUNT(id)) FROM " . $this->share->getTableName() . " WHERE our_result = 'Y' AND username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS active, - ( SELECT ROUND(COUNT(id) * POW(2, " . $this->config['difficulty'] . ")/600/1000) FROM " . $this->share->getTableName() . " WHERE our_result = 'Y' AND username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS hashrate - FROM $this->table + ( + SELECT + IFNULL(IF(our_result='Y', ROUND(COUNT(id) * POW(2, " . $this->config['difficulty'] . ") / 600 / 1000), 0), 0) AS hashrate + FROM " . $this->share->getTableName() . " + WHERE + username = w.username + AND time > DATE_SUB(now(), INTERVAL 10 MINUTE) + ) + ( + SELECT + IFNULL(IF(our_result='Y', ROUND(COUNT(id) * POW(2, " . $this->config['difficulty'] . ") / 600 / 1000), 0), 0) AS hashrate + FROM " . $this->share->getArchiveTableName() . " + WHERE + username = w.username + AND time > DATE_SUB(now(), INTERVAL 10 MINUTE) + ) AS hashrate + FROM $this->table AS w WHERE account_id = ?"); if ($this->checkStmt($stmt) && $stmt->bind_param('i', $account_id) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); @@ -135,7 +161,7 @@ class Worker { **/ public function getCountAllActiveWorkers() { $this->debug->append("STA " . __METHOD__, 4); - $stmt = $this->mysqli->prepare("SELECT IFNULL(COUNT(DISTINCT username), 0) AS total FROM " . $this->share->getTableName() . " WHERE time > DATE_SUB(now(), INTERVAL 10 MINUTE)"); + $stmt = $this->mysqli->prepare("SELECT IFNULL(IF(our_result='Y', COUNT(DISTINCT username), 0), 0) AS total FROM " . $this->share->getTableName() . " WHERE time > DATE_SUB(now(), INTERVAL 10 MINUTE)"); if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_object()->total; return false; diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index 359f74da..265dfc7a 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -109,6 +109,7 @@ $config['ap_threshold']['max'] = 250; * mobile : Enable/Disable mobile theme support * mobile_theme : Theme used for mobile browsers * api disabled : Disable the sites API functions + * blocks count : # of blocks to display on block statistics page * * Defaults: * title = `The Pool - Mining Evolved` @@ -119,6 +120,7 @@ $config['ap_threshold']['max'] = 250; * mobile = true * mobile_theme = `mobile` * api disbabled = false + * blocks count = 20 **/ $config['website']['title'] = 'The Pool - Mining Evolved'; $config['website']['name'] = 'The Pool'; @@ -128,6 +130,7 @@ $config['website']['theme'] = 'mmcFE'; $config['website']['mobile'] = true; $config['website']['mobile_theme'] = 'mobile'; $config['website']['api']['disabled'] = false; +$config['website']['blocks']['count'] = 20; /** * Account specific settings diff --git a/public/include/pages/account/transactions.inc.php b/public/include/pages/account/transactions.inc.php index bd8f2aa4..a06eae61 100644 --- a/public/include/pages/account/transactions.inc.php +++ b/public/include/pages/account/transactions.inc.php @@ -6,11 +6,13 @@ if ($user->isAuthenticated()) { $iLimit = 30; empty($_REQUEST['start']) ? $start = 0 : $start = $_REQUEST['start']; $aTransactions = $transaction->getTransactions($start, @$_REQUEST['filter'], $iLimit, $_SESSION['USERDATA']['id']); + $aTransactionSummary = $transaction->getTransactionSummary($_SESSION['USERDATA']['id']); $iCountTransactions = $transaction->num_rows; $aTransactionTypes = $transaction->getTypes(); if (!$aTransactions) $_SESSION['POPUP'][] = array('CONTENT' => 'Could not find any transaction', 'TYPE' => 'errormsg'); $smarty->assign('LIMIT', $iLimit); $smarty->assign('TRANSACTIONS', $aTransactions); + $smarty->assign('SUMMARY', $aTransactionSummary); $smarty->assign('TRANSACTIONTYPES', $aTransactionTypes); $smarty->assign('TXSTATUS', array('' => '', 'Confirmed' => 'Confirmed', 'Unconfirmed' => 'Unconfirmed', 'Orphan' => 'Orphan')); $smarty->assign('COUNTTRANSACTIONS', $iCountTransactions); diff --git a/public/include/pages/admin/transactions.inc.php b/public/include/pages/admin/transactions.inc.php index 505f25ab..5b544da6 100644 --- a/public/include/pages/admin/transactions.inc.php +++ b/public/include/pages/admin/transactions.inc.php @@ -14,11 +14,13 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { $debug->append('No cached version available, fetching from backend', 3); empty($_REQUEST['start']) ? $start = 0 : $start = $_REQUEST['start']; $aTransactions = $transaction->getTransactions($start, @$_REQUEST['filter'], $iLimit); + $aTransactionSummary = $transaction->getTransactionSummary(); $iCountTransactions = $transaction->num_rows; $aTransactionTypes = $transaction->getTypes(); if (!$aTransactions) $_SESSION['POPUP'][] = array('CONTENT' => 'Could not find any transaction', 'TYPE' => 'errormsg'); $smarty->assign('LIMIT', $iLimit); $smarty->assign('TRANSACTIONS', $aTransactions); + $smarty->assign('SUMMARY', $aTransactionSummary); $smarty->assign('TRANSACTIONTYPES', $aTransactionTypes); $smarty->assign('TXSTATUS', array('' => '', 'Confirmed' => 'Confirmed', 'Unconfirmed' => 'Unconfirmed', 'Orphan' => 'Orphan')); $smarty->assign('COUNTTRANSACTIONS', $iCountTransactions); diff --git a/public/include/pages/statistics/blocks.inc.php b/public/include/pages/statistics/blocks.inc.php index 3218a9f4..494e6be3 100644 --- a/public/include/pages/statistics/blocks.inc.php +++ b/public/include/pages/statistics/blocks.inc.php @@ -7,7 +7,7 @@ if (!defined('SECURITY')) die('Hacking attempt'); if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { $debug->append('No cached version available, fetching from backend', 3); // Grab the last blocks found - $iLimit = 20; + !empty($config['website']['blocks']['count']) ? $iLimit = $config['website']['blocks']['count'] : $iLimit = 20; $aBlocksFoundData = $statistics->getBlocksFound($iLimit); // Propagate content our template diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index 64dcf2dc..7ddeb583 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -12,14 +12,13 @@ $dDifficulty = 1; $aRoundShares = 1; // Only run these if the user is logged in -if (@$_SESSION['AUTHENTICATED']) { - $aRoundShares = $statistics->getRoundShares(); - if ($bitcoin->can_connect() === true) { - $dDifficulty = $bitcoin->query('getdifficulty'); - if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty)) - $dDifficulty = $dDifficulty['proof-of-work']; - } +$aRoundShares = $statistics->getRoundShares(); +if ($bitcoin->can_connect() === true) { + $dDifficulty = $bitcoin->query('getdifficulty'); + if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty)) + $dDifficulty = $dDifficulty['proof-of-work']; } + // Always fetch this since we need for ministats header $bitcoin->can_connect() === true ? $dNetworkHashrate = $bitcoin->query('getnetworkhashps') : $dNetworkHashrate = 0; diff --git a/public/templates/mmcFE/account/transactions/default.tpl b/public/templates/mmcFE/account/transactions/default.tpl index 5563aee4..169e7de2 100644 --- a/public/templates/mmcFE/account/transactions/default.tpl +++ b/public/templates/mmcFE/account/transactions/default.tpl @@ -1,3 +1,22 @@ +{include file="global/block_header.tpl" BLOCK_HEADER="Transaction Summary"} +
| {$type} | + {/foreach} +
|---|
| {$total} | + {/foreach} +