Skip to content
Snippets Groups Projects
Commit 2a89e47f authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

Merge remote-tracking branch 'origin/master' into task_RemovePageBrowser

parents ddfcf789 3c94d831
No related branches found
No related tags found
1 merge request!33[BUGFIX] Fix totally broken page browser implementation, Cleanup code / Remove...
......@@ -26,7 +26,6 @@ namespace SGalinski\SgNews\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\SgNews\Service\LicensingService;
use SGalinski\SgNews\Utility\BackendNewsUtility;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
......@@ -114,17 +113,11 @@ class BackendController extends ActionController {
$backendUser->pushModuleData('tools_beuser/index.php/web_SgNewsNews_' . $key, $menuSetting);
}
$currentLanguageInfo = NULL;
if (!LicensingService::checkKey()) {
$this->view->assign('showLicenseBanner', TRUE);
} else {
$this->language = $backendUser->getModuleData(
'tools_beuser/index.php/web_SgNewsNews_language', 'ses'
) ?: 0;
$languageOptions = BackendNewsUtility::getAvailableLanguages($this->pageUid);
$currentLanguageInfo = $languageOptions[$this->language] ?? NULL;
}
$this->language = $backendUser->getModuleData(
'tools_beuser/index.php/web_SgNewsNews_language', 'ses'
) ?: 0;
$languageOptions = BackendNewsUtility::getAvailableLanguages($this->pageUid);
$currentLanguageInfo = $languageOptions[$this->language] ?? NULL;
$this->docHeaderComponent->setMetaInformation($this->pageInfo);
$this->makeButtons();
......@@ -223,9 +216,6 @@ class BackendController extends ActionController {
* @throws \InvalidArgumentException
*/
private function makeLanguageMenu() {
if (!LicensingService::checkKey()) {
return;
}
$languageMenu = $this->docHeaderComponent->getMenuRegistry()->makeMenu();
$languageMenu->setIdentifier('languageMenu');
$languages = BackendNewsUtility::getAvailableLanguages($this->pageUid);
......
......@@ -25,7 +25,6 @@ namespace SGalinski\SgNews\Hooks;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\SgNews\Service\LicensingService;
use SGalinski\SgNews\Utility\BackendNewsUtility;
use TYPO3\CMS\Backend\Controller\PageLayoutController as CorePageLayoutController;
use TYPO3\CMS\Backend\Utility\BackendUtility;
......@@ -50,9 +49,6 @@ class PageLayoutController {
*/
public function addNewsModuleLink(array $parameters = [], $controller): string {
$out = '';
if (!(int) $controller->id || !LicensingService::checkKey()) {
return $out;
}
$pageRow = BackendUtility::getRecord('pages', $controller->id);
$acceptedDoktypes = [BackendNewsUtility::NEWS_DOKTYPE, BackendNewsUtility::CATEGORY_DOKTYPE];
if (
......
<?php
namespace SGalinski\SgNews\Service;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use SGalinski\SgNews\Utility\ExtensionUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Http\NullResponse;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Class SGalinski\SgNews\Service\LicensingService
*/
class LicensingService {
/**
* Licensing Service Url
*/
const URL = 'https://www.sgalinski.de/?eID=sgLicensing';
/**
* Licensing Service Url
*/
const EXTENSION_KEY = 'sg_news';
/** @var bool|NULL */
private static $isLicenseKeyValid;
/**
* @return boolean
*/
public static function checkKey(): bool {
if (static::$isLicenseKeyValid === NULL) {
static::$isLicenseKeyValid = FALSE;
$configuration = $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][self::EXTENSION_KEY] ?? [];
if (isset($configuration['key']) && $key = trim($configuration['key'])) {
static::$isLicenseKeyValid = (bool) preg_match('/^([A-Z\d]{6}-?){4}$/', $key);
}
}
return static::$isLicenseKeyValid;
}
/**
* Licensing Service ping
*
* @param boolean $returnUrl
* @return string
*/
public static function ping($returnUrl = FALSE): string {
try {
$configuration = $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS'][self::EXTENSION_KEY] ?? [];
$key = '';
if (isset($configuration['key'])) {
$key = trim($configuration['key']);
}
$params = [
'extension' => self::EXTENSION_KEY,
'host' => GeneralUtility::getIndpEnv('HTTP_HOST'),
'key' => $key
];
$params = http_build_query($params);
$pingUrl = self::URL;
$pingUrl .= $params !== '' ? (strpos($pingUrl, '?') === FALSE ? '?' : '&') . $params : '';
if ($returnUrl) {
return $pingUrl;
}
GeneralUtility::getUrl($pingUrl);
} catch (\Exception $exception) {
}
return '';
}
/**
* Generates a random password string based on the configured password policies.
*
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @return ResponseInterface
* @throws \InvalidArgumentException
*/
public function ajaxPing(ServerRequestInterface $request, ResponseInterface $response = NULL): ResponseInterface {
/** @var BackendUserAuthentication $backendUser */
$backendUser = $GLOBALS['BE_USER'];
if ($backendUser && !$backendUser->getModuleData('tools_beuser/index.php/web_SgNewsNews_pinged', 'ses')) {
$backendUser->pushModuleData('tools_beuser/index.php/web_SgNewsNews_pinged', TRUE);
self::ping();
}
return $response ?? new NullResponse();
}
}
......@@ -26,7 +26,6 @@ namespace SGalinski\SgNews\ViewHelpers\Backend;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\SgNews\Service\LicensingService;
use SGalinski\SgNews\ViewHelpers\AbstractViewHelper;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Imaging\Icon;
......@@ -82,7 +81,7 @@ class ControlViewHelper extends AbstractViewHelper {
}
$out = $databaseRecordList->makeControl($table, $row);
if ($table === 'pages' && LicensingService::checkKey()) {
if ($table === 'pages') {
/** @var IconFactory $iconFactory */
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$buttonLabel = LocalizationUtility::translate('backend.button.editPageContent', 'SgNews');
......
......@@ -26,7 +26,6 @@ namespace SGalinski\SgNews\ViewHelpers\Backend;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\SgNews\Service\LicensingService;
use SGalinski\SgNews\Utility\BackendNewsUtility;
use SGalinski\SgNews\ViewHelpers\AbstractViewHelper;
use TYPO3\CMS\Backend\Routing\UriBuilder;
......@@ -63,9 +62,6 @@ class TranslationLinksViewHelper extends AbstractViewHelper {
$table = $this->arguments['table'];
$pageUid = $this->arguments['pageUid'];
$out = '';
if (!LicensingService::checkKey()) {
return $out;
}
$table = trim($table);
if ($table !== 'pages' && !isset($GLOBALS['TCA'][$table]['ctrl']['languageField'])) {
......
<?php
return [
'sg_news::ajaxPing' => [
'path' => '/sg_news/ajaxPing',
'target' => SGalinski\SgNews\Service\LicensingService::class . '::ajaxPing',
]
];
......@@ -43,9 +43,6 @@
</div>
<div id="typo3-docbody">
<div id="typo3-inner-docbody">
<f:if condition="{showLicenseBanner}">
<f:render partial="Backend/LicenseBanner" />
</f:if>
<h1>
<f:render section="headline" />
</h1>
......
<div class="bannerContainer">
<div class="row">
<div class="col-xs-12">
<div class="panel panel-info">
<div class="panel-heading">
<f:image width="150" height="33" src="{f:uri.resource(path: 'Images/logo.svg')}" />
| <span><f:translate key="backend.licenceBannerTitle"/></span>
</div>
<div class="panel-body">
<f:format.raw>
<f:translate key="backend.licenceBannerText"/>
</f:format.raw>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -31,7 +31,6 @@ define([
var SgNewsModule = {
init: function() {
$.get(TYPO3.settings.ajaxUrls['sg_news::ajaxPing']);
$('#filter-reset-btn').on('click', function(event) {
event.preventDefault();
this.form.reset();
......
......@@ -6,7 +6,7 @@
"license": [
"GPL-2.0-or-later"
],
"version": "9.3.4",
"version": "9.3.7",
"support": {
},
"repositories": [
......
......@@ -19,7 +19,7 @@ $EM_CONF['sg_news'] = [
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'lockType' => '',
'version' => '9.3.4',
'version' => '9.3.7',
'constraints' => [
'depends' => [
'typo3' => '9.5.0-10.4.99',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment