Index: typo3_src/typo3/sysext/backend/Classes/View/PageLayoutView.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- typo3_src/typo3/sysext/backend/Classes/View/PageLayoutView.php (revision 8dad992c4dee4c20356cb1a1ac8d0a8cc65adbc8)
+++ typo3_src/typo3/sysext/backend/Classes/View/PageLayoutView.php (revision )
@@ -307,7 +307,7 @@
$editIdList = implode(',', $editUids);
// Traverse fields (as set above) in order to create header values:
foreach ($this->fieldArray as $field) {
- if ($editIdList && isset($GLOBALS['TCA']['pages']['columns'][$field]) && $field != 'uid' && !$this->pages_noEditColumns) {
+ if ($editIdList && isset($GLOBALS['TCA']['pages']['columns'][$field]) && $field !== 'uid' && !$this->pages_noEditColumns) {
$params = '&edit[pages][' . $editIdList . ']=edit&columnsOnly=' . $field . '&disHelp=1';
$iTitle = sprintf($GLOBALS['LANG']->getLL('editThisColumn'), rtrim(trim($GLOBALS['LANG']->sL(BackendUtility::getItemLabel('pages', $field))), ':'));
$eI = '' . IconUtility::getSpriteIcon('actions-document-open') . ' ';
@@ -322,7 +322,7 @@
$theData[$field] = ' ID: ';
break;
default:
- if (substr($field, 0, 6) == 'table_') {
+ if (strpos($field, 'table_') === 0) {
$f2 = substr($field, 6);
if ($GLOBALS['TCA'][$f2]) {
$theData[$field] = ' ' . IconUtility::getSpriteIconForRecord($f2, array(), array('title' => $GLOBALS['LANG']->sL($GLOBALS['TCA'][$f2]['ctrl']['title'], TRUE)));
@@ -670,7 +670,6 @@
$lP = $this->tt_contentConfig['sys_language_uid'];
}
$cList = explode(',', $this->tt_contentConfig['showSingleCol']);
- $content = array();
$out = '';
// Expand the table to some preset dimensions:
$out .= '
@@ -712,7 +711,7 @@
' . $this->tt_content_drawItem($row, $isRTE) . '
';
// If the element was not the last element, add a divider line:
- if ($c != $numberOfContentElementsInColumn) {
+ if ($c !== $numberOfContentElementsInColumn) {
$rowOut .= '
@@ -830,7 +829,7 @@
$dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
}
// If records were found, render the list
- if ($dbCount == 0) {
+ if ($dbCount === 0) {
return '';
}
// Set fields
@@ -1002,7 +1001,7 @@
BackendUtility::workspaceOL('pages', $row);
if (is_array($row)) {
$c++;
- $row['treeIcons'] = $treeIcons . ' backPath, ('gfx/ol/join' . ($rc == $c ? 'bottom' : '') . '.gif'), 'width="18" height="16"') . ' alt="" />';
+ $row['treeIcons'] = $treeIcons . ' backPath, ('gfx/ol/join' . ($rc === $c ? 'bottom' : '') . '.gif'), 'width="18" height="16"') . ' alt="" />';
$theRows[] = $row;
// Get the branch
$spaceOutIcons = ' backPath, ('gfx/ol/' . ($rc == $c ? 'blank.gif' : 'line.gif')), 'width="18" height="16"') . ' alt="" />';
@@ -1056,11 +1055,11 @@
$theData[$field] = '' . $row['uid'] . $eI . ' ';
break;
default:
- if (substr($field, 0, 6) == 'table_') {
+ if (strpos($field, 'table_') === 0) {
$f2 = substr($field, 6);
if ($GLOBALS['TCA'][$f2]) {
$c = $this->numberOfRecords($f2, $row['uid']);
- $theData[$field] = ' ' . ($c ? $c : '');
+ $theData[$field] = ' ' . ($c ?: '');
}
} else {
$theData[$field] = ' ' . htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field]));
@@ -1283,12 +1282,12 @@
case 'textpic':
case 'image':
- if ($row['CType'] == 'text' || $row['CType'] == 'textpic') {
+ if ($row['CType'] === 'text' || $row['CType'] === 'textpic') {
if ($row['bodytext']) {
$out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . ' ';
}
}
- if ($row['CType'] == 'textpic' || $row['CType'] == 'image') {
+ if ($row['CType'] === 'textpic' || $row['CType'] === 'image') {
if ($row['image']) {
$out .= $this->thumbCode($row, 'tt_content', 'image') . ' ';
if ($row['imagecaption']) {
@@ -1583,7 +1582,6 @@
*/
public function getResult($result, $table = 'tt_content') {
// Initialize:
- $editUidList = '';
$recs = array();
$nextTree = $this->nextThree;
$c = 0;
Index: typo3_src/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- typo3_src/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php (revision 8dad992c4dee4c20356cb1a1ac8d0a8cc65adbc8)
+++ typo3_src/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php (revision )
@@ -363,7 +363,7 @@
* @todo Define visibility
*/
public function isAdmin() {
- return is_array($this->user) && ($this->user['admin'] & 1) == 1;
+ return isset($this->user['admin']) && ($this->user['admin'] & 1) == 1;
}
/**
@@ -612,13 +612,9 @@
* @todo Define visibility
*/
public function check($type, $value) {
- if (isset($this->groupData[$type])) {
- if ($this->isAdmin() || GeneralUtility::inList($this->groupData[$type], $value)) {
- return TRUE;
+ return ((isset($this->groupData[$type])) &&
+ ($this->isAdmin() || GeneralUtility::inList($this->groupData[$type], $value)));
- }
+ }
- }
- return FALSE;
- }
/**
* Checking the authMode of a select field with authMode set
@@ -1138,7 +1134,7 @@
$TSConf = array('value' => NULL, 'properties' => NULL);
$parts = GeneralUtility::trimExplode('.', $objectString, TRUE, 2);
$key = $parts[0];
- if (strlen($key) > 0) {
+ if ($key !== '') {
if (count($parts) > 1 && strlen($parts[1]) > 0) {
// Go on, get the next level
if (is_array($config[$key . '.'])) {
Index: typo3_src/typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- typo3_src/typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php (revision 8dad992c4dee4c20356cb1a1ac8d0a8cc65adbc8)
+++ typo3_src/typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php (revision )
@@ -43,6 +43,13 @@
*/
abstract class AbstractRecordList {
+ /**
+ * Id
+ *
+ * @var int
+ */
+ public $id;
+
// Used in this class:
// default Max items shown
/**
@@ -174,16 +181,17 @@
* Returns a table-row with the content from the fields in the input data array.
* OBS: $this->fieldArray MUST be set! (represents the list of fields to display)
*
- * @param integer $h Is an integer >=0 and denotes how tall a element is. Set to '0' makes a halv line, -1 = full line, set to 1 makes a 'join' and above makes 'line'
+ * @param integer $height Is an integer >=0 and denotes how tall a element is. Set to '0' makes a halv line, -1 = full line, set to 1 makes a 'join' and above makes 'line'
* @param string $icon Is the + of the record. If not supplied the first 'join'-icon will be a 'line' instead
* @param array $data Is the dataarray, record with the fields. Notice: These fields are (currently) NOT htmlspecialchar'ed before being wrapped in -tags
- * @param string $tdParams Is insert in the -tags. Must carry a ' ' as first character
- * @param integer OBSOLETE - NOT USED ANYMORE. $lMargin is the leftMargin (integer)
+ * @param string $trParams Is insert in the -tags. Must carry a ' ' as first character
+ * @param int|string $lMargin OBSOLETE - NOT USED ANYMORE. $lMargin is the leftMargin (integer)
* @param string $altLine Is the HTML -tag for an alternative 'gfx/ol/line.gif'-icon (used in the top)
+ *
* @return string HTML content for the table row
* @todo Define visibility
*/
- public function addElement($h, $icon, $data, $trParams = '', $lMargin = '', $altLine = '') {
+ public function addElement($height, $icon, $data, $trParams = '', $lMargin = '', $altLine = '') {
$noWrap = $this->no_noWrap ? '' : ' nowrap="nowrap"';
// Start up:
$out = '
@@ -193,16 +201,14 @@
if ($this->showIcon) {
$out .= '
';
- if (!$h) {
+ if (!$height) {
$out .= ' ';
} else {
- for ($a = 0; $a < $h; $a++) {
+ for ($a = 0; $a < $height; ++$a) {
if (!$a) {
if ($icon) {
$out .= $icon;
}
- } else {
-
}
}
}
@@ -210,16 +216,14 @@
';
}
// Init rendering.
- $colsp = '';
- $lastKey = '';
- $c = 0;
- $ccount = 0;
+ $colsp = $lastKey = '';
+ $c = $ccount = 0;
// Traverse field array which contains the data to present:
foreach ($this->fieldArray as $vKey) {
if (isset($data[$vKey])) {
if ($lastKey) {
$cssClass = $this->addElement_tdCssClass[$lastKey];
- if ($this->oddColumnsCssClass && $ccount % 2 == 0) {
+ if ($this->oddColumnsCssClass && $ccount % 2 === 0) {
$cssClass = implode(' ', array($this->addElement_tdCssClass[$lastKey], $this->oddColumnsCssClass));
}
$out .= '
@@ -227,12 +231,12 @@
}
$lastKey = $vKey;
$c = 1;
- $ccount++;
+ ++$ccount;
} else {
if (!$lastKey) {
$lastKey = $vKey;
}
- $c++;
+ ++$c;
}
if ($c > 1) {
$colsp = ' colspan="' . $c . '"';
@@ -249,10 +253,8 @@
addElement_tdParams[$lastKey] . '>' . $data[$lastKey] . ' ';
}
// End row
- $out .= '
+ return $out . '
';
- // Return row.
- return $out;
}
/**
@@ -286,8 +288,8 @@
public function fwd_rwd_nav($table = '') {
$code = '';
if ($this->eCounter >= $this->firstElementNumber && $this->eCounter < $this->firstElementNumber + $this->iLimit) {
- if ($this->firstElementNumber && $this->eCounter == $this->firstElementNumber) {
+ if ($this->firstElementNumber && $this->eCounter === $this->firstElementNumber) {
- // Reverse
+ // Reverse
$theData = array();
$titleCol = $this->fieldArray[0];
$theData[$titleCol] = $this->fwd_rwd_HTML('fwd', $this->eCounter, $table);
@@ -295,8 +297,8 @@
}
return array(1, $code);
} else {
- if ($this->eCounter == $this->firstElementNumber + $this->iLimit) {
+ if ($this->eCounter === $this->firstElementNumber + $this->iLimit) {
- // Forward
+ // Forward
$theData = array();
$titleCol = $this->fieldArray[0];
$theData[$titleCol] = $this->fwd_rwd_HTML('rwd', $this->eCounter, $table);
@@ -352,7 +354,7 @@
public function CBfunctions() {
return '
// checkOffCB()
- function checkOffCB(listOfCBnames, link) { //
+ function checkOffCB(listOfCBnames, link) {
var checkBoxes, flag, i;
var checkBoxes = listOfCBnames.split(",");
if (link.rel === "") {
@@ -367,12 +369,12 @@
}
}
// cbValue()
- function cbValue(CBname) { //
+ function cbValue(CBname) {
var CBfullName = "CBC["+CBname+"]";
return (document.dblistForm[CBfullName] && document.dblistForm[CBfullName].checked ? 1 : 0);
}
// setcbValue()
- function setcbValue(CBname,flag) { //
+ function setcbValue(CBname,flag) {
CBfullName = "CBC["+CBname+"]";
if(document.dblistForm[CBfullName]) {
document.dblistForm[CBfullName].checked = flag ? "on" : 0;
@@ -412,8 +414,7 @@
}
$out .= ' ';
}
- $out .= $title;
- return $out;
+ return $out . $title;
}
/**
@@ -451,9 +452,8 @@
if ($launchViewParameter !== '') {
$htmlCode .= ' onclick="' . htmlspecialchars(('top.launchView(' . $launchViewParameter . '); return false;')) . '"';
}
- $htmlCode .= ' title="' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(implode(' / ', $result), 100)) . '">';
- $htmlCode .= count($references);
- $htmlCode .= '';
+ $htmlCode .= ' title="' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(implode(' / ', $result), 100)) . '">' .
+ count($references) . '';
}
return $htmlCode;
}
Index: typo3_src/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- typo3_src/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php (revision 8dad992c4dee4c20356cb1a1ac8d0a8cc65adbc8)
+++ typo3_src/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php (revision )
@@ -505,7 +505,7 @@
foreach ($accRows as $row) {
// Render item row if counter < limit
if ($cc < $this->iLimit) {
- $cc++;
+ ++$cc;
$this->translations = FALSE;
$iOut .= $this->renderListRow($table, $row, $cc, $titleCol, $thumbsCol);
// If localization view is enabled it means that the selected records are
@@ -532,7 +532,7 @@
}
}
// Counter of total rows incremented:
- $this->eCounter++;
+ ++$this->eCounter;
}
// Record navigation is added to the beginning and end of the table if in single table mode
if ($this->table) {
@@ -605,17 +605,17 @@
public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent = 0) {
$iOut = '';
// If in search mode, make sure the preview will show the correct page
- if (strlen($this->searchString)) {
+ if ($this->searchString !== '') {
$id_orig = $this->id;
$this->id = $row['pid'];
}
if (is_array($row)) {
// Add special classes for first and last row
$rowSpecial = '';
- if ($cc == 1 && $indent == 0) {
+ if ($cc === 1 && $indent === 0) {
$rowSpecial .= ' firstcol';
}
- if ($cc == $this->totalRowCount || $cc == $this->iLimit) {
+ if ($cc === $this->totalRowCount || $cc === $this->iLimit) {
$rowSpecial .= ' lastcol';
}
// Background color, if any:
@@ -627,7 +627,7 @@
// Overriding with versions background color if any:
$row_bgColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $row_bgColor;
// Incr. counter.
- $this->counter++;
+ ++$this->counter;
// The icon with link
$alttext = BackendUtility::getRecordIconAltText($row, $table);
$iconImg = IconUtility::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($alttext), 'style' => $indent ? ' margin-left: ' . $indent . 'px;' : ''));
@@ -657,29 +657,29 @@
$theData[$fCol] .= ' ' . $this->thumbCode($row, $table, $thumbsCol);
}
$localizationMarkerClass = '';
- if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0 && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0) {
+ if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) &&
+ $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0 &&
+ $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0) {
// It's a translated record with a language parent
$localizationMarkerClass = ' localization';
}
- } elseif ($fCol == 'pid') {
+ } elseif ($fCol === 'pid') {
$theData[$fCol] = $row[$fCol];
- } elseif ($fCol == '_PATH_') {
+ } elseif ($fCol === '_PATH_') {
$theData[$fCol] = $this->recPath($row['pid']);
- } elseif ($fCol == '_REF_') {
+ } elseif ($fCol === '_REF_') {
$theData[$fCol] = $this->createReferenceHtml($table, $row['uid']);
- } elseif ($fCol == '_CONTROL_') {
+ } elseif ($fCol === '_CONTROL_') {
$theData[$fCol] = $this->makeControl($table, $row);
- } elseif ($fCol == '_AFTERCONTROL_' || $fCol == '_AFTERREF_') {
+ } elseif ($fCol === '_AFTERCONTROL_' || $fCol === '_AFTERREF_') {
$theData[$fCol] = ' ';
- } elseif ($fCol == '_CLIPBOARD_') {
+ } elseif ($fCol === '_CLIPBOARD_') {
$theData[$fCol] = $this->makeClip($table, $row);
- } elseif ($fCol == '_LOCALIZATION_') {
+ } elseif ($fCol === '_LOCALIZATION_') {
list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row);
$theData[$fCol] = $lC1;
$theData[$fCol . 'b'] = $lC2;
- } elseif ($fCol == '_LOCALIZATION_b') {
-
- } else {
+ } elseif ($fCol !== '_LOCALIZATION_b') {
$tmpProc = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid']);
$theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]);
if ($this->csvOutput) {
@@ -688,7 +688,7 @@
}
}
// Reset the ID if it was overwritten
- if (strlen($this->searchString)) {
+ if ($this->searchString !== '') {
$this->id = $id_orig;
}
// Add row to CSV list:
@@ -722,7 +722,7 @@
*/
protected function getReferenceCount($tableName, $uid) {
if (!isset($this->referenceCount[$tableName][$uid])) {
- $numberOfReferences = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'sys_refindex', 'ref_table = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tableName, 'sys_refindex') . ' AND ref_uid = ' . $uid . ' AND deleted = 0');
+ $numberOfReferences = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('recuid', 'sys_refindex', 'ref_table = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tableName, 'sys_refindex') . ' AND ref_uid = ' . $uid . ' AND deleted = 0');
$this->referenceCount[$tableName][$uid] = $numberOfReferences;
}
return $this->referenceCount[$tableName][$uid];
@@ -733,6 +733,8 @@
*
* @param string $table Table name
* @param array $currentIdList Array of the currently displayed uids of the table
+ *
+ * @throws \UnexpectedValueException
* @return string Header table row
* @access private
* @see getTable()
@@ -744,7 +746,7 @@
// Traverse the fields:
foreach ($this->fieldArray as $fCol) {
// Calculate users permissions to edit records in the table:
- $permsEdit = $this->calcPerms & ($table == 'pages' ? 2 : 16);
+ $permsEdit = $this->calcPerms & ($table === 'pages' ? 2 : 16);
switch ((string) $fCol) {
case '_PATH_':
// Path
@@ -808,17 +810,17 @@
if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly']) {
// If new records can be created on this page, add links:
if ($this->calcPerms & ($table == 'pages' ? 8 : 16) && $this->showNewRecLink($table)) {
- if ($table == 'tt_content' && $this->newWizards) {
+ if ($table === 'tt_content' && $this->newWizards) {
// If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
$tmpTSc = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
$tmpTSc = $tmpTSc['properties']['newContentWiz.']['overrideWithExtension'];
$newContentWizScriptPath = $this->backPath . ExtensionManagementUtility::isLoaded($tmpTSc) ? ExtensionManagementUtility::extRelPath($tmpTSc) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php';
$icon = '' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . ' ';
} elseif ($table == 'pages' && $this->newWizards) {
- $icon = '' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . ' ';
+ $icon = '' . ($table === 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . ' ';
} else {
$params = '&edit[' . $table . '][' . $this->id . ']=new';
- if ($table == 'pages_language_overlay') {
+ if ($table === 'pages_language_overlay') {
$params .= '&overrideVals[pages_language_overlay][doktype]=' . (int)$this->pageRow['doktype'];
}
$icon = '' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . ' ';
@@ -908,7 +910,6 @@
$returnContent = '';
// Show page selector if not all records fit into one page
if ($totalPages > 1) {
- $first = ($previous = ($next = ($last = ($reload = ''))));
$listURL = $this->listURL('', $this->table);
// 1 = first page
$currentPage = floor(($this->firstElementNumber + 1) / $this->iLimit) + 1;
@@ -992,6 +993,8 @@
*
* @param string $table The table
* @param array $row The record for which to make the control panel.
+ *
+ * @throws \UnexpectedValueException
* @return string HTML table with the control panel (unless disabled)
* @todo Define visibility
*/
@@ -1005,20 +1008,26 @@
}
$cells = array();
// If the listed table is 'pages' we have to request the permission settings for each page:
- if ($table == 'pages') {
+ $isPagesTable = FALSE;
+ if ($table === 'pages') {
+ $isPagesTable = TRUE;
$localCalcPerms = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $row['uid']));
}
// This expresses the edit permissions for this particular element:
- $permsEdit = $table == 'pages' && $localCalcPerms & 2 || $table != 'pages' && $this->calcPerms & 16;
+ $hasEditPermission = $isPagesTable && $localCalcPerms & 2 || !$isPagesTable && $this->calcPerms & 16;
+ $isTtContentTable = FALSE;
+ if ($table === 'tt_content') {
+ $isTtContentTable = TRUE;
+ }
// "Show" link (only pages and tt_content elements)
- if ($table == 'pages' || $table == 'tt_content') {
+ if ($isPagesTable || $isTtContentTable) {
$cells['view'] = ''
. IconUtility::getSpriteIcon('actions-document-view') . ' ';
@@ -1026,15 +1035,15 @@
$cells['view'] = $this->spaceIcon;
}
// "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
- if ($permsEdit) {
+ if ($hasEditPermission) {
$params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
$cells['edit'] = '' . ($GLOBALS['TCA'][$table]['ctrl']['readOnly'] ? IconUtility::getSpriteIcon('actions-document-open-read-only') : IconUtility::getSpriteIcon('actions-document-open')) . ' ';
} elseif (!$this->table) {
$cells['edit'] = $this->spaceIcon;
}
// "Move" wizard link for pages/tt_content elements:
- if ($table == 'tt_content' && $permsEdit || $table == 'pages') {
- $cells['move'] = '' . ($table == 'tt_content' ? IconUtility::getSpriteIcon('actions-document-move') : IconUtility::getSpriteIcon('actions-page-move')) . ' ';
+ if ($isTtContentTable && $hasEditPermission || $isPagesTable) {
+ $cells['move'] = '' . ($isTtContentTable ? IconUtility::getSpriteIcon('actions-document-move') : IconUtility::getSpriteIcon('actions-page-move')) . ' ';
} elseif (!$this->table) {
$cells['move'] = $this->spaceIcon;
}
@@ -1045,7 +1054,7 @@
// If the table is NOT a read-only table, then show these links:
if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly']) {
// "Revert" link (history/undo)
- $cells['history'] = '' . IconUtility::getSpriteIcon('actions-document-history-open') . ' ';
+ $cells['history'] = '' . IconUtility::getSpriteIcon('actions-document-history-open') . ' ';
// Versioning:
if (ExtensionManagementUtility::isLoaded('version') && !ExtensionManagementUtility::isLoaded('workspaces')) {
$vers = BackendUtility::selectVersionsOfRecord($table, $row['uid'], 'uid', $GLOBALS['BE_USER']->workspace, FALSE, $row);
@@ -1061,24 +1070,24 @@
}
}
// "Edit Perms" link:
- if ($table == 'pages' && $GLOBALS['BE_USER']->check('modules', 'web_perm') && ExtensionManagementUtility::isLoaded('perm')) {
+ if ($isPagesTable && $GLOBALS['BE_USER']->check('modules', 'web_perm') && ExtensionManagementUtility::isLoaded('perm')) {
$cells['perms'] = '' . IconUtility::getSpriteIcon('status-status-locked') . ' ';
} elseif (!$this->table && $GLOBALS['BE_USER']->check('modules', 'web_perm')) {
$cells['perms'] = $this->spaceIcon;
}
// "New record after" link (ONLY if the records in the table are sorted by a "sortby"-row or if default values can depend on previous record):
if ($GLOBALS['TCA'][$table]['ctrl']['sortby'] || $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']) {
- if ($table != 'pages' && $this->calcPerms & 16 || $table == 'pages' && $this->calcPerms & 8) {
+ if (!$isPagesTable && $this->calcPerms & 16 || $isPagesTable && $this->calcPerms & 8) {
if ($this->showNewRecLink($table)) {
$params = '&edit[' . $table . '][' . -($row['_MOVE_PLH'] ? $row['_MOVE_PLH_uid'] : $row['uid']) . ']=new';
- $cells['new'] = '' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . ' ';
+ $cells['new'] = '' . ($isPagesTable ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . ' ';
}
}
} elseif (!$this->table) {
$cells['new'] = $this->spaceIcon;
}
// "Up/Down" links
- if ($permsEdit && $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField && !$this->searchLevels) {
+ if ($hasEditPermission && $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField && !$this->searchLevels) {
if (isset($this->currentTable['prev'][$row['uid']])) {
// Up
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prev'][$row['uid']];
@@ -1099,19 +1108,19 @@
}
// "Hide/Unhide" links:
$hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
- if ($permsEdit && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField] && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $hiddenField))) {
+ if ($hasEditPermission && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField] && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $hiddenField))) {
if ($row[$hiddenField]) {
$params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=0';
- $cells['hide'] = '' . IconUtility::getSpriteIcon('actions-edit-unhide') . ' ';
+ $cells['hide'] = '' . IconUtility::getSpriteIcon('actions-edit-unhide') . ' ';
} else {
$params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
- $cells['hide'] = '' . IconUtility::getSpriteIcon('actions-edit-hide') . ' ';
+ $cells['hide'] = '' . IconUtility::getSpriteIcon('actions-edit-hide') . ' ';
}
} elseif (!$this->table) {
$cells['hide'] = $this->spaceIcon;
}
// "Delete" link:
- if ($table == 'pages' && $localCalcPerms & 4 || $table != 'pages' && $this->calcPerms & 16) {
+ if ($hasEditPermission) {
// Check if the record version is in "deleted" state, because that will switch the action to "restore"
if ($GLOBALS['BE_USER']->workspace > 0 && isset($row['t3ver_state']) && (int)$row['t3ver_state'] === 2) {
$actionName = 'restore';
@@ -1146,7 +1155,7 @@
$cells['delete'] = $this->spaceIcon;
}
// "Levels" links: Moving pages into new levels...
- if ($permsEdit && $table == 'pages' && !$this->searchLevels) {
+ if ($hasEditPermission && $isPagesTable && !$this->searchLevels) {
// Up (Paste as the page right after the current parent page)
if ($this->calcPerms & 8) {
$params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id;
@@ -1220,15 +1229,15 @@
$cells = array();
$cells['pasteAfter'] = ($cells['pasteInto'] = $this->spaceIcon);
//enables to hide the copy, cut and paste icons for localized records - doesn't make much sense to perform these options for them
- $isL10nOverlay = $this->localizationView && $table != 'pages_language_overlay' && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0;
+ $isL10nOverlay = $this->localizationView && $table !== 'pages_language_overlay' && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0;
// Return blank, if disabled:
// Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
// For the "Normal" pad:
- if ($this->clipObj->current == 'normal') {
+ if ($this->clipObj->current === 'normal') {
// Show copy/cut icons:
$isSel = (string) $this->clipObj->isSelected($table, $row['uid']);
- $cells['copy'] = $isL10nOverlay ? $this->spaceIcon : '' . (!$isSel == 'copy' ? IconUtility::getSpriteIcon('actions-edit-copy') : IconUtility::getSpriteIcon('actions-edit-copy-release')) . ' ';
- $cells['cut'] = $isL10nOverlay ? $this->spaceIcon : '' . (!$isSel == 'cut' ? IconUtility::getSpriteIcon('actions-edit-cut') : IconUtility::getSpriteIcon('actions-edit-cut-release')) . ' ';
+ $cells['copy'] = $isL10nOverlay ? $this->spaceIcon : '' . (!$isSel === 'copy' ? IconUtility::getSpriteIcon('actions-edit-copy') : IconUtility::getSpriteIcon('actions-edit-copy-release')) . ' ';
+ $cells['cut'] = $isL10nOverlay ? $this->spaceIcon : '' . (!$isSel === 'cut' ? IconUtility::getSpriteIcon('actions-edit-cut') : IconUtility::getSpriteIcon('actions-edit-cut-release')) . ' ';
} else {
// For the numeric clipboard pads (showing checkboxes where one can select elements on/off)
// Setting name of the element in ->CBnames array:
@@ -1255,7 +1264,7 @@
}
// Now, looking for elements in general:
$elFromTable = $this->clipObj->elFromTable('');
- if ($table == 'pages' && count($elFromTable)) {
+ if ($table === 'pages' && count($elFromTable)) {
$cells['pasteInto'] = '' . IconUtility::getSpriteIcon('actions-document-paste-into') . ' ';
}
/**
@@ -1442,15 +1451,15 @@
*/
public function addSortLink($code, $field, $table) {
// Certain circumstances just return string right away (no links):
- if ($field == '_CONTROL_' || $field == '_LOCALIZATION_' || $field == '_CLIPBOARD_' || $field == '_REF_' || $this->disableSingleTableView) {
+ if ($field === '_CONTROL_' || $field === '_LOCALIZATION_' || $field === '_CLIPBOARD_' || $field === '_REF_' || $this->disableSingleTableView) {
return $code;
}
// If "_PATH_" (showing record path) is selected, force sorting by pid field (will at least group the records!)
- if ($field == '_PATH_') {
+ if ($field === '_PATH_') {
$field = 'pid';
}
// Create the sort link:
- $sortUrl = $this->listURL('', -1, 'sortField,sortRev,table,firstElementNumber') . '&table=' . $table . '&sortField=' . $field . '&sortRev=' . ($this->sortRev || $this->sortField != $field ? 0 : 1);
+ $sortUrl = $this->listURL('', -1, 'sortField,sortRev,table,firstElementNumber') . '&table=' . $table . '&sortField=' . $field . '&sortRev=' . ($this->sortRev || $this->sortField !== $field ? 0 : 1);
$sortArrow = $this->sortField === $field ? IconUtility::getSpriteIcon('status-status-sorting-' . ($this->sortRev ? 'desc' : 'asc')) : '';
// Return linked field:
return '' . $code . $sortArrow . ' ';
@@ -1481,9 +1490,9 @@
*/
public function showNewRecLink($table) {
// No deny/allow tables are set:
- if (!count($this->allowedNewTables) && !count($this->deniedNewTables)) {
+ if (empty($this->allowedNewTables) && empty($this->deniedNewTables)) {
return TRUE;
- } elseif (!in_array($table, $this->deniedNewTables) && (!count($this->allowedNewTables) || in_array($table, $this->allowedNewTables))) {
+ } elseif (!in_array($table, $this->deniedNewTables) && (empty($this->allowedNewTables) || in_array($table, $this->allowedNewTables))) {
return TRUE;
} else {
return FALSE;
Index: typo3_src/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- typo3_src/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php (revision 8dad992c4dee4c20356cb1a1ac8d0a8cc65adbc8)
+++ typo3_src/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php (revision )
@@ -299,10 +299,11 @@
* @param string $search Search word, if any
* @param integer $levels Number of levels to search down the page tree
* @param integer $showLimit Limit of records to be listed.
+ *
* @return void
* @todo Define visibility
*/
- public function start($id, $table, $pointer, $search = '', $levels = '', $showLimit = 0) {
+ public function start($id, $table, $pointer, $search = '', $levels = 0, $showLimit = 0) {
// Setting internal variables:
// sets the parent id
$this->id = (int)$id;
@@ -312,10 +313,11 @@
}
$this->firstElementNumber = $pointer;
$this->searchString = trim($search);
- $this->searchLevels = trim($levels);
+ // Set search levels:
+ $this->searchLevels = (int)$levels;
$this->showLimit = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($showLimit, 0, 10000);
// Setting GPvars:
- $this->csvOutput = GeneralUtility::_GP('csv') ? TRUE : FALSE;
+ $this->csvOutput = (bool)GeneralUtility::_GP('csv');
$this->sortField = GeneralUtility::_GP('sortField');
$this->sortRev = GeneralUtility::_GP('sortRev');
$this->displayFields = GeneralUtility::_GP('displayFields');
@@ -334,8 +336,6 @@
if (isset($this->modTSconfig['properties']['itemsLimitSingleTable'])) {
$this->itemsLimitSingleTable = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int)$this->modTSconfig['properties']['itemsLimitSingleTable'], 1, 10000);
}
- // Set search levels:
- $searchLevels = (int)$this->searchLevels;
$this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
// This will hide records from display - it has nothing todo with user rights!!
if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) {
@@ -360,11 +360,11 @@
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($returnUrl);
}
}
- if ($searchLevels > 0) {
- $allowedMounts = $this->getSearchableWebmounts($this->id, $searchLevels, $this->perms_clause);
+ if ($this->searchLevels > 0) {
+ $allowedMounts = $this->getSearchableWebmounts($this->id, $this->searchLevels, $this->perms_clause);
$pidList = implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($allowedMounts));
$this->pidSelect = 'pid IN (' . $pidList . ')';
- } elseif ($searchLevels < 0) {
+ } elseif ($this->searchLevels < 0) {
// Search everywhere
$this->pidSelect = '1=1';
} else {
@@ -391,16 +391,16 @@
foreach ($GLOBALS['TCA'] as $tableName => $value) {
// Checking if the table should be rendered:
// Checks that we see only permitted/requested tables:
- if ((!$this->table || $tableName == $this->table) && (!$this->tableList || GeneralUtility::inList($this->tableList, $tableName)) && $GLOBALS['BE_USER']->check('tables_select', $tableName)) {
+ if ((!$this->table || $tableName === $this->table) && (!$this->tableList || GeneralUtility::inList($this->tableList, $tableName)) && $GLOBALS['BE_USER']->check('tables_select', $tableName)) {
// Don't show table if hidden by TCA ctrl section
- $hideTable = $GLOBALS['TCA'][$tableName]['ctrl']['hideTable'] ? TRUE : FALSE;
+ $hideTable = (bool)$GLOBALS['TCA'][$tableName]['ctrl']['hideTable'];
// Don't show table if hidden by pageTSconfig mod.web_list.hideTables
if (in_array($tableName, GeneralUtility::trimExplode(',', $this->hideTables))) {
$hideTable = TRUE;
}
// Override previous selection if table is enabled or hidden by TSconfig TCA override mod.web_list.table
if (isset($this->tableTSconfigOverTCA[$tableName . '.']['hideTable'])) {
- $hideTable = $this->tableTSconfigOverTCA[$tableName . '.']['hideTable'] ? TRUE : FALSE;
+ $hideTable = (bool)$this->tableTSconfigOverTCA[$tableName . '.']['hideTable'];
}
if ($hideTable) {
continue;
@@ -446,7 +446,7 @@
* @return string HTML for the search box
* @todo Define visibility
*/
- public function getSearchBox($formFields = 1) {
+ public function getSearchBox($formFields = TRUE) {
// Setting form-elements, if applicable:
$formElements = array('', '');
if ($formFields) {
@@ -475,7 +475,7 @@
' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showRecords', TRUE) . ':
- formWidth(4) . ' />
+ formWidth(4) . ' />
' . $formElements[1] . '';
@@ -552,19 +552,20 @@
}
}
// Set ORDER BY:
- $orderBy = $GLOBALS['TCA'][$table]['ctrl']['sortby'] ? 'ORDER BY ' . $GLOBALS['TCA'][$table]['ctrl']['sortby'] : $GLOBALS['TCA'][$table]['ctrl']['default_sortby'];
- if ($this->sortField) {
- if (in_array($this->sortField, $this->makeFieldList($table, 1))) {
+ if ($this->sortField && in_array($this->sortField, $this->makeFieldList($table, 1))) {
- $orderBy = 'ORDER BY ' . $this->sortField;
- if ($this->sortRev) {
- $orderBy .= ' DESC';
- }
+ $orderBy = 'ORDER BY ' . $this->sortField;
+ if ($this->sortRev) {
+ $orderBy .= ' DESC';
+ }
+ } elseif ($GLOBALS['TCA'][$table]['ctrl']['sortby']) {
+ $orderBy = 'ORDER BY ' . $GLOBALS['TCA'][$table]['ctrl']['sortby'];
+ } else {
+ $orderBy = $GLOBALS['TCA'][$table]['ctrl']['default_sortby'];
- }
+ }
- }
// Set LIMIT:
$limit = $this->iLimit ? ($this->firstElementNumber ? $this->firstElementNumber . ',' : '') . ($this->iLimit + 1) : '';
// Filtering on displayable pages (permissions):
- $pC = $table == 'pages' && $this->perms_clause ? ' AND ' . $this->perms_clause : '';
+ $pC = $table === 'pages' && $this->perms_clause ? ' AND ' . $this->perms_clause : '';
// Adding search constraints:
$search = $this->makeSearchString($table, $id);
// Compiling query array:
@@ -577,7 +578,9 @@
'LIMIT' => $limit
);
// Filter out records that are translated, if TSconfig mod.web_list.hideTranslations is set
- if ((in_array($table, GeneralUtility::trimExplode(',', $this->hideTranslations)) || $this->hideTranslations === '*') && !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) && $table !== 'pages_language_overlay') {
+ if (($this->hideTranslations === '*' || in_array($table, GeneralUtility::trimExplode(',', $this->hideTranslations))) &&
+ !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) &&
+ $table !== 'pages_language_overlay') {
$queryParts['WHERE'] .= ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=0 ';
}
// Apply hook as requested in http://forge.typo3.org/issues/16634
@@ -605,7 +608,7 @@
* @todo Define visibility
*/
public function setTotalItems($queryParts) {
- $this->totalItems = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $queryParts['FROM'], $queryParts['WHERE']);
+ $this->totalItems = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $queryParts['FROM'], $queryParts['WHERE']);
}
/**
@@ -625,7 +628,7 @@
if ($this->searchString) {
$result = ' AND 0=1';
$searchableFields = $this->getSearchFields($table);
- if (count($searchableFields) > 0) {
+ if (!empty($searchableFields)) {
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->searchString)) {
$whereParts = array(
'uid=' . $this->searchString
@@ -634,15 +637,20 @@
if (isset($GLOBALS['TCA'][$table]['columns'][$fieldName])) {
$fieldConfig = &$GLOBALS['TCA'][$table]['columns'][$fieldName]['config'];
$condition = $fieldName . '=' . $this->searchString;
- if ($fieldConfig['type'] == 'input' && $fieldConfig['eval'] && GeneralUtility::inList($fieldConfig['eval'], 'int')) {
- if (is_array($fieldConfig['search']) && in_array('pidonly', $fieldConfig['search']) && $currentPid > 0) {
+ if ($fieldConfig['type'] === 'input' &&
+ $fieldConfig['eval'] &&
+ GeneralUtility::inList($fieldConfig['eval'], 'int')) {
+ if (is_array($fieldConfig['search']) &&
+ in_array('pidonly', $fieldConfig['search'])
+ && $currentPid > 0) {
$condition = '(' . $condition . ' AND ' . $tablePidField . '=' . $currentPid . ')';
}
$whereParts[] = $condition;
} elseif (
- $fieldConfig['type'] == 'text' ||
- $fieldConfig['type'] == 'flex' ||
- ($fieldConfig['type'] == 'input' && (!$fieldConfig['eval'] || !preg_match('/date|time|int/', $fieldConfig['eval'])))) {
+ $fieldConfig['type'] === 'text' ||
+ $fieldConfig['type'] === 'flex' ||
+ ($fieldConfig['type'] === 'input' &&
+ (!$fieldConfig['eval'] || !preg_match('/date|time|int/', $fieldConfig['eval'])))) {
$condition = $fieldName . ' LIKE \'%' . $this->searchString . '%\'';
$whereParts[] = $condition;
}
@@ -666,14 +674,17 @@
$format = '((' . $fieldConfig['search']['andWhere'] . ') AND (' . $format . '))';
}
}
- if ($fieldConfig['type'] == 'text' || $fieldConfig['type'] == 'flex' || $fieldConfig['type'] == 'input' && (!$fieldConfig['eval'] || !preg_match('/date|time|int/', $fieldConfig['eval']))) {
+ if ($fieldConfig['type'] === 'text' ||
+ $fieldConfig['type'] === 'flex' ||
+ $fieldConfig['type'] === 'input' &&
+ (!$fieldConfig['eval'] || !preg_match('/date|time|int/', $fieldConfig['eval']))) {
$whereParts[] = sprintf($format, $fieldName, $like);
}
}
}
}
// If search-fields were defined (and there always are) we create the query:
- if (count($whereParts)) {
+ if (!empty($whereParts)) {
$result = ' AND (' . implode(' OR ', $whereParts) . ')';
}
}
@@ -752,7 +763,7 @@
switch ((string) $this->clickTitleMode) {
case 'edit':
// If the listed table is 'pages' we have to request the permission settings for each page:
- if ($table == 'pages') {
+ if ($table === 'pages') {
$localCalcPerms = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $row['uid']));
$permsEdit = $localCalcPerms & 2;
} else {
@@ -767,18 +778,18 @@
break;
case 'show':
// "Show" link (only pages and tt_content elements)
- if ($table == 'pages' || $table == 'tt_content') {
+ if ($table === 'pages' || $table === 'tt_content') {
$code = '' . $code . ' ';
+ BackendUtility::viewOnClick(($table === 'tt_content' ? $this->id . '#' . $row['uid'] : $row['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . $code . '';
}
break;
case 'info':
// "Info": (All records)
- $code = '' . $code . ' ';
+ $code = '' . $code . ' ';
break;
default:
// Output the label now:
- if ($table == 'pages') {
+ if ($table === 'pages') {
$code = '' . $code . ' ';
} else {
$code = $this->linkUrlMail($code, $origCode);
@@ -878,7 +889,7 @@
* @return array Array, where values are fieldnames to include in query
* @todo Define visibility
*/
- public function makeFieldList($table, $dontCheckUser = 0, $addDateFields = 0) {
+ public function makeFieldList($table, $dontCheckUser = FALSE, $addDateFields = FALSE) {
// Init fieldlist array:
$fieldListArr = array();
// Check table:
@@ -895,7 +906,7 @@
$fieldListArr[] = 'pid';
// Add date fields
- if ($dontCheckUser || $GLOBALS['BE_USER']->isAdmin() || $addDateFields) {
+ if ($addDateFields || $dontCheckUser || $GLOBALS['BE_USER']->isAdmin()) {
if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) {
$fieldListArr[] = $GLOBALS['TCA'][$table]['ctrl']['tstamp'];
}
@@ -988,7 +999,9 @@
*/
public function localizationRedirect($justLocalized) {
list($table, $orig_uid, $language) = explode(':', $justLocalized);
- if ($GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) {
+ if ($GLOBALS['TCA'][$table] &&
+ $GLOBALS['TCA'][$table]['ctrl']['languageField'] &&
+ $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) {
$localizedRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid', $table, $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . (int)$language . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . (int)$orig_uid . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table));
if (is_array($localizedRecord)) {
// Create parameters and finally run the classic page module for creating a new page translation
Index: typo3_src/typo3/sysext/backend/Classes/Utility/BackendUtility.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- typo3_src/typo3/sysext/backend/Classes/Utility/BackendUtility.php (revision 8dad992c4dee4c20356cb1a1ac8d0a8cc65adbc8)
+++ typo3_src/typo3/sysext/backend/Classes/Utility/BackendUtility.php (revision )
@@ -50,6 +50,13 @@
*/
class BackendUtility {
+ /**
+ * Array of parsed pageTsConfig, indexed by page id.
+ *
+ * @var array
+ */
+ static private $pageTsConfigCache = array();
+
/*******************************************
*
* SQL-related, selecting records, searching
@@ -1129,55 +1136,52 @@
* @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
*/
static public function getPagesTSconfig($id, $rootLine = NULL, $returnPartArray = FALSE) {
- static $pagesTSconfig_cache = array();
$id = (int)$id;
- if ($returnPartArray === FALSE
- && $rootLine === NULL
- && isset($pagesTSconfig_cache[$id])
- ) {
- return $pagesTSconfig_cache[$id];
- } else {
- $TSconfig = array();
+ if (!$returnPartArray && $rootLine === NULL) {
+ if (isset(self::$pageTsConfigCache[$id])) {
+ return self::$pageTsConfigCache[$id];
+ }
+ }
+
+ $isCacheable = FALSE;
+ $tsConfig = array();
- if (!is_array($rootLine)) {
+ if (!is_array($rootLine)) {
- $useCacheForCurrentPageId = TRUE;
+ $isCacheable = TRUE;
- $rootLine = self::BEgetRootLine($id, '', TRUE);
+ $rootLine = self::BEgetRootLine($id, '', TRUE);
- } else {
- $useCacheForCurrentPageId = FALSE;
- }
+ }
- // Order correctly
- ksort($rootLine);
- $TSdataArray = array();
- // Setting default configuration
- $TSdataArray['defaultPageTSconfig'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];
- foreach ($rootLine as $k => $v) {
- $TSdataArray['uid_' . $v['uid']] = $v['TSconfig'];
- }
- $TSdataArray = TypoScriptParser::checkIncludeLines_array($TSdataArray);
- if ($returnPartArray) {
- return $TSdataArray;
- }
- // Parsing the page TS-Config
- $pageTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
- /* @var $parseObj \TYPO3\CMS\Backend\Configuration\TsConfigParser */
- $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Configuration\\TsConfigParser');
- $res = $parseObj->parseTSconfig($pageTS, 'PAGES', $id, $rootLine);
- if ($res) {
+ // Order correctly
+ ksort($rootLine);
+ $TSdataArray = array();
+ // Setting default configuration
+ $TSdataArray['defaultPageTSconfig'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];
+ foreach ($rootLine as $k => $v) {
+ $TSdataArray['uid_' . $v['uid']] = $v['TSconfig'];
+ }
+ $TSdataArray = TypoScriptParser::checkIncludeLines_array($TSdataArray);
+ if ($returnPartArray) {
+ return $TSdataArray;
+ }
+ // Parsing the page TS-Config
+ $pageTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
+ /* @var $parseObj \TYPO3\CMS\Backend\Configuration\TsConfigParser */
+ $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Configuration\\TsConfigParser');
+ $res = $parseObj->parseTSconfig($pageTS, 'PAGES', $id, $rootLine);
+ if ($res) {
- $TSconfig = $res['TSconfig'];
+ $tsConfig = $res['TSconfig'];
- }
- // Get User TSconfig overlay
- $userTSconfig = $GLOBALS['BE_USER']->userTS['page.'];
- if (is_array($userTSconfig)) {
+ }
+ // Get User TSconfig overlay
+ $userTSconfig = $GLOBALS['BE_USER']->userTS['page.'];
+ if (is_array($userTSconfig)) {
- \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($TSconfig, $userTSconfig);
+ \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($tsConfig, $userTSconfig);
- }
+ }
- if ($useCacheForCurrentPageId) {
- $pagesTSconfig_cache[$id] = $TSconfig;
+ if ($isCacheable) {
+ self::$pageTsConfigCache[$id] = $tsConfig;
- }
+ }
+ return $tsConfig;
- }
+ }
- return $TSconfig;
- }
/**
* Updates Page TSconfig for a page with $id
@@ -2565,10 +2569,7 @@
* @return string
*/
static public function viewOnClick($pageUid, $backPath = '', $rootLine = '', $anchorSection = '', $alternativeUrl = '', $additionalGetVars = '', $switchFocus = TRUE) {
- $viewScript = '/index.php?id=';
- if ($alternativeUrl) {
- $viewScript = $alternativeUrl;
- }
+ $viewScript = $alternativeUrl ?: '/index.php?id=';
if (
isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewOnClickClass'])
@@ -3026,7 +3027,7 @@
*/
static public function getListViewLink($urlParameters = array(), $linkTitle = '', $linkText = '') {
$url = self::getModuleUrl('web_list', $urlParameters);
- if (!ExtensionManagementUtility::isLoaded('recordlist') || $url === FALSE) {
+ if ($url === FALSE || !ExtensionManagementUtility::isLoaded('recordlist')) {
return '';
} else {
return '' . IconUtility::getSpriteIcon('actions-system-list-open') . htmlspecialchars($linkText) . ' ';
@@ -3153,7 +3154,7 @@
);
} else {
$pageClause = $GLOBALS['BE_USER']->getPagePermsClause(1);
- if ($foreign_table != 'pages') {
+ if ($foreign_table !== 'pages') {
$queryParts = array(
'SELECT' => self::getCommonSelectFields($foreign_table, $foreign_table . '.'),
'FROM' => $foreign_table . ', pages',
@@ -3339,8 +3340,7 @@
* @see \TYPO3\CMS\Backend\Form\FormEngine::getTSCpid()
*/
static public function getPidForModTSconfig($table, $uid, $pid) {
- $retVal = $table == 'pages' && MathUtility::canBeInterpretedAsInteger($uid) ? $uid : $pid;
- return $retVal;
+ return $table === 'pages' && MathUtility::canBeInterpretedAsInteger($uid) ? $uid : $pid;
}
/**
@@ -3548,7 +3548,7 @@
static public function referenceCount($table, $ref, $msg = '', $count = NULL) {
if ($count === NULL) {
// Look up the path:
- if ($table == '_FILE') {
+ if ($table === '_FILE') {
if (GeneralUtility::isFirstPartOfStr($ref, PATH_site)) {
$ref = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($ref);
$condition = 'ref_string=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($ref, 'sys_refindex');
@@ -3558,7 +3558,7 @@
} else {
$condition = 'ref_uid=' . (int)$ref;
}
- $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'sys_refindex', 'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') . ' AND ' . $condition . ' AND deleted=0');
+ $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('recuid', 'sys_refindex', 'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') . ' AND ' . $condition . ' AND deleted=0');
}
return $count ? ($msg ? sprintf($msg, $count) : $count) : '';
}
@@ -3572,12 +3572,16 @@
* @return string Output string (or integer count value if no msg string specified)
*/
static public function translationCount($table, $ref, $msg = '') {
- if (empty($GLOBALS['TCA'][$table]['ctrl']['transForeignTable']) && $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] && !$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']) {
+ $count = 0;
+ if (empty($GLOBALS['TCA'][$table]['ctrl']['transForeignTable']) &&
+ $GLOBALS['TCA'][$table]['ctrl']['languageField'] &&
+ $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] &&
+ !$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable']) {
$where = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . (int)$ref . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '<>0';
if (!empty($GLOBALS['TCA'][$table]['ctrl']['delete'])) {
$where .= ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['delete'] . '=0';
}
- $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $table, $where);
+ $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'], $table, $where);
}
return $count ? ($msg ? sprintf($msg, $count) : $count) : '';
}
@@ -3705,6 +3709,7 @@
}
// Check if workspace is different from zero and record is set:
if ($wsid !== 0 && is_array($row)) {
+ $movePldSwap = FALSE;
// Check if input record is a move-placeholder and if so, find the pointed-to live record:
if ($previewMovePlaceholders) {
$orig_uid = $row['uid'];
@@ -3715,7 +3720,10 @@
// If version was found, swap the default record with that one.
if (is_array($wsAlt)) {
// Check if this is in move-state:
- if ($previewMovePlaceholders && !$movePldSwap && ($table == 'pages' || (int)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) && $unsetMovePointers) {
+ if ($previewMovePlaceholders &&
+ !$movePldSwap &&
+ ($table === 'pages' || (int)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) &&
+ $unsetMovePointers) {
// Only for WS ver 2... (moving)
// If t3ver_state is not found, then find it... (but we like best if it is here...)
if (!isset($wsAlt['t3ver_state'])) {
@@ -3768,7 +3776,7 @@
*/
static public function movePlhOL($table, &$row) {
// Only for WS ver 2... (moving)
- if ($table == 'pages' || (int)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) {
+ if ($table === 'pages' || (int)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) {
// If t3ver_move_id or t3ver_state is not found, then find it... (but we like best if it is here...)
if (!isset($row['t3ver_move_id']) || !isset($row['t3ver_state'])) {
$moveIDRec = self::getRecord($table, $row['uid'], 't3ver_move_id, t3ver_state');
@@ -3889,7 +3897,7 @@
$output = array();
if ($workspace != 0) {
foreach ($GLOBALS['TCA'] as $tableName => $cfg) {
- if ($tableName != 'pages' && $cfg['ctrl']['versioningWS']) {
+ if ($tableName !== 'pages' && $cfg['ctrl']['versioningWS']) {
// Select all records from this table in the database from the workspace
// This joins the online version with the offline version as tables A and B
$output[$tableName] = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('B.uid as live_uid, A.uid as offline_uid', $tableName . ' A,' . $tableName . ' B', 'A.pid=-1' . ' AND B.pid=' . (int)$pageId . ' AND A.t3ver_wsid=' . (int)$workspace . ' AND A.t3ver_oid=B.uid' . self::deleteClause($tableName, 'A') . self::deleteClause($tableName, 'B'));
@@ -4015,13 +4023,14 @@
* @internal
*/
static public function ADMCMD_previewCmds($pageinfo) {
+ $simUser = $simTime = '';
if ($pageinfo['fe_group'] > 0) {
$simUser = '&ADMCMD_simUser=' . $pageinfo['fe_group'];
}
if ($pageinfo['starttime'] > $GLOBALS['EXEC_TIME']) {
$simTime = '&ADMCMD_simTime=' . $pageinfo['starttime'];
}
- if ($pageinfo['endtime'] < $GLOBALS['EXEC_TIME'] && $pageinfo['endtime'] != 0) {
+ if ($pageinfo['endtime'] < $GLOBALS['EXEC_TIME'] && $pageinfo['endtime'] !== 0) {
$simTime = '&ADMCMD_simTime=' . ($pageinfo['endtime'] - 1);
}
return $simUser . $simTime;