Merge pull request #1085 from TheSerapher/issue-1079

Issue 1079
This commit is contained in:
Sebastian Grewe 2013-12-23 12:22:13 -08:00
commit ba625e100e
2 changed files with 33 additions and 2 deletions

View File

@ -17,8 +17,7 @@ $data = array(
'username' => $user->getUsername($user_id),
'shares' => $statistics->getUserShares($user_id),
'hashrate' => $statistics->getUserHashrate($user_id),
'sharerate' => $statistics->getUserSharerate($user_id),
'transactions' => $aTransactionSummary
'sharerate' => $statistics->getUserSharerate($user_id)
);
echo $api->get_json($data);

View File

@ -0,0 +1,32 @@
<?php
// Make sure we are called from index.php
if (!defined('SECURITY')) die('Hacking attempt');
// Check if the API is activated
$api->isActive();
// Check user token
$user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']);
// Fetch transactions
if (isset($_REQUEST['limit']) && $_REQUEST['limit'] < 30) {
$limit = $_REQUEST['limit'];
} else {
// Force limit
$limit = 5;
}
$data['transactions'] = $transaction->getTransactions($user_id, NULL, $limit);
// Fetch summary if enabled
if (!$setting->getValue('disable_transactionsummary')) {
$aTransactionSummary = $transaction->getTransactionSummary($_SESSION['USERDATA']['id']);
$data['transactionsummary'] = $aTransactionSummary;
}
// Output JSON format
echo $api->get_json($data);
// Supress master template
$supress_master = 1;
?>