Skip to content

Commit

Permalink
Version preps
Browse files Browse the repository at this point in the history
  • Loading branch information
coastforge-mei committed Sep 16, 2021
1 parent cbb9a77 commit 08bb4b8
Show file tree
Hide file tree
Showing 4 changed files with 1,096 additions and 244 deletions.
22 changes: 12 additions & 10 deletions Classes/C4GUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,11 @@ public static function getKey($settings, $service, $params = '', $getKeyOnly = t
$headers['User-Agent'] = $_SERVER['HTTP_USER_AGENT'];
}
$client = HttpClient::create([
'headers' => $headers
'headers' => $headers,
]);

try {
$response =$client->request('GET', $keySearchUrl, ['timeout' => 2]);
$response = $client->request('GET', $keySearchUrl, ['timeout' => 2]);
$statusCode = $response->getStatusCode();
if ($response && $response->getStatusCode() === 200) {
$response = $response->getContent();
Expand All @@ -455,15 +456,15 @@ public static function getKey($settings, $service, $params = '', $getKeyOnly = t
return $response;
}
}
}
catch (\Exception $exception) {
} catch (\Exception $exception) {
return false;
}
}

return false;
}
public static function getKeys($settings, $arrKeyParams) {
public static function getKeys($settings, $arrKeyParams)
{
if ($settings && $settings->con4gisIoUrl && $settings->con4gisIoKey) {
$hour = date('YmdH', time());

Expand All @@ -486,21 +487,22 @@ public static function getKeys($settings, $arrKeyParams) {
$headers['User-Agent'] = $_SERVER['HTTP_USER_AGENT'];
}
$client = HttpClient::create([
'headers' => $headers
'headers' => $headers,
]);

try {
$response =$client->request('GET', $keySearchUrl, ['timeout' => 2]);
$response = $client->request('GET', $keySearchUrl, ['timeout' => 2]);
$statusCode = $response->getStatusCode();
if ($response && $response->getStatusCode() === 200) {
$response = $response->getContent();
$response = \GuzzleHttp\json_decode($response, true);
foreach ($response as $key => $valueKey) {
\Contao\Session::getInstance()->set('ciokey_' . $arrKeyParams[$key][0] . '_' . $arrKeyParams[$key][1] ? "id=" . $arrKeyParams[$key][1] : '', $hour . '_' . $valueKey['key']);
\Contao\Session::getInstance()->set('ciokey_' . $arrKeyParams[$key][0] . '_' . $arrKeyParams[$key][1] ? 'id=' . $arrKeyParams[$key][1] : '', $hour . '_' . $valueKey['key']);
}

return $response;
}
}
catch (\Exception $exception) {
} catch (\Exception $exception) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/public/dist/js/AlertHandler.js

Large diffs are not rendered by default.

Loading

0 comments on commit 08bb4b8

Please sign in to comment.