Commit c384ce07 authored by Christian Kuhn's avatar Christian Kuhn Committed by Wouter Wolters
Browse files

[TASK] CGL fixes after upgrade to php-cs-fixer 1.4

Change a series of cgl details after update of php-cs-fixer
from 1.0 to 1.4.

Change-Id: Iba289f530e2df2c6fc73e5f5b705a673b4b3db0f
Resolves: #82171
Related: #82164
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/53776


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent 2798e522
<?php
namespace TYPO3\CMS\Backend\Backend\Avatar;
/*
......@@ -53,9 +54,10 @@ class Avatar
}
$cacheId = 'avatar_' . md5(
$backendUser['uid'] . '/' .
(string)$size . '/' .
(string)$showIcon);
$backendUser['uid'] . '/' .
(string)$size . '/' .
(string)$showIcon
);
$avatar = static::getCache()->get($cacheId);
......@@ -142,10 +144,19 @@ class Avatar
$providers = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['avatarProviders'];
foreach ($providers as $identifier => $configuration) {
if (empty($configuration) || !is_array($configuration)) {
throw new \RuntimeException('Missing configuration for avatar provider "' . $identifier . '".', 1439317801);
throw new \RuntimeException(
'Missing configuration for avatar provider "' . $identifier . '".',
1439317801
);
}
if (!is_string($configuration['provider']) || empty($configuration['provider']) || !class_exists($configuration['provider']) || !is_subclass_of($configuration['provider'], AvatarProviderInterface::class)) {
throw new \RuntimeException('The avatar provider "' . $identifier . '" defines an invalid provider. Ensure the class exists and implements the "' . AvatarProviderInterface::class . '".', 1439317802);
if (!is_string($configuration['provider']) || empty($configuration['provider']) || !class_exists($configuration['provider']) || !is_subclass_of(
$configuration['provider'],
AvatarProviderInterface::class
)) {
throw new \RuntimeException(
'The avatar provider "' . $identifier . '" defines an invalid provider. Ensure the class exists and implements the "' . AvatarProviderInterface::class . '".',
1439317802
);
}
}
......
......@@ -381,8 +381,12 @@ class Clipboard
$thumb = [];
$folder = $fileObject instanceof \TYPO3\CMS\Core\Resource\Folder;
$size = $folder ? '' : '(' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes)';
if (!$folder && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
$fileObject->getExtension())
if (
!$folder
&& GeneralUtility::inList(
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
$fileObject->getExtension()
)
) {
$thumb = [
'image' => $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, []),
......@@ -390,10 +394,14 @@ class Clipboard
];
}
$lines[] = [
'icon' => '<span title="' . htmlspecialchars($fileObject->getName() . ' ' . $size) . '">' . $this->iconFactory->getIconForResource($fileObject,
Icon::SIZE_SMALL)->render() . '</span>',
'title' => $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getName(),
$this->getBackendUser()->uc['titleLen'])), $fileObject->getName()),
'icon' => '<span title="' . htmlspecialchars($fileObject->getName() . ' ' . $size) . '">' . $this->iconFactory->getIconForResource(
$fileObject,
Icon::SIZE_SMALL
)->render() . '</span>',
'title' => $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs(
$fileObject->getName(),
$this->getBackendUser()->uc['titleLen']
)), $fileObject->getName()),
'thumb' => $thumb,
'infoLink' => htmlspecialchars('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($v) . '); return false;'),
'removeLink' => $this->removeUrl('_FILE', GeneralUtility::shortMD5($v))
......@@ -408,10 +416,15 @@ class Clipboard
$rec = BackendUtility::getRecordWSOL($table, $uid);
if (is_array($rec)) {
$lines[] = [
'icon' => $this->linkItemText($this->iconFactory->getIconForRecord($table, $rec,
Icon::SIZE_SMALL)->render(), $rec, $table),
'title' => $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table,
$rec), $this->getBackendUser()->uc['titleLen'])), $rec, $table),
'icon' => $this->linkItemText($this->iconFactory->getIconForRecord(
$table,
$rec,
Icon::SIZE_SMALL
)->render(), $rec, $table),
'title' => $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle(
$table,
$rec
), $this->getBackendUser()->uc['titleLen'])), $rec, $table),
'infoLink' => htmlspecialchars('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', \'' . (int)$uid . '\'); return false;'),
'removeLink' => $this->removeUrl($table, $uid)
];
......
......@@ -145,7 +145,7 @@ class ElementHistoryController extends AbstractModule
->setFieldName('history_log');
$buttonBar->addButton($helpButton);
// Get returnUrl parameter
// Get returnUrl parameter
$returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
if ($returnUrl) {
$backButton = $buttonBar->makeLinkButton()
......
......@@ -273,14 +273,13 @@ class NewContentElementController extends AbstractModule
$icon = $this->moduleTemplate->getIconFactory()->getIcon($wInfo['iconIdentifier'])->render();
$this->menuItemView->assignMultiple([
'onClickEvent' => $this->onClickEvent,
'aOnClick' => $aOnClick,
'wizardInformation' => $wInfo,
'icon' => $icon,
'wizardOnClick' => $wizardOnClick,
'wizardKey' => $wizardKey
]
);
'onClickEvent' => $this->onClickEvent,
'aOnClick' => $aOnClick,
'wizardInformation' => $wInfo,
'icon' => $icon,
'wizardOnClick' => $wizardOnClick,
'wizardKey' => $wizardKey
]);
$menuItems[$key]['content'] .= $this->menuItemView->render();
$cc++;
}
......
......@@ -655,8 +655,8 @@ class EditDocumentController extends AbstractModule
} else {
$relatedPageId = -$nRec['uid'];
}
// Determine related page ID for workspace context
} else {
// Determine related page ID for workspace context
if ($insertRecordOnTop) {
// Fetch live version of workspace version since the pid value is always -1 in workspaces
$liveRecord = BackendUtility::getRecord($nTable, $nRec['t3ver_oid'], $recordFields);
......
......@@ -109,9 +109,11 @@ class RenameFileController extends AbstractModule
$parsedUrl = parse_url($this->returnUrl);
$queryParts = GeneralUtility::explodeUrl2Array(urldecode($parsedUrl['query']));
if ($queryParts['id'] === $this->fileOrFolderObject->getCombinedIdentifier()) {
$this->returnUrl = str_replace(urlencode($queryParts['id']),
$this->returnUrl = str_replace(
urlencode($queryParts['id']),
urlencode($this->fileOrFolderObject->getStorage()->getRootLevelFolder()->getCombinedIdentifier()),
$this->returnUrl);
$this->returnUrl
);
}
}
......
......@@ -106,7 +106,8 @@ class FormFlexAjaxController extends AbstractFormEngineAjaxController
['lDEF'][$flexFormFieldName]
['el'][$flexFormContainerIdentifier][$flexFormContainerName]['el']
)
&& is_array($formData['databaseRow'][$fieldName]
&& is_array(
$formData['databaseRow'][$fieldName]
['data'][$flexFormSheetName]
['lDEF'][$flexFormFieldName]
['el'][$flexFormContainerIdentifier][$flexFormContainerName]['el']
......
......@@ -331,8 +331,8 @@ class FormInlineAjaxController extends AbstractFormEngineAjaxController
'language' => $parentLanguage,
'ids' => [$type],
];
// Either localize or synchronize all child elements from default language of the parent element
} else {
// Either localize or synchronize all child elements from default language of the parent element
$cmd[$parent['table']][$parent['uid']]['inlineLocalizeSynchronize'] = [
'field' => $parent['field'],
'language' => $parentLanguage,
......
......@@ -344,10 +344,18 @@ class PageLayoutController
)
)
)
->groupBy('pages_language_overlay.sys_language_uid', 'sys_language.uid', 'sys_language.pid',
'sys_language.tstamp', 'sys_language.hidden', 'sys_language.title',
'sys_language.language_isocode', 'sys_language.static_lang_isocode', 'sys_language.flag',
'sys_language.sorting')
->groupBy(
'pages_language_overlay.sys_language_uid',
'sys_language.uid',
'sys_language.pid',
'sys_language.tstamp',
'sys_language.hidden',
'sys_language.title',
'sys_language.language_isocode',
'sys_language.static_lang_isocode',
'sys_language.flag',
'sys_language.sorting'
)
->orderBy('sys_language.sorting');
if (!$this->getBackendUser()->isAdmin()) {
$queryBuilder->andWhere(
......
......@@ -121,7 +121,8 @@ class EditController extends AbstractWizardController
HttpUtility::redirect($url);
} elseif (is_array($config)
&& $this->P['currentSelectedValues']
&& ($config['type'] === 'select'
&& (
$config['type'] === 'select'
&& $config['foreign_table']
|| $config['type'] === 'group'
&& $config['internal_type'] === 'db'
......
......@@ -61,8 +61,10 @@ class FileThumbnails extends AbstractNode
$fileObject = $fileFactory->getFileObject($uidOrPath);
if (!$fileObject->isMissing()) {
$extension = $fileObject->getExtension();
if (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
$extension)
if (GeneralUtility::inList(
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
$extension
)
) {
$thumbnailsHtml[] = '<li>';
$thumbnailsHtml[] = '<span class="thumbnail">';
......@@ -93,8 +95,13 @@ class FileThumbnails extends AbstractNode
. '</li>';
} catch (\Exception $exception) {
$message = $exception->getMessage();
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $message, '',
FlashMessage::ERROR, true);
$flashMessage = GeneralUtility::makeInstance(
FlashMessage::class,
$message,
'',
FlashMessage::ERROR,
true
);
$flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
$defaultFlashMessageQueue->enqueue($flashMessage);
......
......@@ -137,7 +137,9 @@ class OtherLanguageContent extends AbstractNode
$field,
'',
'',
$config['config']['uploadfolder'], 0, ' align="middle"'
$config['config']['uploadfolder'],
0,
' align="middle"'
) .
($absFilePath ? BackendUtility::wrapClickMenuOnIcon($fileIcon, $absFilePath, 0) : $fileIcon) .
$imgPath .
......
......@@ -1034,8 +1034,8 @@ abstract class AbstractItemProvider
// Use pid from parent page clause if in flex form context
if (!empty($result['flexParentDatabaseRow']['pid'])) {
$effectivePid = $result['flexParentDatabaseRow']['pid'];
// Use pid from database row if in inline context
} elseif (!$effectivePid && !empty($result['databaseRow']['pid'])) {
// Use pid from database row if in inline context
$effectivePid = $result['databaseRow']['pid'];
}
}
......
......@@ -176,7 +176,8 @@ class DatabaseRowInitializeNew implements FormDataProviderInterface
}
$selectorFieldName = $result['inlineParentConfig']['foreign_selector'];
if (!isset($result['processedTca']['columns'][$selectorFieldName]['config']['type'])
|| ($result['processedTca']['columns'][$selectorFieldName]['config']['type'] !== 'select'
|| (
$result['processedTca']['columns'][$selectorFieldName]['config']['type'] !== 'select'
&& $result['processedTca']['columns'][$selectorFieldName]['config']['type'] !== 'group'
)
) {
......
......@@ -481,9 +481,8 @@ class TcaFlexProcess implements FormDataProviderInterface
['sheets'][$dataStructureSheetName]['ROOT']['el']
[$dataStructureFieldName]['children'] = [];
}
// A "normal" TCA flex form element, no section
} else {
// A "normal" TCA flex form element, no section
if (isset($dataValues['data'][$dataStructureSheetName]['lDEF'][$dataStructureFieldName])
&& array_key_exists('vDEF', $dataValues['data'][$dataStructureSheetName]['lDEF'][$dataStructureFieldName])
) {
......
......@@ -49,7 +49,9 @@ class TcaGroup implements FormDataProviderInterface
// Sanitize max items, set to 99999 if not defined
$result['processedTca']['columns'][$fieldName]['config']['maxitems'] = MathUtility::forceIntegerInRange(
$fieldConfig['config']['maxitems'], 0, 99999
$fieldConfig['config']['maxitems'],
0,
99999
);
if ($result['processedTca']['columns'][$fieldName]['config']['maxitems'] === 0) {
$result['processedTca']['columns'][$fieldName]['config']['maxitems'] = 99999;
......
......@@ -339,7 +339,8 @@ class TcaInline extends AbstractDatabaseRecordProvider implements FormDataProvid
$this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang.xlf:formEngine.databaseRecordErrorInlineChildChild'),
[ $e->getTableName(), $e->getUid(), $childTableName, (int)$childUid ]
);
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class,
$flashMessage = GeneralUtility::makeInstance(
FlashMessage::class,
$message,
'',
FlashMessage::ERROR
......
......@@ -957,7 +957,8 @@ class RecordHistory
if (!isset($this->pageAccessCache[$pageId])) {
$this->pageAccessCache[$pageId] = BackendUtility::readPageAccess(
$pageId, $this->getBackendUser()->getPagePermsClause(1)
$pageId,
$this->getBackendUser()->getPagePermsClause(1)
);
}
......
......@@ -70,9 +70,8 @@ class RequestHandler implements RequestHandlerInterface
// Check if the router has the available route and dispatch.
try {
return $this->dispatch($request);
// When token was invalid redirect to login
} catch (InvalidRequestTokenException $e) {
// When token was invalid redirect to login
$url = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir;
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($url);
}
......
......@@ -200,8 +200,8 @@ class ModuleLoader
// check if there is a navigation component (like the pagetree)
if (is_array($this->navigationComponents[$name])) {
$finalModuleConfiguration['navigationComponentId'] = $this->navigationComponents[$name]['componentId'];
// navigation component can be overridden by the main module component
} elseif ($mainModule && is_array($this->navigationComponents[$mainModule]) && $setupInformation['configuration']['inheritNavigationComponentFromMainModule'] !== false) {
// navigation component can be overridden by the main module component
$finalModuleConfiguration['navigationComponentId'] = $this->navigationComponents[$mainModule]['componentId'];
}
return $finalModuleConfiguration;
......
Supports Markdown
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