Commit fac1ae0d authored by Thomas Löffler's avatar Thomas Löffler

Fixes soap problems due to a php bug

* Refactors a bit
* Changes flashMessage output
* Removes obsolete code and whitespace
parent e015be42
Pipeline #1975 passed with stages
in 1 minute and 32 seconds
......@@ -123,15 +123,18 @@ class RegisterkeyController extends \T3o\TerFe2\Controller\AbstractTerBasedContr
/** @var \T3o\TerFe2\Domain\Model\Extension $extension */
$extension = $this->extensionRepository->findOneByExtKey($extensionKey);
$message = '';
if ($error === 'key_invalid') {
$message = $this->resolveWSErrorMessage($error . '.message');
}
if ($extension instanceof \T3o\TerFe2\Domain\Model\Extension && $extension->getFrontendUser()) {
/** @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $frontendUser */
$frontendUser = $this->userRepository->findOneByUsername($extension->getFrontendUser());
if ($frontendUser instanceof \TYPO3\CMS\Extbase\Domain\Model\FrontendUser) {
$message = $this->resolveWSErrorMessage(
$error . '.message',
array(
[
'<a href="mailto:' . htmlspecialchars($frontendUser->getEmail()) . '">' . htmlspecialchars($frontendUser->getName()) . '</a>'
)
]
);
}
}
......
......@@ -99,13 +99,6 @@ class Soap implements \TYPO3\CMS\Core\SingletonInterface
public function resetConnection()
{
// Create connection
$arrContextOptions = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]);
$this->soapConnection = new \SoapClient($this->wsdlUrl, array(
'trace' => 1,
'exceptions' => (bool)$this->returnExceptions,
......@@ -181,18 +174,19 @@ class Soap implements \TYPO3\CMS\Core\SingletonInterface
*/
public function __call($methodName, array $params = array())
{
// To prevent invalid xml errors in the second request, reset the connection before every request
$this->resetConnection();
// Call given method
$response = $this->soapConnection->__soapCall(
$methodName,
$params,
NULL,
$this->authenticationHeader
);
// Check for errors
if (is_soap_fault($response)) {
throw new \Exception('Could not call function "' . $methodName . '" on soap server');
try {
$response = $this->soapConnection->__soapCall(
$methodName,
$params,
NULL,
$this->authenticationHeader
);
} catch (\SoapFault $soapFault) {
throw new \Exception('Could not call function "' . $methodName . '" on soap server. SoapFault: ' . $soapFault->getMessage());
}
return $this->convertObjectToArray($response);
......
......@@ -257,7 +257,7 @@
<label index="registerkey.error.user_not_found">The given user could not be found.</label>
<label index="registerkey.error.key_not_found">The given extension could not be found.</label>
<label index="registerkey.error.key_invalid.title">Extension key is invalid.</label>
<label index="registerkey.error.key_invalid.message"> Please pay attention to the rules below the form.</label>
<label index="registerkey.error.key_invalid.message">Please pay attention to the rules below the form.</label>
<label index="registerkey.error.key_exists.title">An extension with this key already exists.</label>
<label index="registerkey.error.key_exists.message">You can contact the extension owner: %s</label>
<label index="registerkey.error.result_empty.title">An unknown error occured.</label>
......
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xmlns:f="http://typo3.org/ns/fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<div class="tx_terfe2">
<f:flashMessages as="flashMessages">
<f:if condition="{flashMessages}">
<f:for each="{flashMessages}" as="flashMessage">
<div class="alert {flashMessage.class}" role="alert">
<strong class="fa fa-{flashMessage.iconName}"></strong> {flashMessage.message}
<f:if condition="{flashMessage.title}">
<f:then>
<h4 class="alert-heading"><strong class="fa fa-{flashMessage.iconName}"></strong> {flashMessage.title}</h4>
{flashMessage.message}
</f:then>
<f:else>
<strong class="fa fa-{flashMessage.iconName}"></strong> {flashMessage.message}
</f:else>
</f:if>
</div>
</f:for>
</f:if>
......@@ -12,3 +21,4 @@
<f:render section="main"/>
</div>
</div>
</html>
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