Commit ae572c61 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

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 ...@@ -110,7 +110,10 @@ class SlackUserController extends ActionController
switch ($response['error']) { switch ($response['error']) {
case 'already_in_team': case 'already_in_team':
$this->addFlashMessage( $this->addFlashMessage(
LocalizationUtility::translate('tx_t3oslack.existingAccount', $this->extensionName) . $newSlackUser->getEmail(), LocalizationUtility::translate(
'tx_t3oslack.existingAccount',
$this->extensionName
) . $newSlackUser->getEmail(),
'', '',
FlashMessage::WARNING FlashMessage::WARNING
); );
......
...@@ -324,26 +324,31 @@ class FeManagerHooks ...@@ -324,26 +324,31 @@ class FeManagerHooks
*/ */
protected function getLocationDataByIp() protected function getLocationDataByIp()
{ {
$location = ''; if ($this->settings['ipapi']['access_key']) {
$locationDataAsJson = GeneralUtility::getUrl('http://geoip.nekudo.com/api/' . GeneralUtility::getIndpEnv('REMOTE_ADDR')); $apiUrl = 'http://api.ipapi.com/' . GeneralUtility::getIndpEnv('REMOTE_ADDR');
$locationData = json_decode($locationDataAsJson, true); $apiUrl .= '?access_key=' . $this->settings['ipapi']['access_key'];
$location = '';
if (!empty($locationData)) { $locationDataAsJson = GeneralUtility::getUrl($apiUrl);
if (isset($locationData['type']) && $locationData['type'] === 'error') { $locationData = json_decode($locationDataAsJson, true);
$location = 'Location could not retrieved: ' . $locationData['msg'] . ' with IP: ' . GeneralUtility::getIndpEnv('REMOTE_ADDR');
} else { if (!empty($locationData)) {
if (isset($locationData['country']['name'])) { if (isset($locationData['type']) && $locationData['type'] === 'error') {
$location = $locationData['country']['name']; $location = 'Location could not retrieved: ' . $locationData['msg'] . ' with IP: ' . GeneralUtility::getIndpEnv('REMOTE_ADDR');
} } else {
if (isset($locationData['country_name'])) {
if (isset($locationData['city']) && $locationData['city']) { $location = $locationData['country_name'];
$location .= ', ' . $locationData['city']; }
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 { ...@@ -18,6 +18,7 @@ plugin.tx_t3omy {
url = url =
} }
} }
ipapi.access_key = {$tx_t3omy.ipapi.access_key}
} }
config.tx_realurl_enable = 1 config.tx_realurl_enable = 1
......
...@@ -13,6 +13,12 @@ plugin.tx_femanager.settings.adminName = TYPO3 Association / typo3.org Administr ...@@ -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.settings.adminEmail = confirm-t3o-account@typo3.org
plugin.tx_femanager.persistence.storagePid = 5 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 ### ### 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