php-mpos/public/include/pages/api/getblocksfound.inc.php
Sebastian Grewe 98f2a2d61a [FIX] Honor anon flag on API getblocksfound
Fixes #1407 once merged
2014-01-14 17:04:59 +01:00

28 lines
749 B
PHP

<?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']);
// Check how many blocks to fetch
$setting->getValue('statistics_block_count') ? $iLimit = $setting->getValue('statistics_block_count') : $iLimit = 20;
// Fetch latest blocks found, honor anon flag
$aBlocks = $statistics->getBlocksFound($iLimit);
foreach ($aBlocks as $iKey => $aBlockData) {
if ($aBlockData['is_anonymous'] == 1)
$aBlocks[$iKey]['finder'] = 'anonymous';
}
// Output JSON format
echo $api->get_json($aBlocks);
// Supress master template
$supress_master = 1;
?>