Skip to content

Commit

Permalink
[RELEASE] 4.1.1
Browse files Browse the repository at this point in the history
- Fix usage of no longer working API url
  • Loading branch information
pascal20997 committed Nov 22, 2018
1 parent 38902e4 commit f547b86
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 107 deletions.
79 changes: 0 additions & 79 deletions Classes/Configuration/ExtConf.php

This file was deleted.

10 changes: 3 additions & 7 deletions Classes/Hooks/DataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
*/
class tx_avalex_DataHandler
{
/**
* @var string
*/
protected $apiBaseUrl = '';

/**
* Check API keys on save
*
Expand All @@ -41,7 +36,6 @@ public function processDatamap_preProcessFieldArray(
if ($table !== 'tx_avalex_configuration' || !array_key_exists('api_key', $incomingFieldArray)) {
return;
}
$this->apiBaseUrl = tx_avalex_ExtConf::getInstance()->getApiBaseUrl();
if (!$this->checkApiKey($incomingFieldArray['api_key'])) {
// prevent save because key is invalid
unset($incomingFieldArray['api_key']);
Expand All @@ -58,7 +52,9 @@ protected function checkApiKey($apiKey)
{
$isValid = true;
$apiKey = (string)$apiKey;
$response = @file_get_contents($this->apiBaseUrl . 'api_keys/is_configured.json?apikey=' . $apiKey);
$response = @file_get_contents(
tx_avalex_ApiUtility::getApiUrl() . 'api_keys/is_configured.json?apikey=' . $apiKey
);
$responseArray = json_decode($response, true);
if ($responseArray && array_key_exists('message', $responseArray) && $responseArray['message'] === 'OK') {
// API key valid
Expand Down
9 changes: 3 additions & 6 deletions Classes/Task/ImporterTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ public function execute()
{
$this->init();

$apiBaseURL = tx_avalex_ExtConf::getInstance()->getApiBaseUrl();
if (!$apiBaseURL) {
return false;
}

$configurations = $this->avalexConfigurationRepository->findAll();
foreach ($configurations as $configuration) {
$configurationUid = (int)$configuration['uid'];
Expand All @@ -51,7 +46,9 @@ public function execute()
return false;
}

$legalText = @file_get_contents($apiBaseURL . 'datenschutzerklaerung?apikey=' . $apiKey);
$legalText = @file_get_contents(
tx_avalex_ApiUtility::getApiUrl() . 'datenschutzerklaerung?apikey=' . $apiKey
);
if (!$this->checkResponse($legalText)) {
return false;
}
Expand Down
34 changes: 34 additions & 0 deletions Classes/Utility/ApiUtility.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/*
* This file is part of the avalex project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* Class tx_avalex_ApiUtility
*/
class tx_avalex_ApiUtility
{
/**
* @var string
*/
protected static $apiUrl = 'https://avalex.de/';

/**
* Returns the API url with trailing slash
*
* @return string
*/
public static function getApiUrl()
{
return self::$apiUrl;
}
}
2 changes: 1 addition & 1 deletion ext_autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
'tx_avalex_importertask' => $extensionClassesPath . 'Task/ImporterTask.php',
'tx_avalex_datahandler' => $extensionClassesPath . 'Hooks/DataHandler.php',
'tx_avalex_avalexplugin' => $extensionClassesPath . 'AvalexPlugin.php',
'tx_avalex_extconf' => $extensionClassesPath . 'Configuration/ExtConf.php'
'tx_avalex_apiutility' => $extensionClassesPath . 'Utility/ApiUtility.php'
);
3 changes: 0 additions & 3 deletions ext_conf_template.txt

This file was deleted.

22 changes: 11 additions & 11 deletions ext_emconf.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

/***************************************************************
* Extension Manager/Repository config file for ext "avalex".
*
* Auto generated 24-10-2018 14:44
*
* Manual updates:
* Only the data in the array - everything else is removed by next
* writing. "version" and "dependencies" must not be touched!
***************************************************************/
########################################################################
# Extension Manager/Repository config file for ext "avalex".
#
# Auto generated 22-11-2018 09:46
#
# Manual updates:
# Only the data in the array - everything else is removed by next
# writing. "version" and "dependencies" must not be touched!
########################################################################

$EM_CONF[$_EXTKEY] = array(
'title' => 'avalex legacy',
Expand All @@ -21,7 +21,7 @@
'uploadfolder' => '',
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '4.1.0',
'version' => '4.1.1',
'constraints' => array(
'depends' => array(
'typo3' => '4.3.0-6.1.99',
Expand All @@ -34,7 +34,7 @@
),
),
'clearcacheonload' => '',
'_md5_values_when_last_written' => 'a:18:{s:16:"ext_autoload.php";s:4:"6f43";s:21:"ext_conf_template.txt";s:4:"2cd9";s:12:"ext_icon.gif";s:4:"5c06";s:17:"ext_localconf.php";s:4:"886d";s:14:"ext_tables.php";s:4:"87dd";s:14:"ext_tables.sql";s:4:"2c7f";s:24:"Classes/AvalexPlugin.php";s:4:"6f62";s:33:"Classes/Configuration/ExtConf.php";s:4:"05e7";s:48:"Classes/Domain/Repository/AbstractRepository.php";s:4:"7ea2";s:59:"Classes/Domain/Repository/AvalexConfigurationRepository.php";s:4:"e035";s:49:"Classes/Domain/Repository/LegalTextRepository.php";s:4:"a9b0";s:41:"Classes/Exception/InvalidUidException.php";s:4:"d4b5";s:29:"Classes/Hooks/DataHandler.php";s:4:"7e80";s:29:"Classes/Task/ImporterTask.php";s:4:"bf21";s:45:"Configuration/TCA/tx_avalex_configuration.php";s:4:"fc54";s:41:"Configuration/TCA/tx_avalex_legaltext.php";s:4:"e165";s:40:"Resources/Private/Language/locallang.xml";s:4:"9bbb";s:43:"Resources/Private/Language/locallang_db.xml";s:4:"ee7c";}',
'_md5_values_when_last_written' => 'a:17:{s:16:"ext_autoload.php";s:4:"1bc1";s:12:"ext_icon.gif";s:4:"5c06";s:17:"ext_localconf.php";s:4:"886d";s:14:"ext_tables.php";s:4:"87dd";s:14:"ext_tables.sql";s:4:"2c7f";s:24:"Classes/AvalexPlugin.php";s:4:"6f62";s:48:"Classes/Domain/Repository/AbstractRepository.php";s:4:"7ea2";s:59:"Classes/Domain/Repository/AvalexConfigurationRepository.php";s:4:"e035";s:49:"Classes/Domain/Repository/LegalTextRepository.php";s:4:"a9b0";s:41:"Classes/Exception/InvalidUidException.php";s:4:"d4b5";s:29:"Classes/Hooks/DataHandler.php";s:4:"9ccc";s:29:"Classes/Task/ImporterTask.php";s:4:"36fd";s:30:"Classes/Utility/ApiUtility.php";s:4:"da91";s:45:"Configuration/TCA/tx_avalex_configuration.php";s:4:"fc54";s:41:"Configuration/TCA/tx_avalex_legaltext.php";s:4:"e165";s:40:"Resources/Private/Language/locallang.xml";s:4:"9bbb";s:43:"Resources/Private/Language/locallang_db.xml";s:4:"ee7c";}',
);

?>

0 comments on commit f547b86

Please sign in to comment.