Merge pull request #1567 from MPOS/donation-percentage
[IMPROVED] Added donation minimum and rounding
This commit is contained in:
commit
30fcc42e7d
@ -382,6 +382,7 @@ class User extends Base {
|
|||||||
public function updateAccount($userID, $address, $threshold, $donate, $email, $is_anonymous, $strToken) {
|
public function updateAccount($userID, $address, $threshold, $donate, $email, $is_anonymous, $strToken) {
|
||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
$bUser = false;
|
$bUser = false;
|
||||||
|
$donate = round($donate, 2);
|
||||||
// number validation checks
|
// number validation checks
|
||||||
if (!is_numeric($threshold)) {
|
if (!is_numeric($threshold)) {
|
||||||
$this->setErrorMessage('Invalid input for auto-payout');
|
$this->setErrorMessage('Invalid input for auto-payout');
|
||||||
@ -396,8 +397,8 @@ class User extends Base {
|
|||||||
if (!is_numeric($donate)) {
|
if (!is_numeric($donate)) {
|
||||||
$this->setErrorMessage('Invalid input for donation');
|
$this->setErrorMessage('Invalid input for donation');
|
||||||
return false;
|
return false;
|
||||||
} else if ($donate < 0) {
|
} else if ($donate < $this->config['donate_threshold']['min'] && $donate != 0) {
|
||||||
$this->setErrorMessage('Donation below allowed 0% limit');
|
$this->setErrorMessage('Donation below allowed ' . $this->config['donate_threshold']['min'] . '% limit');
|
||||||
return false;
|
return false;
|
||||||
} else if ($donate > 100) {
|
} else if ($donate > 100) {
|
||||||
$this->setErrorMessage('Donation above allowed 100% limit');
|
$this->setErrorMessage('Donation above allowed 100% limit');
|
||||||
|
|||||||
@ -7,7 +7,7 @@ if (!defined('SECURITY')) die('Hacking attempt');
|
|||||||
* This is used in the version check to ensure you run the latest version of the configuration file.
|
* This is used in the version check to ensure you run the latest version of the configuration file.
|
||||||
* Once you upgraded your config, change the version here too.
|
* Once you upgraded your config, change the version here too.
|
||||||
**/
|
**/
|
||||||
$config['version'] = '0.0.5';
|
$config['version'] = '0.0.6';
|
||||||
|
|
||||||
// Our include directory for additional features
|
// Our include directory for additional features
|
||||||
define('INCLUDE_DIR', BASEPATH . 'include');
|
define('INCLUDE_DIR', BASEPATH . 'include');
|
||||||
@ -135,7 +135,7 @@ $config['twofactor']['options']['changepw'] = true;
|
|||||||
*
|
*
|
||||||
* Options:
|
* Options:
|
||||||
* enabled = Whether or not we will generate/check for valid CSRF tokens
|
* enabled = Whether or not we will generate/check for valid CSRF tokens
|
||||||
* disabled_forms = Which forms you want to disable csrf protection on, if enabled
|
* disabled_forms = Which forms you want to disable csrf protection on, if enabled
|
||||||
* * Valid options : login, contact, accountedit, workers, notifications, invite, register, passreset, unlockaccount
|
* * Valid options : login, contact, accountedit, workers, notifications, invite, register, passreset, unlockaccount
|
||||||
* Default:
|
* Default:
|
||||||
* enabled = true
|
* enabled = true
|
||||||
@ -216,6 +216,16 @@ $config['price']['currency'] = 'USD';
|
|||||||
$config['ap_threshold']['min'] = 1;
|
$config['ap_threshold']['min'] = 1;
|
||||||
$config['ap_threshold']['max'] = 250;
|
$config['ap_threshold']['max'] = 250;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Donation thresholds
|
||||||
|
*
|
||||||
|
* You can define a min and max values for you users
|
||||||
|
* donation settings here.
|
||||||
|
*
|
||||||
|
* Defaults:
|
||||||
|
* `min` = `1`
|
||||||
|
**/
|
||||||
|
$config['donate_threshold']['min'] = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account specific settings
|
* Account specific settings
|
||||||
|
|||||||
@ -193,6 +193,7 @@ $smarty->assign("DETAILSUNLOCKED", $ea_editable);
|
|||||||
$smarty->assign("CHANGEPASSSENT", $cp_sent);
|
$smarty->assign("CHANGEPASSSENT", $cp_sent);
|
||||||
$smarty->assign("WITHDRAWSENT", $wf_sent);
|
$smarty->assign("WITHDRAWSENT", $wf_sent);
|
||||||
$smarty->assign("DETAILSSENT", $ea_sent);
|
$smarty->assign("DETAILSSENT", $ea_sent);
|
||||||
|
$smarty->assign("DONATE_THRESHOLD", $config['donate_threshold']);
|
||||||
if ($csrfenabled && !in_array('accountedit', $config['csrf']['disabled_forms'])) {
|
if ($csrfenabled && !in_array('accountedit', $config['csrf']['disabled_forms'])) {
|
||||||
$token = $csrftoken->getBasic($user->getCurrentIP(), 'editaccount');
|
$token = $csrftoken->getBasic($user->getCurrentIP(), 'editaccount');
|
||||||
$smarty->assign('CTOKEN', $token);
|
$smarty->assign('CTOKEN', $token);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ if (!defined('SECURITY')) die('Hacking attempt');
|
|||||||
|
|
||||||
define('MPOS_VERSION', '0.0.2');
|
define('MPOS_VERSION', '0.0.2');
|
||||||
define('DB_VERSION', '0.0.4');
|
define('DB_VERSION', '0.0.4');
|
||||||
define('CONFIG_VERSION', '0.0.5');
|
define('CONFIG_VERSION', '0.0.6');
|
||||||
|
|
||||||
// Fetch installed database version
|
// Fetch installed database version
|
||||||
$db_version = $setting->getValue('DB_VERSION');
|
$db_version = $setting->getValue('DB_VERSION');
|
||||||
|
|||||||
@ -29,8 +29,8 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label>Donation Percentage</label>
|
<label>Donation Percentage</label>
|
||||||
<font size="1"> Donation amount in percent (example: 0.5)</font>
|
<font size="1"> Donation amount in percent ({$DONATE_THRESHOLD.min}-100%)</font>
|
||||||
{nocache}<input type="text" name="donatePercent" value="{$smarty.request.donatePercent|default:$GLOBAL.userdata.donate_percent|escape}" size="4" {if $GLOBAL.twofactor.enabled && $GLOBAL.twofactor.options.details && !$DETAILSUNLOCKED}disabled{/if}/>{/nocache}
|
{nocache}<input type="text" name="donatePercent" value="{$smarty.request.donatePercent|default:$GLOBAL.userdata.donate_percent|escape|number_format:"2"}" size="4" {if $GLOBAL.twofactor.enabled && $GLOBAL.twofactor.options.details && !$DETAILSUNLOCKED}disabled{/if}/>{/nocache}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label>Automatic Payout Threshold</label>
|
<label>Automatic Payout Threshold</label>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user