Commit 24f83ec5 authored by Nicole Cordes's avatar Nicole Cordes Committed by Anja Leichsenring
Browse files

[TASK] Cleanup ext:backend

Cleanup ext:backend with the following code changes:
* Make use of the "use" statement for GeneralUtility
* Make use of the "use" statement for BackendUtility
* Case in switch statements are tabbed with one more tab

Change-Id: I6549316dddc9575cab4e661b7c111ec947757cb8
Fixes: #47900
Releases: 6.2
Reviewed-on: https://review.typo3.org/20479
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
parent 723b023e
......@@ -26,11 +26,10 @@ namespace TYPO3\CMS\Backend\Configuration;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Contains translation tools
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
/**
* Contains translation tools
*
......@@ -52,7 +51,7 @@ class TranslationConfigurationProvider {
* @todo Define visibility
*/
public function getSystemLanguages($page_id = 0, $backPath = '') {
$modSharedTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($page_id, 'mod.SHARED');
$modSharedTSconfig = BackendUtility::getModTSconfig($page_id, 'mod.SHARED');
$languageIconTitles = array();
// fallback "old iconstyles"
if (preg_match('/\\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'])) {
......@@ -76,13 +75,13 @@ class TranslationConfigurationProvider {
foreach ($sys_languages as $row) {
$languageIconTitles[$row['uid']] = $row;
if ($row['static_lang_isocode'] && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) {
$staticLangRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2');
$staticLangRow = BackendUtility::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2');
if ($staticLangRow['lg_iso_2']) {
$languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
}
}
if (strlen($row['flag'])) {
$languageIconTitles[$row['uid']]['flagIcon'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconName('sys_language', $row);
$languageIconTitles[$row['uid']]['flagIcon'] = IconUtility::mapRecordTypeToSpriteIconName('sys_language', $row);
}
}
return $languageIconTitles;
......@@ -103,7 +102,7 @@ class TranslationConfigurationProvider {
public function translationInfo($table, $uid, $sys_language_uid = 0, $row = NULL, $selFieldList = '') {
if ($GLOBALS['TCA'][$table] && $uid) {
if ($row === NULL) {
$row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $uid);
$row = BackendUtility::getRecordWSOL($table, $uid);
}
if (is_array($row)) {
$trTable = $this->getTranslationTable($table);
......@@ -111,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)) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($trTable) . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause($trTable));
$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));
$translations = array();
$translations_errors = array();
foreach ($translationsTemp as $r) {
......@@ -185,5 +184,4 @@ class TranslationConfigurationProvider {
}
?>
\ No newline at end of file
......@@ -27,6 +27,9 @@ namespace TYPO3\CMS\Backend\Configuration;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Backend\Utility\BackendUtility;
/**
* A TS-Config parsing class which performs condition evaluation
*
......@@ -53,7 +56,7 @@ class TsConfigParser extends \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
$this->id = $id;
$this->rootLine = $rootLine;
$hash = md5($type . ':' . $TStext);
$cachedContent = \TYPO3\CMS\Backend\Utility\BackendUtility::getHash($hash, 0);
$cachedContent = BackendUtility::getHash($hash);
if ($cachedContent) {
$storedData = unserialize($cachedContent);
$storedMD5 = substr($cachedContent, -strlen($hash));
......@@ -67,7 +70,7 @@ class TsConfigParser extends \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
);
} else {
$shash = md5($checkMD5 . $hash);
$cachedSpec = \TYPO3\CMS\Backend\Utility\BackendUtility::getHash($shash, 0);
$cachedSpec = BackendUtility::getHash($shash);
if ($cachedSpec) {
$storedData = unserialize($cachedSpec);
$res = array(
......@@ -77,7 +80,7 @@ class TsConfigParser extends \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
} else {
$storeData = $this->parseWithConditions($TStext);
$serData = serialize($storeData);
\TYPO3\CMS\Backend\Utility\BackendUtility::storeHash($shash, $serData, $type . '_TSconfig');
BackendUtility::storeHash($shash, $serData, $type . '_TSconfig');
$res = array(
'TSconfig' => $storeData['TSconfig'],
'cached' => 0
......@@ -88,7 +91,7 @@ class TsConfigParser extends \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
$storeData = $this->parseWithConditions($TStext);
$serData = serialize($storeData);
$md5 = md5($serData);
\TYPO3\CMS\Backend\Utility\BackendUtility::storeHash($hash, $serData . $md5, $type . '_TSconfig');
BackendUtility::storeHash($hash, $serData . $md5, $type . '_TSconfig');
$res = array(
'TSconfig' => $storeData['TSconfig'],
'cached' => 0
......
......@@ -26,6 +26,10 @@ namespace TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Matching TypoScript conditions for backend disposal.
*
......@@ -38,12 +42,8 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
/**
* Constructor for this class
*
* @return void
*/
public function __construct() {
}
public function __construct() {}
/**
* Evaluates a TypoScript condition given as input, eg. "[browser=net][...(other conditions)...]"
......@@ -53,7 +53,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
* @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::parse()
*/
protected function evaluateCondition($string) {
list($key, $value) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('=', $string, FALSE, 2);
list($key, $value) = GeneralUtility::trimExplode('=', $string, FALSE, 2);
$result = parent::evaluateConditionCommon($key, $value);
if (is_bool($result)) {
return $result;
......@@ -61,9 +61,9 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
switch ($key) {
case 'usergroup':
$groupList = $this->getGroupList();
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if ($test == '*' || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($groupList, $test)) {
if ($test == '*' || GeneralUtility::inList($groupList, $test)) {
return TRUE;
}
}
......@@ -75,7 +75,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
}
break;
case 'treeLevel':
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
$treeLevel = count($this->rootline) - 1;
// If a new page is being edited or saved the treeLevel is higher by one:
if ($this->isNewPageWithPageId($this->pageId)) {
......@@ -90,7 +90,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
case 'PIDupinRootline':
case 'PIDinRootline':
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
if ($key == 'PIDinRootline' || !in_array($this->pageId, $values) || $this->isNewPageWithPageId($this->pageId)) {
foreach ($values as $test) {
foreach ($this->rootline as $rl_dat) {
......@@ -139,10 +139,10 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
*/
protected function determinePageId() {
$pageId = 0;
$editStatement = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('edit');
$commandStatement = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('cmd');
$editStatement = GeneralUtility::_GP('edit');
$commandStatement = GeneralUtility::_GP('cmd');
// Determine id from module that was called with an id:
if ($id = intval(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'))) {
if ($id = intval(GeneralUtility::_GP('id'))) {
$pageId = $id;
} elseif (is_array($editStatement)) {
list($table, $uidAndAction) = each($editStatement);
......@@ -172,7 +172,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
*/
protected function getPage() {
$pageId = isset($this->pageId) ? $this->pageId : $this->determinePageId();
return \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $pageId);
return BackendUtility::getRecord('pages', $pageId);
}
/**
......@@ -190,7 +190,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
if (($ignoreTable || $table === 'pages') && $id >= 0) {
$pageId = $id;
} else {
$record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, abs($id), '*', '', FALSE);
$record = BackendUtility::getRecordWSOL($table, abs($id), '*', '', FALSE);
$pageId = $record['pid'];
}
}
......@@ -222,7 +222,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
foreach ($elementsData as $element) {
if ($element['cmd'] == 'new' && $element['table'] == 'pages') {
if ($element['pid'] < 0) {
$pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', abs($element['pid']), 'pid');
$pageRecord = BackendUtility::getRecord('pages', abs($element['pid']), 'pid');
$element['pid'] = $pageRecord['pid'];
}
if ($element['pid'] == $pageId) {
......@@ -242,7 +242,7 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
*/
protected function determineRootline() {
$pageId = isset($this->pageId) ? $this->pageId : $this->determinePageId();
$rootline = \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($pageId, '', TRUE);
$rootline = BackendUtility::BEgetRootLine($pageId, '', TRUE);
return $rootline;
}
......@@ -296,5 +296,4 @@ class ConditionMatcher extends \TYPO3\CMS\Core\Configuration\TypoScript\Conditio
}
?>
\ No newline at end of file
......@@ -26,6 +26,7 @@ namespace TYPO3\CMS\Backend\ContextMenu;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Abstract Context Menu
*
......@@ -65,5 +66,4 @@ abstract class AbstractContextMenu {
}
?>
\ No newline at end of file
......@@ -26,6 +26,7 @@ namespace TYPO3\CMS\Backend\ContextMenu;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Abstract Context Menu Data Provider
*
......@@ -212,5 +213,4 @@ abstract class AbstractContextMenuDataProvider {
}
?>
\ No newline at end of file
......@@ -26,6 +26,7 @@ namespace TYPO3\CMS\Backend\ContextMenu;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Context Menu Action
*
......@@ -273,5 +274,4 @@ class ContextMenuAction {
}
?>
\ No newline at end of file
......@@ -26,6 +26,7 @@ namespace TYPO3\CMS\Backend\ContextMenu;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Context Menu Action Collection
*
......@@ -50,5 +51,4 @@ class ContextMenuActionCollection extends \ArrayObject {
}
?>
\ No newline at end of file
......@@ -26,6 +26,7 @@ namespace TYPO3\CMS\Backend\ContextMenu\Extdirect;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Abstract Context Menu for ExtDirect
*
......@@ -74,5 +75,4 @@ abstract class AbstractExtdirectContextMenu extends \TYPO3\CMS\Backend\ContextMe
}
?>
\ No newline at end of file
......@@ -26,6 +26,9 @@ namespace TYPO3\CMS\Backend\ContextMenu\Pagetree;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Context Menu Data Provider for the Page Tree
*
......@@ -55,12 +58,12 @@ class ContextMenuDataProvider extends \TYPO3\CMS\Backend\ContextMenu\AbstractCon
$tsConfig = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.' . $this->getContextMenuType() . '.disableItems');
$disableItems = array();
if (trim($tsConfig['value']) !== '') {
$disableItems = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $tsConfig['value']);
$disableItems = GeneralUtility::trimExplode(',', $tsConfig['value']);
}
$tsConfig = $GLOBALS['BE_USER']->getTSConfig('options.contextMenu.pageTree.disableItems');
$oldDisableItems = array();
if (trim($tsConfig['value']) !== '') {
$oldDisableItems = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $tsConfig['value']);
$oldDisableItems = GeneralUtility::trimExplode(',', $tsConfig['value']);
}
$additionalItems = array();
foreach ($oldDisableItems as $item) {
......@@ -69,7 +72,7 @@ class ContextMenuDataProvider extends \TYPO3\CMS\Backend\ContextMenu\AbstractCon
continue;
}
if (strpos($this->legacyContextMenuMapping[$item], ',')) {
$actions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->legacyContextMenuMapping[$item]);
$actions = GeneralUtility::trimExplode(',', $this->legacyContextMenuMapping[$item]);
$additionalItems = array_merge($additionalItems, $actions);
} else {
$additionalItems[] = $item;
......@@ -96,5 +99,4 @@ class ContextMenuDataProvider extends \TYPO3\CMS\Backend\ContextMenu\AbstractCon
}
?>
\ No newline at end of file
......@@ -26,6 +26,7 @@ namespace TYPO3\CMS\Backend\ContextMenu\Pagetree\Extdirect;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Context Menu of the Page Tree
*
......@@ -65,5 +66,4 @@ class ContextMenuConfiguration extends \TYPO3\CMS\Backend\ContextMenu\Extdirect\
}
?>
\ No newline at end of file
......@@ -26,6 +26,7 @@ namespace TYPO3\CMS\Backend\ContextMenu\Renderer;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Abstract Context Menu Renderer
*
......@@ -62,5 +63,4 @@ abstract class AbstractContextMenuRenderer {
}
?>
\ No newline at end of file
......@@ -27,6 +27,10 @@ namespace TYPO3\CMS\Backend\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Class for rendering the TYPO3 backend version 4.2+
*
......@@ -83,9 +87,9 @@ class BackendController {
// Set debug flag for BE development only
$this->debug = intval($GLOBALS['TYPO3_CONF_VARS']['BE']['debug']) === 1;
// Initializes the backend modules structure for use later.
$this->moduleLoader = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
$this->moduleLoader = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Module\\ModuleLoader');
$this->moduleLoader->load($GLOBALS['TBE_MODULES']);
$this->moduleMenu = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\ModuleMenuView');
$this->moduleMenu = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\ModuleMenuView');
$this->pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
$this->pageRenderer->loadScriptaculous('builder,effects,controls,dragdrop');
$this->pageRenderer->loadExtJS();
......@@ -143,7 +147,7 @@ class BackendController {
'liveSearch' => '\\TYPO3\\CMS\\Backend\\Toolbar\\LiveSearchToolbarItem'
);
foreach ($coreToolbarItems as $toolbarItemName => $toolbarItemClassName) {
$toolbarItem = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($toolbarItemClassName, $this);
$toolbarItem = GeneralUtility::makeInstance($toolbarItemClassName, $this);
if (!$toolbarItem instanceof \TYPO3\CMS\Backend\Toolbar\ToolbarItemHookInterface) {
throw new \UnexpectedValueException('$toolbarItem "' . $toolbarItemName . '" must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ToolbarItemHookInterface', 1195126772);
}
......@@ -163,7 +167,7 @@ class BackendController {
public function render() {
$this->executeHook('renderPreProcess');
// Prepare the scaffolding, at this point extension may still add javascript and css
$logo = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\LogoView');
$logo = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\LogoView');
$logo->setLogo('gfx/typo3logo_mini.png');
// Create backend scaffolding
$backendScaffolding = '
......@@ -241,24 +245,24 @@ class BackendController {
$absoluteComponentPath = PATH_t3lib . 'js/extjs/' . $componentDirectory;
$relativeComponentPath = '../' . str_replace(PATH_site, '', $absoluteComponentPath);
} else {
$absoluteComponentPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($info['extKey']) . $componentDirectory;
$relativeComponentPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($info['extKey']) . $componentDirectory;
$absoluteComponentPath = ExtensionManagementUtility::extPath($info['extKey']) . $componentDirectory;
$relativeComponentPath = ExtensionManagementUtility::extRelPath($info['extKey']) . $componentDirectory;
}
$cssFiles = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($absoluteComponentPath . 'css/', 'css');
$cssFiles = GeneralUtility::getFilesInDir($absoluteComponentPath . 'css/', 'css');
if (file_exists($absoluteComponentPath . 'css/loadorder.txt')) {
// Don't allow inclusion outside directory
$loadOrder = str_replace('../', '', \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($absoluteComponentPath . 'css/loadorder.txt'));
$cssFilesOrdered = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $loadOrder, TRUE);
$loadOrder = str_replace('../', '', GeneralUtility::getUrl($absoluteComponentPath . 'css/loadorder.txt'));
$cssFilesOrdered = GeneralUtility::trimExplode(LF, $loadOrder, TRUE);
$cssFiles = array_merge($cssFilesOrdered, $cssFiles);
}
foreach ($cssFiles as $cssFile) {
$this->pageRenderer->addCssFile($relativeComponentPath . 'css/' . $cssFile);
}
$jsFiles = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($absoluteComponentPath . 'javascript/', 'js');
$jsFiles = GeneralUtility::getFilesInDir($absoluteComponentPath . 'javascript/', 'js');
if (file_exists($absoluteComponentPath . 'javascript/loadorder.txt')) {
// Don't allow inclusion outside directory
$loadOrder = str_replace('../', '', \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($absoluteComponentPath . 'javascript/loadorder.txt'));
$jsFilesOrdered = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, $loadOrder, TRUE);
$loadOrder = str_replace('../', '', GeneralUtility::getUrl($absoluteComponentPath . 'javascript/loadorder.txt'));
$jsFilesOrdered = GeneralUtility::trimExplode(LF, $loadOrder, TRUE);
$jsFiles = array_merge($jsFilesOrdered, $jsFiles);
}
foreach ($jsFiles as $jsFile) {
......@@ -315,7 +319,7 @@ class BackendController {
$title = $username;
// Link to user setup if it's loaded and user has access
$link = '';
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('setup') && $GLOBALS['BE_USER']->check('modules', 'user_setup')) {
if (ExtensionManagementUtility::isLoaded('setup') && $GLOBALS['BE_USER']->check('modules', 'user_setup')) {
$link = '<a href="#" onclick="top.goToModule(\'user_setup\'); this.blur(); return false;">';
}
// Superuser mode
......@@ -338,7 +342,7 @@ class BackendController {
$filePath = 'typo3temp/locallang-BE-' . sha1($code) . '.js';
if (!file_exists((PATH_site . $filePath))) {
// writeFileToTypo3tempDir() returns NULL on success (please double-read!)
if (\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir(PATH_site . $filePath, $code) !== NULL) {
if (GeneralUtility::writeFileToTypo3tempDir(PATH_site . $filePath, $code) !== NULL) {
throw new \RuntimeException('LocalLangFile could not be written to ' . $filePath, 1295193026);
}
}
......@@ -447,10 +451,10 @@ class BackendController {
* @return void
*/
protected function generateJavascript() {
$pathTYPO3 = \TYPO3\CMS\Core\Utility\GeneralUtility::dirname(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/';
$pathTYPO3 = GeneralUtility::dirname(GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/';
// If another page module was specified, replace the default Page module with the new one
$newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
$pageModule = \TYPO3\CMS\Backend\Utility\BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
$pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
if (!$GLOBALS['BE_USER']->check('modules', $pageModule)) {
$pageModule = '';
}
......@@ -465,11 +469,11 @@ class BackendController {
$this->loginSecurityLevel = 'superchallenged';
}
$t3Configuration = array(
'siteUrl' => \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'),
'siteUrl' => GeneralUtility::getIndpEnv('TYPO3_SITE_URL'),
'PATH_typo3' => $pathTYPO3,
'PATH_typo3_enc' => rawurlencode($pathTYPO3),
'username' => htmlspecialchars($GLOBALS['BE_USER']->user['username']),
'uniqueID' => \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5(uniqid('')),
'uniqueID' => GeneralUtility::shortMD5(uniqid('')),
'securityLevel' => $this->loginSecurityLevel,
'TYPO3_mainDir' => TYPO3_mainDir,
'pageModule' => $pageModule,
......@@ -481,7 +485,7 @@ class BackendController {
'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,
'listModulePath' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('recordlist') ? \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('recordlist') . 'mod1/' : '',
'listModulePath' => ExtensionManagementUtility::isLoaded('recordlist') ? ExtensionManagementUtility::extRelPath('recordlist') . 'mod1/' : '',
'debugInWindow' => $GLOBALS['BE_USER']->uc['debugInWindow'] ? 1 : 0,
'ContextHelpWindows' => array(
'width' => 600,
......@@ -538,22 +542,22 @@ class BackendController {
* @return void
*/
protected function handlePageEditing() {
if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) {
if (!ExtensionManagementUtility::isLoaded('cms')) {
return;
}
// EDIT page:
$editId = preg_replace('/[^[:alnum:]_]/', '', \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('edit'));
$editId = preg_replace('/[^[:alnum:]_]/', '', GeneralUtility::_GET('edit'));
$editRecord = '';
if ($editId) {
// Looking up the page to edit, checking permissions:
$where = ' AND (' . $GLOBALS['BE_USER']->getPagePermsClause(2) . ' OR ' . $GLOBALS['BE_USER']->getPagePermsClause(16) . ')';
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($editId)) {
$editRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL('pages', $editId, '*', $where);
$editRecord = BackendUtility::getRecordWSOL('pages', $editId, '*', $where);
} else {
$records = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField('pages', 'alias', $editId, $where);
$records = BackendUtility::getRecordsByField('pages', 'alias', $editId, $where);
if (is_array($records)) {
$editRecord = reset($records);
\TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL('pages', $editRecord);
BackendUtility::workspaceOL('pages', $editRecord);
}
}
// If the page was accessible, then let the user edit it.
......@@ -567,7 +571,7 @@ class BackendController {
if (!$GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_dontSetPageTree')) {
$bookmarkKeepExpanded = $GLOBALS['BE_USER']->getTSConfigVal('options.bookmark_onEditId_keepExistingExpanded');
// Expanding page tree:
\TYPO3\CMS\Backend\Utility\BackendUtility::openPageTree(intval($editRecord['pid']), !$bookmarkKeepExpanded);
BackendUtility::openPageTree(intval($editRecord['pid']), !$bookmarkKeepExpanded);
}
} else {
$this->js .= '
......@@ -584,7 +588,7 @@ class BackendController {
* @return void
*/
protected function setStartupModule() {
$startModule = preg_replace('/[^[:alnum:]_]/', '', \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('module'));
$startModule = preg_replace('/[^[:alnum:]_]/', '', GeneralUtility::_GET('module'));
if (!$startModule) {
if ($GLOBALS['BE_USER']->uc['startModule']) {
$startModule = $GLOBALS['BE_USER']->uc['startModule'];
......@@ -592,11 +596,11 @@ class BackendController {
$startModule = 'user_task';
}
}
$moduleParameters = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('modParams');
$moduleParameters = GeneralUtility::_GET('modParams');
if ($startModule) {
return '
// start in module:
top.startInModule = [\'' . $startModule . '\', ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($moduleParameters) . '];
top.startInModule = [\'' . $startModule . '\', ' . GeneralUtility::quoteJSvalue($moduleParameters) . '];
';
} else {
return '';
......@@ -626,7 +630,7 @@ class BackendController {
public function addJavascriptFile($javascriptFile) {
$jsFileAdded = FALSE;
//TODO add more checks if neccessary
if (file_exists(\TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath(PATH_typo3 . $javascriptFile))) {
if (file_exists(GeneralUtility::resolveBackPath(PATH_typo3 . $javascriptFile))) {
$this->jsFiles[] = $javascriptFile;
$jsFileAdded = TRUE;
}
......@@ -670,7 +674,7 @@ class BackendController {
* @return void
*/
public function addToolbarItem($toolbarItemName, $toolbarItemClassName) {
$toolbarItem = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($toolbarItemClassName, $this);
$toolbarItem = GeneralUtility::makeInstance($toolbarItemClassName, $this);
if (!$toolbarItem instanceof \TYPO3\CMS\Backend\Toolbar\ToolbarItemHookInterface) {
throw new \UnexpectedValueException('$toolbarItem "' . $toolbarItemName . '" must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ToolbarItemHookInterface', 1195125501);
}
......@@ -697,12 +701,11 @@ class BackendController {
$options = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/backend.php'];
if (isset($options[$identifier]) && is_array($options[$identifier])) {
foreach ($options[$identifier] as $hookFunction) {