Commit a483d7a2 authored by Georg Ringer's avatar Georg Ringer Committed by Benni Mack
Browse files

[TASK] Use strict comparison for strings

Change string comparison for string checks. Checks which could lead
to false positives like comparing with '0' or '' are excluded.
RegEx used to find affected places: (?<=\s)((?:!|=)=)(?=[^=]'[^0-9'\n]+')

Resolves: #79540
Resolves: master
Change-Id: I9a04bdd9e0e78cc97036560709bb505097bf48f9
Reviewed-on: https://review.typo3.org/51462

Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 120f7ea3
......@@ -544,10 +544,10 @@ class ShortcutToolbarItem implements ToolbarItemInterface
$shortcut['table'] = key($queryParameters['edit']);
$shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
$shortcut['pid'] = BackendUtility::getRecord($shortcut['table'], $shortcut['recordid'])['pid'];
if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] === 'edit') {
$shortcut['type'] = 'edit';
$shortcutNamePrepend = htmlspecialchars($languageService->getLL('shortcut_edit'));
} elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
} elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] === 'new') {
$shortcut['type'] = 'new';
$shortcutNamePrepend = htmlspecialchars($languageService->getLL('shortcut_create'));
}
......@@ -874,7 +874,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
protected function getShortcutIconTitle($shortcutLabel, $moduleName, $parentModuleName = '')
{
$languageService = $this->getLanguageService();
if (substr($moduleName, 0, 5) == 'xMOD_') {
if (substr($moduleName, 0, 5) === 'xMOD_') {
$title = substr($moduleName, 5);
} else {
list($mainModule, $subModule) = explode('_', $moduleName);
......
......@@ -161,7 +161,7 @@ class Clipboard
{
if (is_array($cmd['el'])) {
foreach ($cmd['el'] as $k => $v) {
if ($this->current == 'normal') {
if ($this->current === 'normal') {
unset($this->clipData['normal']);
}
if ($v) {
......@@ -206,7 +206,7 @@ class Clipboard
if (isset($this->clipData[$padIdent])) {
$this->clipData['current'] = ($this->current = $padIdent);
}
if ($this->current != 'normal' || !$this->isElements()) {
if ($this->current !== 'normal' || !$this->isElements()) {
$this->clipData[$this->current]['mode'] = '';
}
// Setting mode to default (move) if no items on it or if not 'normal'
......@@ -348,7 +348,7 @@ class Clipboard
'label' => 'labels.normal',
'padding' => $this->padTitle('normal')
];
if ($this->current == 'normal') {
if ($this->current === 'normal') {
$tabArray['normal']['content'] = $this->getContentFromTab('normal');
}
// Print header and content for the NUMERIC tabs:
......@@ -523,7 +523,7 @@ class Clipboard
{
$el = count($this->elFromTable($this->fileMode ? '_FILE' : '', $pad));
if ($el) {
return ' (' . ($pad == 'normal' ? ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) : htmlspecialchars($el)) . ')';
return ' (' . ($pad === 'normal' ? ($this->clipData['normal']['mode'] === 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) : htmlspecialchars($el)) . ')';
}
return '';
}
......@@ -710,19 +710,19 @@ class Clipboard
public function confirmMsgText($table, $rec, $type, $clElements, $columnLabel = '')
{
if ($this->getBackendUser()->jsConfirmation(JsConfirmation::COPY_MOVE_PASTE)) {
$labelKey = 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:mess.' . ($this->currentMode() == 'copy' ? 'copy' : 'move') . ($this->current == 'normal' ? '' : 'cb') . '_' . $type;
$labelKey = 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:mess.' . ($this->currentMode() === 'copy' ? 'copy' : 'move') . ($this->current === 'normal' ? '' : 'cb') . '_' . $type;
$msg = $this->getLanguageService()->sL($labelKey . ($columnLabel ? '_colPos': ''));
if ($table == '_FILE') {
if ($table === '_FILE') {
$thisRecTitle = basename($rec);
if ($this->current == 'normal') {
if ($this->current === 'normal') {
$selItem = reset($clElements);
$selRecTitle = basename($selItem);
} else {
$selRecTitle = count($clElements);
}
} else {
$thisRecTitle = $table == 'pages' && !is_array($rec) ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : BackendUtility::getRecordTitle($table, $rec);
if ($this->current == 'normal') {
$thisRecTitle = $table === 'pages' && !is_array($rec) ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] : BackendUtility::getRecordTitle($table, $rec);
if ($this->current === 'normal') {
$selItem = $this->getSelectedRecord();
$selRecTitle = $selItem['_RECORD_TITLE'];
} else {
......@@ -779,7 +779,7 @@ class Clipboard
if ($v) {
list($table, $uid) = explode('|', $k);
// Rendering files/directories on the clipboard
if ($table == '_FILE') {
if ($table === '_FILE') {
if (file_exists($v) && GeneralUtility::isAllowedAbsPath($v)) {
$params['tx_impexp'][is_dir($v) ? 'dir' : 'file'][] = $v;
}
......@@ -832,7 +832,7 @@ class Clipboard
*/
public function currentMode()
{
return $this->clipData[$this->current]['mode'] == 'copy' ? 'copy' : 'cut';
return $this->clipData[$this->current]['mode'] === 'copy' ? 'copy' : 'cut';
}
/**
......@@ -846,7 +846,7 @@ class Clipboard
if (is_array($this->clipData[$this->current]['el'])) {
foreach ($this->clipData[$this->current]['el'] as $k => $v) {
list($table, $uid) = explode('|', $k);
if ($table != '_FILE') {
if ($table !== '_FILE') {
if (!$v || !is_array(BackendUtility::getRecord($table, $uid, 'uid'))) {
unset($this->clipData[$this->current]['el'][$k]);
$this->changed = 1;
......@@ -883,9 +883,9 @@ class Clipboard
foreach ($this->clipData[$pad]['el'] as $k => $v) {
if ($v) {
list($table, $uid) = explode('|', $k);
if ($table != '_FILE') {
if ($table !== '_FILE') {
if ((!$matchTable || (string)$table == (string)$matchTable) && $GLOBALS['TCA'][$table]) {
$list[$k] = $pad == 'normal' ? $v : $uid;
$list[$k] = $pad === 'normal' ? $v : $uid;
}
} else {
if ((string)$table == (string)$matchTable) {
......@@ -909,7 +909,7 @@ class Clipboard
public function isSelected($table, $uid)
{
$k = $table . '|' . $uid;
return $this->clipData[$this->current]['el'][$k] ? ($this->current == 'normal' ? $this->currentMode() : 1) : '';
return $this->clipData[$this->current]['el'][$k] ? ($this->current === 'normal' ? $this->currentMode() : 1) : '';
}
/**
......@@ -979,7 +979,7 @@ class Clipboard
$elements = $this->elFromTable($pTable);
// So the order is preserved.
$elements = array_reverse($elements);
$mode = $this->currentMode() == 'copy' ? 'copy' : 'move';
$mode = $this->currentMode() === 'copy' ? 'copy' : 'move';
// Traverse elements and make CMD array
foreach ($elements as $tP => $value) {
list($table, $uid) = explode('|', $tP);
......@@ -995,7 +995,7 @@ class Clipboard
} else {
$CMD[$table][$uid][$mode] = $pUid;
}
if ($mode == 'move') {
if ($mode === 'move') {
$this->removeElement($tP);
}
}
......@@ -1043,11 +1043,11 @@ class Clipboard
{
list($pTable, $pUid) = explode('|', $ref);
$elements = $this->elFromTable('_FILE');
$mode = $this->currentMode() == 'copy' ? 'copy' : 'move';
$mode = $this->currentMode() === 'copy' ? 'copy' : 'move';
// Traverse elements and make CMD array
foreach ($elements as $tP => $path) {
$FILE[$mode][] = ['data' => $path, 'target' => $pUid];
if ($mode == 'move') {
if ($mode === 'move') {
$this->removeElement($tP);
}
}
......
......@@ -79,7 +79,7 @@ class ConditionMatcher extends AbstractConditionMatcher
case 'PIDupinRootline':
case 'PIDinRootline':
$values = GeneralUtility::trimExplode(',', $value, true);
if ($key == 'PIDinRootline' || !in_array($this->pageId, $values) || $this->isNewPageWithPageId($this->pageId)) {
if ($key === 'PIDinRootline' || !in_array($this->pageId, $values) || $this->isNewPageWithPageId($this->pageId)) {
foreach ($values as $test) {
foreach ($this->rootline as $rl_dat) {
if ($rl_dat['uid'] == $test) {
......
......@@ -144,7 +144,7 @@ class ElementInformationController
// Check permissions and uid value:
if ($this->uid && $this->getBackendUser()->check('tables_select', $this->table)) {
if ((string)$this->table == 'pages') {
if ((string)$this->table === 'pages') {
$this->pageInfo = BackendUtility::readPageAccess($this->uid, $this->permsClause);
$this->access = is_array($this->pageInfo) ? 1 : 0;
$this->row = $this->pageInfo;
......
......@@ -149,7 +149,7 @@ class MoveElementController extends AbstractModule
$assigns['makeCopyChecked'] = $this->makeCopy ? ' checked="checked"' : '';
$assigns['makeCopyOnClick'] = $onClick;
// IF the table is "pages":
if ((string)$this->table == 'pages') {
if ((string)$this->table === 'pages') {
// Get page record (if accessible):
$pageInfo = BackendUtility::readPageAccess($this->page_id, $this->perms_clause);
if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo['pid'], $this->perms_clause)) {
......@@ -176,7 +176,7 @@ class MoveElementController extends AbstractModule
}
}
// IF the table is "tt_content":
if ((string)$this->table == 'tt_content') {
if ((string)$this->table === 'tt_content') {
// First, get the record:
$tt_content_rec = BackendUtility::getRecord('tt_content', $this->moveUid);
// ?
......@@ -248,12 +248,12 @@ class MoveElementController extends AbstractModule
{
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
if ($this->page_id) {
if ((string)$this->table == 'pages') {
if ((string)$this->table === 'pages') {
$cshButton = $buttonBar->makeHelpButton()
->setModuleName('xMOD_csh_corebe')
->setFieldName('move_el_pages');
$buttonBar->addButton($cshButton);
} elseif ((string)$this->table == 'tt_content') {
} elseif ((string)$this->table === 'tt_content') {
$cshButton = $buttonBar->makeHelpButton()
->setModuleName('xMOD_csh_corebe')
->setFieldName('move_el_cs');
......
......@@ -491,7 +491,7 @@ class NewContentElementController extends AbstractModule
if (is_array($GLOBALS['TCA']['tt_content']['columns'][$fN])) {
// Get information about if the field value is OK:
$config = &$GLOBALS['TCA']['tt_content']['columns'][$fN]['config'];
$authModeDeny = $config['type'] == 'select' && $config['authMode']
$authModeDeny = $config['type'] === 'select' && $config['authMode']
&& !$backendUser->checkAuthMode('tt_content', $fN, $fV, $config['authMode']);
// explode TSconfig keys only as needed
if (!isset($removeItems[$fN])) {
......
......@@ -607,7 +607,7 @@ class EditDocumentController extends AbstractModule
}
// Traverse all new records and forge the content of ->editconf so we can continue to EDIT
// these records!
if ($tableName == 'pages'
if ($tableName === 'pages'
&& $this->retUrl != BackendUtility::getModuleUrl('dummy')
&& $this->returnNewPageId
) {
......@@ -649,7 +649,7 @@ class EditDocumentController extends AbstractModule
$nRec = BackendUtility::getRecord($nTable, $nUid, $recordFields);
// Determine insertion mode ('top' is self-explaining,
// otherwise new elements are inserted after one using a negative uid)
$insertRecordOnTop = ($this->getNewIconMode($nTable) == 'top');
$insertRecordOnTop = ($this->getNewIconMode($nTable) === 'top');
// Setting a blank editconf array for a new record:
$this->editconf = [];
// Determine related page ID for regular live context
......@@ -1026,7 +1026,7 @@ class EditDocumentController extends AbstractModule
if (is_array($conf) && $GLOBALS['TCA'][$table] && $beUser->check('tables_modify', $table)) {
// Traverse the keys/comments of each table (keys can be a commalist of uids)
foreach ($conf as $cKey => $command) {
if ($command == 'edit' || $command == 'new') {
if ($command === 'edit' || $command === 'new') {
// Get the ids:
$ids = GeneralUtility::trimExplode(',', $cKey, true);
// Traverse the ids:
......@@ -1067,7 +1067,7 @@ class EditDocumentController extends AbstractModule
) {
$this->viewId = $formData['parentPageRow']['uid'];
} else {
if ($table == 'pages') {
if ($table === 'pages') {
$this->viewId = $formData['databaseRow']['uid'];
} elseif (!empty($formData['parentPageRow']['uid'])) {
$this->viewId = $formData['parentPageRow']['uid'];
......@@ -1154,7 +1154,7 @@ class EditDocumentController extends AbstractModule
$this->formResultCompiler->mergeResult($formResult);
// Seems the pid is set as hidden field (again) at end?!
if ($command == 'new') {
if ($command === 'new') {
// @todo: looks ugly
$html .= LF
. '<input type="hidden"'
......@@ -1784,7 +1784,7 @@ class EditDocumentController extends AbstractModule
// Traverse the keys/comments of each table (keys can be a commalist of uids)
$newConf = [];
foreach ($conf as $cKey => $cmd) {
if ($cmd == 'edit') {
if ($cmd === 'edit') {
// Traverse the ids:
$ids = GeneralUtility::trimExplode(',', $cKey, true);
foreach ($ids as $idKey => $theUid) {
......
......@@ -900,7 +900,7 @@ class FormInlineAjaxController extends AbstractFormEngineAjaxController
$childConfig = $childConfig[$flexFormNode];
// Skip to the field configuration of a sheet
if (isset($childConfig['ROOT']) && $childConfig['ROOT']['type'] == 'array') {
if (isset($childConfig['ROOT']) && $childConfig['ROOT']['type'] === 'array') {
$childConfig = $childConfig['ROOT']['el'];
}
}
......
......@@ -384,7 +384,7 @@ class InlineRecordContainer extends AbstractContainer
// Initialize:
$cells = [];
$additionalCells = [];
$isNewItem = substr($rec['uid'], 0, 3) == 'NEW';
$isNewItem = substr($rec['uid'], 0, 3) === 'NEW';
$isParentExisting = MathUtility::canBeInterpretedAsInteger($data['inlineParentUid']);
$tcaTableCtrl = $GLOBALS['TCA'][$foreignTable]['ctrl'];
$tcaTableCols = $GLOBALS['TCA'][$foreignTable]['columns'];
......
......@@ -76,7 +76,7 @@ class SelectCheckBoxElement extends AbstractFormElement
// Non-selectable element:
if ($p[1] === '--div--') {
$selIcon = '';
if (isset($p[2]) && $p[2] != 'empty-empty') {
if (isset($p[2]) && $p[2] !== 'empty-empty') {
$selIcon = FormEngineUtility::getIconHtml($p[2]);
}
$currentGroup++;
......
......@@ -819,7 +819,7 @@ abstract class AbstractItemProvider
$flexFormTools = GeneralUtility::makeInstance(FlexFormTools::class);
$flexForms = [];
foreach ($GLOBALS['TCA'][$table]['columns'] as $tableField => $fieldConf) {
if (!empty($fieldConf['config']['type']) && !empty($fieldConf['config']['ds']) && $fieldConf['config']['type'] == 'flex') {
if (!empty($fieldConf['config']['type']) && !empty($fieldConf['config']['ds']) && $fieldConf['config']['type'] === 'flex') {
$flexForms[$tableField] = [];
foreach (array_keys($fieldConf['config']['ds']) as $flexFormKey) {
// Get extension identifier (uses second value if it's not empty, "list" or "*", else first one)
......
......@@ -97,7 +97,7 @@ class TcaInline extends AbstractDatabaseRecordProvider implements FormDataProvid
$table = $result['tableName'];
$row = $result['databaseRow'];
// If the parent is a page, use the uid(!) of the (new?) page as pid for the child records:
if ($table == 'pages') {
if ($table === 'pages') {
$liveVersionId = BackendUtility::getLiveVersionIdOfRecord('pages', $row['uid']);
$pid = is_null($liveVersionId) ? $row['uid'] : $liveVersionId;
} elseif ($row['pid'] < 0) {
......
......@@ -118,7 +118,7 @@ class SuggestWizardDefaultReceiver
if (isset($config['maxItemsInResultList'])) {
$this->maxItems = $config['maxItemsInResultList'];
}
if ($this->table == 'pages') {
if ($this->table === 'pages') {
$this->queryBuilder->andWhere(
QueryHelper::stripLogicalOperatorPrefix($GLOBALS['BE_USER']->getPagePermsClause(1))
);
......@@ -328,7 +328,7 @@ class SuggestWizardDefaultReceiver
{
$retValue = true;
$table = $this->mmForeignTable ?: $this->table;
if ($table == 'pages') {
if ($table === 'pages') {
if (!BackendUtility::readPageAccess($uid, $GLOBALS['BE_USER']->getPagePermsClause(1))) {
$retValue = false;
}
......@@ -369,7 +369,7 @@ class SuggestWizardDefaultReceiver
protected function getRecordPath(&$row, $uid)
{
$titleLimit = max($this->config['maxPathTitleLength'], 0);
if (($this->mmForeignTable ? $this->mmForeignTable : $this->table) == 'pages') {
if (($this->mmForeignTable ? $this->mmForeignTable : $this->table) === 'pages') {
$path = BackendUtility::getRecordPath($uid, '', $titleLimit);
// For pages we only want the first (n-1) parts of the path,
// because the n-th part is the page itself
......
......@@ -656,7 +656,7 @@ class RecordHistory
$changeLog = $this->getHistoryData($elParts[0], $elParts[1]);
// get history of tables of this page and merge it into changelog
if ($elParts[0] == 'pages' && $this->showSubElements && $this->hasPageAccess('pages', $elParts[1])) {
if ($elParts[0] === 'pages' && $this->showSubElements && $this->hasPageAccess('pages', $elParts[1])) {
foreach ($GLOBALS['TCA'] as $tablename => $value) {
// check if there are records on the page
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($tablename);
......
......@@ -991,7 +991,7 @@ class BackendUtility
$srcPointer = 'default';
}
// Get Data Source: Detect if it's a file reference and in that case read the file and parse as XML. Otherwise the value is expected to be XML.
if (substr($ds_array[$srcPointer], 0, 5) == 'FILE:') {
if (substr($ds_array[$srcPointer], 0, 5) === 'FILE:') {
$file = GeneralUtility::getFileAbsFileName(substr($ds_array[$srcPointer], 5));
if ($file && @is_file($file)) {
$dataStructArray = GeneralUtility::xml2array(file_get_contents($file));
......@@ -1727,7 +1727,7 @@ class BackendUtility
}
$fileExtension = $fileObject->getExtension();
if ($fileExtension == 'ttf'
if ($fileExtension === 'ttf'
|| GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)
) {
$imageUrl = $fileObject->process(
......@@ -1884,14 +1884,14 @@ class BackendUtility
*/
public static function getRecordIconAltText($row, $table = 'pages')
{
if ($table == 'pages') {
if ($table === 'pages') {
$out = self::titleAttribForPages($row, '', 0);
} else {
$out = !empty(trim($GLOBALS['TCA'][$table]['ctrl']['descriptionColumn'])) ? $row[$GLOBALS['TCA'][$table]['ctrl']['descriptionColumn']] . ' ' : '';
$ctrl = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
// Uid is added
$out .= 'id=' . $row['uid'];
if ($table == 'pages' && $row['alias']) {
if ($table === 'pages' && $row['alias']) {
$out .= ' / ' . $row['alias'];
}
if (static::isTableWorkspaceEnabled($table) && $row['pid'] < 0) {
......@@ -2651,7 +2651,7 @@ class BackendUtility
if (is_array($GLOBALS['TCA'][$table])) {
if ($fN == $GLOBALS['TCA'][$table]['ctrl']['tstamp'] || $fN == $GLOBALS['TCA'][$table]['ctrl']['crdate']) {
$fVnew = self::datetime($fV);
} elseif ($fN == 'pid') {
} elseif ($fN === 'pid') {
// Fetches the path with no regard to the users permissions to select pages.
$fVnew = self::getRecordPath($fV, '1=1', 20);
} else {
......@@ -2740,7 +2740,7 @@ class BackendUtility
case 'string':
case 'short':
$formEl = '<input type="text" name="' . $dataPrefix . '[' . $fname . ']" value="' . $params[$fname] . '"' . static::getDocumentTemplate()->formWidth(($config[0] == 'short' ? 24 : 48)) . ' />';
$formEl = '<input type="text" name="' . $dataPrefix . '[' . $fname . ']" value="' . $params[$fname] . '"' . static::getDocumentTemplate()->formWidth(($config[0] === 'short' ? 24 : 48)) . ' />';
break;
case 'check':
$formEl = '<input type="hidden" name="' . $dataPrefix . '[' . $fname . ']" value="0" /><input type="checkbox" name="' . $dataPrefix . '[' . $fname . ']" value="1"' . ($params[$fname] ? ' checked="checked"' : '') . ' />';
......@@ -4201,7 +4201,7 @@ class BackendUtility
);
// Look up the path:
if ($table == '_FILE') {
if ($table === '_FILE') {
if (!GeneralUtility::isFirstPartOfStr($ref, PATH_site)) {
return '';
}
......
......@@ -360,7 +360,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
foreach ($this->fieldArray as $field) {
if ($editIdList
&& isset($GLOBALS['TCA']['pages']['columns'][$field])
&& $field != 'uid'
&& $field !== 'uid'
&& !$this->pages_noEditColumns
) {
$iTitle = sprintf(
......@@ -393,7 +393,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
$theData[$field] = '&nbsp;<strong>ID:</strong>';
break;
default:
if (substr($field, 0, 6) == 'table_') {
if (substr($field, 0, 6) === 'table_') {
$f2 = substr($field, 6);
if ($GLOBALS['TCA'][$f2]) {
$theData[$field] = '&nbsp;' .
......@@ -1357,7 +1357,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
}
break;
default:
if (substr($field, 0, 6) == 'table_') {
if (substr($field, 0, 6) === 'table_') {
$f2 = substr($field, 6);
if ($GLOBALS['TCA'][$f2]) {
$c = $this->numberOfRecords($f2, $row['uid']);
......
......@@ -54,9 +54,9 @@ class BackendUserActionController extends ActionController
{
/** @var BackendTemplateView $view */
parent::initializeView($view);
if ($this->actionMethodName == 'indexAction'
|| $this->actionMethodName == 'onlineAction'
|| $this->actionMethodName == 'compareAction') {
if ($this->actionMethodName === 'indexAction'
|| $this->actionMethodName === 'onlineAction'
|| $this->actionMethodName === 'compareAction') {
$this->generateMenu();
$this->registerDocheaderButtons();
$this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
......
......@@ -863,7 +863,7 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
$this->internal['results_at_a_time'] = $this->piVars['results'];
$this->internal['maxPages'] = MathUtility::forceIntegerInRange($this->conf['search.']['page_links'], 1, 100, 10);
$resultSectionsCount = count($this->resultSections);
$addString = $resData['count'] && $this->piVars['group'] == 'sections' && $freeIndexUid <= 0 ? ' ' . sprintf($this->pi_getLL(($resultSectionsCount > 1 ? 'inNsections' : 'inNsection')), $resultSectionsCount) : '';
$addString = $resData['count'] && $this->piVars['group'] === 'sections' && $freeIndexUid <= 0 ? ' ' . sprintf($this->pi_getLL(($resultSectionsCount > 1 ? 'inNsections' : 'inNsection')), $resultSectionsCount) : '';
$browseBox1 = $this->renderPagination(1, $addString, $this->printResultSectionLinks(), $freeIndexUid);
$browseBox2 = $this->renderPagination(0, '', '', $freeIndexUid);
// Browsing nav, bottom.
......@@ -876,7 +876,7 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
$content .= '<p' . $this->pi_classParam('noresults') . '>' . htmlspecialchars($this->pi_getLL('noResults')) . '</p>';
}
// Print a message telling which words we searched for, and in which sections etc.
$what = $this->tellUsWhatIsSeachedFor($sWArr) . (substr($this->piVars['sections'], 0, 2) == 'rl' ? ' ' . htmlspecialchars($this->pi_getLL('inSection')) . ' "' . $this->getPathFromPageId(substr($this->piVars['sections'], 4)) . '"' : '');
$what = $this->tellUsWhatIsSeachedFor($sWArr) . (substr($this->piVars['sections'], 0, 2) === 'rl' ? ' ' . htmlspecialchars($this->pi_getLL('inSection')) . ' "' . $this->getPathFromPageId(substr($this->piVars['sections'], 4)) . '"' : '');
$what = '<div' . $this->pi_classParam('whatis') . '>' . $this->cObj->stdWrap($what, $this->conf['whatis_stdWrap.']) . '</div>';
$content = $what . $content;
// Return content:
......@@ -920,7 +920,7 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
if ($freeIndexUid <= 0) {
switch ($this->piVars['group']) {
case 'sections':
$rl2flag = substr($this->piVars['sections'], 0, 2) == 'rl';
$rl2flag = substr($this->piVars['sections'], 0, 2) === 'rl';
$sections = [];
foreach ($resultRows as $row) {
$id = $row['rl0'] . '-' . $row['rl1'] . ($rl2flag ? '-' . $row['rl2'] : '');
......@@ -932,7 +932,7 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
$theId = $rlParts[2] ? $rlParts[2] : ($rlParts[1] ? $rlParts[1] : $rlParts[0]);
$theRLid = $rlParts[2] ? 'rl2_' . $rlParts[2] : ($rlParts[1] ? 'rl1_' . $rlParts[1] : '0');
$sectionName = $this->getPathFromPageId($theId);
if ($sectionName[0] == '/') {
if ($sectionName[0] === '/') {
$sectionName = substr($sectionName, 1);
}
if (!trim($sectionName)) {
......@@ -1167,11 +1167,11 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
{
$out = $this->wholeSiteIdList < 0 ? '' : ' AND ISEC.rl0 IN (' . $this->wholeSiteIdList . ')';
$match = '';
if (substr($this->piVars['sections'], 0, 4) == 'rl1_') {
if (substr($this->piVars['sections'], 0, 4) === 'rl1_') {
$list = implode(',', GeneralUtility::intExplode(',', substr($this->piVars['sections'], 4)));
$out .= ' AND ISEC.rl1 IN (' . $list . ')';
$match = true;
} elseif (substr($this->piVars['sections'], 0, 4) == 'rl2_') {
} elseif (substr($this->piVars['sections'], 0, 4) === 'rl2_') {
$list = implode(',', GeneralUtility::intExplode(',', substr($this->piVars['sections'], 4)));
$out .= ' AND ISEC.rl2 IN (' . $list . ')';
$match = true;
......@@ -1327,7 +1327,7 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
// Indexing configuration clause:
$freeIndexUidClause = $this->freeIndexUidWhere($freeIndexUid);
// If any of the ranking sortings are selected, we must make a join with the word/rel-table again, because we need to calculate ranking based on all search-words found.
if (substr($this->piVars['order'], 0, 5) == 'rank_') {
if (substr($this->piVars['order'], 0, 5) === 'rank_') {
switch ($this->piVars['order']) {
case 'rank_flag':
// This gives priority to word-position (max-value) so that words in title, keywords, description counts more than in content.
......@@ -2032,7 +2032,7 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
} else {
// Default creation / finding of icon:
$icon = '';
if ($it === '0' || substr($it, 0, 2) == '0:') {
if ($it === '0' || substr($it, 0, 2) === '0:') {
if (is_array($specRowConf['pageIcon.'])) {
$this->iconFileNameCache[$it] = $this->cObj->cObjGetSingle('IMAGE', $specRowConf['pageIcon.']);
} else {
......
......@@ -71,9 +71,9 @@ class EnforceUrlSchemeHook implements TypolinkModifyLinkConfigForPageLinksHookIn
if (isset($parentObject->page['url_scheme']) && $parentObject->page['url_scheme'] > 0) {
$newUrl = '';
$requestUrlScheme = parse_url(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME);
if ((int)$parentObject->page['url_scheme'] === HttpUtility::SCHEME_HTTP && $requestUrlScheme == 'https') {
if ((int)$parentObject->page['url_scheme'] === HttpUtility::SCHEME_HTTP && $requestUrlScheme === 'https') {
$newUrl = 'http://' . substr(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), 8);
} elseif ((int)$parentObject->page['url_scheme'] === HttpUtility::SCHEME_HTTPS && $requestUrlScheme == 'http') {
} elseif ((int)$parentObject->page['url_scheme'] === HttpUtility::SCHEME_HTTPS && $requestUrlScheme === 'http') {
$newUrl = 'https://' . substr(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), 7);
}
if ($newUrl !== '') {
......
......@@ -146,8 +146,8 @@ class PageLayoutActionHook
];
$moveButton = $buttonBar->makeLinkButton()