Project

General

Profile

Task #56108 » 56108.patch

Michiel Roos, 2014-02-24 23:32

View differences:

typo3_src/typo3/sysext/backend/Classes/View/PageLayoutView.php (revision )
$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 = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, '')) . '" title="' . htmlspecialchars($iTitle) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
......
$theData[$field] = '&nbsp;<strong>ID:</strong>';
break;
default:
if (substr($field, 0, 6) == 'table_') {
if (strpos($field, 'table_') === 0) {
$f2 = substr($field, 6);
if ($GLOBALS['TCA'][$f2]) {
$theData[$field] = '&nbsp;' . IconUtility::getSpriteIconForRecord($f2, array(), array('title' => $GLOBALS['LANG']->sL($GLOBALS['TCA'][$f2]['ctrl']['title'], TRUE)));
......
$lP = $this->tt_contentConfig['sys_language_uid'];
}
$cList = explode(',', $this->tt_contentConfig['showSingleCol']);
$content = array();
$out = '';
// Expand the table to some preset dimensions:
$out .= '
......
<td' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . ' valign="top">' . $this->tt_content_drawItem($row, $isRTE) . '</td>
</tr>';
// If the element was not the last element, add a divider line:
if ($c != $numberOfContentElementsInColumn) {
if ($c !== $numberOfContentElementsInColumn) {
$rowOut .= '
<tr>
<td></td>
......
$dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
}
// If records were found, render the list
if ($dbCount == 0) {
if ($dbCount === 0) {
return '';
}
// Set fields
......
BackendUtility::workspaceOL('pages', $row);
if (is_array($row)) {
$c++;
$row['treeIcons'] = $treeIcons . '<img' . IconUtility::skinImg($this->backPath, ('gfx/ol/join' . ($rc == $c ? 'bottom' : '') . '.gif'), 'width="18" height="16"') . ' alt="" />';
$row['treeIcons'] = $treeIcons . '<img' . IconUtility::skinImg($this->backPath, ('gfx/ol/join' . ($rc === $c ? 'bottom' : '') . '.gif'), 'width="18" height="16"') . ' alt="" />';
$theRows[] = $row;
// Get the branch
$spaceOutIcons = '<img' . IconUtility::skinImg($this->backPath, ('gfx/ol/' . ($rc == $c ? 'blank.gif' : 'line.gif')), 'width="18" height="16"') . ' alt="" />';
......
$theData[$field] = '<span align="right">' . $row['uid'] . $eI . '</span>';
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] = '&nbsp;&nbsp;' . ($c ? $c : '');
$theData[$field] = '&nbsp;&nbsp;' . ($c ?: '');
}
} else {
$theData[$field] = '&nbsp;&nbsp;' . htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field]));
......
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) . '<br />';
}
}
if ($row['CType'] == 'textpic' || $row['CType'] == 'image') {
if ($row['CType'] === 'textpic' || $row['CType'] === 'image') {
if ($row['image']) {
$out .= $this->thumbCode($row, 'tt_content', 'image') . '<br />';
if ($row['imagecaption']) {
......
*/
public function getResult($result, $table = 'tt_content') {
// Initialize:
$editUidList = '';
$recs = array();
$nextTree = $this->nextThree;
$c = 0;
typo3_src/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php (revision )
* @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;
}
/**
......
* @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
......
$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 . '.'])) {
typo3_src/typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php (revision )
*/
abstract class AbstractRecordList {
/**
* Id
*
* @var int
*/
public $id;
// Used in this class:
// default Max items shown
/**
......
* 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 <img>+<a> 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 <td>-tags
* @param string $tdParams Is insert in the <td>-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 <tr>-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 <img>-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 = '
......
if ($this->showIcon) {
$out .= '
<td nowrap="nowrap" class="col-icon">';
if (!$h) {
if (!$height) {
$out .= '<img src="clear.gif" width="1" height="8" alt="" />';
} else {
for ($a = 0; $a < $h; $a++) {
for ($a = 0; $a < $height; ++$a) {
if (!$a) {
if ($icon) {
$out .= $icon;
}
} else {
}
}
}
......
';
}
// 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 .= '
......
}
$lastKey = $vKey;
$c = 1;
$ccount++;
++$ccount;
} else {
if (!$lastKey) {
$lastKey = $vKey;
}
$c++;
++$c;
}
if ($c > 1) {
$colsp = ' colspan="' . $c . '"';
......
<td' . $noWrap . ' class="' . $cssClass . '"' . $colsp . $this->addElement_tdParams[$lastKey] . '>' . $data[$lastKey] . '</td>';
}
// End row
$out .= '
return $out . '
</tr>';
// Return row.
return $out;
}
/**
......
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);
......
}
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);
......
public function CBfunctions() {
return '
// checkOffCB()
function checkOffCB(listOfCBnames, link) { //
function checkOffCB(listOfCBnames, link) {
var checkBoxes, flag, i;
var checkBoxes = listOfCBnames.split(",");
if (link.rel === "") {
......
}
}
// 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;
......
}
$out .= '&nbsp;';
}
$out .= $title;
return $out;
return $out . $title;
}
/**
......
if ($launchViewParameter !== '') {
$htmlCode .= ' onclick="' . htmlspecialchars(('top.launchView(' . $launchViewParameter . '); return false;')) . '"';
}
$htmlCode .= ' title="' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(implode(' / ', $result), 100)) . '">';
$htmlCode .= count($references);
$htmlCode .= '</a>';
$htmlCode .= ' title="' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(implode(' / ', $result), 100)) . '">' .
count($references) . '</a>';
}
return $htmlCode;
}
typo3_src/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php (revision )
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
......
}
}
// 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) {
......
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:
......
// 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;' : ''));
......
$theData[$fCol] .= '<br />' . $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] = '&nbsp;';
} 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) {
......
}
}
// Reset the ID if it was overwritten
if (strlen($this->searchString)) {
if ($this->searchString !== '') {
$this->id = $id_orig;
}
// Add row to CSV list:
......
*/
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];
......
*
* @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()
......
// 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
......
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 = '<a href="#" onclick="' . htmlspecialchars(('return jumpExt(\'' . $newContentWizScriptPath . '?id=' . $this->id . '\');')) . '" title="' . $GLOBALS['LANG']->getLL('new', TRUE) . '">' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
} elseif ($table == 'pages' && $this->newWizards) {
$icon = '<a href="' . htmlspecialchars(($this->backPath . 'db_new.php?id=' . $this->id . '&pagesOnly=1&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')))) . '" title="' . $GLOBALS['LANG']->getLL('new', TRUE) . '">' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
$icon = '<a href="' . htmlspecialchars(($this->backPath . 'db_new.php?id=' . $this->id . '&pagesOnly=1&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')))) . '" title="' . $GLOBALS['LANG']->getLL('new', TRUE) . '">' . ($table === 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
} 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 = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('new', TRUE) . '">' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
......
$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;
......
*
* @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
*/
......
}
$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'] = '<a href="#" onclick="'
. htmlspecialchars(
BackendUtility::viewOnClick(
($table === 'tt_content' ? $this->id : $row['uid']),
($isTtContentTable ? $this->id : $row['uid']),
$this->backPath,
'',
($table === 'tt_content' ? '#' . $row['uid'] : '')
($isTtContentTable ? '#' . $row['uid'] : '')
)
) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">'
. IconUtility::getSpriteIcon('actions-document-view') . '</a>';
......
$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'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . ($GLOBALS['TCA'][$table]['ctrl']['readOnly'] ? IconUtility::getSpriteIcon('actions-document-open-read-only') : IconUtility::getSpriteIcon('actions-document-open')) . '</a>';
} elseif (!$this->table) {
$cells['edit'] = $this->spaceIcon;
}
// "Move" wizard link for pages/tt_content elements:
if ($table == 'tt_content' && $permsEdit || $table == 'pages') {
$cells['move'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpExt(\'' . $this->backPath . 'move_el.php?table=' . $table . '&uid=' . $row['uid'] . '\');')) . '" title="' . $GLOBALS['LANG']->getLL(('move_' . ($table == 'tt_content' ? 'record' : 'page')), TRUE) . '">' . ($table == 'tt_content' ? IconUtility::getSpriteIcon('actions-document-move') : IconUtility::getSpriteIcon('actions-page-move')) . '</a>';
if ($isTtContentTable && $hasEditPermission || $isPagesTable) {
$cells['move'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpExt(\'' . $this->backPath . 'move_el.php?table=' . $table . '&uid=' . $row['uid'] . '\');')) . '" title="' . $GLOBALS['LANG']->getLL(('move_' . ($isTtContentTable ? 'record' : 'page')), TRUE) . '">' . ($isTtContentTable ? IconUtility::getSpriteIcon('actions-document-move') : IconUtility::getSpriteIcon('actions-page-move')) . '</a>';
} elseif (!$this->table) {
$cells['move'] = $this->spaceIcon;
}
......
// 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'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpExt(\'' . $this->backPath . 'show_rechis.php?element=' . rawurlencode(($table . ':' . $row['uid'])) . '\',\'#latest\');')) . '" title="' . $GLOBALS['LANG']->getLL('history', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-history-open') . '</a>';
$cells['history'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpExt(\'' . $this->backPath . 'show_rechis.php?element=' . rawurlencode($table . ':' . $row['uid']) . '\',\'#latest\');')) . '" title="' . $GLOBALS['LANG']->getLL('history', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-history-open') . '</a>';
// Versioning:
if (ExtensionManagementUtility::isLoaded('version') && !ExtensionManagementUtility::isLoaded('workspaces')) {
$vers = BackendUtility::selectVersionsOfRecord($table, $row['uid'], 'uid', $GLOBALS['BE_USER']->workspace, FALSE, $row);
......
}
}
// "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'] = '<a href="' . htmlspecialchars((BackendUtility::getModuleUrl('web_perm') . '&id=' . $row['uid'] . '&return_id=' . $row['uid'] . '&edit=1')) . '" title="' . $GLOBALS['LANG']->getLL('permissions', TRUE) . '">' . IconUtility::getSpriteIcon('status-status-locked') . '</a>';
} 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'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL(('new' . ($table == 'pages ' ? 'Page' : 'Record')), TRUE) . '">' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
$cells['new'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL(('new' . ($table === 'pages ' ? 'Page' : 'Record')), TRUE) . '">' . ($isPagesTable ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
}
}
} 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']];
......
}
// "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'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL(('unHide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>';
$cells['hide'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL(('unHide' . ($isPagesTable ? 'Page' : '')), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>';
} else {
$params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
$cells['hide'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL(('hide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-hide') . '</a>';
$cells['hide'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL(('hide' . ($isPagesTable ? 'Page' : '')), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-hide') . '</a>';
}
} 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';
......
$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;
......
$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 : '<a href="#" onclick="' . htmlspecialchars(('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 1, ($isSel == 'copy'), array('returnUrl' => '')) . '\');')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE) . '">' . (!$isSel == 'copy' ? IconUtility::getSpriteIcon('actions-edit-copy') : IconUtility::getSpriteIcon('actions-edit-copy-release')) . '</a>';
$cells['cut'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="' . htmlspecialchars(('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 0, ($isSel == 'cut'), array('returnUrl' => '')) . '\');')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE) . '">' . (!$isSel == 'cut' ? IconUtility::getSpriteIcon('actions-edit-cut') : IconUtility::getSpriteIcon('actions-edit-cut-release')) . '</a>';
$cells['copy'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="' . htmlspecialchars(('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 1, ($isSel === 'copy'), array('returnUrl' => '')) . '\');')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE) . '">' . (!$isSel === 'copy' ? IconUtility::getSpriteIcon('actions-edit-copy') : IconUtility::getSpriteIcon('actions-edit-copy-release')) . '</a>';
$cells['cut'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="' . htmlspecialchars(('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 0, ($isSel === 'cut'), array('returnUrl' => '')) . '\');')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE) . '">' . (!$isSel === 'cut' ? IconUtility::getSpriteIcon('actions-edit-cut') : IconUtility::getSpriteIcon('actions-edit-cut-release')) . '</a>';
} else {
// For the numeric clipboard pads (showing checkboxes where one can select elements on/off)
// Setting name of the element in ->CBnames array:
......
}
// Now, looking for elements in general:
$elFromTable = $this->clipObj->elFromTable('');
if ($table == 'pages' && count($elFromTable)) {
if ($table === 'pages' && count($elFromTable)) {
$cells['pasteInto'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('', $row['uid'])) . '" onclick="' . htmlspecialchars(('return ' . $this->clipObj->confirmMsg($table, $row, 'into', $elFromTable))) . '" title="' . $GLOBALS['LANG']->getLL('clip_pasteInto', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-into') . '</a>';
}
/**
......
*/
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 '<a href="' . htmlspecialchars($sortUrl) . '">' . $code . $sortArrow . '</a>';
......
*/
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;
typo3_src/typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php (revision )
* @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;
......
}
$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');
......
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')) {
......
\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 {
......
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;
......
* @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) {
......
</tr>
<tr>
<td><label for="showLimit">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showRecords', TRUE) . ':</label></td>
<td colspan="3"><input type="text" name="showLimit" id="showLimit" value="' . htmlspecialchars(($this->showLimit ? $this->showLimit : '')) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' /></td>
<td colspan="3"><input type="text" name="showLimit" id="showLimit" value="' . htmlspecialchars(($this->showLimit ?: '')) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' /></td>
</tr>
</table>
' . $formElements[1] . '</div>';
......
}
}
// 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:
......
'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
......
* @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']);
}
/**
......
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
......
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;
}
......
$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) . ')';
}
}
......
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 {
......
break;
case 'show':
// "Show" link (only pages and tt_content elements)
if ($table == 'pages' || $table == 'tt_content') {
if ($table === 'pages' || $table === 'tt_content') {
$code = '<a href="#" onclick="' . htmlspecialchars(
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 . '</a>';
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 . '</a>';
}
break;
case 'info':
// "Info": (All records)
$code = '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;')) . '" title="' . $GLOBALS['LANG']->getLL('showInfo', TRUE) . '">' . $code . '</a>';
$code = '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;') . '" title="' . $GLOBALS['LANG']->getLL('showInfo', TRUE) . '">' . $code . '</a>';
break;
default:
// Output the label now:
if ($table == 'pages') {
if ($table === 'pages') {
$code = '<a href="' . htmlspecialchars($this->listURL($uid, '', 'firstElementNumber')) . '" onclick="setHighlight(' . $uid . ')">' . $code . '</a>';
} else {
$code = $this->linkUrlMail($code, $origCode);
......
* @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:
......
$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'];
}
......
*/
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
typo3_src/typo3/sysext/backend/Classes/Utility/BackendUtility.php (revision )
*/
class BackendUtility {
/**
* Array of parsed pageTsConfig, indexed by page id.
*
* @var array
*/
static private $pageTsConfigCache = array();
/*******************************************
*
* SQL-related, selecting records, searching
......
* @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
......
* @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'])
......
*/
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 '<a href="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($linkTitle) . '">' . IconUtility::getSpriteIcon('actions-system-list-open') . htmlspecialchars($linkText) . '</a>';
......
);
} 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',
......
* @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;
}
/**
......
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');
......
} 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) : '';
}
......
* @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) : '';
}
......
}
// 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'];
......
// 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'])) {
......
*/
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');
......
$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'));
......
* @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;
(2-2/2)