commit
a6c8d507dc
@ -130,7 +130,7 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
$aData['fee' ] = 0;
|
$aData['fee' ] = 0;
|
||||||
$aData['donation'] = 0;
|
$aData['donation'] = 0;
|
||||||
|
|
||||||
if ($config['fees'] > 0)
|
if ($config['fees'] > 0 && $aData['no_fees'] == 0)
|
||||||
$aData['fee'] = number_format(round($config['fees'] / 100 * $aData['payout'], 8), 8);
|
$aData['fee'] = number_format(round($config['fees'] / 100 * $aData['payout'], 8), 8);
|
||||||
// Calculate donation amount, fees not included
|
// Calculate donation amount, fees not included
|
||||||
$aData['donation'] = number_format(round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8), 8);
|
$aData['donation'] = number_format(round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8), 8);
|
||||||
|
|||||||
@ -72,7 +72,7 @@ foreach ($aAccountShares as $aData) {
|
|||||||
$aData['donation'] = 0;
|
$aData['donation'] = 0;
|
||||||
|
|
||||||
// Calculate block fees
|
// Calculate block fees
|
||||||
if ($config['fees'] > 0)
|
if ($config['fees'] > 0 && $aData['no_fees'] == 0)
|
||||||
$aData['fee'] = number_format(round($config['fees'] / 100 * $aData['payout'], 8), 8);
|
$aData['fee'] = number_format(round($config['fees'] / 100 * $aData['payout'], 8), 8);
|
||||||
// Calculate donation amount
|
// Calculate donation amount
|
||||||
$aData['donation'] = number_format(round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8), 8);
|
$aData['donation'] = number_format(round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8), 8);
|
||||||
|
|||||||
@ -66,7 +66,7 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
|
|||||||
$aData['fee' ] = 0;
|
$aData['fee' ] = 0;
|
||||||
$aData['donation'] = 0;
|
$aData['donation'] = 0;
|
||||||
|
|
||||||
if ($config['fees'] > 0)
|
if ($config['fees'] > 0 && $aData['no_fees'] == 0)
|
||||||
$aData['fee'] = number_format(round($config['fees'] / 100 * $aData['payout'], 8), 8);
|
$aData['fee'] = number_format(round($config['fees'] / 100 * $aData['payout'], 8), 8);
|
||||||
// Calculate donation amount, fees not included
|
// Calculate donation amount, fees not included
|
||||||
$aData['donation'] = number_format(round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8), 8);
|
$aData['donation'] = number_format(round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8), 8);
|
||||||
|
|||||||
@ -97,6 +97,7 @@ class Share {
|
|||||||
SELECT
|
SELECT
|
||||||
a.id,
|
a.id,
|
||||||
SUBSTRING_INDEX( s.username , '.', 1 ) as username,
|
SUBSTRING_INDEX( s.username , '.', 1 ) as username,
|
||||||
|
a.no_fees AS no_fees,
|
||||||
IFNULL(SUM(IF(our_result='Y', 1, 0)), 0) AS valid,
|
IFNULL(SUM(IF(our_result='Y', 1, 0)), 0) AS valid,
|
||||||
IFNULL(SUM(IF(our_result='N', 1, 0)), 0) AS invalid
|
IFNULL(SUM(IF(our_result='N', 1, 0)), 0) AS invalid
|
||||||
FROM $this->table AS s
|
FROM $this->table AS s
|
||||||
@ -135,6 +136,7 @@ class Share {
|
|||||||
SELECT
|
SELECT
|
||||||
a.id,
|
a.id,
|
||||||
SUBSTRING_INDEX( s.username , '.', 1 ) as account,
|
SUBSTRING_INDEX( s.username , '.', 1 ) as account,
|
||||||
|
a.no_fees AS no_fees,
|
||||||
IFNULL(SUM(IF(our_result='Y', 1, 0)), 0) AS valid,
|
IFNULL(SUM(IF(our_result='Y', 1, 0)), 0) AS valid,
|
||||||
IFNULL(SUM(IF(our_result='N', 1, 0)), 0) AS invalid
|
IFNULL(SUM(IF(our_result='N', 1, 0)), 0) AS invalid
|
||||||
FROM $this->tableArchive AS s
|
FROM $this->tableArchive AS s
|
||||||
|
|||||||
@ -224,6 +224,7 @@ class Statistics {
|
|||||||
a.id AS id,
|
a.id AS id,
|
||||||
a.is_admin as is_admin,
|
a.is_admin as is_admin,
|
||||||
a.is_locked as is_locked,
|
a.is_locked as is_locked,
|
||||||
|
a.no_fees as no_fees,
|
||||||
a.username AS username,
|
a.username AS username,
|
||||||
a.donate_percent AS donate_percent,
|
a.donate_percent AS donate_percent,
|
||||||
a.email AS email,
|
a.email AS email,
|
||||||
|
|||||||
@ -43,6 +43,9 @@ class User {
|
|||||||
public function getUserEmail($username) {
|
public function getUserEmail($username) {
|
||||||
return $this->getSingle($username, 'email', 'username', 's');
|
return $this->getSingle($username, 'email', 'username', 's');
|
||||||
}
|
}
|
||||||
|
public function getUserNoFee($id) {
|
||||||
|
return $this->getSingle($id, 'no_fees', 'id');
|
||||||
|
}
|
||||||
public function getUserAdmin($id) {
|
public function getUserAdmin($id) {
|
||||||
return $this->getSingle($id, 'is_admin', 'id');
|
return $this->getSingle($id, 'is_admin', 'id');
|
||||||
}
|
}
|
||||||
@ -58,12 +61,19 @@ class User {
|
|||||||
public function getUserFailed($id) {
|
public function getUserFailed($id) {
|
||||||
return $this->getSingle($id, 'failed_logins', 'id');
|
return $this->getSingle($id, 'failed_logins', 'id');
|
||||||
}
|
}
|
||||||
|
public function isNoFee($id) {
|
||||||
|
return $this->getUserNoFee($id);
|
||||||
|
}
|
||||||
public function isLocked($id) {
|
public function isLocked($id) {
|
||||||
return $this->getUserLocked($id);
|
return $this->getUserLocked($id);
|
||||||
}
|
}
|
||||||
public function isAdmin($id) {
|
public function isAdmin($id) {
|
||||||
return $this->getUserAdmin($id);
|
return $this->getUserAdmin($id);
|
||||||
}
|
}
|
||||||
|
public function changeNoFee($id) {
|
||||||
|
$field = array('name' => 'no_fees', 'type' => 'i', 'value' => !$this->isNoFee($id));
|
||||||
|
return $this->updateSingle($id, $field);
|
||||||
|
}
|
||||||
public function changeLocked($id) {
|
public function changeLocked($id) {
|
||||||
$field = array('name' => 'is_locked', 'type' => 'i', 'value' => !$this->isLocked($id));
|
$field = array('name' => 'is_locked', 'type' => 'i', 'value' => !$this->isLocked($id));
|
||||||
return $this->updateSingle($id, $field);
|
return $this->updateSingle($id, $field);
|
||||||
@ -416,7 +426,7 @@ class User {
|
|||||||
$this->debug->append("Fetching user information for user id: $userID");
|
$this->debug->append("Fetching user information for user id: $userID");
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
id, username, pin, api_key, is_admin, is_anonymous, email,
|
id, username, pin, api_key, is_admin, is_anonymous, email, no_fees,
|
||||||
IFNULL(donate_percent, '0') as donate_percent, coin_address, ap_threshold
|
IFNULL(donate_percent, '0') as donate_percent, coin_address, ap_threshold
|
||||||
FROM $this->table
|
FROM $this->table
|
||||||
WHERE id = ? LIMIT 0,1");
|
WHERE id = ? LIMIT 0,1");
|
||||||
|
|||||||
@ -11,16 +11,19 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
|||||||
|
|
||||||
$aRoundShares = $statistics->getRoundShares();
|
$aRoundShares = $statistics->getRoundShares();
|
||||||
|
|
||||||
// Change account lock
|
switch (@$_POST['do']) {
|
||||||
if (@$_POST['do'] == 'lock') {
|
case 'lock':
|
||||||
$supress_master = 1;
|
$supress_master = 1;
|
||||||
$user->changeLocked($_POST['account_id']);
|
$user->changeLocked($_POST['account_id']);
|
||||||
}
|
break;
|
||||||
|
case 'fee':
|
||||||
// Change account admin
|
$supress_master = 1;
|
||||||
if (@$_POST['do'] == 'admin') {
|
$user->changeNoFee($_POST['account_id']);
|
||||||
|
break;
|
||||||
|
case 'admin':
|
||||||
$supress_master = 1;
|
$supress_master = 1;
|
||||||
$user->changeAdmin($_POST['account_id']);
|
$user->changeAdmin($_POST['account_id']);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (@$_POST['query']) {
|
if (@$_POST['query']) {
|
||||||
|
|||||||
@ -90,7 +90,7 @@ if (@$_SESSION['USERDATA']['id']) {
|
|||||||
// Some estimations
|
// Some estimations
|
||||||
if (@$aRoundShares['valid'] > 0) {
|
if (@$aRoundShares['valid'] > 0) {
|
||||||
$aGlobal['userdata']['est_block'] = round(( (int)$aGlobal['userdata']['shares']['valid'] / (int)$aRoundShares['valid'] ) * (float)$config['reward'], 8);
|
$aGlobal['userdata']['est_block'] = round(( (int)$aGlobal['userdata']['shares']['valid'] / (int)$aRoundShares['valid'] ) * (float)$config['reward'], 8);
|
||||||
$aGlobal['userdata']['est_fee'] = round(((float)$config['fees'] / 100) * (float)$aGlobal['userdata']['est_block'], 8);
|
$aGlobal['userdata']['no_fees'] == 0 ? $aGlobal['userdata']['est_fee'] = round(((float)$config['fees'] / 100) * (float)$aGlobal['userdata']['est_block'], 8) : $aGlobal['userdata']['est_fee'] = 0;
|
||||||
$aGlobal['userdata']['est_donation'] = round((( (float)$aGlobal['userdata']['donate_percent'] / 100) * ((float)$aGlobal['userdata']['est_block'] - (float)$aGlobal['userdata']['est_fee'])), 8);
|
$aGlobal['userdata']['est_donation'] = round((( (float)$aGlobal['userdata']['donate_percent'] / 100) * ((float)$aGlobal['userdata']['est_block'] - (float)$aGlobal['userdata']['est_fee'])), 8);
|
||||||
$aGlobal['userdata']['est_payout'] = round((float)$aGlobal['userdata']['est_block'] - (float)$aGlobal['userdata']['est_donation'] - (float)$aGlobal['userdata']['est_fee'], 8);
|
$aGlobal['userdata']['est_payout'] = round((float)$aGlobal['userdata']['est_block'] - (float)$aGlobal['userdata']['est_donation'] - (float)$aGlobal['userdata']['est_fee'], 8);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,4 +1,11 @@
|
|||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
|
function storeFee(id) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "{$smarty.server.PHP_SELF}",
|
||||||
|
data: "page={$smarty.request.page}&action={$smarty.request.action}&do=fee&account_id=" + id,
|
||||||
|
});
|
||||||
|
}
|
||||||
function storeLock(id) {
|
function storeLock(id) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@ -41,6 +48,7 @@
|
|||||||
<th class="right">Balance </th>
|
<th class="right">Balance </th>
|
||||||
<th class="center">Admin</th>
|
<th class="center">Admin</th>
|
||||||
<th class="center">Locked</th>
|
<th class="center">Locked</th>
|
||||||
|
<th class="center">No Fees</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -65,6 +73,11 @@
|
|||||||
<input type="checkbox" onclick="storeLock({$USERS[user].id})" name="locked[{$USERS[user].id}]" value="1" id="locked[{$USERS[user].id}]" {if $USERS[user].is_locked}checked{/if} />
|
<input type="checkbox" onclick="storeLock({$USERS[user].id})" name="locked[{$USERS[user].id}]" value="1" id="locked[{$USERS[user].id}]" {if $USERS[user].is_locked}checked{/if} />
|
||||||
<label for="locked[{$USERS[user].id}]"></label>
|
<label for="locked[{$USERS[user].id}]"></label>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="center">
|
||||||
|
<input type="hidden" name="nofee[{$USERS[user].id}]" value="0"/>
|
||||||
|
<input type="checkbox" onclick="storeFee({$USERS[user].id})" name="nofee[{$USERS[user].id}]" value="1" id="nofee[{$USERS[user].id}]" {if $USERS[user].no_fees}checked{/if} />
|
||||||
|
<label for="nofee[{$USERS[user].id}]"></label>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{sectionelse}
|
{sectionelse}
|
||||||
<tr>
|
<tr>
|
||||||
@ -85,6 +98,7 @@
|
|||||||
<th class="right">Balance </th>
|
<th class="right">Balance </th>
|
||||||
<th class="center">Admin</th>
|
<th class="center">Admin</th>
|
||||||
<th class="center">Locked</th>
|
<th class="center">Locked</th>
|
||||||
|
<th class="center">No Fees</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{if $GLOBAL.userdata.username|default}
|
{if $GLOBAL.userdata.username|default}
|
||||||
<h2>Welcome, {$smarty.session.USERDATA.username|escape} <font size='1px'><b>{if $GLOBAL.userdata.is_anonymous}Anonymous{else}Active{/if} Account</b>: <b>{$GLOBAL.fees|escape}%</b> Pool Fee</font> <font size='1px'><i>(You are <a href='{$smarty.server.PHP_SELF}?page=account&action=edit'>donating</a> <b></i>{$GLOBAL.userdata.donate_percent|escape}%</b> <i>of your earnings)</i></font></h2>
|
<h2>Welcome, {$smarty.session.USERDATA.username|escape} <font size='1px'><b>{if $GLOBAL.userdata.is_anonymous}Anonymous{else if $GLOBAL.userdata.no_fees}Promo{else}Active{/if} Account</b>: <b>{if $GLOBAL.userdata.no_fees}0{else}{$GLOBAL.fees|escape}{/if}%</b> Pool Fee</font> <font size='1px'><i>(You are <a href='{$smarty.server.PHP_SELF}?page=account&action=edit'>donating</a> <b></i>{$GLOBAL.userdata.donate_percent|escape}%</b> <i>of your earnings)</i></font></h2>
|
||||||
{else}
|
{else}
|
||||||
<h2>Welcome guest, <font size="1px"> please <a href="{$smarty.server.PHP_SELF}?page=register">register</a> to user this pool.</font></h2>
|
<h2>Welcome guest, <font size="1px"> please <a href="{$smarty.server.PHP_SELF}?page=register">register</a> to user this pool.</font></h2>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
1
sql/005_accounts_nofees.sql
Normal file
1
sql/005_accounts_nofees.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE `accounts` ADD `no_fees` BOOLEAN NOT NULL DEFAULT FALSE AFTER `is_anonymous` ;
|
||||||
Loading…
Reference in New Issue
Block a user