From 7dce98190190424fdc2db350268135b05f5069cf Mon Sep 17 00:00:00 2001
From: Barry Deeney
Date: Sun, 2 Mar 2014 11:02:28 +0800
Subject: [PATCH 01/14] Added the getLastValid function for findblock cron
---
public/include/classes/block.class.php | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/public/include/classes/block.class.php b/public/include/classes/block.class.php
index 76ccf43d..cf0ea7ee 100644
--- a/public/include/classes/block.class.php
+++ b/public/include/classes/block.class.php
@@ -15,6 +15,18 @@ class Block extends Base {
return $result->fetch_assoc();
return $this->sqlError();
}
+
+ /**
+ * Specific method to fetch the latest block found that is VALID
+ * @param none
+ * @return data array Array with database fields as keys
+ **/
+ public function getLastValid() {
+ $stmt = $this->mysqli->prepare("SELECT * FROM $this->table WHERE confirmations > -1 ORDER BY height DESC LIMIT 1");
+ if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result())
+ return $result->fetch_assoc();
+ return $this->sqlError();
+ }
/**
* Get a specific block, by block height
From 338154b1eeaf70b0dfa94a2690971587c6c212a7 Mon Sep 17 00:00:00 2001
From: Barry Deeney
Date: Sun, 2 Mar 2014 11:03:32 +0800
Subject: [PATCH 02/14] Updated findblock cron to use block->getLastValid
---
cronjobs/findblock.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cronjobs/findblock.php b/cronjobs/findblock.php
index 4ee9f644..d425c476 100755
--- a/cronjobs/findblock.php
+++ b/cronjobs/findblock.php
@@ -26,7 +26,7 @@ chdir(dirname(__FILE__));
require_once('shared.inc.php');
// Fetch our last block found from the DB as a starting point
-$aLastBlock = @$block->getLast();
+$aLastBlock = @$block->getLastValid();
$strLastBlockHash = $aLastBlock['blockhash'];
if (!$strLastBlockHash) $strLastBlockHash = '';
From bba3781ebfc6fb9f713b2c8c67bed3031d3d2d69 Mon Sep 17 00:00:00 2001
From: iAmShorty
Date: Tue, 4 Mar 2014 11:48:28 +0100
Subject: [PATCH 03/14] [FIX] Wallet Balance Newmint Calc Fix
---
public/templates/mpos/admin/wallet/default.tpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/templates/mpos/admin/wallet/default.tpl b/public/templates/mpos/admin/wallet/default.tpl
index 033336e8..479c0b2d 100644
--- a/public/templates/mpos/admin/wallet/default.tpl
+++ b/public/templates/mpos/admin/wallet/default.tpl
@@ -19,7 +19,7 @@
| Liquid Assets |
- {($BALANCE - $LOCKED - $UNCONFIRMED + $NEWMINT|default:"0")|number_format:"8"} |
+ {($BALANCE - $LOCKED - $UNCONFIRMED {if $NEWMINT >= 0}+ $NEWMINT|default:"0")}|number_format:"8"} |
{if $NEWMINT >= 0}
From c2747a183bee6487b6e4b1981a5ae4ada0a4c89d Mon Sep 17 00:00:00 2001
From: iAmShorty
Date: Tue, 4 Mar 2014 11:51:36 +0100
Subject: [PATCH 04/14] [FIX] closing if
---
public/templates/mpos/admin/wallet/default.tpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/templates/mpos/admin/wallet/default.tpl b/public/templates/mpos/admin/wallet/default.tpl
index 479c0b2d..21fe96ec 100644
--- a/public/templates/mpos/admin/wallet/default.tpl
+++ b/public/templates/mpos/admin/wallet/default.tpl
@@ -19,7 +19,7 @@
| Liquid Assets |
- {($BALANCE - $LOCKED - $UNCONFIRMED {if $NEWMINT >= 0}+ $NEWMINT|default:"0")}|number_format:"8"} |
+ {($BALANCE - $LOCKED - $UNCONFIRMED {if $NEWMINT >= 0}+ $NEWMINT|default:"0"){/if}}|number_format:"8"} |
{if $NEWMINT >= 0}
From 5cab31468901b8d535c611024460dfe5d2587237 Mon Sep 17 00:00:00 2001
From: iAmShorty
Date: Tue, 4 Mar 2014 11:59:10 +0100
Subject: [PATCH 05/14] [FIX] changed template and calc
---
public/templates/mpos/admin/wallet/default.tpl | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/public/templates/mpos/admin/wallet/default.tpl b/public/templates/mpos/admin/wallet/default.tpl
index 21fe96ec..f536ee46 100644
--- a/public/templates/mpos/admin/wallet/default.tpl
+++ b/public/templates/mpos/admin/wallet/default.tpl
@@ -17,15 +17,20 @@
| Unconfirmed |
{$UNCONFIRMED|number_format:"8"} |
+{if $NEWMINT >= 0}
| Liquid Assets |
- {($BALANCE - $LOCKED - $UNCONFIRMED {if $NEWMINT >= 0}+ $NEWMINT|default:"0"){/if}}|number_format:"8"} |
+ {($BALANCE - $LOCKED - $UNCONFIRMED + $NEWMINT|default:"0")|number_format:"8"} |
-{if $NEWMINT >= 0}
| PoS New Mint |
{$NEWMINT|number_format:"8"} |
+{else}
+
+ | Liquid Assets |
+ {($BALANCE - $LOCKED - $UNCONFIRMED)|number_format:"8"} |
+
{/if}
From d8decf221b29781b36e8da7f1689c95cca397017 Mon Sep 17 00:00:00 2001
From: iAmShorty
Date: Wed, 5 Mar 2014 12:58:08 +0100
Subject: [PATCH 06/14] [UPDATE] minimum manual payout
---
public/include/config/global.inc.dist.php | 7 +++++++
public/include/pages/account/edit.inc.php | 2 ++
public/include/smarty_globals.inc.php | 1 +
public/templates/mpos/account/edit/default.tpl | 7 ++++++-
4 files changed, 16 insertions(+), 1 deletion(-)
mode change 100644 => 100755 public/include/config/global.inc.dist.php
mode change 100644 => 100755 public/include/pages/account/edit.inc.php
mode change 100644 => 100755 public/include/smarty_globals.inc.php
mode change 100644 => 100755 public/templates/mpos/account/edit/default.tpl
diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php
old mode 100644
new mode 100755
index 06e67c82..634bf021
--- a/public/include/config/global.inc.dist.php
+++ b/public/include/config/global.inc.dist.php
@@ -77,6 +77,13 @@ $config['price']['currency'] = 'USD';
$config['ap_threshold']['min'] = 1;
$config['ap_threshold']['max'] = 250;
+/**
+ * Minimum manual Payout Threshold
+ * Minimum manual payout amount
+ * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-automatic-payout-thresholds
+ **/
+$config['mp_threshold'] = 1;
+
/**
* Donation thresholds
* Minimum donation amount in percent
diff --git a/public/include/pages/account/edit.inc.php b/public/include/pages/account/edit.inc.php
old mode 100644
new mode 100755
index cde09a77..ba0fb4a0
--- a/public/include/pages/account/edit.inc.php
+++ b/public/include/pages/account/edit.inc.php
@@ -96,6 +96,8 @@ if ($user->isAuthenticated()) {
case 'cashOut':
if ($setting->getValue('disable_payouts') == 1 || $setting->getValue('disable_manual_payouts') == 1) {
$_SESSION['POPUP'][] = array('CONTENT' => 'Manual payouts are disabled.', 'TYPE' => 'info');
+ } else if ($aBalance['confirmed'] < $config['mp_threshold']) {
+ $_SESSION['POPUP'][] = array('CONTENT' => 'Payout must be greater or equal than .', 'TYPE' => 'info');
} else if (!$user->getCoinAddress($_SESSION['USERDATA']['id'])) {
$_SESSION['POPUP'][] = array('CONTENT' => 'You have no payout address set.', 'TYPE' => 'errormsg');
} else {
diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php
old mode 100644
new mode 100755
index 61d350f4..8b7bd71e
--- a/public/include/smarty_globals.inc.php
+++ b/public/include/smarty_globals.inc.php
@@ -88,6 +88,7 @@ $aGlobal = array(
'txfee_manual' => $config['txfee_manual'],
'txfee_auto' => $config['txfee_auto'],
'payout_system' => $config['payout_system'],
+ 'mp_threshold' => $config['mp_threshold'],
'ap_threshold' => array(
'min' => $config['ap_threshold']['min'],
'max' => $config['ap_threshold']['max']
diff --git a/public/templates/mpos/account/edit/default.tpl b/public/templates/mpos/account/edit/default.tpl
old mode 100644
new mode 100755
index 4b7053f5..de6c9ca5
--- a/public/templates/mpos/account/edit/default.tpl
+++ b/public/templates/mpos/account/edit/default.tpl
@@ -89,6 +89,9 @@
Please note: a {if $GLOBAL.config.txfee_manual > 0.00001}{$GLOBAL.config.txfee_manual}{else}{$GLOBAL.config.txfee_manual|number_format:"8"}{/if} {$GLOBAL.config.currency} transaction will apply when processing "On-Demand" manual payments
+
+ Minimum Cashout: {$GLOBAL.config.mp_threshold + $GLOBAL.config.txfee_manual} {$GLOBAL.config.currency}
+
- Minimum Cashout: {$GLOBAL.config.mp_threshold + $GLOBAL.config.txfee_manual} {$GLOBAL.config.currency}
+ Minimum Cashout: {$GLOBAL.config.mp_threshold} {$GLOBAL.config.currency}