Commit d7e1728e authored by Stefan Neufeind's avatar Stefan Neufeind Committed by Markus Klein
Browse files

[TASK] Use booleans where currently 1/0 are used

Releases: master
Resolves: #83023
Change-Id: I9fe436f94a1223020b5fd0c308fa5bdb1b81ec39
Reviewed-on: https://review.typo3.org/54671


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Nicole Cordes's avatarNicole Cordes <typo3@cordes.co>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
parent 3adecebc
......@@ -77,9 +77,9 @@ class Clipboard
/**
* If set, clipboard is displaying files.
*
* @var int
* @var bool
*/
public $fileMode = 0;
public $fileMode = false;
/**
* @var IconFactory
......@@ -299,7 +299,7 @@ class Clipboard
);
$title = $languageService
->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.clipboard.delete_elements');
$returnUrl = $this->deleteUrl(1, ($this->fileMode ? 1 : 0));
$returnUrl = $this->deleteUrl(true, $this->fileMode);
$btnOkText = $languageService
->sL('LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:buttons.confirm.delete_elements.yes');
$btnCancelText = $languageService
......@@ -627,11 +627,11 @@ class Clipboard
/**
* deleteUrl for current pad
*
* @param bool|int $setRedirect If set, then the redirect URL will point back to the current script, but with CB reset.
* @param bool|int $file If set, then the URL will link to the tce_file.php script in the typo3/ dir.
* @param bool $setRedirect If set, then the redirect URL will point back to the current script, but with CB reset.
* @param bool $file If set, then the URL will link to the tce_file.php script in the typo3/ dir.
* @return string
*/
public function deleteUrl($setRedirect = 1, $file = 0)
public function deleteUrl($setRedirect = true, $file = false)
{
$urlParameters = [
'CB[delete]' => 1,
......
......@@ -144,13 +144,13 @@ class ElementInformationController
if ($this->uid && $this->getBackendUser()->check('tables_select', $this->table)) {
if ((string)$this->table === 'pages') {
$this->pageInfo = BackendUtility::readPageAccess($this->uid, $this->permsClause);
$this->access = is_array($this->pageInfo) ? 1 : 0;
$this->access = is_array($this->pageInfo);
$this->row = $this->pageInfo;
} else {
$this->row = BackendUtility::getRecordWSOL($this->table, $this->uid);
if ($this->row) {
$this->pageInfo = BackendUtility::readPageAccess($this->row['pid'], $this->permsClause);
$this->access = is_array($this->pageInfo) ? 1 : 0;
$this->access = is_array($this->pageInfo);
}
}
}
......
......@@ -174,7 +174,7 @@ class NewContentElementController
// Getting the current page and receiving access information (used in main())
$perms_clause = $this->getBackendUser()->getPagePermsClause(1);
$this->pageInfo = BackendUtility::readPageAccess($this->id, $perms_clause);
$this->access = is_array($this->pageInfo) ? 1 : 0;
$this->access = is_array($this->pageInfo);
}
/**
......
......@@ -454,8 +454,8 @@ class NewRecordController
// Enabled option for the position of a new page
$this->newPagesSelectPosition = !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageSelectPosition']);
// Pseudo-boolean (0/1) for backward compatibility
$displayNewPagesIntoLink = $this->newPagesInto && !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageInside']) ? 1 : 0;
$displayNewPagesAfterLink = $this->newPagesAfter && !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageAfter']) ? 1 : 0;
$displayNewPagesIntoLink = $this->newPagesInto && !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageInside']);
$displayNewPagesAfterLink = $this->newPagesAfter && !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageAfter']);
// Slight spacer from header:
$this->code .= '';
// New Page
......
......@@ -688,7 +688,7 @@ class PageLayoutController
$lang = $this->getLanguageService();
// Access check...
// The page will show only if there is a valid page and if this page may be viewed by the user
$access = is_array($this->pageinfo) ? 1 : 0;
$access = is_array($this->pageinfo);
// Content
$content = '';
if ($this->id && $access) {
......@@ -816,8 +816,8 @@ class PageLayoutController
$dbList->agePrefixes = $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears');
$dbList->id = $this->id;
$dbList->nextThree = MathUtility::forceIntegerInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10);
$dbList->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
$dbList->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
$dbList->option_newWizard = empty($this->modTSconfig['properties']['disableNewContentElementWizard']);
$dbList->defLangBinding = !empty($this->modTSconfig['properties']['defLangBinding']);
if (!$dbList->nextThree) {
$dbList->nextThree = 1;
}
......
......@@ -190,7 +190,7 @@ class NewContentElementWizardController
// Getting the current page and receiving access information (used in main())
$permissionsClause = $this->getBackendUser()->getPagePermsClause(1);
$this->pageInfo = BackendUtility::readPageAccess($this->id, $permissionsClause);
$this->access = is_array($this->pageInfo) ? 1 : 0;
$this->access = is_array($this->pageInfo);
}
/**
......
......@@ -35,15 +35,15 @@ abstract class AbstractTreeView
// EXTERNAL, static:
// If set, the first element in the tree is always expanded.
/**
* @var int
* @var bool
*/
public $expandFirst = 0;
public $expandFirst = false;
// If set, then ALL items will be expanded, regardless of stored settings.
/**
* @var int
* @var bool
*/
public $expandAll = 0;
public $expandAll = false;
// Holds the current script to reload to.
/**
......@@ -603,7 +603,7 @@ abstract class AbstractTreeView
*/
public function expandNext($id)
{
return !empty($this->stored[$this->bank][$id]) || $this->expandAll ? 1 : 0;
return !empty($this->stored[$this->bank][$id]) || $this->expandAll;
}
/**
......
......@@ -29,6 +29,6 @@ class NewRecordPageTreeView extends PageTreeView
*/
public function expandNext($id)
{
return $id == $GLOBALS['SOBE']->id ? 1 : 0;
return $id == $GLOBALS['SOBE']->id;
}
}
......@@ -61,9 +61,9 @@ class PageLayoutView implements LoggerAwareInterface
/**
* If TRUE, users/groups are shown in the page info box.
*
* @var int
* @var bool
*/
public $pI_showUser = 0;
public $pI_showUser = false;
/**
* The number of successive records to edit when showing content elements.
......@@ -75,16 +75,16 @@ class PageLayoutView implements LoggerAwareInterface
/**
* If TRUE, disables the edit-column icon for tt_content elements
*
* @var int
* @var bool
*/
public $pages_noEditColumns = 0;
public $pages_noEditColumns = false;
/**
* If TRUE, new-wizards are linked to rather than the regular new-element list.
*
* @var int
* @var bool
*/
public $option_newWizard = 1;
public $option_newWizard = true;
/**
* If set to "1", will link a big button to content element wizard.
......@@ -96,9 +96,9 @@ class PageLayoutView implements LoggerAwareInterface
/**
* If TRUE, elements will have edit icons (probably this is whether the user has permission to edit the page content). Set externally.
*
* @var int
* @var bool
*/
public $doEdit = 1;
public $doEdit = true;
/**
* Age prefixes for displaying times. May be set externally to localized values.
......
......@@ -6477,11 +6477,11 @@ class DataHandler implements LoggerAwareInterface
$res = $hookObj->checkRecordUpdateAccess($table, $id, $data, $res, $this);
}
}
if ($res === 1 || $res === 0) {
return $res;
if (isset($res)) {
return (bool)$res;
}
}
$res = 0;
$res = false;
if ($GLOBALS['TCA'][$table] && (int)$id > 0) {
// If information is cached, return it
......@@ -6491,9 +6491,9 @@ class DataHandler implements LoggerAwareInterface
// permissions check for page translations need to be done on the parent page
if ($table === 'pages') {
$defaultLanguagePageId = $this->getDefaultLanguagePageId($id);
$res = $this->doesRecordExist($table, $defaultLanguagePageId, 'edit') ? 1 : 0;
} elseif ($this->doesRecordExist($table, $id, 'edit')) {
$res = 1;
$res = $this->doesRecordExist($table, $defaultLanguagePageId, 'edit');
} else {
$res = $this->doesRecordExist($table, $id, 'edit');
}
// Cache the result
$this->recUpdateAccessCache[$table][$id] = $res;
......
......@@ -622,7 +622,7 @@ class RelationHandler
$tableC = count($this->tableArray);
if ($tableC) {
// Boolean: does the field "tablename" need to be filled?
$prep = $tableC > 1 || $prependTableName || $this->MM_isMultiTableRelationship ? 1 : 0;
$prep = $tableC > 1 || $prependTableName || $this->MM_isMultiTableRelationship;
$c = 0;
$additionalWhere_tablenames = '';
if ($this->MM_is_foreign && $prep) {
......
......@@ -64,7 +64,7 @@ class HtmlParser
// We skip the first element in foreach loop
$partsSliced = array_slice($parts, 1, null, true);
foreach ($partsSliced as $v) {
$isEndTag = substr($content, $pointer, 2) === '</' ? 1 : 0;
$isEndTag = substr($content, $pointer, 2) === '</';
$tagLen = strcspn(substr($content, $pointer), '>') + 1;
// We meet a start-tag:
if (!$isEndTag) {
......
......@@ -477,7 +477,7 @@ class TimeTracker implements SingletonInterface
foreach ($arr as $k => $v) {
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($k)) {
$c++;
$deeper = is_array($arr[$k . '.']) ? 1 : 0;
$deeper = is_array($arr[$k . '.']);
$LN = $ac == $c ? 'blank' : 'line';
$BTM = $ac == $c ? 'bottom' : '';
......
......@@ -409,7 +409,7 @@ class ExtendedTemplateService extends TemplateService
// This excludes all constants starting with '_' from being shown.
if ($this->bType !== 'const' || $depth[0] !== '_') {
$goto = substr(md5($depth), 0, 6);
$deeper = is_array($arr[$key . '.']) && ($this->tsbrowser_depthKeys[$depth] || $this->ext_expandAllNotes) ? 1 : 0;
$deeper = is_array($arr[$key . '.']) && ($this->tsbrowser_depthKeys[$depth] || $this->ext_expandAllNotes);
$PM = is_array($arr[$key . '.']) && !$this->ext_noPMicons ? ($deeper ? 'minus' : 'plus') : 'join';
$HTML .= $depthData . '<li>';
if ($PM !== 'join') {
......
......@@ -215,14 +215,14 @@ class FrontendEditPanel
$iconImg = '<span title="' . htmlspecialchars($iconTitle, ENT_COMPAT, 'UTF-8', false) . '" style="' . ($conf['styleAttribute'] ? htmlspecialchars($conf['styleAttribute']) : '') . '">'
. $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render('inline')
. '</span>';
$nV = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0;
$noView = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0;
$url = BackendUtility::getModuleUrl(
'record_edit',
[
'edit[' . $table . '][' . $editUid . ']' => 'edit',
'columnsOnly' => $fieldList,
'noView' => $nV,
'noView' => $noView,
'feEdit' => 1
]
) . $addUrlParamStr;
......@@ -257,10 +257,10 @@ class FrontendEditPanel
*/
protected function editPanelLinkWrap($string, $formName, $cmd, $currentRecord = '', $confirm = '', $nPid = '')
{
$nV = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0;
$noView = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0;
if ($cmd === 'edit') {
$rParts = explode(':', $currentRecord);
$out = $this->editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl('record_edit', ['edit[' . $rParts[0] . '][' . $rParts[1] . ']' => 'edit', 'noView' => $nV, 'feEdit' => 1]), $currentRecord);
$out = $this->editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl('record_edit', ['edit[' . $rParts[0] . '][' . $rParts[1] . ']' => 'edit', 'noView' => $noView, 'feEdit' => 1]), $currentRecord);
} elseif ($cmd === 'new') {
$rParts = explode(':', $currentRecord);
if ($rParts[0] === 'pages') {
......@@ -269,7 +269,7 @@ class FrontendEditPanel
if (!(int)$nPid) {
$nPid = MathUtility::canBeInterpretedAsInteger($rParts[1]) ? -$rParts[1] : $this->frontendController->id;
}
$out = $this->editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl('record_edit', ['edit[' . $rParts[0] . '][' . $nPid . ']' => 'new', 'noView' => $nV]), $currentRecord);
$out = $this->editPanelLinkWrap_doWrap($string, BackendUtility::getModuleUrl('record_edit', ['edit[' . $rParts[0] . '][' . $nPid . ']' => 'new', 'noView' => $noView]), $currentRecord);
}
} else {
if ($confirm && $this->backendUser->jsConfirmation(JsConfirmation::FE_EDIT)) {
......
......@@ -348,7 +348,7 @@ class FileListController extends ActionController
$this->filelist->thumbs = $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $this->MOD_SETTINGS['displayThumbs'];
// Create clipboard object and initialize that
$this->filelist->clipObj = GeneralUtility::makeInstance(Clipboard::class);
$this->filelist->clipObj->fileMode = 1;
$this->filelist->clipObj->fileMode = true;
$this->filelist->clipObj->initializeClipboard();
$CB = GeneralUtility::_GET('CB');
if ($this->cmd === 'setCB') {
......
......@@ -1720,7 +1720,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
*/
public function checkPagerecordForIncludeSection($row)
{
return !$row['extendToSubpages'] || $this->checkEnableFields($row) ? 1 : 0;
return !$row['extendToSubpages'] || $this->checkEnableFields($row);
}
/**
......
......@@ -822,7 +822,7 @@ class ImportExportController extends BaseScriptClass
*/
public function importData($inData)
{
$access = is_array($this->pageinfo) ? 1 : 0;
$access = is_array($this->pageinfo);
$beUser = $this->getBackendUser();
if ($this->id && $access || $beUser->isAdmin() && !$this->id) {
if ($beUser->isAdmin() && !$this->id) {
......
......@@ -63,7 +63,7 @@ class PageInformationController extends \TYPO3\CMS\Backend\Module\AbstractFuncti
$dblist->showIcon = 0;
$dblist->setLMargin = 0;
$dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears');
$dblist->pI_showUser = 1;
$dblist->pI_showUser = true;
switch ((int)$this->pObj->MOD_SETTINGS['pages']) {
case 1:
......
......@@ -276,7 +276,7 @@ class RecordList
$lang = $this->getLanguageService();
// Loading current page record and checking access:
$this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
$access = is_array($this->pageinfo) ? 1 : 0;
$access = is_array($this->pageinfo);
// Start document template object:
// We need to keep this due to deeply nested dependencies
$this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
......
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