commit
152db4b831
@ -130,6 +130,7 @@ class Transaction {
|
||||
|
||||
/**
|
||||
* Get total balance for all users locked in wallet
|
||||
* This includes any outstanding unconfirmed transactions!
|
||||
* @param none
|
||||
* @return data double Amount locked for users
|
||||
**/
|
||||
@ -141,9 +142,7 @@ class Transaction {
|
||||
(
|
||||
SELECT sum(t.amount) AS credit
|
||||
FROM $this->table AS t
|
||||
LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id
|
||||
WHERE t.type = 'Credit'
|
||||
AND b.confirmations >= ?
|
||||
) AS t1,
|
||||
(
|
||||
SELECT sum(t.amount) AS debit
|
||||
@ -152,12 +151,10 @@ class Transaction {
|
||||
) AS t2,
|
||||
(
|
||||
SELECT sum(t.amount) AS other
|
||||
FROM transactions AS t
|
||||
LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id
|
||||
FROM " . $this->table . " AS t
|
||||
WHERE t.type IN ('Donation','Fee')
|
||||
AND b.confirmations >= ?
|
||||
) AS t3");
|
||||
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $this->config['confirmations'], $this->config['confirmations']) && $stmt->execute() && $stmt->bind_result($dBalance) && $stmt->fetch())
|
||||
if ($this->checkStmt($stmt) && $stmt->execute() && $stmt->bind_result($dBalance) && $stmt->fetch())
|
||||
return $dBalance;
|
||||
// Catchall
|
||||
$this->setErrorMessage('Unable to find locked credits for all users');
|
||||
|
||||
25
public/include/pages/admin/wallet.inc.php
Normal file
25
public/include/pages/admin/wallet.inc.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
// Make sure we are called from index.php
|
||||
if (!defined('SECURITY'))
|
||||
die('Hacking attempt');
|
||||
|
||||
// Check user to ensure they are admin
|
||||
if (!$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
||||
header("HTTP/1.1 404 Page not found");
|
||||
die();
|
||||
}
|
||||
|
||||
if ($bitcoin->can_connect() === true){
|
||||
$dBalance = $bitcoin->query('getbalance');
|
||||
} else {
|
||||
$dBalance = 0;
|
||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to litecoind RPC service: ' . $bitcoin->can_connect(), 'TYPE' => 'errormsg');
|
||||
}
|
||||
|
||||
$smarty->assign("BALANCE", $dBalance);
|
||||
$smarty->assign("LOCKED", $transaction->getLockedBalance());
|
||||
|
||||
// Tempalte specifics
|
||||
$smarty->assign("CONTENT", "default.tpl");
|
||||
?>
|
||||
16
public/templates/mmcFE/admin/wallet/default.tpl
Normal file
16
public/templates/mmcFE/admin/wallet/default.tpl
Normal file
@ -0,0 +1,16 @@
|
||||
{include file="global/block_header.tpl" BLOCK_HEADER="Wallet Information"}
|
||||
<table width="350px">
|
||||
<tr>
|
||||
<th>Wallet Balance</th>
|
||||
<td class="right">{$BALANCE|number_format:"8"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Locked for users</th>
|
||||
<td class="right">{$LOCKED|number_format:"8"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Liquid Assets</th>
|
||||
<td class="right">{($BALANCE - $LOCKED)|number_format:"8"}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{include file="global/block_footer.tpl"}
|
||||
@ -14,6 +14,7 @@
|
||||
<li><a href="{$smarty.server.PHP_SELF}?page=admin">Admin Panel</a>
|
||||
<ul>
|
||||
<li><a href="{$smarty.server.PHP_SELF}?page=admin&action=user">User Info</a></li>
|
||||
<li><a href="{$smarty.server.PHP_SELF}?page=admin&action=wallet">Wallet Info</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{/if}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user