Skip to content

Commit 236cccd

Browse files
authoredMay 24, 2018
Merge pull request #2738 from MPOS/development
UPDATE : Development to Master
2 parents 8fa8d6c + e5b1ec5 commit 236cccd

35 files changed

+177
-116
lines changed
 

‎composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "delboy1978uk/mpos",
2+
"name": "MPOS/php-mpos",
33
"description": "MPOS stands for Mining Portal Open Source. A unified mining interface for various Scrypt and SHA256d Crypto-currencies!",
44
"require-dev": {
55
"codeception/codeception": "~2.0"
66
},
77
"authors": [
88
{
9-
"name": "Derek Stephen McLean",
10-
"email": "delboy1978uk@gmail.com"
9+
"name": "Sebastian Grewe",
10+
"email": "sebastian.grewe@gmail.com"
1111
}
1212
],
1313
"require": {

‎include/autoloader.inc.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
(SECURITY == "*)WT#&YHfd" && SECHASH_CHECK) ? die("public/index.php -> Set a new SECURITY value to continue") : 0;
33
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
44

5-
require_once(INCLUDE_DIR . '/../vendor/autoload.php');
5+
if (file_exists(INCLUDE_DIR . '/../vendor/autoload.php')) {
6+
require_once(INCLUDE_DIR . '/../vendor/autoload.php');
7+
} else {
8+
die("Unable to load vendor libraries, please run `php composer.phar install` in root folder.");
9+
}
610

711
// Default classes
812
require_once(INCLUDE_DIR . '/lib/KLogger.php');

‎include/classes/bitcoin.class.php

100644100755
+3-1
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,15 @@ public function __construct($scheme, $username, $password, $address = "localhost
284284
* The check is done by calling the server's getinfo() method and checking
285285
* for a fault.
286286
*
287+
* To turn code compatible with BTC >= 0.16, getmininginfo() method used instead of getinfo()
288+
*
287289
* @return mixed boolean TRUE if successful, or a fault string otherwise
288290
* @access public
289291
* @throws none
290292
*/
291293
public function can_connect() {
292294
try {
293-
$r = $this->getinfo();
295+
$r = $this->getmininginfo();
294296
} catch (Exception $e) {
295297
return $e->getMessage();
296298
}

‎include/classes/bitcoinwrapper.class.php

100644100755
+17-1
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,29 @@ public function __construct($type, $username, $password, $host, $debug_level, $d
2424
public function getinfo() {
2525
$this->oDebug->append("STA " . __METHOD__, 4);
2626
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
27-
return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
27+
try {
28+
return $this->memcache->setCache(__FUNCTION__, parent::getnetworkinfo()+parent::getmininginfo()+parent::getwalletinfo(), 30);
29+
} catch (Exception $e) {
30+
$this->oDebug->append("DEPRECATED : RPC version < 0.16, fallback to `getinfo` RPC call", 2);
31+
return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
32+
}
33+
}
34+
35+
public function is_testnet() {
36+
$this->oDebug->append("STA " . __METHOD__, 4);
37+
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
38+
if (!(parent::getblockchaininfo()))
39+
return $this->memcache->setCache(__FUNCTION__, parent::is_testnet(), 30);
40+
else
41+
return $this->memcache->setCache(__FUNCTION__, parent::getblockchaininfo()['chain'] == 'test', 30);
2842
}
43+
2944
public function getmininginfo() {
3045
$this->oDebug->append("STA " . __METHOD__, 4);
3146
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
3247
return $this->memcache->setCache(__FUNCTION__, parent::getmininginfo(), 30);
3348
}
49+
3450
public function getblockcount() {
3551
$this->oDebug->append("STA " . __METHOD__, 4);
3652
if ($data = $this->memcache->get(__FUNCTION__)) return $data;

‎include/classes/block.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public function setShareId($block_id, $share_id) {
237237
* @return bool
238238
**/
239239
public function setShares($block_id, $shares=NULL) {
240-
$field = array( 'name' => 'shares', 'value' => $shares, 'type' => 'i');
240+
$field = array( 'name' => 'shares', 'value' => $shares, 'type' => 'd');
241241
return $this->updateSingle($block_id, $field);
242242
}
243243

‎include/classes/coins/coin_base.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function calcHashrate($shares, $interval) {
6060
* according to our configuration difficulty
6161
**/
6262
public function calcEstaimtedShares($dDifficulty) {
63-
return (int)round(pow(2, (32 - $this->target_bits)) * $dDifficulty, 0);
63+
return (float)round(pow(2, (32 - $this->target_bits)) * $dDifficulty, $this->share_difficulty_precision);
6464
}
6565

6666
/**

‎include/classes/statistics.class.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function getBlocksFound($limit=10) {
111111
b.*,
112112
a.username AS finder,
113113
a.is_anonymous AS is_anonymous,
114-
ROUND(difficulty * POW(2, 32 - " . $this->coin->getTargetBits() . "), 0) AS estshares
114+
ROUND(difficulty * POW(2, 32 - " . $this->coin->getTargetBits() . "), " . $this->coin->getShareDifficultyPrecision() . ") AS estshares
115115
FROM " . $this->block->getTableName() . " AS b
116116
LEFT JOIN " . $this->user->getTableName() . " AS a
117117
ON b.account_id = a.id
@@ -203,7 +203,7 @@ public function getBlocksSolvedbyWorker($account_id, $limit=25) {
203203
public function updateShareStatistics($aStats, $iBlockId) {
204204
$this->debug->append("STA " . __METHOD__, 4);
205205
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, valid, invalid, block_id) VALUES (?, ?, ?, ?)");
206-
if ($this->checkStmt($stmt) && $stmt->bind_param('iiii', $aStats['id'], $aStats['valid'], $aStats['invalid'], $iBlockId) && $stmt->execute()) return true;
206+
if ($this->checkStmt($stmt) && $stmt->bind_param('iddi', $aStats['id'], $aStats['valid'], $aStats['invalid'], $iBlockId) && $stmt->execute()) return true;
207207
return $this->sqlError();
208208
}
209209

@@ -213,7 +213,7 @@ public function updateShareStatistics($aStats, $iBlockId) {
213213
public function insertPPLNSStatistics($aStats, $iBlockId) {
214214
$this->debug->append("STA " . __METHOD__, 4);
215215
$stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, valid, invalid, pplns_valid, pplns_invalid, block_id) VALUES (?, ?, ?, ?, ?, ?)");
216-
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiiii', $aStats['id'], $aStats['valid'], $aStats['invalid'], $aStats['pplns_valid'], $aStats['pplns_invalid'], $iBlockId) && $stmt->execute()) return true;
216+
if ($this->checkStmt($stmt) && $stmt->bind_param('iddddi', $aStats['id'], $aStats['valid'], $aStats['invalid'], $aStats['pplns_valid'], $aStats['pplns_invalid'], $iBlockId) && $stmt->execute()) return true;
217217
return $this->sqlError();
218218
}
219219

@@ -261,12 +261,12 @@ public function getCurrentShareRate($interval=180) {
261261
SELECT
262262
(
263263
(
264-
SELECT ROUND(SUM(difficulty) / ?, 2) AS sharerate
264+
SELECT ROUND(SUM(difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate
265265
FROM " . $this->share->getTableName() . "
266266
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND)
267267
AND our_result = 'Y'
268268
) + (
269-
SELECT ROUND(SUM(difficulty) / ?, 2) AS sharerate
269+
SELECT ROUND(SUM(difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate
270270
FROM " . $this->share->getArchiveTableName() . "
271271
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND)
272272
AND our_result = 'Y'
@@ -470,7 +470,7 @@ public function fetchAllUserMiningStats($interval=180) {
470470
a.username AS account,
471471
COUNT(DISTINCT t1.username) AS workers,
472472
IFNULL(SUM(t1.difficulty), 0) AS shares,
473-
ROUND(SUM(t1.difficulty) / ?, 2) AS sharerate,
473+
ROUND(SUM(t1.difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate,
474474
IFNULL(AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 0) AS avgsharediff
475475
FROM (
476476
SELECT

‎include/classes/worker.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function getWorkers($account_id, $interval=600) {
174174
while ($row = $result->fetch_assoc()) {
175175
$row['hashrate'] = round($this->coin->calcHashrate($row['shares'], $interval), 2);
176176
if ($row['count_all'] > 0) {
177-
$row['difficulty'] = round($row['shares'] / $row['count_all'], 2);
177+
$row['difficulty'] = round($row['shares'] / $row['count_all'], $this->coin->getShareDifficultyPrecision());
178178
} else {
179179
$row['difficulty'] = 0.00;
180180
}

‎include/config/global.inc.dist.php

+33-33
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
/**
55
* Do not edit this unless you have confirmed that your config has been updated!
66
* Also the URL to check for the most recent upstream versions available
7-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version
7+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#config-version
88
**/
99
$config['version'] = '1.0.1';
1010
$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php';
1111

1212
/**
1313
* Unless you disable this, we'll do a quick check on your config first.
14-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-check
14+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#config-check
1515
*/
1616
$config['skip_config_tests'] = false;
1717

@@ -24,7 +24,7 @@
2424
/**
2525
* Defines
2626
* Debug setting and salts for hashing passwords
27-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-defines--salts
27+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#defines--salts
2828
*/
2929
$config['DEBUG'] = 0;
3030
$config['SALT'] = 'PLEASEMAKEMESOMETHINGRANDOM';
@@ -33,7 +33,7 @@
3333
/**
3434
* Coin Algorithm
3535
* Algorithm used by this coin, sha256d or scrypt
36-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-algorithm
36+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#algorithm
3737
**/
3838
$config['algorithm'] = 'scrypt';
3939

@@ -47,7 +47,7 @@
4747
/**
4848
* Database configuration
4949
* MySQL database configuration
50-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-database-configuration
50+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#database-configuration
5151
**/
5252
$config['db']['host'] = 'localhost';
5353
$config['db']['user'] = 'someuser';
@@ -75,7 +75,7 @@
7575
/**
7676
* Local wallet RPC
7777
* RPC configuration for your daemon/wallet
78-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-local-wallet-rpc
78+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#local-wallet-rpc
7979
**/
8080
$config['wallet']['type'] = 'http';
8181
$config['wallet']['host'] = 'localhost:19334';
@@ -85,7 +85,7 @@
8585
/**
8686
* Swiftmailer configuration
8787
* Configure your way to send mails
88-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-swiftmailer
88+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#swiftmailer
8989
**/
9090
$config['swiftmailer']['type'] = 'sendmail';
9191
$config['swiftmailer']['sendmail']['path'] = '/usr/sbin/sendmail';
@@ -100,7 +100,7 @@
100100
/**
101101
* Getting Started Config
102102
* Shown to users in the 'Getting Started' section
103-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-getting-started
103+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#getting-started
104104
**/
105105
$config['gettingstarted']['coinname'] = 'Litecoin';
106106
$config['gettingstarted']['coinurl'] = 'http://www.litecoin.org';
@@ -110,7 +110,7 @@
110110
/**
111111
* Ticker API
112112
* Fetch exchange rates via an API
113-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-ticker-api
113+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#ticker-api
114114
**/
115115
$config['price']['enabled'] = false;
116116
$config['price']['url'] = 'https://btc-e.nz';
@@ -120,66 +120,66 @@
120120
/**
121121
* Automatic Payout Thresholds
122122
* Minimum and Maximum auto payout amount
123-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-automatic-payout-thresholds
123+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#automatic-payout-thresholds
124124
**/
125125
$config['ap_threshold']['min'] = 1;
126126
$config['ap_threshold']['max'] = 250;
127127

128128
/**
129129
* Minimum manual Payout Threshold
130130
* Minimum manual payout amount
131-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-manual-payout-threshold
131+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#manual-payout-threshold
132132
**/
133133
$config['mp_threshold'] = 1;
134134

135135
/**
136136
* Donation thresholds
137137
* Minimum donation amount in percent
138-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-donation-thresholds
138+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#donation-thresholds
139139
**/
140140
$config['donate_threshold']['min'] = 1;
141141

142142
/**
143143
* Account Specific Settings
144144
* Settings for each user account
145-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-account-specific-settings
145+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#account-specific-settings
146146
**/
147147
$config['accounts']['invitations']['count'] = 5;
148148

149149
/**
150150
* Currency
151151
* Shorthand name for the currency
152-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-currency
152+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#currency
153153
*/
154154
$config['currency'] = 'LTC';
155155

156156
/**
157157
* Coin Target
158158
* Target time for coins to be generated
159-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-coin-target
159+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#coin-target
160160
**/
161161
$config['cointarget'] = '150';
162162

163163
/**
164164
* Coin Diff Change
165165
* Amount of blocks between difficulty changes
166-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-coin-diff-change
166+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#coin-diff-change
167167
**/
168168
$config['coindiffchangetarget'] = 2016;
169169

170170
/**
171171
* TX Fees
172172
* Fees applied to transactions
173-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-tx-fees
173+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#tx-fees
174174
**/
175175
$config['txfee_auto'] = 0.1;
176176
$config['txfee_manual'] = 0.1;
177177

178178
/**
179179
* Block & Pool Bonus
180180
* Bonus coins for blockfinder or a pool bonus for everyone
181-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-block-bonus
182-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pool-bonus
181+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#block-bonus
182+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pool-bonus
183183
*/
184184
$config['block_bonus'] = 0;
185185
$config['pool_bonus'] = 0;
@@ -188,14 +188,14 @@
188188
/**
189189
* Payout System
190190
* Payout system chosen
191-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-payout-system
191+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#payout-system
192192
**/
193193
$config['payout_system'] = 'prop';
194194

195195
/**
196196
* Sendmany Support
197197
* Enable/Disable Sendmany RPC method
198-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-sendmany-support
198+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#sendmany-support
199199
**/
200200
$config['sendmany']['enabled'] = false;
201201

@@ -209,15 +209,15 @@
209209
/**
210210
* Round Purging
211211
* Round share purging configuration
212-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-round-purging
212+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#round-purging
213213
**/
214214
$config['purge']['sleep'] = 1;
215215
$config['purge']['shares'] = 25000;
216216

217217
/**
218218
* Share Archiving
219219
* Share archiving configuration details
220-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-archiving
220+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#archiving
221221
**/
222222
$config['archive']['maxrounds'] = 10;
223223
$config['archive']['maxage'] = 60 * 24;
@@ -226,14 +226,14 @@
226226
/**
227227
* Pool Fees
228228
* Fees applied to users
229-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pool-fees
229+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pool-fees
230230
*/
231231
$config['fees'] = 0;
232232

233233
/**
234234
* PPLNS
235235
* Pay Per Last N Shares
236-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pplns-settings
236+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pplns-settings
237237
*/
238238
$config['pplns']['shares']['default'] = 4000000;
239239
$config['pplns']['shares']['type'] = 'blockavg';
@@ -244,30 +244,30 @@
244244
/**
245245
* Difficulty
246246
* Difficulty setting for stratum/pushpool
247-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pool-target-difficulty
247+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pool-target-difficulty
248248
*/
249249
$config['difficulty'] = 20;
250250

251251
/**
252252
* Block Reward
253253
* Block reward configuration details
254-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-reward-settings
254+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#reward-settings
255255
**/
256256
$config['reward_type'] = 'block';
257257
$config['reward'] = 50;
258258

259259
/**
260260
* Confirmations
261261
* Credit and Network confirmation settings
262-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-confirmations
262+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#confirmations
263263
*/
264264
$config['confirmations'] = 120;
265265
$config['network_confirmations'] = 120;
266266

267267
/**
268268
* PPS
269269
* Pay Per Share configuration details
270-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-pps-settings
270+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#pps-settings
271271
**/
272272
$config['pps']['reward']['default'] = 50;
273273
$config['pps']['reward']['type'] = 'blockavg';
@@ -276,7 +276,7 @@
276276
/**
277277
* Memcache
278278
* Memcache configuration details
279-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache
279+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#memcache
280280
**/
281281
$config['memcache']['enabled'] = true;
282282
$config['memcache']['host'] = 'localhost';
@@ -292,7 +292,7 @@
292292
/**
293293
* Cookies
294294
* Cookie configuration details
295-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-cookies
295+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#cookies
296296
**/
297297
$config['cookie']['duration'] = '1440';
298298
$config['cookie']['domain'] = '';
@@ -303,14 +303,14 @@
303303
/**
304304
* Smarty Cache
305305
* Enable smarty cache and cache length
306-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-smarty-cache
306+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#smarty-cache
307307
**/
308308
$config['smarty']['cache'] = 0;
309309
$config['smarty']['cache_lifetime'] = 30;
310310

311311
/**
312312
* System load
313313
* Disable some calls when high system load
314-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-system-load
314+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#system-load
315315
**/
316316
$config['system']['load']['max'] = 10.0;

‎include/config/security.inc.dist.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/**
2424
* Memcache Rate Limiting
2525
* Rate limit requests using Memcache
26-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-memcache-rate-limiting
26+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#memcache-rate-limiting
2727
*/
2828
$config['mc_antidos']['enabled'] = true;
2929
$config['mc_antidos']['protect_ajax'] = true;
@@ -38,14 +38,14 @@
3838
/**
3939
* CSRF Protection
4040
* Enable or disable CSRF protection
41-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-csrf-protection
41+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#csrf-protection
4242
*/
4343
$config['csrf']['enabled'] = true;
4444

4545
/**
4646
* E-mail confirmations for user actions
4747
* Two-factor confirmation for user actions
48-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-e-mail-confirmations
48+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#e-mail-confirmations
4949
*/
5050
$config['twofactor']['enabled'] = true;
5151
$config['twofactor']['options']['details'] = true;
@@ -55,7 +55,7 @@
5555
/**
5656
* Lock account after X
5757
* Lock accounts after X invalid logins or pins
58-
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-lock-accounts-after-failed-logins
58+
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#lock-accounts-after-failed-logins
5959
**/
6060
$config['maxfailed']['login'] = 3;
6161
$config['maxfailed']['pin'] = 3;

‎include/pages/api/getusertransactions.inc.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@
2020
// Force limit
2121
$limit = 100;
2222
}
23+
if (isset($_REQUEST['filter']) && is_array($_REQUEST['filter'])) {
24+
$filter = $_REQUEST['filter'];
25+
} else {
26+
$filter = NULL;
27+
}
2328

24-
$data['transactions'] = $transaction->getTransactions($start, NULL, $limit, $user_id);
29+
$data['transactions'] = $transaction->getTransactions($start, $filter, $limit, $user_id);
2530

2631
// Fetch summary if enabled
2732
if (!$setting->getValue('disable_transactionsummary')) {

‎include/pages/statistics.inc.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
} else {
1010
$dDifficulty = 1;
1111
$iBlock = 0;
12-
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to litecoind RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'alert alert-danger');
12+
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'alert alert-danger');
1313
}
1414
$smarty->assign("CURRENTBLOCK", $iBlock);
1515
$smarty->assign("DIFFICULTY", $dDifficulty);

‎include/version.inc.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
33

4-
define('MPOS_VERSION', '1.0.9');
5-
define('DB_VERSION', '1.0.2');
4+
define('MPOS_VERSION', '1.1.0');
5+
define('DB_VERSION', '1.0.3');
66
define('CONFIG_VERSION', '1.0.1');
77
define('HASH_VERSION', 1);
88

‎sql/000_base_structure.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ CREATE TABLE IF NOT EXISTS `blocks` (
4343
`accounted` tinyint(1) NOT NULL DEFAULT '0',
4444
`account_id` int(255) unsigned DEFAULT NULL,
4545
`worker_name` varchar(50) DEFAULT 'unknown',
46-
`shares` bigint(30) unsigned DEFAULT NULL,
46+
`shares` double unsigned DEFAULT NULL,
4747
`share_id` bigint(30) DEFAULT NULL,
4848
PRIMARY KEY (`id`),
4949
UNIQUE KEY `height` (`height`,`blockhash`),
@@ -142,7 +142,7 @@ CREATE TABLE IF NOT EXISTS `settings` (
142142
UNIQUE KEY `setting` (`name`)
143143
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
144144

145-
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '1.0.2');
145+
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '1.0.3');
146146

147147
CREATE TABLE IF NOT EXISTS `shares` (
148148
`id` bigint(30) NOT NULL AUTO_INCREMENT,
@@ -182,10 +182,10 @@ CREATE TABLE IF NOT EXISTS `statistics_shares` (
182182
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
183183
`account_id` int(10) unsigned NOT NULL,
184184
`block_id` int(10) unsigned NOT NULL,
185-
`valid` bigint(20) NOT NULL,
186-
`invalid` bigint(20) NOT NULL DEFAULT '0',
187-
`pplns_valid` bigint(20) NOT NULL,
188-
`pplns_invalid` bigint(20) NOT NULL DEFAULT '0',
185+
`valid` float unsigned NOT NULL DEFAULT '0',
186+
`invalid` float unsigned NOT NULL DEFAULT '0',
187+
`pplns_valid` float unsigned NOT NULL DEFAULT '0',
188+
`pplns_invalid` float unsigned NOT NULL DEFAULT '0',
189189
PRIMARY KEY (`id`),
190190
KEY `account_id` (`account_id`),
191191
KEY `block_id` (`block_id`)

‎templates/bootstrap/dashboard/blocks/default.tpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<td class="text-right">{$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date}</td>
2727
<td class="text-right">{$BLOCKSFOUND[block].difficulty|number_format:"4"}</td>
2828
<td class="text-right">{$BLOCKSFOUND[block].amount|number_format:"2"}</td>
29-
<td class="text-right">{$BLOCKSFOUND[block].estshares|number_format}</td>
30-
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
29+
<td class="text-right">{$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision}</td>
30+
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision}</td>
3131
<td class="text-right">
3232
{math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares}
3333
<font color="{if ($percentage <= 100)}green{else}red{/if}">{$percentage|number_format:"2"}</font>
@@ -46,4 +46,4 @@
4646
{/if}
4747
</div>
4848
</div>
49-
{/if}
49+
{/if}

‎templates/bootstrap/dashboard/js/api.tpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ $(document).ready(function(){
4343
4444
// Load initial sparkline values
4545
var storedPersonalHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.hashrate|round:"2"}{literal} ];
46-
var storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|round:"2"}{literal} ];
46+
var storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|round:$GLOBAL.config.sharediffprecision}{literal} ];
4747
var storedPoolHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.hashrate|round:"2"}{literal} ];
4848
var storedNetHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.nethashrate|round:"2"}{literal} ];
4949
var storedPoolWorkers = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.workers}{literal} ];
@@ -89,7 +89,7 @@ $(document).ready(function(){
8989
storedPersonalHashrate.shift();
9090
storedPersonalHashrate.push(parseFloat(data.getdashboarddata.data.personal.hashrate).toFixed(2))
9191
storedPersonalSharerate.shift();
92-
storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2))
92+
storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal}))
9393
storedPoolHashrate.shift();
9494
storedPoolHashrate.push(parseFloat(data.getdashboarddata.data.pool.hashrate).toFixed(2))
9595
storedNetHashrate.shift();
@@ -122,7 +122,7 @@ $(document).ready(function(){
122122
} else {
123123
$('#b-nethashrate').html('n/a');
124124
}
125-
$('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2)));
125+
$('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal})));
126126
$('#b-yvalid').html(number_format(data.getdashboarddata.data.personal.shares.valid, {/literal}{$GLOBAL.config.sharediffprecision}{literal}));
127127
$('#b-yivalid').html(number_format(data.getdashboarddata.data.personal.shares.invalid, {/literal}{$GLOBAL.config.sharediffprecision}{literal}));
128128
if ( data.getdashboarddata.data.personal.shares.valid > 0 ) {

‎templates/bootstrap/dashboard/overview/_with_price_graph.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<div class="circle-tile-description text-faded">
4444
<p class="h5 up-more">My Sharerate</p>
4545
<div class="circle-tile-number text-faded up">
46-
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:"2"}</span>
46+
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision}</span>
4747
<span class="overview-mhs"> S/s</span>
4848
<br>
4949
<span class="personal-sharerate-bar spark-18"></span>

‎templates/bootstrap/dashboard/overview/_without_price_graph.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<div class="circle-tile-description text-faded">
4444
<p class="h5 up-more">My Sharerate</p>
4545
<div class="circle-tile-number text-faded up">
46-
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:"2"}</span>
46+
<span class="overview" id="b-sharerate">{$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision}</span>
4747
<span class="overview-mhs"> S/s</span>
4848
<br>
4949
<span class="personal-sharerate-bar spark-18"></span>

‎templates/bootstrap/dashboard/round_statistics/prop/round.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p>
7171
</div>
7272
<div class="circle-tile-number text-faded">
73-
<p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p>
73+
<p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget|default:2016 > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p>
7474
</div>
7575
</div>
7676
</div>

‎templates/bootstrap/statistics/blocks/block_overview_time.tpl

+12-12
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
0
3939
{/if}
4040
</td>
41-
<td class="text-right">{$LASTBLOCKSBYTIME.TotalEstimatedShares|number_format}</td>
42-
<td class="text-right">{$LASTBLOCKSBYTIME.TotalShares|number_format}</td>
41+
<td class="text-right">{$LASTBLOCKSBYTIME.TotalEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
42+
<td class="text-right">{$LASTBLOCKSBYTIME.TotalShares|number_format:$GLOBAL.config.sharediffprecision}</td>
4343
<td class="text-right">
4444
{if $LASTBLOCKSBYTIME.TotalEstimatedShares > 0}
4545
<font color="{if (($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}%</font></b>
@@ -64,8 +64,8 @@
6464
0
6565
{/if}
6666
</td>
67-
<td class="text-right">{$LASTBLOCKSBYTIME.1HourEstimatedShares|number_format}</td>
68-
<td class="text-right">{$LASTBLOCKSBYTIME.1HourShares|number_format}</td>
67+
<td class="text-right">{$LASTBLOCKSBYTIME.1HourEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
68+
<td class="text-right">{$LASTBLOCKSBYTIME.1HourShares|number_format:$GLOBAL.config.sharediffprecision}</td>
6969
<td class="text-right">
7070
{if $LASTBLOCKSBYTIME.1HourEstimatedShares > 0}
7171
<font color="{if (($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}%</font></b>
@@ -90,8 +90,8 @@
9090
0
9191
{/if}
9292
</td>
93-
<td class="text-right">{$LASTBLOCKSBYTIME.24HourEstimatedShares|number_format}</td>
94-
<td class="text-right">{$LASTBLOCKSBYTIME.24HourShares|number_format}</td>
93+
<td class="text-right">{$LASTBLOCKSBYTIME.24HourEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
94+
<td class="text-right">{$LASTBLOCKSBYTIME.24HourShares|number_format:$GLOBAL.config.sharediffprecision}</td>
9595
<td class="text-right">
9696
{if $LASTBLOCKSBYTIME.24HourEstimatedShares > 0}
9797
<font color="{if (($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}%</font></b>
@@ -116,8 +116,8 @@
116116
0
117117
{/if}
118118
</td>
119-
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysEstimatedShares|number_format}</td>
120-
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysShares|number_format}</td>
119+
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
120+
<td class="text-right">{$LASTBLOCKSBYTIME.7DaysShares|number_format:$GLOBAL.config.sharediffprecision}</td>
121121
<td class="text-right">
122122
{if $LASTBLOCKSBYTIME.7DaysEstimatedShares > 0}
123123
<font color="{if (($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}%</font></b>
@@ -142,8 +142,8 @@
142142
0
143143
{/if}
144144
</td>
145-
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksEstimatedShares|number_format}</td>
146-
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksShares|number_format}</td>
145+
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
146+
<td class="text-right">{$LASTBLOCKSBYTIME.4WeeksShares|number_format:$GLOBAL.config.sharediffprecision}</td>
147147
<td class="text-right">
148148
{if $LASTBLOCKSBYTIME.4WeeksEstimatedShares > 0}
149149
<font color="{if (($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}%</font></b>
@@ -168,8 +168,8 @@
168168
0
169169
{/if}
170170
</td>
171-
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthEstimatedShares|number_format}</td>
172-
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthShares|number_format}</td>
171+
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthEstimatedShares|number_format:$GLOBAL.config.sharediffprecision}</td>
172+
<td class="text-right">{$LASTBLOCKSBYTIME.12MonthShares|number_format:$GLOBAL.config.sharediffprecision}</td>
173173
<td class="text-right">
174174
{if $LASTBLOCKSBYTIME.12MonthEstimatedShares > 0}
175175
<font color="{if (($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100) <= 100)}green{elseif (($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100) <= 115)}orange{else}red{/if}">{($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}%</font></b>

‎templates/bootstrap/statistics/blocks/blocks_found_details.tpl

+6-6
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@
5151
<td class="text-right">{$BLOCKSFOUND[block].amount|number_format:"2"}</td>
5252
<td class="text-right">
5353
{assign var="totalexpectedshares" value=$totalexpectedshares+$BLOCKSFOUND[block].estshares}
54-
{$BLOCKSFOUND[block].estshares|number_format}
54+
{$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision}
5555
</td>
5656
{if $GLOBAL.config.payout_system == 'pplns'}
57-
<td class="text-right">{$BLOCKSFOUND[block].pplns_shares|number_format}</td>
57+
<td class="text-right">{$BLOCKSFOUND[block].pplns_shares|number_format:$GLOBAL.config.sharediffprecision}</td>
5858
{/if}
59-
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format}</td>
59+
<td class="text-right">{$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision}</td>
6060
<td class="text-right">
6161
{math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares}
6262
<font color="{if ($percentage <= 100)}green{elseif ($percentage <= 115)}orange{else}red{/if}">{$percentage|number_format:"2"}</font>
@@ -65,11 +65,11 @@
6565
{/section}
6666
<tr>
6767
<td colspan="6"><b>Totals</b></td>
68-
<td class="text-right">{$totalexpectedshares|number_format}</td>
68+
<td class="text-right">{$totalexpectedshares|number_format:$GLOBAL.config.sharediffprecision}</td>
6969
{if $GLOBAL.config.payout_system == 'pplns'}
70-
<td class="text-right">{$pplnsshares|number_format}</td>
70+
<td class="text-right">{$pplnsshares|number_format:$GLOBAL.config.sharediffprecision}</td>
7171
{/if}
72-
<td class="text-right">{$totalshares|number_format}</td>
72+
<td class="text-right">{$totalshares|number_format:$GLOBAL.config.sharediffprecision}</td>
7373
<td class="text-right">{if $count > 0}<font color="{if (($totalshares / $totalexpectedshares * 100) <= 100)}green{elseif (($totalshares / $totalexpectedshares * 100) <= 115)}orange{else}red{/if}">{($totalshares / $totalexpectedshares * 100)|number_format:"2"}</font>{else}0{/if}</td>
7474
</tr>
7575
</tbody>

