From 4c4944fdb2470adbf3f8c526a6130892abb074e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Uslu?= Date: Tue, 29 Apr 2014 01:47:44 +0300 Subject: [PATCH 1/9] added X11 algorithm support (coins like darkcoin) --- public/include/classes/coins/coin_x11.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 public/include/classes/coins/coin_x11.class.php diff --git a/public/include/classes/coins/coin_x11.class.php b/public/include/classes/coins/coin_x11.class.php new file mode 100644 index 00000000..6e356be3 --- /dev/null +++ b/public/include/classes/coins/coin_x11.class.php @@ -0,0 +1,13 @@ + From 99e3a6349c7d56826e8ea060867fb2de3cd25929 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 30 Apr 2014 15:20:46 +0200 Subject: [PATCH 2/9] [FIX] Password Hashing on new accounts --- public/include/autoloader.inc.php | 1 + public/index.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/public/include/autoloader.inc.php b/public/include/autoloader.inc.php index f04988c2..4d14e17e 100644 --- a/public/include/autoloader.inc.php +++ b/public/include/autoloader.inc.php @@ -17,6 +17,7 @@ require_once(INCLUDE_DIR . '/config/error_codes.inc.php'); require_once(CLASS_DIR . '/base.class.php'); require_once(CLASS_DIR . '/coins/coin_base.class.php'); require_once(CLASS_DIR . '/setting.class.php'); +require_once(INCLUDE_DIR . '/version.inc.php'); if (PHP_OS == 'WINNT') require_once(CLASS_DIR . '/memcached.class.php'); // Now decide on which coin class to load and instantiate diff --git a/public/index.php b/public/index.php index 4665a0a6..5a7db5f0 100644 --- a/public/index.php +++ b/public/index.php @@ -101,7 +101,6 @@ if (count(@$_SESSION['last_ip_pop']) == 2) { // version check and config check if not disabled if (@$_SESSION['USERDATA']['is_admin'] && $user->isAdmin(@$_SESSION['USERDATA']['id'])) { - require_once(INCLUDE_DIR . '/version.inc.php'); if (!@$config['skip_config_tests']) { require_once(INCLUDE_DIR . '/admin_checks.php'); } From ab2a62efa39fdf3efcf423b4f8dcc29d1c3eafa1 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 30 Apr 2014 15:23:22 +0200 Subject: [PATCH 3/9] [REMOVED] Getnavbardata API --- public/include/config/admin_settings.inc.php | 14 ---- .../include/pages/api/getnavbardata.inc.php | 76 ------------------- 2 files changed, 90 deletions(-) delete mode 100644 public/include/pages/api/getnavbardata.inc.php diff --git a/public/include/config/admin_settings.inc.php b/public/include/config/admin_settings.inc.php index 9ed22091..b5839ef7 100644 --- a/public/include/config/admin_settings.inc.php +++ b/public/include/config/admin_settings.inc.php @@ -364,20 +364,6 @@ $aSettings['system'][] = array( 'name' => 'disable_dashboard_api', 'value' => $setting->getValue('disable_dashboard_api'), 'tooltip' => 'Disable dashboard API entirely to reduce server load.' ); -$aSettings['system'][] = array( - 'display' => 'Disable Live Navbar', 'type' => 'select', - 'options' => array( 0 => 'No', 1 => 'Yes'), - 'default' => 0, - 'name' => 'disable_navbar', 'value' => $setting->getValue('disable_navbar'), - 'tooltip' => 'Disable live updates on the navbar to reduce server load.' -); -$aSettings['system'][] = array( - 'display' => 'Disable Navbar API', 'type' => 'select', - 'options' => array( 0 => 'No', 1 => 'Yes'), - 'default' => 0, - 'name' => 'disable_navbar_api', 'value' => $setting->getValue('disable_navbar_api'), - 'tooltip' => 'Disable navbar API entirely to reduce server load. Used in pool stats and navbar mini stats.' -); $aSettings['system'][] = array( 'display' => 'Disable TX Summaries', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes'), diff --git a/public/include/pages/api/getnavbardata.inc.php b/public/include/pages/api/getnavbardata.inc.php deleted file mode 100644 index 24ab357e..00000000 --- a/public/include/pages/api/getnavbardata.inc.php +++ /dev/null @@ -1,76 +0,0 @@ -getValue('disable_navbar_api')) { - echo $api->get_json(array('error' => 'disabled')); - die(); -} - -// System load check -if ($load = @sys_getloadavg()) { - if (isset($config['system']['load']['max']) && $load[0] > $config['system']['load']['max']) { - header('HTTP/1.1 503 Too busy, try again later'); - die('Server too busy. Please try again later.'); - } -} - -// Fetch RPC information -if ($bitcoin->can_connect() === true) { - $dNetworkHashrate = $bitcoin->getnetworkhashps(); - $dDifficulty = $bitcoin->getdifficulty(); - $iBlock = $bitcoin->getblockcount(); -} else { - $dNetworkHashrate = 0; - $dDifficulty = 1; - $iBlock = 0; -} - -// Some settings -if ( ! $interval = $setting->getValue('statistics_ajax_data_interval')) $interval = 300; -if ( ! $dPoolHashrateModifier = $setting->getValue('statistics_pool_hashrate_modifier') ) $dPoolHashrateModifier = 1; -if ( ! $dNetworkHashrateModifier = $setting->getValue('statistics_network_hashrate_modifier') ) $dNetworkHashrateModifier = 1; - -// Fetch raw data -$statistics->setGetCache(false); -$dPoolHashrate = $statistics->getCurrentHashrate($interval); -if ($dPoolHashrate > $dNetworkHashrate) $dNetworkHashrate = $dPoolHashrate; -$statistics->setGetCache(true); - -// Small helper -$aHashunits = array( '1' => 'KH/s', '0.001' => 'MH/s', '0.000001' => 'GH/s', '0.000000001' => 'TH/s' ); - -// Apply pool modifiers -$dPoolHashrateAdjusted = $dPoolHashrate * $dPoolHashrateModifier; -$dNetworkHashrateAdjusted = $dNetworkHashrate / 1000 * $dNetworkHashrateModifier; - -// Use caches for this one -$aRoundShares = $statistics->getRoundShares(); - -$iTotalRoundShares = $aRoundShares['valid'] + $aRoundShares['invalid']; -if ($iTotalRoundShares > 0) { - $dPoolInvalidPercent = round($aRoundShares['invalid'] / $iTotalRoundShares * 100, 2); -} else { - $dUserInvalidPercent = 0; - $dPoolInvalidPercent = 0; -} - -// Round progress -$iEstShares = $statistics->getEstimatedShares($dDifficulty); -if ($iEstShares > 0 && $aRoundShares['valid'] > 0) { - $dEstPercent = round(100 / $iEstShares * $aRoundShares['valid'], 2); -} else { - $dEstPercent = 0; -} - -// Output JSON format -$data = array( - 'raw' => array( 'workers' => $worker->getCountAllActiveWorkers(), 'pool' => array( 'hashrate' => $dPoolHashrate ) ), - 'pool' => array( 'workers' => $worker->getCountAllActiveWorkers(), 'hashrate' => $dPoolHashrateAdjusted, 'estimated' => $iEstShares, 'progress' => $dEstPercent ), - 'network' => array( 'hashrate' => $dNetworkHashrateAdjusted, 'difficulty' => $dDifficulty, 'block' => $iBlock ) -); -echo $api->get_json($data); - -// Supress master template -$supress_master = 1; -?> From 33560ec19df2acdb1f6f4bfbd40148e46ae43cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Uslu?= Date: Wed, 30 Apr 2014 16:34:10 +0300 Subject: [PATCH 4/9] added scrypt-n coin-algo class for sake of completeness --- public/include/classes/coins/coin_scryptn.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 public/include/classes/coins/coin_scryptn.class.php diff --git a/public/include/classes/coins/coin_scryptn.class.php b/public/include/classes/coins/coin_scryptn.class.php new file mode 100644 index 00000000..bf829ab1 --- /dev/null +++ b/public/include/classes/coins/coin_scryptn.class.php @@ -0,0 +1,13 @@ + From 0246fb33ea94604e54ae5f3586473869f1c881aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=BCseyin=20Uslu?= Date: Wed, 30 Apr 2014 16:49:08 +0300 Subject: [PATCH 5/9] Updated the coin_scryptn.class.php comment. --- public/include/classes/coins/coin_scryptn.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/include/classes/coins/coin_scryptn.class.php b/public/include/classes/coins/coin_scryptn.class.php index bf829ab1..db588f61 100644 --- a/public/include/classes/coins/coin_scryptn.class.php +++ b/public/include/classes/coins/coin_scryptn.class.php @@ -5,6 +5,9 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; * We extend our CoinBase class * No need to change anything, base class supports * scrypt and sha256d + * + * Note: This is exactly the same as Scrypt, but it's + * here to let MPOS api report the correct coin algorithm. **/ class Coin extends CoinBase { protected $target_bits = 16; From e445ab4bbc447296990c61793cb624a90f167669 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 1 May 2014 09:26:23 +0200 Subject: [PATCH 6/9] [FIX] Undefined Index in Workers page --- public/include/classes/worker.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/public/include/classes/worker.class.php b/public/include/classes/worker.class.php index 570dcd32..f47445ae 100644 --- a/public/include/classes/worker.class.php +++ b/public/include/classes/worker.class.php @@ -141,6 +141,7 @@ class Worker extends Base { FROM $this->table AS w WHERE account_id = ?"); if ($this->checkStmt($stmt) && $stmt->bind_param('iiiii', $interval, $interval, $interval, $interval, $account_id) && $stmt->execute() && $result = $stmt->get_result()) { + $aData = array(); while ($row = $result->fetch_assoc()) { $row['hashrate'] = round($this->coin->calcHashrate($row['shares'], $interval), 2); if ($row['count_all'] > 0) { From b4d8d1006ee552d71393fbd5a90d50024d844f7d Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 1 May 2014 09:42:31 +0200 Subject: [PATCH 7/9] [FIX] Undefined offset, pplns round stats --- .../templates/bootstrap/statistics/round/pplns_transactions.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/templates/bootstrap/statistics/round/pplns_transactions.tpl b/public/templates/bootstrap/statistics/round/pplns_transactions.tpl index 89006812..4d71e703 100644 --- a/public/templates/bootstrap/statistics/round/pplns_transactions.tpl +++ b/public/templates/bootstrap/statistics/round/pplns_transactions.tpl @@ -24,7 +24,7 @@ {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if} {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format|default:0} - {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if} + {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if} {$PPLNSROUNDSHARES[txs].pplns_valid|number_format|default:"0"} {if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0 }{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"|default:"0"}{else}0{/if} {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 && $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0}{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if} From 79d8db265975cf2970cac1c564e73c10a4bdcd0f Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Thu, 1 May 2014 12:45:59 +0200 Subject: [PATCH 8/9] [FIX] disabled timezone with two factor auth --- public/templates/bootstrap/account/edit/detail.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/templates/bootstrap/account/edit/detail.tpl b/public/templates/bootstrap/account/edit/detail.tpl index 9b40dc67..582deb94 100644 --- a/public/templates/bootstrap/account/edit/detail.tpl +++ b/public/templates/bootstrap/account/edit/detail.tpl @@ -33,14 +33,14 @@
{nocache} - {html_options options=$TIMEZONES selected=$GLOBAL.userdata.timezone} {/nocache}
- {nocache}{/nocache} + {nocache}{/nocache}
From e6b98ce482739c46a00d8196f444ac8a1a53b078 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 1 May 2014 13:23:34 +0200 Subject: [PATCH 9/9] [FIX] Removed getnavbardata from pool stats --- public/templates/bootstrap/statistics/js.tpl | 30 ------------------- .../bootstrap/statistics/pool/default.tpl | 4 --- 2 files changed, 34 deletions(-) delete mode 100644 public/templates/bootstrap/statistics/js.tpl diff --git a/public/templates/bootstrap/statistics/js.tpl b/public/templates/bootstrap/statistics/js.tpl deleted file mode 100644 index 65a66336..00000000 --- a/public/templates/bootstrap/statistics/js.tpl +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/public/templates/bootstrap/statistics/pool/default.tpl b/public/templates/bootstrap/statistics/pool/default.tpl index ede77276..cf917562 100644 --- a/public/templates/bootstrap/statistics/pool/default.tpl +++ b/public/templates/bootstrap/statistics/pool/default.tpl @@ -8,7 +8,3 @@ {include file="statistics/pool/general_stats.tpl"} {include file="statistics/blocks/small_table.tpl"}
- -{if !$GLOBAL.website.api.disabled && !$GLOBAL.config.disable_navbar && !$GLOBAL.config.disable_navbar_api} -{include file="statistics/js.tpl"} -{/if}