Commit ae572c61 authored by Stefan Busemann's avatar Stefan Busemann

Merge branch '229-shutdown-of-geoip-nekudo-com' into 'develop'

Resolve "Shutdown of geoip.nekudo.com"

Closes #229

See merge request !138
parents d24f86e6 649f2e28
Pipeline #6379 passed with stages
in 4 minutes and 3 seconds
......@@ -110,7 +110,10 @@ class SlackUserController extends ActionController
switch ($response['error']) {
case 'already_in_team':
$this->addFlashMessage(
LocalizationUtility::translate('tx_t3oslack.existingAccount', $this->extensionName) . $newSlackUser->getEmail(),
LocalizationUtility::translate(
'tx_t3oslack.existingAccount',
$this->extensionName
) . $newSlackUser->getEmail(),
'',
FlashMessage::WARNING
);
......
......@@ -324,26 +324,31 @@ class FeManagerHooks
*/
protected function getLocationDataByIp()
{
$location = '';
$locationDataAsJson = GeneralUtility::getUrl('http://geoip.nekudo.com/api/' . GeneralUtility::getIndpEnv('REMOTE_ADDR'));
$locationData = json_decode($locationDataAsJson, true);
if (!empty($locationData)) {
if (isset($locationData['type']) && $locationData['type'] === 'error') {
$location = 'Location could not retrieved: ' . $locationData['msg'] . ' with IP: ' . GeneralUtility::getIndpEnv('REMOTE_ADDR');
} else {
if (isset($locationData['country']['name'])) {
$location = $locationData['country']['name'];
}
if (isset($locationData['city']) && $locationData['city']) {
$location .= ', ' . $locationData['city'];
if ($this->settings['ipapi']['access_key']) {
$apiUrl = 'http://api.ipapi.com/' . GeneralUtility::getIndpEnv('REMOTE_ADDR');
$apiUrl .= '?access_key=' . $this->settings['ipapi']['access_key'];
$location = '';
$locationDataAsJson = GeneralUtility::getUrl($apiUrl);
$locationData = json_decode($locationDataAsJson, true);
if (!empty($locationData)) {
if (isset($locationData['type']) && $locationData['type'] === 'error') {
$location = 'Location could not retrieved: ' . $locationData['msg'] . ' with IP: ' . GeneralUtility::getIndpEnv('REMOTE_ADDR');
} else {
if (isset($locationData['country_name'])) {
$location = $locationData['country_name'];
}
if (isset($locationData['city']) && $locationData['city']) {
$location .= ', ' . $locationData['city'];
}
}
} else {
$location = 'Empty result from api.ipapi.com.';
}
} else {
$location = 'Empty result from geoip.nekudo.com/api/.';
}
return $location;
return $location;
}
return 'No Access key is set in typoscript constants - tx_t3omy.ipapi.access_key';
}
}
......@@ -18,6 +18,7 @@ plugin.tx_t3omy {
url =
}
}
ipapi.access_key = {$tx_t3omy.ipapi.access_key}
}
config.tx_realurl_enable = 1
......
......@@ -13,6 +13,12 @@ plugin.tx_femanager.settings.adminName = TYPO3 Association / typo3.org Administr
plugin.tx_femanager.settings.adminEmail = confirm-t3o-account@typo3.org
plugin.tx_femanager.persistence.storagePid = 5
#################
### Settings ###
#################
# cat=T3Omy Settings/ipapi/001; type=string; label = Access Key for api.ipapi.com
tx_t3omy.ipapi.access_key =
###############
### PageIds ###
###############
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment