From 92623902b2d93675e42c2af520d9f6b29b934b03 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 8 Aug 2013 10:03:33 +0200 Subject: [PATCH 01/39] adding round shares back to PPS sidebar --- public/templates/mmcFE/global/sidebar_pps.tpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/templates/mmcFE/global/sidebar_pps.tpl b/public/templates/mmcFE/global/sidebar_pps.tpl index 3fdc478a..1268880a 100644 --- a/public/templates/mmcFE/global/sidebar_pps.tpl +++ b/public/templates/mmcFE/global/sidebar_pps.tpl @@ -28,6 +28,10 @@ Pool Valid {$GLOBAL.roundshares.valid|number_format} + + Your Valid + {$GLOBAL.userdata.shares.valid|number_format} + Pool Invalid {$GLOBAL.roundshares.invalid|number_format}{if $GLOBAL.roundshares.valid > 0} ({($GLOBAL.roundshares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%){/if} From 1a459a7913f9bc963ee3bfa1593a28d4b736d7af Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 8 Aug 2013 12:02:39 +0200 Subject: [PATCH 02/39] Adding transaction summary by types Addresses #581 --- public/include/classes/base.class.php | 3 ++ public/include/classes/transaction.class.php | 32 +++++++++++++++++++ .../pages/account/transactions.inc.php | 2 ++ .../include/pages/admin/transactions.inc.php | 2 ++ .../mmcFE/account/transactions/default.tpl | 19 +++++++++++ .../mmcFE/admin/transactions/default.tpl | 19 +++++++++++ 6 files changed, 77 insertions(+) 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/transaction.class.php b/public/include/classes/transaction.class.php index 3bb3e2a0..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 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..92cdd2d8 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($_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/templates/mmcFE/account/transactions/default.tpl b/public/templates/mmcFE/account/transactions/default.tpl index 5563aee4..62a32a17 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"} + + + + {foreach $SUMMARY as $type=>$total} + + {/foreach} + + + + + {foreach $SUMMARY as $type=>$total} + + {/foreach} + + +
{$type}
{$total}
+{include file="global/block_footer.tpl"} + {include file="global/block_header.tpl" ALIGN="left" BLOCK_STYLE="width: 23%" BLOCK_HEADER="Transaction Filter"}
diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index cbbc7e86..cc2693d9 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -1,3 +1,22 @@ +{include file="global/block_header.tpl" BLOCK_HEADER="Transaction Summary"} + + + + {foreach $SUMMARY as $type=>$total} + + {/foreach} + + + + + {foreach $SUMMARY as $type=>$total} + + {/foreach} + + +
{$type}
{$total}
+{include file="global/block_footer.tpl"} + {include file="global/block_header.tpl" ALIGN="left" BLOCK_STYLE="width: 23%" BLOCK_HEADER="Transaction Filter"} From 031b4940cdec89bc7a200e057198e79a76718a9d Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 8 Aug 2013 12:05:06 +0200 Subject: [PATCH 03/39] admin should see all transactions in summary --- public/include/pages/admin/transactions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/include/pages/admin/transactions.inc.php b/public/include/pages/admin/transactions.inc.php index 92cdd2d8..5b544da6 100644 --- a/public/include/pages/admin/transactions.inc.php +++ b/public/include/pages/admin/transactions.inc.php @@ -14,7 +14,7 @@ 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($_SESSION['USERDATA']['id']); + $aTransactionSummary = $transaction->getTransactionSummary(); $iCountTransactions = $transaction->num_rows; $aTransactionTypes = $transaction->getTypes(); if (!$aTransactions) $_SESSION['POPUP'][] = array('CONTENT' => 'Could not find any transaction', 'TYPE' => 'errormsg'); From d42b66d94e589f307a22e9bd2ca11f5fe8b3a9eb Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 8 Aug 2013 12:09:50 +0200 Subject: [PATCH 04/39] removing useless strings --- public/templates/mmcFE/account/transactions/default.tpl | 4 ++-- public/templates/mmcFE/admin/transactions/default.tpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/templates/mmcFE/account/transactions/default.tpl b/public/templates/mmcFE/account/transactions/default.tpl index 62a32a17..169e7de2 100644 --- a/public/templates/mmcFE/account/transactions/default.tpl +++ b/public/templates/mmcFE/account/transactions/default.tpl @@ -44,11 +44,11 @@ - TX Type + Type {html_options name="filter[type]" options=$TRANSACTIONTYPES selected=$smarty.request.filter.type|default:""} - TX Status + Status {html_options name="filter[status]" options=$TXSTATUS selected=$smarty.request.filter.status|default:""} diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index cc2693d9..cb066607 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -44,11 +44,11 @@ - TX Type + Type {html_options name="filter[type]" options=$TRANSACTIONTYPES selected=$smarty.request.filter.type|default:""} - TX Status + Status {html_options name="filter[status]" options=$TXSTATUS selected=$smarty.request.filter.status|default:""} From 7214d27d9e3db0f94a147e109a0476d666469963 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Fri, 9 Aug 2013 14:58:46 +0200 Subject: [PATCH 05/39] make blocks list sortable --- public/templates/mmcFE/statistics/blocks/default.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/mmcFE/statistics/blocks/default.tpl b/public/templates/mmcFE/statistics/blocks/default.tpl index 72b3fc48..c305d5a1 100644 --- a/public/templates/mmcFE/statistics/blocks/default.tpl +++ b/public/templates/mmcFE/statistics/blocks/default.tpl @@ -32,7 +32,7 @@ target and network difficulty and assuming a zero variance scenario. {include file="global/block_header.tpl" BLOCK_HEADER="Last $BLOCKLIMIT Blocks Found" BLOCK_STYLE="clear:none;"}
- +
From 581888fe1fa8b84a23d3d8284712ca21ca01be30 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 12 Aug 2013 08:45:25 +0200 Subject: [PATCH 06/39] Update POOLS.md --- POOLS.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/POOLS.md b/POOLS.md index f8321f31..21c0f83f 100644 --- a/POOLS.md +++ b/POOLS.md @@ -96,3 +96,9 @@ 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 | From 68f2d72cac73b90a9c3fdfcc994d94a5119caeea Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 12 Aug 2013 08:48:30 +0200 Subject: [PATCH 07/39] use regexp detection --- cronjobs/findblock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cronjobs/findblock.php b/cronjobs/findblock.php index 79dadeba..d5215f87 100755 --- a/cronjobs/findblock.php +++ b/cronjobs/findblock.php @@ -58,7 +58,7 @@ if (empty($aTransactions['transactions'])) { $aData['confirmations'] . "\t\t" . $aData['difficulty'] . "\t" . strftime("%Y-%m-%d %H:%M:%S", $aData['time'])); - if ( ! empty($aBlockInfo['flags']) && $aBlockInfo['flags'] == 'proof-of-stake' ) { + if ( ! empty($aBlockInfo['flags']) && preg_match('/proof-of-stake/', $aBlockInfo['flags']) ) { $logs->logInfo("Block above with height " . $aData['height'] . " not added to database, proof-of-stake block!"); continue; } From f3a0cf04178bc19f40e19385ebaa0367b02ff5d3 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 12 Aug 2013 09:35:45 +0200 Subject: [PATCH 08/39] Fixing PPLNS payouts when exceeding target Round shares are taken to only match PPLNS target. Round target was not re-adjusted to reflect the new, lower amount of round shares. * Fix: Properly adjust round target shares when exceeding PPLNS target Fixes #588 once merged --- cronjobs/pplns_payout.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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) { From 85e22bc02f2a9fabb4e57eb47d1513ceaf45ddce Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 12 Aug 2013 10:07:19 +0200 Subject: [PATCH 09/39] Adding totals to block statistics * Total expected shares * Total actual shares * Average Percentage --- public/templates/mmcFE/statistics/blocks/default.tpl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/public/templates/mmcFE/statistics/blocks/default.tpl b/public/templates/mmcFE/statistics/blocks/default.tpl index c305d5a1..47f610c5 100644 --- a/public/templates/mmcFE/statistics/blocks/default.tpl +++ b/public/templates/mmcFE/statistics/blocks/default.tpl @@ -49,6 +49,7 @@ target and network difficulty and assuming a zero variance scenario. {assign var=rank value=1} {section block $BLOCKSFOUND} + {assign var="totalshares" value=$totalshares+$BLOCKSFOUND[block].shares} @@ -72,6 +74,13 @@ target and network difficulty and assuming a zero variance scenario. {/section} + + + + + {math assign="totalpercentage" equation="shares / estshares * 100" shares=$totalshares estshares=$totalexpectedshares} +
Block
{$BLOCKSFOUND[block].height} @@ -63,6 +64,7 @@ target and network difficulty and assuming a zero variance scenario. {$BLOCKSFOUND[block].amount|number_format:"2"} {math assign="estshares" equation="(pow(2,32 - targetdiff) * blockdiff)" targetdiff=$GLOBAL.config.targetdiff blockdiff=$BLOCKSFOUND[block].difficulty} + {assign var="totalexpectedshares" value=$totalexpectedshares+$estshares} {$estshares|number_format} {$BLOCKSFOUND[block].shares|number_format}
Totals{$totalexpectedshares|number_format}{$totalshares|number_format}{$totalpercentage|number_format:"2"} +
From 80d2cda39905638249e87da519220eb7692deae7 Mon Sep 17 00:00:00 2001 From: Nicolas Schteinschraber Date: Mon, 12 Aug 2013 22:55:40 -0300 Subject: [PATCH 10/39] Sustract fee to manual_payout cron too. --- cronjobs/manual_payout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cronjobs/manual_payout.php b/cronjobs/manual_payout.php index fbd4d927..41b1629a 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; From 22e7904da7e798212975bce70a88f6122e2c45d6 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 13 Aug 2013 09:20:06 +0200 Subject: [PATCH 11/39] Fixing round estimates on public stats page * Fix: Display round restimates when making pool stats public via ACL * Fix: Display proper pool efficiency when pool stats are public Fixes #585 --- public/include/smarty_globals.inc.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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; From c0e84595196045bf3648bd7e2088c3fc21f18ad6 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 14 Aug 2013 10:59:50 +0200 Subject: [PATCH 12/39] fix coloring of total percentage --- public/templates/mmcFE/statistics/blocks/default.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/mmcFE/statistics/blocks/default.tpl b/public/templates/mmcFE/statistics/blocks/default.tpl index 47f610c5..eea09ffb 100644 --- a/public/templates/mmcFE/statistics/blocks/default.tpl +++ b/public/templates/mmcFE/statistics/blocks/default.tpl @@ -79,7 +79,7 @@ target and network difficulty and assuming a zero variance scenario. {$totalexpectedshares|number_format} {$totalshares|number_format} {math assign="totalpercentage" equation="shares / estshares * 100" shares=$totalshares estshares=$totalexpectedshares} - {$totalpercentage|number_format:"2"} + {$totalpercentage|number_format:"2"} From 0679601fbdf97b4a346bbaa8d2a0bf41076b65f2 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 14 Aug 2013 11:03:56 +0200 Subject: [PATCH 13/39] Initilize totals with 0 values Addresses #596 --- public/templates/mmcFE/statistics/blocks/default.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/templates/mmcFE/statistics/blocks/default.tpl b/public/templates/mmcFE/statistics/blocks/default.tpl index eea09ffb..fb2a799d 100644 --- a/public/templates/mmcFE/statistics/blocks/default.tpl +++ b/public/templates/mmcFE/statistics/blocks/default.tpl @@ -48,6 +48,8 @@ target and network difficulty and assuming a zero variance scenario. {assign var=rank value=1} +{assign var=totalexpectedshares value=0} +{assign var=totalshares value=0} {section block $BLOCKSFOUND} {assign var="totalshares" value=$totalshares+$BLOCKSFOUND[block].shares} From 567b8e165554a2abd9ca3fa92eb15d7d133a02bd Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 14 Aug 2013 11:10:58 +0200 Subject: [PATCH 14/39] Fix rounding issues on total row * Use actual percentages to calculate the total to ensure the rows average matches the totals average Fixes #596 --- public/templates/mmcFE/statistics/blocks/default.tpl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public/templates/mmcFE/statistics/blocks/default.tpl b/public/templates/mmcFE/statistics/blocks/default.tpl index fb2a799d..87b9ecb5 100644 --- a/public/templates/mmcFE/statistics/blocks/default.tpl +++ b/public/templates/mmcFE/statistics/blocks/default.tpl @@ -47,11 +47,13 @@ target and network difficulty and assuming a zero variance scenario. -{assign var=rank value=1} +{assign var=count value=0} {assign var=totalexpectedshares value=0} {assign var=totalshares value=0} +{assign var=totalpercentage value=0} {section block $BLOCKSFOUND} {assign var="totalshares" value=$totalshares+$BLOCKSFOUND[block].shares} + {assign var="count" value=$count+1} {$BLOCKSFOUND[block].height} @@ -72,6 +74,7 @@ target and network difficulty and assuming a zero variance scenario. {$BLOCKSFOUND[block].shares|number_format} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares estshares=$estshares} + {assign var="totalpercentage" value=$totalpercentage+$percentage} {$percentage|number_format:"2"} @@ -80,8 +83,7 @@ target and network difficulty and assuming a zero variance scenario. Totals {$totalexpectedshares|number_format} {$totalshares|number_format} - {math assign="totalpercentage" equation="shares / estshares * 100" shares=$totalshares estshares=$totalexpectedshares} - {$totalpercentage|number_format:"2"} + {($totalpercentage / $count)|number_format:"2"} From 184ad5d58bdae95c508fc8e2e8fd0b7f7ac5c047 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 14 Aug 2013 11:15:49 +0200 Subject: [PATCH 15/39] fixing color of total percentage again --- public/templates/mmcFE/statistics/blocks/default.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/mmcFE/statistics/blocks/default.tpl b/public/templates/mmcFE/statistics/blocks/default.tpl index 87b9ecb5..8aeb21e6 100644 --- a/public/templates/mmcFE/statistics/blocks/default.tpl +++ b/public/templates/mmcFE/statistics/blocks/default.tpl @@ -83,7 +83,7 @@ target and network difficulty and assuming a zero variance scenario. Totals {$totalexpectedshares|number_format} {$totalshares|number_format} - {($totalpercentage / $count)|number_format:"2"} + {($totalpercentage / $count)|number_format:"2"} From a10b5099ce1cc8dfd5caaec7ffa7846e33350168 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 14 Aug 2013 11:21:21 +0200 Subject: [PATCH 16/39] Update POOLS.md Added @nutnut pools --- POOLS.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/POOLS.md b/POOLS.md index 21c0f83f..42ffd0b4 100644 --- a/POOLS.md +++ b/POOLS.md @@ -102,3 +102,12 @@ Small Time Miners are running various stratum only pools for different coins. | 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 | From e5cb4d0886cb2e533c2736ff3d3570a8033156e0 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 14 Aug 2013 11:23:14 +0200 Subject: [PATCH 17/39] Fixing combined hashrate graph This shouuld fix #598 with graphs being completely off --- public/templates/mmcFE/statistics/graphs/both.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/mmcFE/statistics/graphs/both.tpl b/public/templates/mmcFE/statistics/graphs/both.tpl index 03832b5f..878a5b4d 100644 --- a/public/templates/mmcFE/statistics/graphs/both.tpl +++ b/public/templates/mmcFE/statistics/graphs/both.tpl @@ -29,7 +29,7 @@ {$POOLHASHRATES.$i|default:"0"} {/for} {for $i=0 to date('G', time() - 60 * 60)} - {$POOLHASHRATES.$i - $YOURHASHRATES.$i|default:"0"} + {$POOLHASHRATES.$i|default:"0"} {/for} From fcf5a21ce35ff48fed6372add7dbd601b03ee907 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 14 Aug 2013 11:44:29 +0200 Subject: [PATCH 18/39] Adding QRCodes under Accounts * Added: API String QR Code for #582 and #591 This will allow more QRCodes being added that are specific to an account. The require library is added and the API string can be used as an example how codes are generated. Fixes #582 --- public/include/pages/account/qrcode.inc.php | 6 ++++ .../site_assets/mmcFE/js/jquery.qrcode.min.js | 28 +++++++++++++++++++ .../mmcFE/account/qrcode/default.tpl | 22 +++++++++++++++ public/templates/mmcFE/global/navigation.tpl | 1 + 4 files changed, 57 insertions(+) create mode 100644 public/include/pages/account/qrcode.inc.php create mode 100644 public/site_assets/mmcFE/js/jquery.qrcode.min.js create mode 100644 public/templates/mmcFE/account/qrcode/default.tpl diff --git a/public/include/pages/account/qrcode.inc.php b/public/include/pages/account/qrcode.inc.php new file mode 100644 index 00000000..a6543dc5 --- /dev/null +++ b/public/include/pages/account/qrcode.inc.php @@ -0,0 +1,6 @@ +isAuthenticated()) $smarty->assign("CONTENT", "default.tpl"); +?> diff --git a/public/site_assets/mmcFE/js/jquery.qrcode.min.js b/public/site_assets/mmcFE/js/jquery.qrcode.min.js new file mode 100644 index 00000000..fe9680e6 --- /dev/null +++ b/public/site_assets/mmcFE/js/jquery.qrcode.min.js @@ -0,0 +1,28 @@ +(function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;da||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]= +0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c= +j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount- +b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0g;g++)if(null==this.modules[b][i-g]){var n=!1;f>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a, +c),b=new t,e=0;e8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d= +0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+ +a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;dc)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+ +a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256), +LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d +this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b>>7-a%8&1)},put:function(a,c){for(var d=0;d>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1, +correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e").css("height",b+"px").appendTo(c);for(i=0;i").css("width", +d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;jQuery(a).appendTo(this)})}})(jQuery); diff --git a/public/templates/mmcFE/account/qrcode/default.tpl b/public/templates/mmcFE/account/qrcode/default.tpl new file mode 100644 index 00000000..2656314e --- /dev/null +++ b/public/templates/mmcFE/account/qrcode/default.tpl @@ -0,0 +1,22 @@ +{if !$GLOBAL.config.website.api.disabled} +{include file="global/block_header.tpl" BLOCK_HEADER="API String"} +

This code will allow you to import the full API string into your mobile application.

+ + +
+{include file="global/block_footer.tpl"} +{/if} diff --git a/public/templates/mmcFE/global/navigation.tpl b/public/templates/mmcFE/global/navigation.tpl index a18b6a94..4480cf2b 100644 --- a/public/templates/mmcFE/global/navigation.tpl +++ b/public/templates/mmcFE/global/navigation.tpl @@ -8,6 +8,7 @@
  • Transactions
  • {if !$GLOBAL.config.disable_notifications}
  • Notifications
  • {/if} {if !$GLOBAL.config.disable_invitations}
  • Invitations
  • {/if} +
  • QR Codes
  • {/if} From ad6ceed77ec6169e6d42cb76c0ea7dd9a594a458 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 14 Aug 2013 11:47:46 +0200 Subject: [PATCH 19/39] fixing worker activity on mobile template --- public/templates/mobile/account/workers/default.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/mobile/account/workers/default.tpl b/public/templates/mobile/account/workers/default.tpl index 0e171ba6..09ebf867 100644 --- a/public/templates/mobile/account/workers/default.tpl +++ b/public/templates/mobile/account/workers/default.tpl @@ -9,7 +9,7 @@ {assign var="username" value="."|escape|explode:$WORKERS[worker].username:2} {$username.0|escape}.{$username.1|escape} - + {$WORKERS[worker].hashrate|number_format} {/section} From 020d1ef01b13afa0418f82c6e1c299788c632ff5 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 14 Aug 2013 11:48:41 +0200 Subject: [PATCH 20/39] Fixing notification reset for active workers Fixes #600 --- cronjobs/notifications.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From 16557465e43e7a18a9917592de2f9e70ced96b54 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 15 Aug 2013 08:58:50 +0200 Subject: [PATCH 21/39] Added: getuserbalance API call * Adds getbalance to API * Admins: Can fetch any users balance * Users: Can fetch only their own balance Fixes #605 --- .../include/pages/api/getuserbalance.inc.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 public/include/pages/api/getuserbalance.inc.php diff --git a/public/include/pages/api/getuserbalance.inc.php b/public/include/pages/api/getuserbalance.inc.php new file mode 100644 index 00000000..9b765ce7 --- /dev/null +++ b/public/include/pages/api/getuserbalance.inc.php @@ -0,0 +1,28 @@ +isActive(); + +// Check user token +$user_id = $user->checkApiKey($_REQUEST['api_key']); + +// We have to check if that user is admin too +if ( ! $user->isAdmin($user_id) && ($_REQUEST['id'] != $user_id && !empty($_REQUEST['id']))) { + header("HTTP/1.1 401 Unauthorized"); + die("Access denied"); +} else if ($user->isAdmin($user_id)) { + $id = $_REQUEST['id']; + ctype_digit($_REQUEST['id']) ? $id = $_REQUEST['id'] : $id = $user->getUserId($_REQUEST['id']); +} else { + $id = $user_id; +} + +// Output JSON format +echo json_encode(array('getuserbalance' => $transaction->getBalance($id))); + +// Supress master template +$supress_master = 1; +?> From 50f380c25e2716668f7b8a90aa8ca7371e617996 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 15 Aug 2013 09:14:02 +0200 Subject: [PATCH 22/39] first test to fill with data --- public/include/classes/statistics.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index 1452db89..70a2e986 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -406,6 +406,17 @@ class Statistics { while ($row = $result->fetch_assoc()) { $aData[$row['hour']] = $row['hashrate']; } + // We have no data, so we fill with 0 + if (empty($aData)) { + for ($i = 0; $i <= 24; $i++) $aData[$i] = 0; + } else { + $count = -1; + foreach ($aData as $hour => $hashrate) { + $count++; + if ($count == $hour) continue; + $aData[$count] = 0; + } + } return $this->memcache->setCache(__FUNCTION__ . $account_id, $aData); } // Catchall From 14c0535b106a8b13bcd5bcd807a5dab0efd8f6a0 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 15 Aug 2013 09:58:33 +0200 Subject: [PATCH 23/39] Fill empty hours with proper data * Properly sort the array prior to sending it back * Sort from current to one hour earlier for proper data display * Adjusted templates to use new sorted arrays Fixes #606 --- public/include/classes/statistics.class.php | 30 +++++++------------ .../mmcFE/statistics/graphs/both.tpl | 27 ++++++----------- .../mmcFE/statistics/graphs/mine.tpl | 18 ++++------- .../mmcFE/statistics/graphs/pool.tpl | 18 ++++------- 4 files changed, 32 insertions(+), 61 deletions(-) diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index 70a2e986..d61222b0 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -402,21 +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']; - } - // We have no data, so we fill with 0 - if (empty($aData)) { - for ($i = 0; $i <= 24; $i++) $aData[$i] = 0; - } else { - $count = -1; - foreach ($aData as $hour => $hashrate) { - $count++; - if ($count == $hour) continue; - $aData[$count] = 0; - } - } + $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 @@ -449,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/templates/mmcFE/statistics/graphs/both.tpl b/public/templates/mmcFE/statistics/graphs/both.tpl index 878a5b4d..a8011e90 100644 --- a/public/templates/mmcFE/statistics/graphs/both.tpl +++ b/public/templates/mmcFE/statistics/graphs/both.tpl @@ -5,32 +5,23 @@ -{for $i=date('G') to 23} - {$i}:00 -{/for} -{for $i=0 to date('G', time () - 60 * 60)} - {$i}:00 -{/for} +{foreach $YOURHASHRATES as $hour=>$hashrate} + {$hour|default:"0"}:00 +{/foreach} {$smarty.session.USERDATA.username} -{for $i=date('G') to 23} - {$YOURHASHRATES.$i|default:"0"} -{/for} -{for $i=0 to date('G', time() - 60 * 60)} - {$YOURHASHRATES.$i|default:"0"} -{/for} +{foreach $YOURHASHRATES as $hour=>$hashrate} + {$hashrate|default:"0"} +{/foreach} Pool -{for $i=date('G') to 23} - {$POOLHASHRATES.$i|default:"0"} -{/for} -{for $i=0 to date('G', time() - 60 * 60)} - {$POOLHASHRATES.$i|default:"0"} -{/for} +{foreach $POOLHASHRATES as $hour=>$hashrate} + {$hashrate|default:"0"} +{/foreach} diff --git a/public/templates/mmcFE/statistics/graphs/mine.tpl b/public/templates/mmcFE/statistics/graphs/mine.tpl index 4d4259f2..05c8e2b1 100644 --- a/public/templates/mmcFE/statistics/graphs/mine.tpl +++ b/public/templates/mmcFE/statistics/graphs/mine.tpl @@ -5,23 +5,17 @@ -{for $i=date('G') to 23} - {$i}:00 -{/for} -{for $i=0 to date('G', time () - 60 * 60)} - {$i}:00 -{/for} +{foreach $YOURHASHRATES as $hour=>$hashrate} + {$hour|default:"0"}:00 +{/foreach} {$smarty.session.USERDATA.username} -{for $i=date('G') to 23} - {$YOURHASHRATES.$i|default:"0"} -{/for} -{for $i=0 to date('G', time() - 60 * 60)} - {$YOURHASHRATES.$i|default:"0"} -{/for} +{foreach $YOURHASHRATES as $hour=>$hashrate} + {$hashrate|default:"0"} +{/foreach} diff --git a/public/templates/mmcFE/statistics/graphs/pool.tpl b/public/templates/mmcFE/statistics/graphs/pool.tpl index f8d118c7..704dd2bf 100644 --- a/public/templates/mmcFE/statistics/graphs/pool.tpl +++ b/public/templates/mmcFE/statistics/graphs/pool.tpl @@ -5,23 +5,17 @@ -{for $i=date('G') to 23} - {$i}:00 -{/for} -{for $i=0 to date('G', time () - 60 * 60)} - {$i}:00 -{/for} +{foreach $POOLHASHRATES as $hour=>$hashrate} + {$hour|default:"0"}:00 +{/foreach} Pool -{for $i=date('G') to 23} - {$POOLHASHRATES.$i|default:"0"} -{/for} -{for $i=0 to date('G', time() - 60 * 60)} - {$POOLHASHRATES.$i|default:"0"} -{/for} +{foreach $POOLHASHRATES as $hour=>$hashrate} + {$hashrate|default:"0"} +{/foreach} From 1708e5d2b5d5077fb6c06b531a78c4946dfa3321 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 15 Aug 2013 10:03:22 +0200 Subject: [PATCH 24/39] Do not add 24th hour, use 0 hour --- public/include/classes/statistics.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index d61222b0..e4e06167 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -403,10 +403,10 @@ class Statistics { GROUP BY HOUR(time)"); if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $account_id, $account_id) && $stmt->execute() && $result = $stmt->get_result()) { $iStartHour = date('G'); - for ($i = $iStartHour; $i <= 24; $i++) $aData[$i] = 0; + 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; + for ($i = 0; $i < 24; $i++) if (!array_key_exists($i, $aData)) $aData[$i] = 0; return $this->memcache->setCache(__FUNCTION__ . $account_id, $aData); } // Catchall @@ -440,10 +440,10 @@ class Statistics { GROUP BY HOUR(time)"); if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) { $iStartHour = date('G'); - for ($i = $iStartHour; $i <= 24; $i++) $aData[$i] = 0; + 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; + for ($i = 0; $i < 24; $i++) if (!array_key_exists($i, $aData)) $aData[$i] = 0; return $this->memcache->setCache(__FUNCTION__, $aData); } // Catchall From a56907ba00543c7c45a5b0e06bb4368c7d5f997d Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 15 Aug 2013 10:08:48 +0200 Subject: [PATCH 25/39] Adding gethourlyhashrates API call Fixes #608 --- .../pages/api/gethourlyhashrates.inc.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 public/include/pages/api/gethourlyhashrates.inc.php diff --git a/public/include/pages/api/gethourlyhashrates.inc.php b/public/include/pages/api/gethourlyhashrates.inc.php new file mode 100644 index 00000000..776df473 --- /dev/null +++ b/public/include/pages/api/gethourlyhashrates.inc.php @@ -0,0 +1,32 @@ +isActive(); + +// Check user token +$user_id = $user->checkApiKey($_REQUEST['api_key']); + +if ( ! $user->isAdmin($user_id) && ($_REQUEST['id'] != $user_id && !empty($_REQUEST['id']))) { + // User is admin and tries to access an ID that is not their own + header("HTTP/1.1 401 Unauthorized"); + die("Access denied"); +} else if ($user->isAdmin($user_id)) { + // Is it a username or a user ID + ctype_digit($_REQUEST['id']) ? $id = $_REQUEST['id'] : $id = $user->getUserId($_REQUEST['id']); +} else { + // Not admin, only allow own user ID + $id = $user_id; +} + +// Output JSON format +echo json_encode(array('gethourlyhashrates' => array( + 'mine' => $statistics->getHourlyHashrateByAccount($id), + 'pool' => $statistics->getHourlyHashrateByPool() +)), JSON_FORCE_OBJECT); + +// Supress master template +$supress_master = 1; +?> From e7b8cb8d4a14c3f9573e7f3ffb05259c5fc8e958 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 19 Aug 2013 08:48:27 +0200 Subject: [PATCH 26/39] Remove number_format for transaction generation * Fixes: Incorrect payouts due to number formatting * Moved number_format to output only Fixes #611 --- cronjobs/pps_payout.php | 20 ++++++++++---------- cronjobs/proportional_payout.php | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) 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'])) From 7e4c5dab4eceb18b5735a6be1c59d8f9c3db64b2 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 19 Aug 2013 09:31:53 +0200 Subject: [PATCH 27/39] Adding unconfirmed blocks to wallet First attempt addressing #610, still missing a detection for the actual confirmation limit required for each block in case one lowers it in the config. --- public/include/classes/block.class.php | 11 ++++++----- public/include/pages/admin/wallet.inc.php | 8 ++++++++ public/templates/mmcFE/admin/wallet/default.tpl | 4 ++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/public/include/classes/block.class.php b/public/include/classes/block.class.php index 8ce985d1..e6a8fc6d 100644 --- a/public/include/classes/block.class.php +++ b/public/include/classes/block.class.php @@ -10,9 +10,10 @@ class Block { // This defines each block public $height, $blockhash, $confirmations, $time, $accounted; - public function __construct($debug, $mysqli, $salt) { + public function __construct($debug, $mysqli, $config) { $this->debug = $debug; $this->mysqli = $mysqli; + $this->config = $config; $this->debug->append("Instantiated Block class", 2); } @@ -120,9 +121,9 @@ class Block { * @param confirmations int Required confirmations to consider block confirmed * @return data array Array with database fields as keys **/ - public function getAllUnconfirmed($confirmations='120') { - $stmt = $this->mysqli->prepare("SELECT id, height, blockhash, confirmations FROM $this->table WHERE confirmations < ? AND confirmations > -1"); - if ($this->checkStmt($stmt) && $stmt->bind_param("i", $confirmations) && $stmt->execute() && $result = $stmt->get_result()) + public function getAllUnconfirmed() { + $stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE confirmations < ? AND confirmations > -1"); + if ($this->checkStmt($stmt) && $stmt->bind_param("i", $this->config['confirmations']) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); return false; } @@ -267,4 +268,4 @@ class Block { } // Automatically load our class for furhter usage -$block = new Block($debug, $mysqli, SALT); +$block = new Block($debug, $mysqli, $config); diff --git a/public/include/pages/admin/wallet.inc.php b/public/include/pages/admin/wallet.inc.php index 822134dd..de201523 100644 --- a/public/include/pages/admin/wallet.inc.php +++ b/public/include/pages/admin/wallet.inc.php @@ -24,16 +24,24 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { $dNewmint = -1; $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to wallet RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'errormsg'); } + // Fetch unconfirmed amount from blocks table + $aBlocksUnconfirmed = $block->getAllUnconfirmed(); + $dBlocksUnconfirmedBalance = 0; + if (!empty($aBlocksUnconfirmed)) + foreach ($aBlocksUnconfirmed as $aData) $dBlocksUnconfirmedBalance += $aData['amount']; + // Fetch locked balance from transactions $dLockedBalance = $transaction->getLockedBalance(); } else { $debug->append('Using cached page', 3); } +$smarty->assign("UNCONFIRMED", $dBlocksUnconfirmedBalance); $smarty->assign("BALANCE", $dBalance); $smarty->assign("LOCKED", $dLockedBalance); $smarty->assign("NEWMINT", $dNewmint); // Tempalte specifics $smarty->assign("CONTENT", "default.tpl"); + ?> diff --git a/public/templates/mmcFE/admin/wallet/default.tpl b/public/templates/mmcFE/admin/wallet/default.tpl index ed1093d6..ccf49d30 100644 --- a/public/templates/mmcFE/admin/wallet/default.tpl +++ b/public/templates/mmcFE/admin/wallet/default.tpl @@ -8,6 +8,10 @@ Locked for users {$LOCKED|number_format:"8"} + + Unconfirmed + {$UNCONFIRMED|number_format:"8"} + Liquid Assets {($BALANCE - $LOCKED)|number_format:"8"} From f0921264f8047b54df6ad50585c73381db49185f Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 19 Aug 2013 09:36:25 +0200 Subject: [PATCH 28/39] Fixing proof-of-stake detection Fixes #569 --- cronjobs/findblock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cronjobs/findblock.php b/cronjobs/findblock.php index d5215f87..eb19bd41 100755 --- a/cronjobs/findblock.php +++ b/cronjobs/findblock.php @@ -59,7 +59,7 @@ if (empty($aTransactions['transactions'])) { $aData['difficulty'] . "\t" . strftime("%Y-%m-%d %H:%M:%S", $aData['time'])); if ( ! empty($aBlockInfo['flags']) && preg_match('/proof-of-stake/', $aBlockInfo['flags']) ) { - $logs->logInfo("Block above with height " . $aData['height'] . " not added to database, proof-of-stake block!"); + $log->logInfo("Block above with height " . $aData['height'] . " not added to database, proof-of-stake block!"); continue; } if (!$block->addBlock($aData) ) { From f8f50fdc054b0e5329f596ff218dbd29e996dbd9 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 19 Aug 2013 09:39:45 +0200 Subject: [PATCH 29/39] Removing IRC reference Fixes #612 --- public/templates/mmcFE/support/default.tpl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/templates/mmcFE/support/default.tpl b/public/templates/mmcFE/support/default.tpl index 4a3e6eb4..f78550fe 100644 --- a/public/templates/mmcFE/support/default.tpl +++ b/public/templates/mmcFE/support/default.tpl @@ -7,9 +7,7 @@

    This product comes 'as-is' without any warranty. Please check the Apache License, Version 2.0, for details.

    -

    If you would like to get in touch you can find me on Freenode IRC @ #mmcfe-ng.

    - -
    +
    From 59bd71c75d49b5d29592faf67240f0607de156cb Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 19 Aug 2013 09:59:41 +0200 Subject: [PATCH 30/39] Fixing admin requests Fixes #605 --- public/include/pages/api/getuserbalance.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/include/pages/api/getuserbalance.inc.php b/public/include/pages/api/getuserbalance.inc.php index 9b765ce7..76462c00 100644 --- a/public/include/pages/api/getuserbalance.inc.php +++ b/public/include/pages/api/getuserbalance.inc.php @@ -9,11 +9,13 @@ $api->isActive(); // Check user token $user_id = $user->checkApiKey($_REQUEST['api_key']); +echo $user_id; + // We have to check if that user is admin too if ( ! $user->isAdmin($user_id) && ($_REQUEST['id'] != $user_id && !empty($_REQUEST['id']))) { header("HTTP/1.1 401 Unauthorized"); die("Access denied"); -} else if ($user->isAdmin($user_id)) { +} else if ($user->isAdmin($user_id) && !empty($_REQUEST['id'])) { $id = $_REQUEST['id']; ctype_digit($_REQUEST['id']) ? $id = $_REQUEST['id'] : $id = $user->getUserId($_REQUEST['id']); } else { From 2db6dba4826edad7a4eda70de6663345a4ad2016 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 19 Aug 2013 10:40:25 +0200 Subject: [PATCH 31/39] Fix: Display proper PPS value * Fixes: Wrong PPS value before the first block is found Fixes #617 --- public/include/smarty_globals.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index 7ddeb583..a8875c8f 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -65,7 +65,7 @@ $aGlobal = array( // Special calculations for PPS Values based on reward_type setting and/or available blocks if ($config['reward_type'] != 'block') { - $aGlobal['ppsvalue'] = number_format(round(50 / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12); + $aGlobal['ppsvalue'] = number_format(round($config['reward'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,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()) { From 7ec8fa9b9532c0d6121417a7b27f3971f4b94af0 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 20 Aug 2013 12:02:47 +0200 Subject: [PATCH 32/39] Moving a lot of settings from config to adminpanel * Migrated configuration options to admin panel * Removed configuration options from config file * Added help text for each configuration option into panel Addresses #622 and needs extensive testing by pools. A lot has changed so pool owners might have to adjust their own templates to match this new system. --- public/include/autoloader.inc.php | 41 +++-- public/include/classes/api.class.php | 3 +- public/include/classes/base.class.php | 5 +- public/include/classes/mail.class.php | 42 +----- public/include/classes/notification.class.php | 15 -- public/include/classes/setting.class.php | 6 +- public/include/classes/user.class.php | 10 +- public/include/config/admin_settings.inc.php | 140 +++++++++++++++++- public/include/config/global.inc.dist.php | 76 ---------- public/include/pages/register.inc.php | 5 +- .../include/pages/register/register.inc.php | 18 +-- .../include/pages/statistics/blocks.inc.php | 4 +- public/include/pages/statistics/pool.inc.php | 6 +- public/include/smarty_globals.inc.php | 20 ++- .../mmcFE/account/transactions/default.tpl | 2 +- .../mmcFE/admin/settings/default.tpl | 4 +- .../mmcFE/admin/transactions/default.tpl | 2 +- public/templates/mmcFE/global/header.tpl | 4 +- public/templates/mmcFE/global/navigation.tpl | 6 +- public/templates/mmcFE/master.tpl | 2 +- .../mmcFE/statistics/blocks/default.tpl | 6 +- .../mmcFE/statistics/blocks/small_table.tpl | 6 +- .../mmcFE/statistics/pool/authenticated.tpl | 12 +- public/templates/mobile/global/header.tpl | 2 +- public/templates/mobile/master.tpl | 2 +- .../mobile/statistics/blocks/default.tpl | 2 +- .../mobile/statistics/blocks/small_table.tpl | 2 +- .../mobile/statistics/pool/authenticated.tpl | 10 +- 28 files changed, 252 insertions(+), 201 deletions(-) diff --git a/public/include/autoloader.inc.php b/public/include/autoloader.inc.php index 8f8ea6dc..35ce807e 100644 --- a/public/include/autoloader.inc.php +++ b/public/include/autoloader.inc.php @@ -1,34 +1,40 @@ isMobile() && $config['website']['mobile']) { - // Set to mobile theme - $config['website']['mobile_theme'] ? $theme = $config['website']['mobile_theme'] : $theme = 'mobile'; -} else { - // Use configured theme, fallback to default theme - $config['website']['theme'] ? $theme = $config['website']['theme'] : $theme = 'mmcFE'; -} -define('THEME', $theme); - +// Default classes require_once(CLASS_DIR . '/debug.class.php'); require_once(CLASS_DIR . '/bitcoin.class.php'); require_once(CLASS_DIR . '/statscache.class.php'); require_once(CLASS_DIR . '/bitcoinwrapper.class.php'); require_once(INCLUDE_DIR . '/lib/KLogger.php'); require_once(INCLUDE_DIR . '/database.inc.php'); -require_once(INCLUDE_DIR . '/smarty.inc.php'); -// Load classes that need the above as dependencies + +// We need to load these two first require_once(CLASS_DIR . '/base.class.php'); +require_once(CLASS_DIR . '/setting.class.php'); + +// We need this one in here to properly set our theme +require_once(INCLUDE_DIR . '/lib/Mobile_Detect.php'); + +// Detect device +if ($detect->isMobile() && $setting->getValue('website_mobile_theme')) { + // Set to mobile theme + $setting->getValue('website_mobile_theme') ? $theme = $setting->getValue('website_mobile_theme') : $theme = 'mobile'; +} else { + // Use configured theme, fallback to default theme + $setting->getValue('website_theme') ? $theme = $setting->getValue('website_theme') : $theme = 'mmcFE'; +} +define('THEME', $theme); + +// Load smarty now that we have our theme defined +require_once(INCLUDE_DIR . '/smarty.inc.php'); + +// Load everything else in proper order require_once(CLASS_DIR . '/api.class.php'); require_once(CLASS_DIR . '/mail.class.php'); require_once(CLASS_DIR . '/tokentype.class.php'); require_once(CLASS_DIR . '/token.class.php'); require_once(CLASS_DIR . '/payout.class.php'); require_once(CLASS_DIR . '/block.class.php'); -require_once(CLASS_DIR . '/setting.class.php'); require_once(CLASS_DIR . '/monitoring.class.php'); require_once(CLASS_DIR . '/user.class.php'); require_once(CLASS_DIR . '/invitation.class.php'); @@ -40,3 +46,6 @@ require_once(CLASS_DIR . '/notification.class.php'); require_once(CLASS_DIR . '/news.class.php'); require_once(INCLUDE_DIR . '/lib/Michelf/Markdown.php'); require_once(INCLUDE_DIR . '/lib/scrypt.php'); + + +?> diff --git a/public/include/classes/api.class.php b/public/include/classes/api.class.php index 36374162..e1403ee5 100644 --- a/public/include/classes/api.class.php +++ b/public/include/classes/api.class.php @@ -8,7 +8,7 @@ if (!defined('SECURITY')) die('Hacking attempt'); **/ class Api extends Base { function isActive($error=true) { - if (!$this->config['website']['api']['disabled']) { + if (!$this->setting->getValue('disable_api')) { return true; } else { if ($error == true) { @@ -21,3 +21,4 @@ class Api extends Base { $api = new Api(); $api->setConfig($config); +$api->setSetting($setting); diff --git a/public/include/classes/base.class.php b/public/include/classes/base.class.php index 6dc88b02..2aae51ce 100644 --- a/public/include/classes/base.class.php +++ b/public/include/classes/base.class.php @@ -32,7 +32,10 @@ class Base { $this->token = $token; } public function setBlock($block) { - $this->block= $block; + $this->block = $block; + } + public function setSetting($setting) { + $this->setting = $setting; } public function setBitcoin($bitcoin) { $this->bitcoin = $bitcoin; diff --git a/public/include/classes/mail.class.php b/public/include/classes/mail.class.php index e34423c5..ca1342aa 100644 --- a/public/include/classes/mail.class.php +++ b/public/include/classes/mail.class.php @@ -4,30 +4,7 @@ if (!defined('SECURITY')) die('Hacking attempt'); -class Mail { - private $sError = ''; - - public function setDebug($debug) { - $this->debug = $debug; - } - public function setMysql($mysqli) { - $this->mysqli = $mysqli; - } - public function setSmarty($smarty) { - $this->smarty = $smarty; - } - public function setUser($user) { - $this->user = $user; - } - public function setConfig($config) { - $this->config = $config; - } - public function setErrorMessage($msg) { - $this->sError = $msg; - } - public function getError() { - return $this->sError; - } +class Mail extends Base { function checkStmt($bState) { $this->debug->append("STA " . __METHOD__, 4); if ($bState ===! true) { @@ -39,21 +16,15 @@ class Mail { } public function sendMail($template, $aData) { - $this->smarty->assign('WEBSITENAME', $this->config['website']['name']); + $this->smarty->assign('WEBSITENAME', $this->setting->getValue('website_name')); $this->smarty->assign('SUBJECT', $aData['subject']); $this->smarty->assign('DATA', $aData); - $headers = 'From: Website Administration <' . $this->config['website']['email'] . ">\n"; + $headers = 'From: Website Administration <' . $this->setting->getValue('website_email') . ">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; - if (mail($aData['email'], - $this->smarty->fetch(BASEPATH . 'templates/mail/subject.tpl'), - $this->smarty->fetch(BASEPATH . 'templates/mail/' . $template . '.tpl'), - $headers)) { - return true; - } else { - $this->setErrorMessage("Unable to send mail"); - return false; - } + if (mail($aData['email'], $this->smarty->fetch(BASEPATH . 'templates/mail/subject.tpl'), $this->smarty->fetch(BASEPATH . 'templates/mail/' . $template . '.tpl'), $headers)) + return true; + $this->setErrorMessage('Unable to send mail'); return false; } } @@ -64,4 +35,5 @@ $mail->setDebug($debug); $mail->setMysql($mysqli); $mail->setSmarty($smarty); $mail->setConfig($config); +$mail->setSetting($setting); ?> diff --git a/public/include/classes/notification.class.php b/public/include/classes/notification.class.php index d128087a..08f3d3f5 100644 --- a/public/include/classes/notification.class.php +++ b/public/include/classes/notification.class.php @@ -17,21 +17,6 @@ class Notification extends Mail { return $this->updateSingle($id, $field); } - /** - * Update a single row in a table - * @param userID int Account ID - * @param field string Field to update - * @return bool - **/ - private function updateSingle($id, $field, $table='') { - if (empty($table)) $table = $this->table; - $this->debug->append("STA " . __METHOD__, 4); - $stmt = $this->mysqli->prepare("UPDATE $table SET " . $field['name'] . " = ? WHERE id = ? LIMIT 1"); - if ($this->checkStmt($stmt) && $stmt->bind_param($field['type'].'i', $field['value'], $id) && $stmt->execute()) - return true; - $this->debug->append("Unable to update " . $field['name'] . " with " . $field['value'] . " for ID $id"); - return false; - } /** * We check our notification table for existing data * so we can avoid duplicate entries diff --git a/public/include/classes/setting.class.php b/public/include/classes/setting.class.php index f2c1cbea..56a0d460 100644 --- a/public/include/classes/setting.class.php +++ b/public/include/classes/setting.class.php @@ -5,10 +5,9 @@ if (!defined('SECURITY')) die('Hacking attempt'); class Setting { - public function __construct($debug, $mysqli, $salt) { + public function __construct($debug, $mysqli) { $this->debug = $debug; $this->mysqli = $mysqli; - $this->salt = $salt; $this->table = 'settings'; } @@ -47,9 +46,8 @@ class Setting { if ($stmt && $stmt->bind_param('sss', $name, $value, $value) && $stmt->execute()) return true; $this->debug->append("Failed to set $name to $value"); - echo $this->mysqli->error; return false; } } -$setting = new Setting($debug, $mysqli, SALT); +$setting = new Setting($debug, $mysqli); diff --git a/public/include/classes/user.class.php b/public/include/classes/user.class.php index c9fcc2cc..e012505a 100644 --- a/public/include/classes/user.class.php +++ b/public/include/classes/user.class.php @@ -28,6 +28,9 @@ class User { public function setBitcoin($bitcoin) { $this->bitcoin = $bitcoin; } + public function setSetting($setting) { + $this->setting = $setting; + } private function setErrorMessage($msg) { $this->sError = $msg; } @@ -525,7 +528,7 @@ class User { } } if ($this->mysqli->query("SELECT id FROM $this->table LIMIT 1")->num_rows > 0) { - $this->config['accounts']['confirm_email']['enabled'] ? $is_locked = 1 : $is_locked = 0; + ! $this->setting->getValue('accounts_confirm_email_disabled') ? $is_locked = 1 : $is_locked = 0; $is_admin = 0; $stmt = $this->mysqli->prepare(" INSERT INTO $this->table (username, pass, email, pin, api_key, is_locked) @@ -547,14 +550,14 @@ class User { $username_clean = strip_tags($username); if ($this->checkStmt($stmt) && $stmt->bind_param('sssssi', $username_clean, $password_hash, $email1, $pin_hash, $apikey_hash, $is_locked) && $stmt->execute()) { - if ($this->config['accounts']['confirm_email']['enabled'] && $is_admin != 1) { + if (! $this->setting->getValue('accounts_confirm_email_enabled') && $is_admin != 1) { if ($token = $this->token->createToken('confirm_email', $stmt->insert_id)) { $aData['username'] = $username_clean; $aData['token'] = $token; $aData['email'] = $email1; $aData['subject'] = 'E-Mail verification'; if (!$this->mail->sendMail('register/confirm_email', $aData)) { - $this->setErrorMessage('Unable to request email confirmation'); + $this->setErrorMessage('Unable to request email confirmation: ' . $this->mail->getError()); return false; } return true; @@ -666,3 +669,4 @@ $user = new User($debug, $mysqli, SALT, $config); $user->setMail($mail); $user->setToken($oToken); $user->setBitcoin($bitcoin); +$user->setSetting($setting); diff --git a/public/include/config/admin_settings.inc.php b/public/include/config/admin_settings.inc.php index a1d293d8..87375864 100644 --- a/public/include/config/admin_settings.inc.php +++ b/public/include/config/admin_settings.inc.php @@ -3,46 +3,184 @@ // Make sure we are called from index.php if (!defined('SECURITY')) die('Hacking attempt'); +// Load a list of themes available +$aTmpThemes = glob(THEME_DIR . '/*'); +$aThemes = array(); +foreach ($aTmpThemes as $dir) { + if (basename($dir) != 'cache' && basename($dir) != 'compile' && basename($dir) != 'mail') $aThemes[basename($dir)] = basename($dir); +} + // Load the settings available in this system -$aSettings['system'][] = array( +$aSettings['website'][] = array( 'display' => 'Maintenance Mode', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, 'name' => 'maintenance', 'value' => $setting->getValue('maintenance'), 'tooltip' => 'Enable or Disable maintenance mode. Only admins can still login.' ); +$aSettings['website'][] = array( + 'display' => 'Website Name', 'type' => 'text', + 'size' => 25, + 'default' => 'The Pool', + 'name' => 'website_name', 'value' => $setting->getValue('website_name'), + 'tooltip' => 'The name of you pool page, displayed in the header of the page.' +); +$aSettings['website'][] = array( + 'display' => 'Website Title', 'type' => 'text', + 'size' => 25, + 'default' => 'The Pool - Mining Evolved', + 'name' => 'website_title', 'value' => $setting->getValue('website_title'), + 'tooltip' => 'The title of you pool page, displayed in the browser window header.' +); +$aSettings['website'][] = array( + 'display' => 'Website Slogan', 'type' => 'text', + 'size' => 25, + 'default' => 'Resistance is Futile', + 'name' => 'website_slogan', 'value' => $setting->getValue('website_slogan'), + 'tooltip' => 'The slogan of you pool page, displayed in the browser window header.' +); +$aSettings['website'][] = array( + 'display' => 'Website e-mail', 'type' => 'text', + 'size' => 25, + 'default' => 'test@example.com', + 'name' => 'website_email', 'value' => $setting->getValue('website_email'), + 'tooltip' => 'The email address for your pool, used in mail templates and notifications.' +); +$aSettings['website'][] = array( + 'display' => 'Website theme', 'type' => 'select', + 'options' => $aThemes, + 'default' => 'mmcFE', + 'name' => 'website_theme', 'value' => $setting->getValue('website_theme'), + 'tooltip' => 'The default theme used on your pool.' +); +$aSettings['website'][] = array( + 'display' => 'Website mobile theme', 'type' => 'select', + 'options' => $aThemes, + 'default' => 'mobile', + 'name' => 'website_mobile_theme', 'value' => $setting->getValue('website_mobile_theme'), + 'tooltip' => 'The mobile theme used for your pool.' +); +$aSettings['website'][] = array( + 'display' => 'Blockexplorer URL', 'type' => 'text', + 'size' => 50, + 'default' => 'http://explorer.litecoin.net/block/', + 'name' => 'website_blockexplorer_url', 'value' => $setting->getValue('website_blockexplorer_url'), + 'tooltip' => 'URL to the blockexplorer website for your blockchain. Will append the blockhash to the URL. Leave empty to disabled this.' +); +$aSettings['website'][] = array( + 'display' => 'Disable Blockexplorer', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'name' => 'website_blockexplorer_disabled', 'value' => $setting->getValue('website_blockexplorer_disabled'), + 'tooltip' => 'Enabled or disable the blockexplorer URL feature. Will remove any links using the blockexplorer URL.' +); +$aSettings['website'][] = array( + 'display' => 'Chaininfo URL', 'type' => 'text', + 'size' => 50, + 'default' => 'http://allchains.info', + 'name' => 'website_chaininfo_url', 'value' => $setting->getValue('website_chaininfo_url'), + 'tooltip' => 'URL to the chaininfo website for your blockchain. Leave empty to disabled this.' +); +$aSettings['website'][] = array( + 'display' => 'Disable Chaininfo', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'name' => 'website_chaininfo_disabled', 'value' => $setting->getValue('website_chaininfo_disabled'), + 'tooltip' => 'Enabled or disable the chainfo URL feature. Will remove any links using the chaininfo URL.' +); +$aSettings['statistics'][] = array( + 'display' => 'Block Statistics Count', 'type' => 'text', + 'size' => 25, + 'default' => 20, + 'name' => 'statistics_block_count', 'value' => $setting->getValue('statistics_block_count'), + 'tooltip' => 'Blocks to fetch for the block statistics page.' +); +$aSettings['acl'][] = array( + 'display' => 'Pool Statistics', 'type' => 'select', + 'options' => array( 0 => 'Private', 1 => 'Public'), + 'default' => 1, + 'name' => 'acl_pool_statistics', 'value' => $setting->getValue('acl_pool_statistics'), + 'tooltip' => 'Make the pool statistics page private (users only) or public.' +); +$aSettings['acl'][] = array( + 'display' => 'Blcok Statistics', 'type' => 'select', + 'options' => array( 0 => 'Private', 1 => 'Public'), + 'default' => 1, + 'name' => 'acl_block_statistics', 'value' => $setting->getValue('acl_block_statistics'), + 'tooltip' => 'Make the block statistics page private (users only) or public.' +); +$aSettings['system'][] = array( + 'display' => 'Disable e-mail confirmations', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, + 'name' => 'accounts_confirm_email_disabled', 'value' => $setting->getValue('accounts_confirm_email_disabled'), + 'tooltip' => 'Should users supply a valid e-mail address upon registration. Requires them to confirm the address before accounts are activated.' +); $aSettings['system'][] = array( 'display' => 'Disable registrations', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, 'name' => 'lock_registration', 'value' => $setting->getValue('lock_registration'), 'tooltip' => 'Enable or Disable registrations. Useful to create an invitation only pool.' ); $aSettings['system'][] = array( 'display' => 'Disable Invitations', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, 'name' => 'disable_invitations', 'value' => $setting->getValue('disable_invitations'), 'tooltip' => 'Enable or Disable invitations. Users will not be able to invite new users via email if disabled.' ); $aSettings['system'][] = array( 'display' => 'Disable Manual Payouts', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, 'name' => 'disable_mp', 'value' => $setting->getValue('disable_mp'), 'tooltip' => 'Enable or Disable the manual payout processing. Users will not be able to withdraw any funds if disabled.' ); $aSettings['system'][] = array( 'display' => 'Disable Automatic Payouts', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, 'name' => 'disable_ap', 'value' => $setting->getValue('disable_ap'), 'tooltip' => 'Enable or Disable the automatic payout processing. Users exceeding their thresholds will not be paid out if disabled.' ); $aSettings['system'][] = array( 'display' => 'Disable notifications', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, 'name' => 'disable_notifications', 'value' => $setting->getValue('disable_notifications'), 'tooltip' => 'Enable or Disable system notifications. This includes new found blocks, monitoring and all other notifications.' ); +$aSettings['system'][] = array( + 'display' => 'Disable API', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, + 'name' => 'disable_api', 'value' => $setting->getValue('disable_api'), + 'tooltip' => 'Enable or Disable the pool wide API functions. See API reference on Github for details.' +); +$aSettings['recaptcha'][] = array( + 'display' => 'Enable re-Captcha', 'type' => 'select', + 'options' => array( 0 => 'No', 1 => 'Yes' ), + 'default' => 0, + 'name' => 'recaptcha_enabled', 'value' => $setting->getValue('recaptcha_enabled'), + 'tooltip' => 'Enable or Disable re-Captcha. This will require user input on registraion and other forms.' +); +$aSettings['recaptcha'][] = array( + 'display' => 're-Captcha Private Key', 'type' => 'text', + 'size' => 25, + 'default' => 'YOUR_PRIVATE_KEY', + 'name' => 'recaptcha_private_key', 'value' => $setting->getValue('recaptcha_private_key'), + 'tooltip' => '.' +); +$aSettings['recaptcha'][] = array( + 'display' => 're-Captcha Public Key', 'type' => 'text', + 'size' => 25, + 'default' => 'YOUR_PUBLIC_KEY', + 'name' => 'recaptcha_public_key', 'value' => $setting->getValue('recaptcha_public_key'), + 'tooltip' => 'Your public key as given by your re-Captcha account.' +); $aSettings['other'][] = array( 'display' => 'Message of the Day', 'type' => 'text', 'size' => 25, + 'default' => '', 'name' => 'system_motd', 'value' => $setting->getValue('system_motd'), 'tooltip' => 'Display a message of the day as information popup if set.' ); diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index 265dfc7a..88f0a17c 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -97,49 +97,10 @@ $config['ap_threshold']['min'] = 1; $config['ap_threshold']['max'] = 250; -/** - * Website specific configuration settings - * - * Explanation: - * title : Website title used in master template - * name : The pool name, displayed in the header and mails - * slogan : A special slogan, also displayed in the header below name - * email : `From` addresses used in notifications - * theme : Theme used for desktop browsers - * 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` - * name = `The Pool` - * slogan = `Resistance is futile` - * email = `test@example.com` - * theme = `mmcFE` - * mobile = true - * mobile_theme = `mobile` - * api disbabled = false - * blocks count = 20 - **/ -$config['website']['title'] = 'The Pool - Mining Evolved'; -$config['website']['name'] = 'The Pool'; -$config['website']['slogan'] = 'Resistance is futile'; -$config['website']['email'] = 'test@example.com'; -$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 * * Explanation - * You can change some defaults on how accounts are created or registered - * By default, all newly created accounts will require an email verificaiton. - * Only after acitivating an account the user will be able to login - * * Invitations will allow your users to invite new members to join the pool. * After sending a mail to the invited user, they can register using the token * created. Invitations can be enabled and disabled through the admin panel. @@ -149,41 +110,13 @@ $config['website']['blocks']['count'] = 20; * variable. * * Options: - * confirm_email : Send confirmation mail to user after registration * count : Maximum invitations a user is able to send * * Defaults: - * confirm_email : true * count : 5 **/ -$config['accounts']['confirm_email']['enabled'] = true; $config['accounts']['invitations']['count'] = 5; -/** - * Some basic access restrictions on some pages - * - * Explanation: - * Some pools would like to run a few pages for public access instead - * of enforcing a login. You can change visibility of some pages here. - * - * Options: - * 'public' : Allow guest access and authenticated user to view page - * 'private' : Only allow logged in users access to view page - * - * Defaults: - * 'private' for every page - **/ -$config['website']['acl']['statistics']['pool'] = 'private'; -$config['website']['acl']['statistics']['blocks'] = 'private'; - -/** - * Re-Captcha settings - * Please read http://www.google.com/recaptcha for details - **/ -$config['recaptcha']['enabled'] = false; -$config['recaptcha']['public_key'] = 'YOUR_PUBLIC_RECAPTCHA_KEY'; -$config['recaptcha']['private_key'] = 'YOUR_PRIVATE_RECAPTCHA_KEY'; - // Currency system used in this pool, default: `LTC` $config['currency'] = 'LTC'; @@ -254,15 +187,6 @@ $config['payout_system'] = 'prop'; $config['archive']['maxrounds'] = 10; $config['archive']['maxage'] = 60 * 24; -// URL prefix for block searches, used for block links, default: `http://explorer.litecoin.net/block/` -// The Blockhash is appended on the templates to this URL -// If this config is empty, the block link to the block information page will be removed -$config['blockexplorer'] = 'http://explorer.litecoin.net/block/'; - -// Link to blockchain information, used for difficulty link, default: `http://allchains.info` -// If empty, the difficulty link to the chain information will be removed -$config['chaininfo'] = 'http://allchains.info'; - // Pool fees applied to users in percent, default: 0 (disabled) $config['fees'] = 0; diff --git a/public/include/pages/register.inc.php b/public/include/pages/register.inc.php index 01b71b18..681bcb53 100644 --- a/public/include/pages/register.inc.php +++ b/public/include/pages/register.inc.php @@ -10,11 +10,10 @@ if ($setting->getValue('lock_registration') && $setting->getValue('disable_invit $_SESSION['POPUP'][] = array('CONTENT' => 'Only invited users are allowed to register.', 'TYPE' => 'errormsg'); $smarty->assign("CONTENT", "disabled.tpl"); } else { - if ($config['recaptcha']['enabled']) { + if ($setting->getValue('recaptcha_enabled')) { require_once(INCLUDE_DIR . '/lib/recaptchalib.php'); - $smarty->assign("RECAPTCHA", recaptcha_get_html($config['recaptcha']['public_key'])); + $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'))); } - // Tempalte specifics $smarty->assign("CONTENT", "default.tpl"); } ?> diff --git a/public/include/pages/register/register.inc.php b/public/include/pages/register/register.inc.php index ca165e3b..ecb2c028 100644 --- a/public/include/pages/register/register.inc.php +++ b/public/include/pages/register/register.inc.php @@ -2,11 +2,11 @@ // Make sure we are called from index.php if (!defined('SECURITY')) die('Hacking attempt'); -if ($config['recaptcha']['enabled']) { +if ($setting->getValue('recaptcha_enabled')) { // Load re-captcha specific data require_once(INCLUDE_DIR . '/lib/recaptchalib.php'); $rsp = recaptcha_check_answer ( - $config['recaptcha']['private_key'], + $setting->getValue('recaptcha_private_key'), $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"] @@ -19,28 +19,28 @@ if ($setting->getValue('disable_invitations') && $setting->getValue('lock_regist $_SESSION['POPUP'][] = array('CONTENT' => 'Only invited users are allowed to register.', 'TYPE' => 'errormsg'); } else { // Check if recaptcha is enabled, process form data if valid - if($config['recaptcha']['enabled'] && $_POST["recaptcha_response_field"] && $_POST["recaptcha_response_field"]!=''){ + if($setting->getValue('recaptcha_enabled') && $_POST["recaptcha_response_field"] && $_POST["recaptcha_response_field"]!=''){ if ($rsp->is_valid) { - $smarty->assign("RECAPTCHA", recaptcha_get_html($config['recaptcha']['public_key'])); + $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'))); isset($_POST['token']) ? $token = $_POST['token'] : $token = ''; if ($user->register($_POST['username'], $_POST['password1'], $_POST['password2'], $_POST['pin'], $_POST['email1'], $_POST['email2'], $token)) { - $config['accounts']['confirm_email']['enabled'] ? $_SESSION['POPUP'][] = array('CONTENT' => 'Please check your mailbox to activate this account') : $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login'); + ! $setting->getValue('accounts_confirm_email_disabled') ? $_SESSION['POPUP'][] = array('CONTENT' => 'Please check your mailbox to activate this account') : $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login'); } else { $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to create account: ' . $user->getError(), 'TYPE' => 'errormsg'); } } else { - $smarty->assign("RECAPTCHA", recaptcha_get_html($config['recaptcha']['public_key'], $rsp->error)); + $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), $rsp->error)); $_SESSION['POPUP'][] = array('CONTENT' => 'Invalid Captcha, please try again. (' . $rsp->error . ')', 'TYPE' => 'errormsg'); } // Empty captcha - } else if ($config['recaptcha']['enabled']) { - $smarty->assign("RECAPTCHA", recaptcha_get_html($config['recaptcha']['public_key'], $rsp->error)); + } else if ($setting->getValue('recaptcha_enabled')) { + $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'), $rsp->error)); $_SESSION['POPUP'][] = array('CONTENT' => 'Empty Captcha, please try again.', 'TYPE' => 'errormsg'); // Captcha disabled } else { isset($_POST['token']) ? $token = $_POST['token'] : $token = ''; if ($user->register($_POST['username'], $_POST['password1'], $_POST['password2'], $_POST['pin'], $_POST['email1'], $_POST['email2'], $token)) { - $config['accounts']['confirm_email']['enabled'] ? $_SESSION['POPUP'][] = array('CONTENT' => 'Please check your mailbox to activate this account') : $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login'); + ! $setting->getValue('accounts_confirm_email_disabled') ? $_SESSION['POPUP'][] = array('CONTENT' => 'Please check your mailbox to activate this account') : $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login'); } else { $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to create account: ' . $user->getError(), 'TYPE' => 'errormsg'); } diff --git a/public/include/pages/statistics/blocks.inc.php b/public/include/pages/statistics/blocks.inc.php index 494e6be3..116d999d 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 - !empty($config['website']['blocks']['count']) ? $iLimit = $config['website']['blocks']['count'] : $iLimit = 20; + $setting->getValue('statistics_block_count') ? $iLimit = $setting->getValue('statistics_block_count') : $iLimit = 20; $aBlocksFoundData = $statistics->getBlocksFound($iLimit); // Propagate content our template @@ -17,7 +17,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { $debug->append('Using cached page', 3); } -if ($config['website']['acl']['statistics']['blocks'] == 'public') { +if ($setting->getValue('acl_block_statistics')) { $smarty->assign("CONTENT", "default.tpl"); } else if ($user->isAuthenticated()) { $smarty->assign("CONTENT", "default.tpl"); diff --git a/public/include/pages/statistics/pool.inc.php b/public/include/pages/statistics/pool.inc.php index 2c1ca533..7937029d 100644 --- a/public/include/pages/statistics/pool.inc.php +++ b/public/include/pages/statistics/pool.inc.php @@ -52,7 +52,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { $smarty->assign("CONTRIBSHARES", $aContributorsShares); $smarty->assign("CONTRIBHASHES", $aContributorsHashes); $smarty->assign("CURRENTBLOCK", $iBlock); - $smarty->assign("CURRENTBLOCKHASH", $sBlockHash); + $smarty->assign("CURRENTBLOCKHASH", @$sBlockHash); if (count($aBlockData) > 0) { $smarty->assign("LASTBLOCK", $aBlockData['height']); $smarty->assign("LASTBLOCKHASH", $aBlockData['blockhash']); @@ -66,9 +66,9 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { } // Public / private page detection -if ($config['website']['acl']['statistics']['pool'] == 'public') { +if ($setting->getValue('acl_pool_statistics')) { $smarty->assign("CONTENT", "authenticated.tpl"); -} else if ($user->isAuthenticated() && $config['website']['acl']['statistics']['pool'] == 'private') { +} else if ($user->isAuthenticated() && ! $setting->getValue('acl_pool_statistics')) { $smarty->assign("CONTENT", "authenticated.tpl"); } else { $smarty->assign("CONTENT", "../default.tpl"); diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index a8875c8f..af2805b8 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -32,8 +32,6 @@ if ($iCurrentPoolHashrate > $dNetworkHashrate) $dNetworkHashrate = $iCurrentPool // Global data for Smarty $aGlobal = array( - 'slogan' => $config['website']['slogan'], - 'websitename' => $config['website']['name'], 'hashrate' => $iCurrentPoolHashrate, 'nethashrate' => $dNetworkHashrate, 'sharerate' => $iCurrentPoolShareRate, @@ -43,11 +41,8 @@ $aGlobal = array( 'confirmations' => $config['confirmations'], 'reward' => $config['reward'], 'price' => $setting->getValue('price'), - 'blockexplorer' => $config['blockexplorer'], - 'chaininfo' => $config['chaininfo'], 'disable_mp' => $setting->getValue('disable_mp'), 'config' => array( - 'website' => $config['website'], 'accounts' => $config['accounts'], 'disable_invitations' => $setting->getValue('disable_invitations'), 'disable_notifications' => $setting->getValue('disable_notifications'), @@ -63,6 +58,21 @@ $aGlobal = array( ) ); +// Website configurations +$aGlobal['website']['name'] = $setting->getValue('website_name'); +$aGlobal['website']['title'] = $setting->getValue('website_title'); +$aGlobal['website']['slogan'] = $setting->getValue('website_slogan'); +$aGlobal['website']['email'] = $setting->getValue('website_email'); +$aGlobal['website']['api']['disabled'] = $setting->getValue('disable_api'); +$aGlobal['website']['blockexplorer']['disabled'] = $setting->getValue('website_blockexplorer_disabled'); +$aGlobal['website']['chaininfo']['disabled'] = $setting->getValue('website_chaininfo_disabled'); +$setting->getValue('website_blockexplorer_url') ? $aGlobal['website']['blockexplorer']['url'] = $setting->getValue('website_blockexplorer_url') : $aGlobal['website']['blockexplorer']['url'] = 'http://explorer.litecoin.net/block/'; +$setting->getValue('website_chaininfo_url') ? $aGlobal['website']['chaininfo']['url'] = $setting->getValue('website_chaininfo_url') : $aGlobal['website']['chaininfo']['url'] = 'http://allchains.info'; + +// ACLs +$aGlobal['acl']['pool']['statistics'] = $setting->getValue('acl_pool_statistics'); +$aGlobal['acl']['block']['statistics'] = $setting->getValue('acl_block_statistics'); + // Special calculations for PPS Values based on reward_type setting and/or available blocks if ($config['reward_type'] != 'block') { $aGlobal['ppsvalue'] = number_format(round($config['reward'] / (pow(2,32) * $dDifficulty) * pow(2, $config['difficulty']), 12) ,12); diff --git a/public/templates/mmcFE/account/transactions/default.tpl b/public/templates/mmcFE/account/transactions/default.tpl index 169e7de2..32febd64 100644 --- a/public/templates/mmcFE/account/transactions/default.tpl +++ b/public/templates/mmcFE/account/transactions/default.tpl @@ -96,7 +96,7 @@ ({$TRANSACTIONS[transaction].confirmations|default:"n/a"}) {$TRANSACTIONS[transaction].coin_address} - {if $TRANSACTIONS[transaction].height == 0}n/a{else}{if $GLOBAL.blockexplorer}{$TRANSACTIONS[transaction].height}{else}{$TRANSACTIONS[transaction].height}{/if}{/if} + {if $TRANSACTIONS[transaction].height == 0}n/a{else}{if $GLOBAL.website.blockexplorer.url}{$TRANSACTIONS[transaction].height}{else}{$TRANSACTIONS[transaction].height}{/if}{/if} {$TRANSACTIONS[transaction].amount|number_format:"8"} {/section} diff --git a/public/templates/mmcFE/admin/settings/default.tpl b/public/templates/mmcFE/admin/settings/default.tpl index dd5c5a09..519fb96e 100644 --- a/public/templates/mmcFE/admin/settings/default.tpl +++ b/public/templates/mmcFE/admin/settings/default.tpl @@ -18,9 +18,9 @@ {if $SETTINGS.$TAB[setting].tooltip|default}{/if} {if $SETTINGS.$TAB[setting].type == 'select'} - {html_options name="data[{$SETTINGS.$TAB[setting].name}]" options=$SETTINGS.$TAB[setting].options selected=$SETTINGS.$TAB[setting].value|default:"0"} + {html_options name="data[{$SETTINGS.$TAB[setting].name}]" options=$SETTINGS.$TAB[setting].options selected=$SETTINGS.$TAB[setting].value|default:$SETTINGS.$TAB[setting].default} {else if $SETTINGS.$TAB[setting].type == 'text'} - + {else} Unknown option type: {$SETTINGS.$TAB[setting].type} {/if} diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index cb066607..58b055d9 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -104,7 +104,7 @@ ({$TRANSACTIONS[transaction].confirmations|default:"n/a"}) {$TRANSACTIONS[transaction].coin_address} - {if $TRANSACTIONS[transaction].height == 0}n/a{else}{if $GLOBAL.blockexplorer}{$TRANSACTIONS[transaction].height}{else}{$TRANSACTIONS[transaction].height}{/if}{/if} + {if $TRANSACTIONS[transaction].height == 0}n/a{else}{if $GLOBAL.website.blockexplorer.url}{$TRANSACTIONS[transaction].height}{else}{$TRANSACTIONS[transaction].height}{/if}{/if} {$TRANSACTIONS[transaction].amount|number_format:"8"} {/section} diff --git a/public/templates/mmcFE/global/header.tpl b/public/templates/mmcFE/global/header.tpl index 4ee9d9b5..9b03db7e 100644 --- a/public/templates/mmcFE/global/header.tpl +++ b/public/templates/mmcFE/global/header.tpl @@ -1,5 +1,5 @@ -
    {$GLOBAL.websitename}
    - {$GLOBAL.slogan} +
    {$GLOBAL.website.name|default:"The Pool"}
    + {$GLOBAL.website.slogan|default:"Resistance is Futile"}
    diff --git a/public/templates/mmcFE/global/navigation.tpl b/public/templates/mmcFE/global/navigation.tpl index 4480cf2b..407f24b0 100644 --- a/public/templates/mmcFE/global/navigation.tpl +++ b/public/templates/mmcFE/global/navigation.tpl @@ -35,10 +35,10 @@ {else}
  • Statistics
      - {if $GLOBAL.config.website.acl.statistics.pool == 'public'} + {if $GLOBAL.acl.pool.statistics}
    • Pool Stats
    • {/if} - {if $GLOBAL.config.website.acl.statistics.blocks == 'public'} + {if $GLOBAL.acl.block.statistics}
    • Block Stats
    • {/if}
    @@ -48,7 +48,7 @@
  • About
  • diff --git a/public/templates/mmcFE/master.tpl b/public/templates/mmcFE/master.tpl index 5c7f59b1..28a6a26d 100644 --- a/public/templates/mmcFE/master.tpl +++ b/public/templates/mmcFE/master.tpl @@ -1,7 +1,7 @@ - {$GLOBAL.config.website.title} + {$GLOBAL.website.title} diff --git a/public/templates/mmcFE/statistics/blocks/default.tpl b/public/templates/mmcFE/statistics/blocks/default.tpl index 8aeb21e6..6596647f 100644 --- a/public/templates/mmcFE/statistics/blocks/default.tpl +++ b/public/templates/mmcFE/statistics/blocks/default.tpl @@ -55,7 +55,11 @@ target and network difficulty and assuming a zero variance scenario. {assign var="totalshares" value=$totalshares+$BLOCKSFOUND[block].shares} {assign var="count" value=$count+1} - + {if ! $GLOBAL.website.blockexplorer.disabled} + + {else} + + {/if} - + {if ! $GLOBAL.website.blockexplorer.disabled} + + {else} + + {/if} diff --git a/public/templates/mmcFE/statistics/pool/authenticated.tpl b/public/templates/mmcFE/statistics/pool/authenticated.tpl index 394e762b..6189ef78 100644 --- a/public/templates/mmcFE/statistics/pool/authenticated.tpl +++ b/public/templates/mmcFE/statistics/pool/authenticated.tpl @@ -19,10 +19,10 @@ - {if $GLOBAL.blockexplorer} + {if $GLOBAL.website.blockexplorer.url} - + {else} @@ -32,12 +32,12 @@ {/if} - + - {if $GLOBAL.chaininfo} - + {if ! $GLOBAL.website.chaininfo.disabled} + {else} {/if} @@ -56,7 +56,7 @@
    {$BLOCKSFOUND[block].height}{$BLOCKSFOUND[block].height}{$BLOCKSFOUND[block].height} {if $BLOCKSFOUND[block].confirmations >= $GLOBAL.confirmations} Confirmed diff --git a/public/templates/mmcFE/statistics/blocks/small_table.tpl b/public/templates/mmcFE/statistics/blocks/small_table.tpl index 7ddc03c8..e826fd3a 100644 --- a/public/templates/mmcFE/statistics/blocks/small_table.tpl +++ b/public/templates/mmcFE/statistics/blocks/small_table.tpl @@ -13,7 +13,11 @@ {assign var=rank value=1} {section block $BLOCKSFOUND}
    {$BLOCKSFOUND[block].height}{$BLOCKSFOUND[block].height}{$BLOCKSFOUND[block].height}{if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} {$BLOCKSFOUND[block].shares|number_format}Current Active Workers {$GLOBAL.workers}
    Next Network Block{$CURRENTBLOCK + 1}    (Current: {$CURRENTBLOCK}){$CURRENTBLOCK + 1}    (Current: {$CURRENTBLOCK})
    Last Block Found{if $GLOBAL.blockexplorer}{$LASTBLOCK|default:"0"}{else}{$LASTBLOCK|default:"0"}{/if}{if $GLOBAL.website.blockexplorer.url}{$LASTBLOCK|default:"0"}{else}{$LASTBLOCK|default:"0"}{/if}
    Current Difficulty{$DIFFICULTY}{$DIFFICULTY}{$DIFFICULTY}
    -{if !$GLOBAL.config.website.api.disabled}
  • These stats are also available in JSON format HERE
  • {/if} +{if !$GLOBAL.website.api.disabled}
  • These stats are also available in JSON format HERE
  • {/if} {include file="global/block_footer.tpl"} diff --git a/public/templates/mobile/global/header.tpl b/public/templates/mobile/global/header.tpl index a4de1e59..6575a237 100644 --- a/public/templates/mobile/global/header.tpl +++ b/public/templates/mobile/global/header.tpl @@ -1 +1 @@ -

    {$GLOBAL.websitename}

    +

    {$GLOBAL.website.name|default:"The Pool"}

    diff --git a/public/templates/mobile/master.tpl b/public/templates/mobile/master.tpl index 4cb7f7f3..abbd0874 100644 --- a/public/templates/mobile/master.tpl +++ b/public/templates/mobile/master.tpl @@ -1,7 +1,7 @@ - {$GLOBAL.config.website.title} + {$GLOBAL.website.title} diff --git a/public/templates/mobile/statistics/blocks/default.tpl b/public/templates/mobile/statistics/blocks/default.tpl index e4aa759a..d9c8b94d 100644 --- a/public/templates/mobile/statistics/blocks/default.tpl +++ b/public/templates/mobile/statistics/blocks/default.tpl @@ -46,7 +46,7 @@ target and network difficulty and assuming a zero variance scenario. {assign var=rank value=1} {section block $BLOCKSFOUND} - {$BLOCKSFOUND[block].height} + {$BLOCKSFOUND[block].height} {if $BLOCKSFOUND[block].confirmations >= $GLOBAL.confirmations} Confirmed diff --git a/public/templates/mobile/statistics/blocks/small_table.tpl b/public/templates/mobile/statistics/blocks/small_table.tpl index 9ed3ec74..f373e4e7 100644 --- a/public/templates/mobile/statistics/blocks/small_table.tpl +++ b/public/templates/mobile/statistics/blocks/small_table.tpl @@ -12,7 +12,7 @@ {assign var=rank value=1} {section block $BLOCKSFOUND} - {$BLOCKSFOUND[block].height} + {$BLOCKSFOUND[block].height} {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M"} {$BLOCKSFOUND[block].shares|number_format} diff --git a/public/templates/mobile/statistics/pool/authenticated.tpl b/public/templates/mobile/statistics/pool/authenticated.tpl index 0d0252e6..842a9829 100644 --- a/public/templates/mobile/statistics/pool/authenticated.tpl +++ b/public/templates/mobile/statistics/pool/authenticated.tpl @@ -24,10 +24,10 @@ Current Active Workers {$GLOBAL.workers} - {if $GLOBAL.blockexplorer} + {if $GLOBAL.website.blockexplorer.url} Next Network Block - {$CURRENTBLOCK + 1}    (Current: {$CURRENTBLOCK}) + {$CURRENTBLOCK + 1}    (Current: {$CURRENTBLOCK}) {else} @@ -37,12 +37,12 @@ {/if} Last Block Found - {if $GLOBAL.blockexplorer}{$LASTBLOCK|default:"0"}{else}{$LASTBLOCK|default:"0"}{/if} + {if $GLOBAL.website.blockexplorer.url}{$LASTBLOCK|default:"0"}{else}{$LASTBLOCK|default:"0"}{/if} - {if $GLOBAL.chaininfo} + {if ! $GLOBAL.website.chaininfo.disabled} Current Difficulty - {$DIFFICULTY} + {$DIFFICULTY} {/if} From ba95d678a0fb4d953ba43939122bd613250c4430 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 20 Aug 2013 12:08:59 +0200 Subject: [PATCH 33/39] moved motd to website tab --- public/include/config/admin_settings.inc.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/public/include/config/admin_settings.inc.php b/public/include/config/admin_settings.inc.php index 87375864..f3b68cd8 100644 --- a/public/include/config/admin_settings.inc.php +++ b/public/include/config/admin_settings.inc.php @@ -18,6 +18,13 @@ $aSettings['website'][] = array( 'name' => 'maintenance', 'value' => $setting->getValue('maintenance'), 'tooltip' => 'Enable or Disable maintenance mode. Only admins can still login.' ); +$aSettings['website'][] = array( + 'display' => 'Message of the Day', 'type' => 'text', + 'size' => 25, + 'default' => '', + 'name' => 'system_motd', 'value' => $setting->getValue('system_motd'), + 'tooltip' => 'Display a message of the day as information popup if set.' +); $aSettings['website'][] = array( 'display' => 'Website Name', 'type' => 'text', 'size' => 25, @@ -177,12 +184,5 @@ $aSettings['recaptcha'][] = array( 'name' => 'recaptcha_public_key', 'value' => $setting->getValue('recaptcha_public_key'), 'tooltip' => 'Your public key as given by your re-Captcha account.' ); -$aSettings['other'][] = array( - 'display' => 'Message of the Day', 'type' => 'text', - 'size' => 25, - 'default' => '', - 'name' => 'system_motd', 'value' => $setting->getValue('system_motd'), - 'tooltip' => 'Display a message of the day as information popup if set.' -); ?> From 6ec5b4b84560a4cd4999d52a60adefe6e53eac81 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 22 Aug 2013 11:33:26 +0200 Subject: [PATCH 34/39] Fixing hashrate graphs * Proper initilize array in order * Fill data after initilizing * Removed 0 fills Thanks @iriiria for this fix! Fixes #624 --- public/include/classes/statistics.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index e4e06167..f6863c59 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -403,10 +403,10 @@ class Statistics { GROUP BY HOUR(time)"); if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $account_id, $account_id) && $stmt->execute() && $result = $stmt->get_result()) { $iStartHour = date('G'); - for ($i = $iStartHour; $i < 24; $i++) $aData[$i] = 0; + // Initilize array + for ($i = 0; $i < 24; $i++) $aData[($iStartHour + $i) % 24] = 0; + // Fill data 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 @@ -440,10 +440,10 @@ class Statistics { GROUP BY HOUR(time)"); if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) { $iStartHour = date('G'); - for ($i = $iStartHour; $i < 24; $i++) $aData[$i] = 0; + // Initilize array + for ($i = 0; $i < 24; $i++) $aData[($iStartHour + $i) % 24] = 0; + // Fill data 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 From 1c24820735987031931270e070bffc1e648568aa Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 22 Aug 2013 11:45:40 +0200 Subject: [PATCH 35/39] Adding network_confirmations to configuration * Added new configuration option `$config['network_confirmations']` to dist config * Default to 120 if not set This will allow us to define a different confirmation level for user transactions but still display blocks at their approriate unconfirmed value when displaying them in the wallet information for admins. Risky for pool owners but still a viable option. Fixes #610 --- public/include/classes/block.class.php | 3 ++- public/include/config/global.inc.dist.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/include/classes/block.class.php b/public/include/classes/block.class.php index e6a8fc6d..d98b753c 100644 --- a/public/include/classes/block.class.php +++ b/public/include/classes/block.class.php @@ -123,7 +123,8 @@ class Block { **/ public function getAllUnconfirmed() { $stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE confirmations < ? AND confirmations > -1"); - if ($this->checkStmt($stmt) && $stmt->bind_param("i", $this->config['confirmations']) && $stmt->execute() && $result = $stmt->get_result()) + empty($this->config['network_confirmations']) ? $confirmations = 120 : $confirmations = $this->config['network_confirmations']; + if ($this->checkStmt($stmt) && $stmt->bind_param("i", $confirmations) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); return false; } diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index 265dfc7a..ef51043d 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -349,7 +349,8 @@ $config['reward'] = 50; // Confirmations per block required to credit transactions, default: 120 $config['confirmations'] = 120; - +// Confirmations per block required in network to confirm its transactions, default: 120 +$config['network_confirmations'] = 120; /** * Memcache configuration From a98080ec134a026c505a9ba926e8cf78b630e1ea Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 22 Aug 2013 16:32:06 +0200 Subject: [PATCH 36/39] adding missing THEME_DIR to dist config --- public/include/config/global.inc.dist.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index d0359e80..682cf4a8 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -11,6 +11,9 @@ define('CLASS_DIR', INCLUDE_DIR . '/classes'); // Our pages directory which takes care of define('PAGES_DIR', INCLUDE_DIR . '/pages'); +// Our theme folder holding all themes +define('THEME_DIR', BASEPATH . 'templates'); + // Set debugging level for our debug class define('DEBUG', 0); From e6cf43efa0f027fb9875368adad57e2daf7cebdb Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Fri, 23 Aug 2013 11:28:07 +0200 Subject: [PATCH 37/39] Fix: Properly send notifications again Fixes #630 --- public/include/classes/notification.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/include/classes/notification.class.php b/public/include/classes/notification.class.php index 08f3d3f5..ac61d105 100644 --- a/public/include/classes/notification.class.php +++ b/public/include/classes/notification.class.php @@ -164,9 +164,13 @@ class Notification extends Mail { if ($stmt && $stmt->bind_param('si', $strType, $account_id) && $stmt->execute() && $stmt->bind_result($id) && $stmt->fetch()) { if ($stmt->close() && $this->sendMail('notifications/' . $strType, $aMailData) && $this->addNotification($account_id, $strType, $aMailData)) { return true; + } else { + $this->setErrorMessage('SendMail call failed: ' . $this->mail->getError()); + return false; } } else { $this->setErrorMessage('User disabled ' . $strType . ' notifications'); + return false; } $this->setErrorMessage('Error sending mail notification'); return false; @@ -178,5 +182,5 @@ $notification->setDebug($debug); $notification->setMysql($mysqli); $notification->setSmarty($smarty); $notification->setConfig($config); - +$notification->setSetting($setting); ?> From 0e27cda093bc8b20782c2e0e59675a464d106684 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 26 Aug 2013 11:11:52 +0200 Subject: [PATCH 38/39] Fix: Blocks not being confirmed Fixes an issue introduce with #610. --- public/include/classes/block.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/include/classes/block.class.php b/public/include/classes/block.class.php index d98b753c..a1c730b2 100644 --- a/public/include/classes/block.class.php +++ b/public/include/classes/block.class.php @@ -121,9 +121,8 @@ class Block { * @param confirmations int Required confirmations to consider block confirmed * @return data array Array with database fields as keys **/ - public function getAllUnconfirmed() { + public function getAllUnconfirmed($confirmations=120) { $stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE confirmations < ? AND confirmations > -1"); - empty($this->config['network_confirmations']) ? $confirmations = 120 : $confirmations = $this->config['network_confirmations']; if ($this->checkStmt($stmt) && $stmt->bind_param("i", $confirmations) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); return false; From c578ed21f1c1aa3cd2cec70328adc7cbd90eb4e7 Mon Sep 17 00:00:00 2001 From: Dids Date: Tue, 27 Aug 2013 23:01:35 +0300 Subject: [PATCH 39/39] Updated Pools --- POOLS.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/POOLS.md b/POOLS.md index 42ffd0b4..723c3e53 100644 --- a/POOLS.md +++ b/POOLS.md @@ -111,3 +111,9 @@ Small Time Miners are running various stratum only pools for different coins. | 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 | + +### Dids + +| Pool URL | Coin | Avg. Hashrate | Avg. Active Workers | Notes | +| -------- | ---- | ------------: | ------------------: | ----- | +| http://poolmine.it | Litecoin | 0.23 MHash | 5 | PPLNS, Custom Template |