From 8786a99382c38e6bbfdcadc270ad2f6ea450cfa2 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Fri, 18 Oct 2013 07:21:51 +0200 Subject: [PATCH 1/6] [FIX] Fix sending mails even though diabled Fixes #732 --- public/include/classes/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/include/classes/user.class.php b/public/include/classes/user.class.php index 50955f35..df8969c1 100644 --- a/public/include/classes/user.class.php +++ b/public/include/classes/user.class.php @@ -565,7 +565,7 @@ 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->setting->getValue('accounts_confirm_email_enabled') && $is_admin != 1) { + if (! $this->setting->getValue('accounts_confirm_email_disabled') && $is_admin != 1) { if ($token = $this->token->createToken('confirm_email', $stmt->insert_id)) { $aData['username'] = $username_clean; $aData['token'] = $token; From 0c65c4de1e2a782125c5b2bfcf257e06c5f4124f Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Fri, 18 Oct 2013 19:38:34 +0200 Subject: [PATCH 2/6] [FIX] Removed uneeded shares data --- public/include/pages/api/getdashboarddata.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/include/pages/api/getdashboarddata.inc.php b/public/include/pages/api/getdashboarddata.inc.php index e16d89cd..732eb65a 100644 --- a/public/include/pages/api/getdashboarddata.inc.php +++ b/public/include/pages/api/getdashboarddata.inc.php @@ -47,7 +47,7 @@ $dNetworkHashrateAdjusted = $dNetworkHashrate / 1000 * $dNetworkHashrateModifier // Output JSON format $data = array( 'raw' => array( 'personal' => array( 'hashrate' => $dPersonalHashrate ), 'pool' => array( 'hashrate' => $dPoolHashrate ), 'network' => array( 'hashrate' => $dNetworkHashrate / 1000 ) ), - 'personal' => array ( 'hashrate' => $dPersonalHashrateAdjusted, 'sharerate' => $dPersonalSharerate, 'shares' => $aUserRoundShares, 'balance' => $transaction->getBalance($user_id), 'estimates' => $aEstimates), + 'personal' => array ( 'hashrate' => $dPersonalHashrateAdjusted, 'sharerate' => $dPersonalSharerate, 'shares' => array('valid' => $aUserRoundShares['valid'], 'invalid' => $aUserRoundShares['invalid']), 'balance' => $transaction->getBalance($user_id), 'estimates' => $aEstimates), 'pool' => array( 'hashrate' => $dPoolHashrateAdjusted, 'shares' => $aRoundShares ), 'network' => array( 'hashrate' => $dNetworkHashrateAdjusted, 'difficulty' => $dDifficulty, 'block' => $iBlock ), ); From c89831943b112c5f70d2eef022ef7c6273d828d5 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 19 Oct 2013 09:02:15 +0200 Subject: [PATCH 3/6] [FIX] Fixed issues with uncached user shares data --- public/include/classes/statistics.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index b607ec0c..8fd80aa9 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -196,6 +196,7 @@ class Statistics { $data['share_id'] = 0; $data['data'] = array(); } + $data['last_update'] = time(); $stmt = $this->mysqli->prepare(" SELECT ROUND(IFNULL(SUM(IF(our_result='Y', IF(s.difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), s.difficulty), 0)), 0) / POW(2, (" . $this->config['difficulty'] . " - 16)), 0) AS valid, @@ -245,14 +246,12 @@ class Statistics { if ($data = $this->memcache->get(STATISTICS_ALL_USER_SHARES)) { if (array_key_exists($account_id, $data['data'])) return $data['data'][$account_id]; - // We have no cached value, we return defaults - return array('valid' => 0, 'invalid' => 0, 'donate_percent' => 0, 'is_anonymous' => 0); } - if ($data = $this->memcache->get(__FUNCTION__ . $account_id)) return $data; + // if ($data = $this->memcache->get(__FUNCTION__ . $account_id)) return $data; $stmt = $this->mysqli->prepare(" SELECT - ROUND(IFNULL(SUM(IF(our_result='Y', IF(s.difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), s.difficulty), 0)), 0) / POW(2, (" . $this->config['difficulty'] . " - 16)), 0) AS valid, - ROUND(IFNULL(SUM(IF(our_result='N', IF(s.difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), s.difficulty), 0)), 0) / POW(2, (" . $this->config['difficulty'] . " - 16)), 0) AS invalid + ROUND(IFNULL(SUM(IF(our_result='Y', IF(s.difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), s.difficulty), 0)) / POW(2, (" . $this->config['difficulty'] . " - 16)), 0), 0) AS valid, + ROUND(IFNULL(SUM(IF(our_result='N', IF(s.difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), s.difficulty), 0)) / POW(2, (" . $this->config['difficulty'] . " - 16)), 0), 0) AS invalid FROM " . $this->share->getTableName() . " AS s, " . $this->user->getTableName() . " AS u WHERE From 1bb5ca3c2d5009a87f6e880c69f78c84a8ffcab9 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 21 Oct 2013 15:55:59 +0200 Subject: [PATCH 4/6] [FIX] Fix donors, missing closing th tag --- public/templates/mpos/about/donors/default.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/mpos/about/donors/default.tpl b/public/templates/mpos/about/donors/default.tpl index bdcd27fd..27abea78 100644 --- a/public/templates/mpos/about/donors/default.tpl +++ b/public/templates/mpos/about/donors/default.tpl @@ -9,7 +9,7 @@ Name - % + % {$GLOBAL.config.currency} Total From a5c4b0e8c94d029f15334352b971e00383921f2f Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 21 Oct 2013 17:13:08 +0200 Subject: [PATCH 5/6] [IMPROVED] Show usernames in contrib lists if admin Addresses #737 --- public/templates/mpos/statistics/pool/contributors_hashrate.tpl | 2 +- public/templates/mpos/statistics/pool/contributors_shares.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/templates/mpos/statistics/pool/contributors_hashrate.tpl b/public/templates/mpos/statistics/pool/contributors_hashrate.tpl index aa121749..54b71788 100644 --- a/public/templates/mpos/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mpos/statistics/pool/contributors_hashrate.tpl @@ -20,7 +20,7 @@ {$rank++} {if $CONTRIBHASHES[contrib].donate_percent > 0}{/if} - {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} + {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} {$CONTRIBHASHES[contrib].hashrate|number_format} {$estday|number_format:"3"} {if $GLOBAL.config.price.currency}{($estday * $GLOBAL.price)|default:"n/a"|number_format:"2"}{/if} diff --git a/public/templates/mpos/statistics/pool/contributors_shares.tpl b/public/templates/mpos/statistics/pool/contributors_shares.tpl index 5af2b911..d61b73be 100644 --- a/public/templates/mpos/statistics/pool/contributors_shares.tpl +++ b/public/templates/mpos/statistics/pool/contributors_shares.tpl @@ -16,7 +16,7 @@ {$rank++} {if $CONTRIBSHARES[shares].donate_percent > 0}{/if} - {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} + {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} {$CONTRIBSHARES[shares].shares|number_format} {/section} From 38d3140829145fecb9d0e62cf54bd2f6e3ec31eb Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 21 Oct 2013 17:32:26 +0200 Subject: [PATCH 6/6] [FIX] Added admin check to all templates Fixes #737 --- public/templates/mmcFE/about/donors/default.tpl | 2 +- public/templates/mmcFE/statistics/blocks/default.tpl | 2 +- public/templates/mmcFE/statistics/blocks/small_table.tpl | 2 +- .../templates/mmcFE/statistics/pool/contributors_hashrate.tpl | 2 +- public/templates/mmcFE/statistics/pool/contributors_shares.tpl | 2 +- public/templates/mmcFE/statistics/round/round_shares.tpl | 2 +- public/templates/mobile/statistics/blocks/default.tpl | 2 +- public/templates/mobile/statistics/blocks/small_table.tpl | 2 +- .../templates/mobile/statistics/pool/contributors_hashrate.tpl | 2 +- public/templates/mobile/statistics/pool/contributors_shares.tpl | 2 +- public/templates/mpos/about/donors/default.tpl | 2 +- public/templates/mpos/statistics/blocks/default.tpl | 2 +- public/templates/mpos/statistics/blocks/small_table.tpl | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/public/templates/mmcFE/about/donors/default.tpl b/public/templates/mmcFE/about/donors/default.tpl index 8d5205ac..4bc05312 100644 --- a/public/templates/mmcFE/about/donors/default.tpl +++ b/public/templates/mmcFE/about/donors/default.tpl @@ -12,7 +12,7 @@ {section name=donor loop=$DONORS} - {if $DONORS[donor].is_anonymous|default:"0" == 1}anonymous{else}{$DONORS[donor].username}{/if} + {if $DONORS[donor].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$DONORS[donor].username}{/if} {$DONORS[donor].donate_percent} {$DONORS[donor].donation|number_format:"2"} diff --git a/public/templates/mmcFE/statistics/blocks/default.tpl b/public/templates/mmcFE/statistics/blocks/default.tpl index 06049426..5929524d 100644 --- a/public/templates/mmcFE/statistics/blocks/default.tpl +++ b/public/templates/mmcFE/statistics/blocks/default.tpl @@ -62,7 +62,7 @@ target and network difficulty and assuming a zero variance scenario. {else if $BLOCKSFOUND[block].confirmations == -1} Orphan {else}{$GLOBAL.confirmations - $BLOCKSFOUND[block].confirmations} left{/if} - {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} + {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} {$BLOCKSFOUND[block].difficulty|number_format:"8"} {$BLOCKSFOUND[block].amount|number_format:"2"} diff --git a/public/templates/mmcFE/statistics/blocks/small_table.tpl b/public/templates/mmcFE/statistics/blocks/small_table.tpl index 0c1760ff..b9431854 100644 --- a/public/templates/mmcFE/statistics/blocks/small_table.tpl +++ b/public/templates/mmcFE/statistics/blocks/small_table.tpl @@ -14,7 +14,7 @@ {section block $BLOCKSFOUND} {$BLOCKSFOUND[block].height} - {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} + {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} {$BLOCKSFOUND[block].shares|number_format} diff --git a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl index 212a4695..e5c99524 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl @@ -17,7 +17,7 @@ {math assign="estday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} {$rank++} - {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} + {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} {($CONTRIBHASHES[contrib].hashrate * $GLOBAL.hashmods.personal)|number_format:"2"} {$estday|number_format:"3"} {if $GLOBAL.config.price.currency}{($estday * $GLOBAL.price)|default:"n/a"|number_format:"2"}{/if} diff --git a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl index 6dd36eb8..e14d3d8e 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl @@ -14,7 +14,7 @@ {section shares $CONTRIBSHARES} {$rank++} - {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} + {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} {$CONTRIBSHARES[shares].shares|number_format} {/section} diff --git a/public/templates/mmcFE/statistics/round/round_shares.tpl b/public/templates/mmcFE/statistics/round/round_shares.tpl index 919aed8e..fa09ca0a 100644 --- a/public/templates/mmcFE/statistics/round/round_shares.tpl +++ b/public/templates/mmcFE/statistics/round/round_shares.tpl @@ -16,7 +16,7 @@ {section contrib $ROUNDSHARES} {$rank++} - {if $ROUNDSHARES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$ROUNDSHARES[contrib].username|escape}{/if} + {if $ROUNDSHARES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDSHARES[contrib].username|escape}{/if} {$ROUNDSHARES[contrib].valid|number_format} {$ROUNDSHARES[contrib].invalid|number_format} {($ROUNDSHARES[contrib].invalid / $ROUNDSHARES[contrib].valid * 100)|number_format:"2"} diff --git a/public/templates/mobile/statistics/blocks/default.tpl b/public/templates/mobile/statistics/blocks/default.tpl index a8dff9b2..15fe6688 100644 --- a/public/templates/mobile/statistics/blocks/default.tpl +++ b/public/templates/mobile/statistics/blocks/default.tpl @@ -53,7 +53,7 @@ target and network difficulty and assuming a zero variance scenario. {else if $BLOCKSFOUND[block].confirmations == -1} Orphan {else}{$GLOBAL.confirmations - $BLOCKSFOUND[block].confirmations} left{/if} - {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} + {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} {$BLOCKSFOUND[block].difficulty|number_format:"2"} {(65536 * $BLOCKSFOUND[block].difficulty)|number_format} diff --git a/public/templates/mobile/statistics/blocks/small_table.tpl b/public/templates/mobile/statistics/blocks/small_table.tpl index f373e4e7..0c67f037 100644 --- a/public/templates/mobile/statistics/blocks/small_table.tpl +++ b/public/templates/mobile/statistics/blocks/small_table.tpl @@ -13,7 +13,7 @@ {section block $BLOCKSFOUND} {$BLOCKSFOUND[block].height} - {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} + {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}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/contributors_hashrate.tpl b/public/templates/mobile/statistics/pool/contributors_hashrate.tpl index 811e20a7..2b23089b 100644 --- a/public/templates/mobile/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mobile/statistics/pool/contributors_hashrate.tpl @@ -16,7 +16,7 @@ {if $GLOBAL.userdata.username == $CONTRIBSHARES[contrib].account}{assign var=listed value=1}{/if} {$rank++} - {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} + {if $CONTRIBHASHES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBHASHES[contrib].account|escape}{/if} {$CONTRIBHASHES[contrib].hashrate|number_format} {$estday|number_format:"3"} {($estday * $GLOBAL.price)|default:"n/a"|number_format:"2"} diff --git a/public/templates/mobile/statistics/pool/contributors_shares.tpl b/public/templates/mobile/statistics/pool/contributors_shares.tpl index 1025a28f..28322823 100644 --- a/public/templates/mobile/statistics/pool/contributors_shares.tpl +++ b/public/templates/mobile/statistics/pool/contributors_shares.tpl @@ -13,7 +13,7 @@ {if $GLOBAL.userdata.username == $CONTRIBSHARES[shares].account}{assign var=listed value=1}{/if} {$rank++} - {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} + {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} {$CONTRIBSHARES[shares].shares|number_format} {/section} diff --git a/public/templates/mpos/about/donors/default.tpl b/public/templates/mpos/about/donors/default.tpl index 27abea78..f088f58f 100644 --- a/public/templates/mpos/about/donors/default.tpl +++ b/public/templates/mpos/about/donors/default.tpl @@ -16,7 +16,7 @@ {section name=donor loop=$DONORS} - {if $DONORS[donor].is_anonymous|default:"0" == 1}anonymous{else}{$DONORS[donor].username}{/if} + {if $DONORS[donor].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$DONORS[donor].username}{/if} {$DONORS[donor].donate_percent} {$DONORS[donor].donation|number_format:"2"} diff --git a/public/templates/mpos/statistics/blocks/default.tpl b/public/templates/mpos/statistics/blocks/default.tpl index b1cc4b4d..02bcaf21 100644 --- a/public/templates/mpos/statistics/blocks/default.tpl +++ b/public/templates/mpos/statistics/blocks/default.tpl @@ -71,7 +71,7 @@ {$GLOBAL.confirmations - $BLOCKSFOUND[block].confirmations} left {/if} - {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} + {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} {$BLOCKSFOUND[block].difficulty|number_format:"2"} {$BLOCKSFOUND[block].amount|number_format:"2"} diff --git a/public/templates/mpos/statistics/blocks/small_table.tpl b/public/templates/mpos/statistics/blocks/small_table.tpl index 696c7990..eca1a9d5 100644 --- a/public/templates/mpos/statistics/blocks/small_table.tpl +++ b/public/templates/mpos/statistics/blocks/small_table.tpl @@ -18,7 +18,7 @@ {else} {$BLOCKSFOUND[block].height} {/if} - {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} + {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} {$BLOCKSFOUND[block].shares|number_format}