Commit 9646d26b authored by Jo Hasenau's avatar Jo Hasenau Committed by Stefan Neufeind
Browse files

[TASK] Use (int) instead of intval() or (integer)

This patch replaces most of around 1600 occurrences of
intval() and every (integer) in the whole core.
Additionally it changes GeneralUtility::intExplode to use references
and typecasting as well.
Some occurrences of strstr() together with intval() have been replaced
with strpos() as well.
And some superfluous intval calls have been removed or reduced
to a single one i.e. for protected variables or before loops.
Patch updated after Core CGL decision from 30.01.2014

Resolves: #54265
Releases: 6.2
Change-Id: Iba57ffad1f4233ffa1a9f7d3ca5bfe9d2b53f1e8
Reviewed-on: https://review.typo3.org/26740
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
parent 0524a027
......@@ -51,7 +51,7 @@ class localPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
* @todo Define visibility
*/
public function printTree($treeArr = '') {
$titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
$titleLen = (int)$GLOBALS['BE_USER']->uc['titleLen'];
if (!is_array($treeArr)) {
$treeArr = $this->tree;
}
......@@ -315,4 +315,4 @@ class TBE_FolderTree extends localFolderTree {
}
}
}
\ No newline at end of file
}
......@@ -87,7 +87,7 @@ class ext_posMap_pages extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
* @todo Define visibility
*/
public function linkPageTitle($str, $rec) {
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => intval($rec['uid']), 'moveUid' => $GLOBALS['SOBE']->moveUid));
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
}
......@@ -127,7 +127,7 @@ class ext_posMap_tt_content extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap
* @todo Define visibility
*/
public function linkPageTitle($str, $rec) {
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => intval($rec['uid']), 'moveUid' => $GLOBALS['SOBE']->moveUid));
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
}
......
......@@ -150,7 +150,7 @@ class ClickMenu {
*/
public function init() {
// Setting GPvars:
$this->cmLevel = intval(GeneralUtility::_GP('cmLevel'));
$this->cmLevel = (int)GeneralUtility::_GP('cmLevel');
$this->CB = GeneralUtility::_GP('CB');
if (GeneralUtility::_GP('ajax')) {
$this->ajax = 1;
......@@ -223,7 +223,7 @@ class ClickMenu {
* @todo Define visibility
*/
public function printDBClickMenu($table, $uid) {
$uid = intval($uid);
$uid = (int)$uid;
// Get record:
$this->rec = BackendUtility::getRecordWSOL($table, $uid);
$menuItems = array();
......@@ -241,7 +241,7 @@ class ClickMenu {
$l10nOverlay = FALSE;
// Should only be performed for overlay-records within the same table
if (BackendUtility::isTableLocalizable($table) && !isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) {
$l10nOverlay = intval($this->rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]) != 0;
$l10nOverlay = (int)$this->rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0;
}
// If record found (or root), go ahead and fill the $menuItems array which will contain data for the elements to render.
if (is_array($this->rec) || $root) {
......@@ -522,7 +522,7 @@ class ClickMenu {
*/
public function DB_moveWizard($table, $uid, $rec) {
// Hardcoded field for tt_content elements.
$url = 'move_el.php?table=' . $table . '&uid=' . $uid . ($table == 'tt_content' ? '&sys_language_uid=' . intval($rec['sys_language_uid']) : '');
$url = 'move_el.php?table=' . $table . '&uid=' . $uid . ($table == 'tt_content' ? '&sys_language_uid=' . (int)$rec['sys_language_uid'] : '');
return $this->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_moveWizard' . ($table == 'pages' ? '_page' : ''))), $this->excludeIcon(IconUtility::getSpriteIcon('actions-' . ($table === 'pages' ? 'page' : 'document') . '-move')), $this->urlRefForCM($url, 'returnUrl'), 0);
}
......@@ -541,7 +541,7 @@ class ClickMenu {
$tmpTSc = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
$tmpTSc = $tmpTSc['properties']['newContentWiz.']['overrideWithExtension'];
$newContentWizScriptPath = ExtensionManagementUtility::isLoaded($tmpTSc) ? ExtensionManagementUtility::extRelPath($tmpTSc) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php';
$url = $table == 'pages' || !ExtensionManagementUtility::isLoaded('cms') ? 'db_new.php?id=' . $uid . '&pagesOnly=1' : $newContentWizScriptPath . '?id=' . $rec['pid'] . '&sys_language_uid=' . intval($rec['sys_language_uid']);
$url = $table == 'pages' || !ExtensionManagementUtility::isLoaded('cms') ? 'db_new.php?id=' . $uid . '&pagesOnly=1' : $newContentWizScriptPath . '?id=' . $rec['pid'] . '&sys_language_uid=' . (int)$rec['sys_language_uid'];
return $this->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_newWizard')), $this->excludeIcon(IconUtility::getSpriteIcon('actions-' . ($table === 'pages' ? 'page' : 'document') . '-new')), $this->urlRefForCM($url, 'returnUrl'), 0);
}
......@@ -594,7 +594,7 @@ class ClickMenu {
$theIcon = 'actions-page-open';
$this->editPageIconSet = 1;
if ($GLOBALS['BE_USER']->uc['classicPageEditMode'] || !ExtensionManagementUtility::isLoaded('cms')) {
$addParam = '&editRegularContentFromId=' . intval($this->iParts[1]);
$addParam = '&editRegularContentFromId=' . (int)$this->iParts[1];
} else {
$editOnClick = 'if(' . $loc . '){' . $loc . '.location.href=top.TS.PATH_typo3+\'alt_doc.php?returnUrl=\'+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+\'&edit[' . $table . '][' . $uid . ']=edit' . $addParam . '\';}';
}
......@@ -617,7 +617,7 @@ class ClickMenu {
public function DB_new($table, $uid) {
$editOnClick = '';
$loc = 'top.content.list_frame';
$editOnClick = 'if(' . $loc . '){' . $loc . '.location.href=top.TS.PATH_typo3+\'' . ($this->listFrame ? 'alt_doc.php?returnUrl=\'+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+\'&edit[' . $table . '][-' . $uid . ']=new\'' : 'db_new.php?id=' . intval($uid) . '\'') . ';}';
$editOnClick = 'if(' . $loc . '){' . $loc . '.location.href=top.TS.PATH_typo3+\'' . ($this->listFrame ? 'alt_doc.php?returnUrl=\'+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+\'&edit[' . $table . '][-' . $uid . ']=new\'' : 'db_new.php?id=' . (int)$uid . '\'') . ';}';
return $this->linkItem($this->label('new'), $this->excludeIcon(IconUtility::getSpriteIcon('actions-' . ($table === 'pages' ? 'page' : 'document') . '-new')), $editOnClick . 'return hideCM();');
}
......@@ -674,7 +674,7 @@ class ClickMenu {
var useNode = {
attributes: {
nodeData: {
id: ' . intval($page_id) . '
id: ' . (int)$page_id . '
}
}
};
......
......@@ -387,7 +387,7 @@ class Clipboard {
<tr>
<td class="' . $bgColClass . '">' . $this->linkItemText(IconUtility::getSpriteIconForRecord($table, $rec, array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars(BackendUtility::getRecordIconAltText($rec, $table)))), $rec, $table) . '</td>
<td class="' . $bgColClass . '" nowrap="nowrap" width="95%">&nbsp;' . $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $GLOBALS['BE_USER']->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . '&nbsp;</td>
<td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'' . $table . '\', \'' . intval($uid) . '\'); return false;')) . '">' . IconUtility::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl($table, $uid)) . '#clip_head">' . IconUtility::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td>
<td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'' . $table . '\', \'' . (int)$uid . '\'); return false;')) . '">' . IconUtility::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl($table, $uid)) . '#clip_head">' . IconUtility::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td>
</tr>';
$localizationData = $this->getLocalizations($table, $rec, $bgColClass, $pad);
if ($localizationData) {
......@@ -427,7 +427,7 @@ class Clipboard {
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
if ($table != 'pages' && BackendUtility::isTableLocalizable($table) && !$tcaCtrl['transOrigPointerTable']) {
$where = array();
$where[] = $tcaCtrl['transOrigPointerField'] . '=' . intval($parentRec['uid']);
$where[] = $tcaCtrl['transOrigPointerField'] . '=' . (int)$parentRec['uid'];
$where[] = $tcaCtrl['languageField'] . '<>0';
if (isset($tcaCtrl['delete']) && $tcaCtrl['delete']) {
$where[] = $tcaCtrl['delete'] . '=0';
......@@ -880,7 +880,7 @@ class Clipboard {
*/
public function makePasteCmdArray($ref, $CMD, array $update = NULL) {
list($pTable, $pUid) = explode('|', $ref);
$pUid = intval($pUid);
$pUid = (int)$pUid;
// pUid must be set and if pTable is not set (that means paste ALL elements)
// the uid MUST be positive/zero (pointing to page id)
if ($pTable || $pUid >= 0) {
......
......@@ -110,7 +110,7 @@ class TranslationConfigurationProvider {
if ($trTable !== $table || $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] <= 0) {
if ($trTable !== $table || $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] == 0) {
// Look for translations of this record, index by language field value:
$translationsTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($selFieldList ? $selFieldList : 'uid,' . $GLOBALS['TCA'][$trTable]['ctrl']['languageField'], $trTable, $GLOBALS['TCA'][$trTable]['ctrl']['transOrigPointerField'] . '=' . intval($uid) . ' AND pid=' . intval(($table === 'pages' ? $row['uid'] : $row['pid'])) . ' AND ' . $GLOBALS['TCA'][$trTable]['ctrl']['languageField'] . (!$sys_language_uid ? '>0' : '=' . intval($sys_language_uid)) . BackendUtility::deleteClause($trTable) . BackendUtility::versioningPlaceholderClause($trTable));
$translationsTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($selFieldList ? $selFieldList : 'uid,' . $GLOBALS['TCA'][$trTable]['ctrl']['languageField'], $trTable, $GLOBALS['TCA'][$trTable]['ctrl']['transOrigPointerField'] . '=' . (int)$uid . ' AND pid=' . (int)($table === 'pages' ? $row['uid'] : $row['pid']) . ' AND ' . $GLOBALS['TCA'][$trTable]['ctrl']['languageField'] . (!$sys_language_uid ? '>0' : '=' . (int)$sys_language_uid) . BackendUtility::deleteClause($trTable) . BackendUtility::versioningPlaceholderClause($trTable));
$translations = array();
$translations_errors = array();
foreach ($translationsTemp as $r) {
......
......@@ -142,7 +142,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
$editStatement = GeneralUtility::_GP('edit');
$commandStatement = GeneralUtility::_GP('cmd');
// Determine id from module that was called with an id:
if ($id = intval(GeneralUtility::_GP('id'))) {
if ($id = (int)GeneralUtility::_GP('id')) {
$pageId = $id;
} elseif (is_array($editStatement)) {
list($table, $uidAndAction) = each($editStatement);
......@@ -185,7 +185,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
*/
protected function getPageIdByRecord($table, $id, $ignoreTable = FALSE) {
$pageId = 0;
$id = (int) $id;
$id = (int)$id;
if ($table && $id) {
if (($ignoreTable || $table === 'pages') && $id >= 0) {
$pageId = $id;
......@@ -206,7 +206,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
*/
protected function isNewPageWithPageId($pageId) {
if (isset($GLOBALS['SOBE']) && $GLOBALS['SOBE'] instanceof \TYPO3\CMS\Backend\Controller\EditDocumentController) {
$pageId = intval($pageId);
$pageId = (int)$pageId;
$elementsData = $GLOBALS['SOBE']->elementsData;
$data = $GLOBALS['SOBE']->data;
// If saving a new page record:
......
......@@ -205,7 +205,7 @@ abstract class AbstractContextMenuDataProvider {
$action->setClass(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconClasses($actionConfiguration['spriteIcon']));
}
}
$actionCollection->offsetSet($level . intval($index), $action);
$actionCollection->offsetSet($level . (int)$index, $action);
$actionCollection->ksort();
}
return $actionCollection;
......
......@@ -85,7 +85,7 @@ class BackendController {
*/
public function __construct() {
// Set debug flag for BE development only
$this->debug = intval($GLOBALS['TYPO3_CONF_VARS']['BE']['debug']) === 1;
$this->debug = (int)$GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] === 1;
// Initializes the backend modules structure for use later.
$this->moduleLoader = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
$this->moduleLoader->load($GLOBALS['TBE_MODULES']);
......@@ -129,8 +129,8 @@ class BackendController {
$this->toolbarItems = array();
$this->initializeCoreToolbarItems();
$this->menuWidth = $this->menuWidthDefault;
if (isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW']) && (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'] != (int) $this->menuWidth) {
$this->menuWidth = (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'];
if (isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW']) && (int)$GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'] != (int)$this->menuWidth) {
$this->menuWidth = (int)$GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'];
}
$this->executeHook('constructPostProcess');
}
......@@ -484,8 +484,8 @@ class BackendController {
'veriCode' => $GLOBALS['BE_USER']->veriCode(),
'denyFileTypes' => PHP_EXTENSIONS_DEFAULT,
'moduleMenuWidth' => $this->menuWidth - 1,
'topBarHeight' => isset($GLOBALS['TBE_STYLES']['dims']['topFrameH']) ? intval($GLOBALS['TBE_STYLES']['dims']['topFrameH']) : 30,
'showRefreshLoginPopup' => isset($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) ? intval($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) : FALSE,
'topBarHeight' => isset($GLOBALS['TBE_STYLES']['dims']['topFrameH']) ? (int)$GLOBALS['TBE_STYLES']['dims']['topFrameH'] : 30,
'showRefreshLoginPopup' => isset($GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup']) ? (int)$GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup'] : FALSE,
'listModulePath' => ExtensionManagementUtility::isLoaded('recordlist') ? ExtensionManagementUtility::extRelPath('recordlist') . 'mod1/' : '',
'debugInWindow' => $GLOBALS['BE_USER']->uc['debugInWindow'] ? 1 : 0,
'ContextHelpWindows' => array(
......@@ -516,7 +516,7 @@ class BackendController {
*
* Used in main modules with a frameset for submodules to keep the ID between modules
* Typically that is set by something like this in a Web>* sub module:
* if (top.fsMod) top.fsMod.recentIds["web"] = "\'.intval($this->id).\'";
* if (top.fsMod) top.fsMod.recentIds["web"] = "\'.(int)$this->id.\'";
* if (top.fsMod) top.fsMod.recentIds["file"] = "...(file reference/string)...";
*/
function fsModules() { //
......@@ -564,13 +564,13 @@ class BackendController {
// Setting JS code to open editing:
$this->js .= '
// Load page to edit:
window.setTimeout("top.loadEditId(' . intval($editRecord['uid']) . ');", 500);
window.setTimeout("top.loadEditId(' . (int)$editRecord['uid'] . ');", 500);
';
// Checking page edit parameter:
if (!$GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_dontSetPageTree')) {
$bookmarkKeepExpanded = $GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_keepExistingExpanded');
// Expanding page tree:
BackendUtility::openPageTree(intval($editRecord['pid']), !$bookmarkKeepExpanded);
BackendUtility::openPageTree((int)$editRecord['pid'], !$bookmarkKeepExpanded);
}
} else {
$this->js .= '
......
......@@ -74,7 +74,7 @@ class BackendLayoutWizardController {
throw new \InvalidArgumentException('Hmac Validation failed for backend_layout wizard', 1385811397);
}
$this->md5ID = $this->P['md5ID'];
$uid = intval($this->P['uid']);
$uid = (int)$this->P['uid'];
// Initialize document object:
$this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
......@@ -102,7 +102,7 @@ class BackendLayoutWizardController {
);
$pageRenderer->addInlineLanguageLabelArray($languageLabels);
// Select record
$record = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($this->P['field'], $this->P['table'], 'uid=' . intval($this->P['uid']));
$record = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($this->P['field'], $this->P['table'], 'uid=' . (int)$this->P['uid']);
if (trim($record[0][$this->P['field']]) == '') {
$t3GridData = '[[{colspan:1,rowspan:1,spanned:false,name:\'\'}]]';
$colCount = 1;
......@@ -132,10 +132,10 @@ class BackendLayoutWizardController {
$cellString = '{';
$cellData = array();
if (isset($column['colspan'])) {
$cellData[] = 'colspan:' . intval($column['colspan']);
$columnColSpan = intval($column['colspan']);
$cellData[] = 'colspan:' . (int)$column['colspan'];
$columnColSpan = (int)$column['colspan'];
if (isset($column['rowspan'])) {
$columnRowSpan = intval($column['rowspan']);
$columnRowSpan = (int)$column['rowspan'];
for ($spanRow = 0; $spanRow < $columnRowSpan; $spanRow++) {
for ($spanColumn = 0; $spanColumn < $columnColSpan; $spanColumn++) {
$spannedMatrix[$i + $spanRow][$j + $spanColumn] = 1;
......@@ -149,14 +149,14 @@ class BackendLayoutWizardController {
} else {
$cellData[] = 'colspan:1';
if (isset($column['rowspan'])) {
$columnRowSpan = intval($column['rowspan']);
$columnRowSpan = (int)$column['rowspan'];
for ($spanRow = 0; $spanRow < $columnRowSpan; $spanRow++) {
$spannedMatrix[$i + $spanRow][$j] = 1;
}
}
}
if (isset($column['rowspan'])) {
$cellData[] = 'rowspan:' . intval($column['rowspan']);
$cellData[] = 'rowspan:' . (int)$column['rowspan'];
} else {
$cellData[] = 'rowspan:1';
}
......
......@@ -143,7 +143,7 @@ class ElementInformationController {
*/
protected function initDatabaseRecord() {
$this->type = 'db';
$this->uid = intval($this->uid);
$this->uid = (int)$this->uid;
// Check permissions and uid value:
if ($this->uid && $GLOBALS['BE_USER']->check('tables_select', $this->table)) {
......@@ -313,7 +313,7 @@ class ElementInformationController {
foreach ($extraFields as $name => $value) {
$rowValue = BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]);
if ($name === 'cruser_id' && $rowValue) {
$userTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('username, realName', 'be_users', 'uid = ' . intval($rowValue));
$userTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('username, realName', 'be_users', 'uid = ' . (int)$rowValue);
if ($userTemp[0]['username'] !== '') {
$rowValue = $userTemp[0]['username'];
if ($userTemp[0]['realName'] !== '') {
......@@ -503,7 +503,7 @@ class ElementInformationController {
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'*',
'sys_refindex',
'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($selectTable, 'sys_refindex') . ' AND ref_uid=' . intval($selectUid) . ' AND deleted=0'
'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($selectTable, 'sys_refindex') . ' AND ref_uid=' . (int)$selectUid . ' AND deleted=0'
);
// Compile information for title tag:
......@@ -552,7 +552,7 @@ class ElementInformationController {
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'*',
'sys_refindex',
'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') . ' AND recuid=' . intval($ref)
'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') . ' AND recuid=' . (int)$ref
);
// Compile information for title tag:
......
......@@ -112,8 +112,8 @@ class MoveElementController {
*/
public function init() {
// Setting internal vars:
$this->sys_language = intval(GeneralUtility::_GP('sys_language'));
$this->page_id = intval(GeneralUtility::_GP('uid'));
$this->sys_language = (int)GeneralUtility::_GP('sys_language');
$this->page_id = (int)GeneralUtility::_GP('uid');
$this->table = GeneralUtility::_GP('table');
$this->R_URI = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
$this->input_moveUid = GeneralUtility::_GP('moveUid');
......@@ -167,7 +167,7 @@ class MoveElementController {
$pidPageInfo = BackendUtility::readPageAccess($pageinfo['pid'], $this->perms_clause);
if (is_array($pidPageInfo)) {
if ($GLOBALS['BE_USER']->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
$code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . IconUtility::getSpriteIcon('actions-view-go-up') . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
$code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int)$pageinfo['pid'], 'moveUid' => $this->moveUid))) . '">' . IconUtility::getSpriteIcon('actions-view-go-up') . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
} else {
$code .= IconUtility::getSpriteIconForRecord('pages', $pidPageInfo) . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
}
......@@ -215,7 +215,7 @@ class MoveElementController {
if (is_array($pidPageInfo)) {
if ($GLOBALS['BE_USER']->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
$code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array(
'uid' => intval($pageinfo['pid']),
'uid' => (int)$pageinfo['pid'],
'moveUid' => $this->moveUid
))) . '">' . IconUtility::getSpriteIcon('actions-view-go-up') . BackendUtility::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
} else {
......
......@@ -120,11 +120,11 @@ class NewContentElementController {
$this->include_once = array_merge($this->include_once, $GLOBALS['TBE_MODULES_EXT']['xMOD_db_new_content_el']['addElClasses']);
}
// Setting internal vars:
$this->id = intval(GeneralUtility::_GP('id'));
$this->sys_language = intval(GeneralUtility::_GP('sys_language_uid'));
$this->id = (int)GeneralUtility::_GP('id');
$this->sys_language = (int)GeneralUtility::_GP('sys_language_uid');
$this->R_URI = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
$this->colPos = GeneralUtility::_GP('colPos');
$this->uid_pid = intval(GeneralUtility::_GP('uid_pid'));
$this->uid_pid = (int)GeneralUtility::_GP('uid_pid');
$this->MCONF['name'] = 'xMOD_db_new_content_el';
$this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.wizards.newContentElement');
$config = BackendUtility::getPagesTSconfig($this->id);
......
......@@ -763,7 +763,7 @@ class EditDocumentController {
// NOTICE: the id values in this case points to the page uid onto which the
// record should be create OR (if the id is negativ) to a record from the
// same table AFTER which to create the record.
if (intval($theUid)) {
if ((int)$theUid) {
// Find parent page on which the new record reside
// Less than zero - find parent page
if ($theUid < 0) {
......@@ -964,7 +964,7 @@ class EditDocumentController {
$buttons['delete'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $GLOBALS['LANG']->getLL('deleteItem', TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
}
// Undo:
$undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->firstEl['table'], 'sys_history') . ' AND recuid=' . intval($this->firstEl['uid']), '', 'tstamp DESC', '1');
$undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->firstEl['table'], 'sys_history') . ' AND recuid=' . (int)$this->firstEl['uid'], '', 'tstamp DESC', '1');
if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
$aOnClick = 'window.location.href=\'show_rechis.php?element=' . rawurlencode(($this->firstEl['table'] . ':' . $this->firstEl['uid'])) . '&revert=ALL_FIELDS&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;';
$buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"' . ' title="' . htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('undoLastChange'), BackendUtility::calcAge(($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp']), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))) . '">' . IconUtility::getSpriteIcon('actions-edit-undo') . '</a>';
......@@ -1157,7 +1157,7 @@ class EditDocumentController {
}
if ($rowCurrent[$transOrigPointerField] || $currentLanguage === '0') {
// Get record in other languages to see what's already available
$translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fetchFields, $table, 'pid=' . intval($pid) . ' AND ' . $languageField . '>0' . ' AND ' . $transOrigPointerField . '=' . intval($rowsByLang[0]['uid']) . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table));
$translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fetchFields, $table, 'pid=' . (int)$pid . ' AND ' . $languageField . '>0' . ' AND ' . $transOrigPointerField . '=' . (int)$rowsByLang[0]['uid'] . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table));
foreach ($translations as $row) {
$rowsByLang[$row[$languageField]] = $row;
}
......@@ -1201,7 +1201,7 @@ class EditDocumentController {
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']) {
$localizedRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid', $table, $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . intval($language) . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . intval($orig_uid) . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table));
$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
$params = '&edit[' . $table . '][' . $localizedRecord['uid'] . ']=edit';
......@@ -1236,7 +1236,7 @@ class EditDocumentController {
);
$exQ = $GLOBALS['BE_USER']->isAdmin() ? '' : ' AND sys_language.hidden=0';
if ($id) {
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('sys_language.*', 'pages_language_overlay,sys_language', 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid=' . intval($id) . BackendUtility::deleteClause('pages_language_overlay') . $exQ, 'pages_language_overlay.sys_language_uid,sys_language.uid,sys_language.pid,sys_language.tstamp,sys_language.hidden,sys_language.title,sys_language.static_lang_isocode,sys_language.flag', 'sys_language.title');
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('sys_language.*', 'pages_language_overlay,sys_language', 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid=' . (int)$id . BackendUtility::deleteClause('pages_language_overlay') . $exQ, 'pages_language_overlay.sys_language_uid,sys_language.uid,sys_language.pid,sys_language.tstamp,sys_language.hidden,sys_language.title,sys_language.static_lang_isocode,sys_language.flag', 'sys_language.title');
} else {
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('sys_language.*', 'sys_language', 'sys_language.hidden=0', '', 'sys_language.title');
}
......@@ -1347,7 +1347,7 @@ class EditDocumentController {
*/
public function editRegularContentFromId() {
if (ExtensionManagementUtility::isLoaded('cms')) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tt_content', 'pid=' . intval($this->editRegularContentFromId) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content') . ' AND colPos=0 AND sys_language_uid=0', '', 'sorting');
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tt_content', 'pid=' . (int)$this->editRegularContentFromId . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content') . ' AND colPos=0 AND sys_language_uid=0', '', 'sorting');
if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
$ecUids = array();
while ($ecRec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
......
......@@ -183,7 +183,7 @@ class NewRecordController {
}
// Setting GPvars:
// The page id to operate from
$this->id = intval(GeneralUtility::_GP('id'));
$this->id = (int)GeneralUtility::_GP('id');
$this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
$this->pagesOnly = GeneralUtility::_GP('pagesOnly');
// Create instance of template class for output
......@@ -605,7 +605,7 @@ class NewRecordController {
if ($table == 'pages' && $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'] && isset($GLOBALS['TCA'][$GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']]) && $addContentTable) {
$parameters .= '&edit[' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'] . '][prev]=new&returnNewPageId=1';
} elseif ($table == 'pages_language_overlay') {
$parameters .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageinfo['doktype'];
$parameters .= '&overrideVals[pages_language_overlay][doktype]=' . (int)$this->pageinfo['doktype'];
}
$onClick = BackendUtility::editOnClick($parameters, '', $this->returnUrl);
return '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $linkText . '</a>';
......@@ -632,7 +632,7 @@ class NewRecordController {
return FALSE;
}
// Checking doktype:
$doktype = intval($pid_row['doktype']);
$doktype = (int)$pid_row['doktype'];
if (!($allowedTableList = $GLOBALS['PAGES_TYPES'][$doktype]['allowedTables'])) {
$allowedTableList = $GLOBALS['PAGES_TYPES']['default']['allowedTables'];
}
......
......@@ -232,7 +232,7 @@ class PageLayoutController {
$this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
$this->backPath = $GLOBALS['BACK_PATH'];
// GPvars:
$this->id = intval(GeneralUtility::_GP('id'));
$this->id = (int)GeneralUtility::_GP('id');
$this->pointer = GeneralUtility::_GP('pointer');
$this->imagemode = GeneralUtility::_GP('imagemode');
$this->clear_cache = GeneralUtility::_GP('clear_cache');
......@@ -249,7 +249,7 @@ class PageLayoutController {
// Initialize menu
$this->menuConfig();
// Setting sys language from session var:
$this->current_sys_language = intval($this->MOD_SETTINGS['language']);
$this->current_sys_language = (int)$this->MOD_SETTINGS['language'];
// CSH / Descriptions:
$this->descrTable = '_MOD_' . $this->MCONF['name'];
}
......@@ -369,10 +369,10 @@ class PageLayoutController {
}
// If content from different pid is displayed
if ($this->pageinfo['content_from_pid']) {
$contentPage = BackendUtility::getRecord('pages', intval($this->pageinfo['content_from_pid']));
$contentPage = BackendUtility::getRecord('pages', (int)$this->pageinfo['content_from_pid']);
$title = BackendUtility::getRecordTitle('pages', $contentPage);
$linkToPid = $this->local_linkThisScript(array('id' => $this->pageinfo['content_from_pid']));
$link = '<a href="' . $linkToPid . '">' . htmlspecialchars($title) . ' (PID ' . intval($this->pageinfo['content_from_pid']) . ')</a>';
$link = '<a href="' . $linkToPid . '">' . htmlspecialchars($title) . ' (PID ' . (int)$this->pageinfo['content_from_pid'] . ')</a>';
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('content_from_pid_title'), $link), '', FlashMessage::INFO);
$content .= $flashMessage->render();
}
......@@ -388,8 +388,8 @@ class PageLayoutController {
$overlayRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
'title',
'pages_language_overlay',
'pid = ' . intval($this->id) .
' AND sys_language_uid = ' . intval($this->current_sys_language) .
'pid = ' . (int)$this->id .
' AND sys_language_uid = ' . (int)$this->current_sys_language .
BackendUtility::deleteClause('pages_language_overlay') .
BackendUtility::versioningPlaceholderClause('pages_language_overlay'),
'',
......@@ -425,8 +425,8 @@ class PageLayoutController {
// JavaScript:
$this->doc->JScode = '<script type="text/javascript" ' . 'src="' . GeneralUtility::createVersionNumberedFilename(($GLOBALS['BACK_PATH'] . 'js/jsfunc.updateform.js')) . '">' . '</script>';
$this->doc->JScode .= $this->doc->wrapScriptTags('
if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . intval($this->id) . '_"+top.fsMod.currentBank; ' . intval($this->id) . ';
if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';
if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . (int)$this->id . '_"+top.fsMod.currentBank; ' . (int)$this->id . ';
function jumpToUrl(URL,formEl) { //
if (document.editform && TBE_EDITOR.isFormChanged) { // Check if the function exists... (works in all browsers?)
if (!TBE_EDITOR.isFormChanged()) { //
......@@ -560,7 +560,7 @@ class PageLayoutController {
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html');
$this->doc->JScode = $this->doc->wrapScriptTags('
if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';
');
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('clickAPage_content'), $GLOBALS['LANG']->getLL('clickAPage_header'), FlashMessage::INFO);
$body = $flashMessage->render();
......@@ -613,7 +613,7 @@ class PageLayoutController {
$edit_record = $this->edit_record;
// If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php:
if (substr($edit_record, 0, 9) == '_EDIT_COL') {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND colPos=' . intval(substr($edit_record, 10)) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting');
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . (int)$this->id . ' AND colPos=' . (int)substr($edit_record, 10) . ' AND sys_language_uid=' . (int)$this->current_sys_language . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : BackendUtility::BEenableFields('tt_content')) . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting');
$idListA = array();
while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$idListA[] = $cRow['uid'];
......@@ -623,7 +623,7 @@ class PageLayoutController {
}
// If the former record edited was the creation of a NEW record, this will look up the created records uid:
if ($this->new_unique_uid) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid=' . intval($GLOBALS['BE_USER']->user['uid']) . ' AND NEWid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log'));
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid=' . (int)$GLOBALS['BE_USER']->user['uid'] . ' AND NEWid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log'));
$sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
if (is_array($sys_log_row)) {
$edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid'];
......@@ -634,19 +634,19 @@ class PageLayoutController {
$is_selected = 0;
$languageOverlayRecord = '';
if ($this->current_sys_language) {
list($languageOverlayRecord) = BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $this->id, 'AND sys_language_uid=' . intval($this->current_sys_language));