‎templates/bootstrap/statistics/blocks/small_table.tpl

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

‎templates/bootstrap/statistics/graphs/default.tpl

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<script>
22
$(function () {
3+
var miningstats = {$YOURMININGSTATS nofilter};
34
var hashChart = Morris.Line({
45
element: 'hashrate-area-chart',
5-
data: {$YOURMININGSTATS nofilter},
6+
data: miningstats,
67
xkey: 'time',
78
ykeys: ['hashrate'],
89
labels: ['Hashrate'],
@@ -17,7 +18,7 @@ $(function () {
1718
1819
var workersChart = Morris.Line({
1920
element: 'workers-area-chart',
20-
data: {$YOURMININGSTATS nofilter},
21+
data: miningstats,
2122
xkey: 'time',
2223
ykeys: ['workers'],
2324
labels: ['Workers'],
@@ -32,7 +33,7 @@ $(function () {
3233
3334
var shareCharts= Morris.Line({
3435
element: 'sharerate-area-chart',
35-
data: {$YOURMININGSTATS nofilter},
36+
data: miningstats,
3637
xkey: 'time',
3738
ykeys: ['sharerate'],
3839
labels: ['Sharerate'],

‎templates/bootstrap/statistics/pool/contributors_hashrate.tpl

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

‎templates/bootstrap/statistics/pool/contributors_shares.tpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
<td>{$rank++}</td>
2222
<td>{if $CONTRIBSHARES[shares].donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{else if $CONTRIBSHARES[shares].donate_percent|default:"0" < 2 AND $CONTRIBSHARES[shares].donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td>
2323
<td>{if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if}</td>
24-
<td class="text-right">{$CONTRIBSHARES[shares].shares|number_format}</td>
24+
<td class="text-right">{$CONTRIBSHARES[shares].shares|number_format:$GLOBAL.config.sharediffprecision}</td>
2525
</tr>
2626
{/section}
2727
{if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.shares.valid|default:"0" > 0}
28-
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
28+
{if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}<tr class="success">{else}<tr>{/if}
2929
<td>n/a</td>
3030
<td>{if $GLOBAL.userdata.donate_percent|default:"0" >= 2}<i class="fa fa-trophy fa-fw"></i>{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}<i class="fa fa-star-o fa-fw"></i>{else}<i class="fa fa-ban fa-fw"></i>{/if}</td>
3131
<td>{$GLOBAL.userdata.username|escape}</td>
32-
<td class="text-right">{$GLOBAL.userdata.shares.valid|number_format}</td>
32+
<td class="text-right">{$GLOBAL.userdata.shares.valid|number_format:$GLOBAL.config.sharediffprecision}</td>
3333
</tr>
3434
{/if}
3535
</tbody>

‎templates/bootstrap/statistics/pool/general_stats.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</tr>
4545
<tr>
4646
<th>Est. Shares this Round</th>
47-
<td id="b-target">{$ESTIMATES.shares|number_format} (done: {$ESTIMATES.percent}%)</td>
47+
<td id="b-target">{$ESTIMATES.shares|number_format:$GLOBAL.config.sharediffprecision} (done: {$ESTIMATES.percent}%)</td>
4848
</tr>
4949
{if ! $GLOBAL.website.blockexplorer.disabled}
5050
<tr>

‎templates/bootstrap/statistics/round/block_stats.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<td>Time</td>
3939
<td>{$BLOCKDETAILS.time|default:"0"}</td>
4040
<td>Shares</td>
41-
<td>{$BLOCKDETAILS.shares|number_format:"0"|default:"0"}</td>
41+
<td>{$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
4242
<td>Finder</td>
4343
<td>{$BLOCKDETAILS.finder|default:"unknown"}</td>
4444
</tr>

‎templates/bootstrap/statistics/round/pplns_block_stats.tpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<td>ID</td>
1919
<td>{$BLOCKDETAILS.id|number_format:"0"|default:"0"}</td>
2020
<td>PPLNS Shares</td>
21-
<td>{$PPLNSSHARES|number_format:"0"|default:"0"}</td>
21+
<td>{$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
2222
</tr>
2323
<tr class="even">
2424
<td>Height</td>
@@ -28,7 +28,7 @@
2828
<td>{$BLOCKDETAILS.height|number_format:"0"|default:"0"}</td>
2929
{/if}
3030
<td>Estimated Shares</td>
31-
<td>{$BLOCKDETAILS.estshares|number_format|default:"0"}</td>
31+
<td>{$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
3232
</tr>
3333
<tr class="odd">
3434
<td>Amount</td>
@@ -64,7 +64,7 @@
6464
</tr>
6565
<tr class="odd">
6666
<td>Shares</td>
67-
<td>{$BLOCKDETAILS.shares|number_format:"0"|default:"0"}</td>
67+
<td>{$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
6868
<td>Seconds This Round</td>
6969
<td>{$BLOCKDETAILS.round_time|number_format:"0"|default:"0"}</td>
7070
</tr>

‎templates/bootstrap/statistics/round/pplns_block_stats_small.tpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
<td>{$BLOCKDETAILS.height|number_format:"0"|default:"0"}</td>
3131
{/if}
3232
<td>PPLNS Shares</td>
33-
<td>{$PPLNSSHARES|number_format:"0"|default:"0"}</td>
33+
<td>{$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
3434
<td>Estimated Shares</td>
35-
<td>{$BLOCKDETAILS.estshares|number_format|default:"0"}</td>
35+
<td>{$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
3636
</tr>
3737
<tr class="odd">
3838
<td>Amount</td>
@@ -61,7 +61,7 @@
6161
</tr>
6262
<tr class="odd">
6363
<td>Shares</td>
64-
<td>{$BLOCKDETAILS.shares|number_format:"0"|default:"0"}</td>
64+
<td>{$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"}</td>
6565
<td>Finder</td>
6666
<td>{$BLOCKDETAILS.finder|default:"unknown"}</td>
6767
<td>Seconds This Round</td>

‎templates/bootstrap/statistics/round/pplns_round_shares.tpl

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

‎templates/bootstrap/statistics/round/pplns_transactions.tpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
{section txs $ROUNDTRANSACTIONS}
2424
<tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username}{assign var=listed value=1} style="background-color:#99EB99;"{else}{/if}>
2525
<td>{if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if}</td>
26-
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format|default:0}</td>
26+
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
2727
<td>{if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if}</td>
28-
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format|default:"0"}</td>
28+
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
2929
<td>{if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0 }{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"|default:"0"}{else}0{/if}</td>
3030
<td>{if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 && $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0}{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if}
3131
<font color="{if ($percentage1 >= 100)}green{else}red{/if}">{$percentage1|number_format:"2"}</font></b></td>

‎templates/bootstrap/statistics/round/pplns_transactions_small.tpl

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
{section txs $ROUNDTRANSACTIONS}
2727
<tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username}{assign var=listed value=1} style="background-color:#99EB99;"{else}{/if}>
2828
<td>{if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if}</td>
29-
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format}</td>
30-
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format}</td>
29+
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format:$GLOBAL.config.sharediffprecision}</td>
30+
<td>{$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format:$GLOBAL.config.sharediffprecision}</td>
3131
<td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid > 0 }{($SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid / $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
3232
<td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{(( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid)|number_format:"2"}{else}0.00{/if}</td>
33-
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format}</td>
34-
<td>{$PPLNSROUNDSHARES[txs].pplns_invalid|number_format}</td>
33+
<td>{$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision}</td>
34+
<td>{$PPLNSROUNDSHARES[txs].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision}</td>
3535
<td>{if $PPLNSROUNDSHARES[txs].pplns_invalid > 0 }{($PPLNSROUNDSHARES[txs].pplns_invalid / $PPLNSROUNDSHARES[txs].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if}</td>
3636
<td>{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"}</td>
3737
<td>{if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if}

‎templates/bootstrap/statistics/round/round_shares.tpl

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

‎templates/bootstrap/statistics/round/round_transactions.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<tr{if $GLOBAL.userdata.username|default:"" == $ROUNDTRANSACTIONS[txs].username} style="background-color:#99EB99;"{else}{/if}>
2121
<td>{if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if}</td>
2222
<td>{$ROUNDTRANSACTIONS[txs].type|default:""}</td>
23-
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format}</td>
23+
<td>{$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0}</td>
2424
<td>{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|default:"0"|number_format:"2"}</td>
2525
<td>{$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"}</td>
2626
</tr>
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
function run_103() {
3+
// Ugly but haven't found a better way
4+
global $setting, $config, $coin_address, $user, $mysqli;
5+
6+
// Version information
7+
$db_version_old = '1.0.2'; // What version do we expect
8+
$db_version_new = '1.0.3'; // What is the new version we wish to upgrade to
9+
$db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed
10+
11+
// Upgrade specific variables
12+
$aSql[] = "ALTER TABLE `blocks` CHANGE `shares` `shares` DOUBLE UNSIGNED DEFAULT NULL;";
13+
$aSql[] = "UPDATE `statistics_shares` SET `valid` = '0' WHERE `valid` IS NULL;";
14+
$aSql[] = "UPDATE `statistics_shares` SET `pplns_valid` = '0' WHERE `pplns_valid` IS NULL;";
15+
$aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `invalid` `invalid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `pplns_invalid` `pplns_invalid` FLOAT UNSIGNED NOT NULL DEFAULT '0';";
16+
$aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '" . $db_version_new . "' WHERE name = 'DB_VERSION';";
17+
18+
if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) {
19+
// Run the upgrade
20+
echo '- Starting database migration to version ' . $db_version_new . PHP_EOL;
21+
foreach ($aSql as $sql) {
22+
echo '- Preparing: ' . $sql . PHP_EOL;
23+
$stmt = $mysqli->prepare($sql);
24+
if ($stmt && $stmt->execute()) {
25+
echo '- success' . PHP_EOL;
26+
} else {
27+
echo '- failed: ' . $mysqli->error . PHP_EOL;
28+
exit(1);
29+
}
30+
}
31+
}
32+
}
33+
?>

0 commit comments

Comments
 (0)
Please sign in to comment.