diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 53bd8bb664..e7f12088df 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -760,11 +760,11 @@ App::get('/v1/account/logs') $record = $geodb->get($log['ip']); if ($record) { - $output[$i]['countryCode'] = \strtolower($record['country']['iso_code']); - $output[$i]['countryCode'] = (isset($countries[$record['country']['iso_code']])) ? $countries[$record['country']['iso_code']] : $locale->getText('locale.country.unknown'); + $output[$i]['countryCode'] = (isset($countries[$record['country']['iso_code']])) ? \strtolower($record['country']['iso_code']) : '--'; + $output[$i]['countryName'] = (isset($countries[$record['country']['iso_code']])) ? $countries[$record['country']['iso_code']] : $locale->getText('locale.country.unknown'); } else { $output[$i]['countryCode'] = '--'; - $output[$i]['countryCode'] = $locale->getText('locale.country.unknown'); + $output[$i]['countryName'] = $locale->getText('locale.country.unknown'); } } diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index a0f8fcebd8..cf84053044 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -286,8 +286,8 @@ App::get('/v1/users/:userId/logs') $record = $geodb->get($log['ip']); - if($record){ - $output[$i]['countryCode'] = \strtolower($record['country']['iso_code']); + if ($record) { + $output[$i]['countryCode'] = (isset($countries[$record['country']['iso_code']])) ? \strtolower($record['country']['iso_code']) : '--'; $output[$i]['countryName'] = (isset($countries[$record['country']['iso_code']])) ? $countries[$record['country']['iso_code']] : $locale->getText('locale.country.unknown'); } else { $output[$i]['countryCode'] = '--';