From 98f2a2d61ad3f75c28be679d9ef34d5feb5f61c9 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 14 Jan 2014 17:04:59 +0100 Subject: [PATCH] [FIX] Honor anon flag on API getblocksfound Fixes #1407 once merged --- public/include/pages/api/getblocksfound.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/include/pages/api/getblocksfound.inc.php b/public/include/pages/api/getblocksfound.inc.php index f4770278..037fe180 100644 --- a/public/include/pages/api/getblocksfound.inc.php +++ b/public/include/pages/api/getblocksfound.inc.php @@ -12,8 +12,15 @@ $user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUES // 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($statistics->getBlocksFound($iLimit)); +echo $api->get_json($aBlocks); // Supress master template $supress_master = 1;