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

Merge branch 'develop' into 'redesign-solr-result-list'

# Conflicts:
#   html/typo3conf/ext/ter_fe2/Resources/Private/Layouts/Default.html
#   html/typo3conf/ext/ter_fe2/Resources/Private/Templates/Extension/Show.html
parents 752a2840 ecd868b3
Pipeline #1992 passed with stages
in 1 minute and 24 seconds
......@@ -35,7 +35,8 @@ $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = [
[
'GETvar' => 'tx_terfe2_pi1[controller]',
'valueMap' => [
'Extension' => ''
'Extension' => '',
'Review' => 'security-review'
],
'noMatch' => 'bypass'
],
......@@ -43,7 +44,8 @@ $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'] = [
'GETvar' => 'tx_terfe2_pi1[action]',
'valueMap' => [
'detail' => '',
'download' => 'download'
'download' => 'download',
'update' => 'update'
],
'noMatch' => 'bypass'
],
......
......@@ -88,6 +88,9 @@ class ExtensionController extends \T3o\TerFe2\Controller\AbstractController
$this->versionRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\VersionRepository::class);
$this->authorRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\AuthorRepository::class);
$this->ownerRepository = $this->objectManager->get(\TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository::class);
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
$querySettings->setRespectStoragePage(false);
$this->ownerRepository->setDefaultQuerySettings($querySettings);
$this->providerManager = $this->objectManager->get(\T3o\TerFe2\Provider\ProviderManager::class);
$this->session = $this->objectManager->get(\T3o\TerFe2\Persistence\Session::class);
$this->persistenceManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class);
......
......@@ -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>'
)
]
);
}
}
......
......@@ -31,41 +31,22 @@ namespace T3o\TerFe2\Controller;
class ReviewController extends \T3o\TerFe2\Controller\AbstractTerBasedController
{
/**
* @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager
*/
protected $persistenceManager;
/**
* Initializes the controller
*
* @return void
*/
protected function initializeController()
{
$this->persistenceManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class);
}
/**
* Set unsecure flag of all given versions
*
* @param \T3o\TerFe2\Domain\Model\Extension $extension The extension to update
* @param mixed $insecureVersions Version UIDs or empty string of no version was selected
* @param array $insecureVersions Version UIDs or empty string of no version was selected
* @return void
*/
public function updateAction(\T3o\TerFe2\Domain\Model\Extension $extension, $insecureVersions)
public function updateAction(\T3o\TerFe2\Domain\Model\Extension $extension, array $insecureVersions)
{
$insecureVersions = (is_array($insecureVersions) ? $insecureVersions : array());
$extensionKey = $extension->getExtKey();
$actionParameters = ['extension' => $extension];
$versions = $extension->getVersions();
$persist = FALSE;
$versionChanged = false;
$versionRepository = $this->objectManager->get(\T3o\TerFe2\Domain\Repository\VersionRepository::class);
foreach ($versions as $version) {
$versionString = $version->getVersionString();
$actionParameters = array('extension' => $extension);
/** @var \T3o\TerFe2\Domain\Model\Version $version */
$reviewState = 0;
if (in_array($version->getUid(), $insecureVersions)) {
$reviewState = -1;
......@@ -76,17 +57,17 @@ class ReviewController extends \T3o\TerFe2\Controller\AbstractTerBasedController
}
$error = '';
if ($this->terConnection->setReviewState($extensionKey, $versionString, $reviewState, $error)) {
if ($this->terConnection->setReviewState($extension->getExtKey(), $version->getVersionString(), $reviewState, $error)) {
$version->setReviewState($reviewState);
$persist = TRUE;
$versionChanged = true;
$versionRepository->update($version);
} else {
$message = $this->translate('msg.reviewstate_not_enabled', array($versionString, $error));
$message = $this->translate('msg.reviewstate_not_enabled', [$version->getVersionString(), $error]);
$this->redirectWithMessage($message, 'show', '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, 'Extension', NULL, $actionParameters);
}
}
if ($persist) {
$this->persistenceManager->persistAll();
if ($versionChanged) {
$this->redirectWithMessage($this->translate('msg.reviewstate_enabled'), 'show', '', \TYPO3\CMS\Core\Messaging\FlashMessage::OK, 'Extension', NULL, $actionParameters);
}
......
......@@ -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);
......
......@@ -62,7 +62,7 @@ class CropViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
if (isset($GLOBALS['LANG'])) {
$languageObject = $GLOBALS['LANG'];
} else {
$languageObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('language');
$languageObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Lang\LanguageService::class);
$languageObject->init('en');
}
......
......@@ -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>
......
<div class="container">
<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}
</div>
</f:for>
</f:if>
</f:flashMessages>
<div class="tx_terfe2_content">
<f:render section="main"/>
</div>
<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">
<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>
</f:flashMessages>
<div class="tx_terfe2_content">
<f:render section="main"/>
</div>
</div>
</html>
......@@ -7,10 +7,6 @@
<dd><f:format.date format="%d. %b %Y">{extension.crdate}</f:format.date></dd>
<dt><f:translate key="downloads" /></dt>
<dd><f:format.number decimals="0" thousandsSeparator="," decimalSeparator=".">{extension.downloads}</f:format.number></dd>
<f:security.ifHasRole role="{settings.reviewerGroupUid}">
<dt>Owner:</dt>
<dd>Name: {owner.name}<br />Email: {owner.email}<br />Username: {owner.username}</dd>
</f:security.ifHasRole>
<dt><f:translate key="category" /></dt>
<dd>
<f:if condition="{extension.lastVersion.emCategory}">
......
......@@ -41,7 +41,9 @@
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}"
class="btn btn-primary">
<f:translate key="download_zip" />
<strong>
<f:translate key="download_zip" />
</strong>
</f:link.action>
</f:then>
<f:else>
......@@ -51,7 +53,9 @@
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
class="ter-download-icon ter-download-icon-zip"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}">
<f:translate key="download_zip" />
<strong>
<f:translate key="download_zip" />
</strong>
</f:link.action>
</f:then>
</f:security.ifHasRole>
......@@ -62,7 +66,7 @@
</f:for>
</tbody>
</table>
<button type="button" class="btn btn-primary">Mark as insecure</button>
<button type="button" class="btn btn-primary"><strong>Mark as insecure</strong></button>
</f:form>
</f:then>
<f:else>
......@@ -101,7 +105,9 @@
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}"
class="btn btn-primary">
<f:translate key="download_zip" />
<strong>
<f:translate key="download_zip" />
</strong>
</f:link.action>
</f:then>
<f:else>
......@@ -111,7 +117,9 @@
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
class="ter-download-icon ter-download-icon-zip"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}">
<f:translate key="download_zip" />
<strong>
<f:translate key="download_zip" />
</strong>
</f:link.action>
</f:then>
</f:security.ifHasRole>
......
......@@ -3,7 +3,7 @@
<h5>Works with TYPO3</h5>
<ul class="list-inline">
<f:for each="{version.matrixOfSupportedTypo3Versions}" key="label" as="supported">
<li class="list-inline-item btn btn-{f:if(condition:'{supported}',then:'success',else:'secondary')}">{label}</li>
<li class="list-inline-item btn btn-{f:if(condition:'{supported}',then:'success',else:'secondary')}"><strong>{label}</strong></li>
</f:for>
</ul>
</f:if>
......
......@@ -7,6 +7,23 @@
<f:if condition="{extension}">
<f:then>
<tl:titleTag>{extension.lastVersion.title} ({extension.extKey})</tl:titleTag>
<f:security.ifHasRole role="{settings.reviewerGroupUid}">
<div class="alert alert-info mb-3" role="alert">
<div class="media">
<f:format.raw>
<tl:gravatar emailAddress="{owner.email}" size="125" />
</f:format.raw>
<div class="media-body ml-5">
<h4>Owner of this extension</h4>
<p>
<strong>Name:</strong> {owner.name}<br>
<strong>Email:</strong> <f:link.email email="{owner.email}">{owner.email}</f:link.email><br>
<strong>Username:</strong> {owner.username}
</p>
</div>
</div>
</div>
</f:security.ifHasRole>
<f:if condition="{extension.lastVersion.reviewState} == -2">
<div class="alert alert-warning mt-3 mb-3" role="alert">
<h4 class="alert-header">
......@@ -33,7 +50,7 @@
<div class="col-md-3">
<f:if condition="{extension.lastVersion.reviewState} != -1">
<f:link.action class="btn btn-primary btn-lg pull-right" controller="Extension" action="download" arguments="{extension : extension, versionString : extension.lastVersion.versionString, format : 'zip'}">
Download {extension.lastVersion.versionString}
<strong>Download {extension.lastVersion.versionString}</strong>
</f:link.action>
</f:if>
</div>
......@@ -47,7 +64,7 @@
<h3>Tags</h3>
<p class="tags">
<f:for each="{extension.tags}" as="tag">
<f:link.page class="btn btn-info mb-1" pageUid="{settings.pages.searchResultsPid}" additionalParams="{tx_solr: {filter: {0: 'tags:{tag.title}'}}}">#{tag.title}</f:link.page>
<f:link.page class="btn btn-info mb-1" pageUid="{settings.pages.searchResultsPid}" additionalParams="{tx_solr: {filter: {0: 'tags:{tag.title}'}}}"><strong>#{tag.title}</strong></f:link.page>
</f:for>
</p>
</f:if>
......@@ -90,7 +107,9 @@
<div class="socialshareprivacy"></div>
<f:link.page pageUid="1" class="btn btn-success mb-3">
<f:translate key="back_to_extension_list" />
<strong>
<f:translate key="back_to_extension_list" />
</strong>
</f:link.page>
</f:then>
<f:else>
......
......@@ -40,17 +40,17 @@
</f:comment>
<h5>Works with TYPO3</h5>
<ul class="list-inline">
<li class="list-inline-item btn btn-{f:if(condition:'{document.supports6_boolS}',then:'success',else:'secondary')}">6.2 LTS</li>
<li class="list-inline-item btn btn-{f:if(condition:'{document.supports7_boolS}',then:'success',else:'secondary')}">7 LTS</li>
<li class="list-inline-item btn btn-{f:if(condition:'{document.supports8_boolS}',then:'success',else:'secondary')}">8 LTS</li>
<li class="list-inline-item btn btn-{f:if(condition:'{document.supports9_boolS}',then:'success',else:'secondary')}">9</li>
<li class="list-inline-item btn btn-{f:if(condition:'{document.supports6_boolS}',then:'success',else:'secondary')}"><strong>6.2 LTS</strong></li>
<li class="list-inline-item btn btn-{f:if(condition:'{document.supports7_boolS}',then:'success',else:'secondary')}"><strong>7 LTS</strong></li>
<li class="list-inline-item btn btn-{f:if(condition:'{document.supports8_boolS}',then:'success',else:'secondary')}"><strong>8 LTS</strong></li>
<li class="list-inline-item btn btn-{f:if(condition:'{document.supports9_boolS}',then:'success',else:'secondary')}"><strong>9</strong></li>
</ul>
</div>
</div>
<div class="">
<a class="btn btn-primary btn-block btn-lg" href="{document.extensionDownloadZipUrl_stringS}">
<i class="fa fa-download"></i>
Download version {document.extensionVersion_stringS} as ZIP
<strong>Download version {document.extensionVersion_stringS} as ZIP</strong>
</a>
</div>
</li>
......
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