Commit 041870fd authored by Stefan Neufeind's avatar Stefan Neufeind Committed by Christian Kuhn
Browse files

[TASK] Namespacing: Use-statement for common classes like GeneralUtility

Change-Id: I43d6ef559b0b46e6302ea891b4d39501a99423a6
Resolves: #49745
Releases: 6.2
Reviewed-on: https://review.typo3.org/22041
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
parent 1db576a5
......@@ -23,12 +23,9 @@ namespace TYPO3\CMS\Core\Charset;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Class for conversion between charsets.
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
* @author Martin Kutschker <martin.t.kutschker@blackbox.net>
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Notes on UTF-8
*
......@@ -57,6 +54,7 @@ namespace TYPO3\CMS\Core\Charset;
* - split/spliti
* - ...
*/
/**
* Class for conversion between charsets
*
......@@ -620,7 +618,7 @@ class CharsetConverter {
* Default constructor.
*/
public function __construct() {
$this->locales = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');
$this->locales = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');
}
/**
......@@ -1156,15 +1154,15 @@ class CharsetConverter {
// Conversion table filename:
$charsetConvTableFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('core') . 'Resources/Private/Charsets/csconvtbl/' . $charset . '.tbl';
// If the conversion table is found:
if ($charset && \TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr($charsetConvTableFile) && @is_file($charsetConvTableFile)) {
if ($charset && GeneralUtility::validPathStr($charsetConvTableFile) && @is_file($charsetConvTableFile)) {
// Cache file for charsets:
// Caching brought parsing time for gb2312 down from 2400 ms to 150 ms. For other charsets we are talking 11 ms down to zero.
$cacheFile = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('typo3temp/cs/charset_' . $charset . '.tbl');
$cacheFile = GeneralUtility::getFileAbsFileName('typo3temp/cs/charset_' . $charset . '.tbl');
if ($cacheFile && @is_file($cacheFile)) {
$this->parsedCharsets[$charset] = unserialize(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($cacheFile));
$this->parsedCharsets[$charset] = unserialize(GeneralUtility::getUrl($cacheFile));
} else {
// Parse conversion table into lines:
$lines = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(LF, \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($charsetConvTableFile), 1);
$lines = GeneralUtility::trimExplode(LF, GeneralUtility::getUrl($charsetConvTableFile), 1);
// Initialize the internal variable holding the conv. table:
$this->parsedCharsets[$charset] = array('local' => array(), 'utf8' => array());
// traverse the lines:
......@@ -1194,7 +1192,7 @@ class CharsetConverter {
}
}
if ($cacheFile) {
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($cacheFile, serialize($this->parsedCharsets[$charset]));
GeneralUtility::writeFileToTypo3tempDir($cacheFile, serialize($this->parsedCharsets[$charset]));
}
}
return 2;
......@@ -1218,8 +1216,8 @@ class CharsetConverter {
*/
public function initUnicodeData($mode = NULL) {
// Cache files
$cacheFileCase = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('typo3temp/cs/cscase_utf-8.tbl');
$cacheFileASCII = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('typo3temp/cs/csascii_utf-8.tbl');
$cacheFileCase = GeneralUtility::getFileAbsFileName('typo3temp/cs/cscase_utf-8.tbl');
$cacheFileASCII = GeneralUtility::getFileAbsFileName('typo3temp/cs/csascii_utf-8.tbl');
// Only process if the tables are not yet loaded
switch ($mode) {
case 'case':
......@@ -1228,7 +1226,7 @@ class CharsetConverter {
}
// Use cached version if possible
if ($cacheFileCase && @is_file($cacheFileCase)) {
$this->caseFolding['utf-8'] = unserialize(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($cacheFileCase));
$this->caseFolding['utf-8'] = unserialize(GeneralUtility::getUrl($cacheFileCase));
return 2;
}
break;
......@@ -1238,14 +1236,14 @@ class CharsetConverter {
}
// Use cached version if possible
if ($cacheFileASCII && @is_file($cacheFileASCII)) {
$this->toASCII['utf-8'] = unserialize(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($cacheFileASCII));
$this->toASCII['utf-8'] = unserialize(GeneralUtility::getUrl($cacheFileASCII));
return 2;
}
break;
}
// Process main Unicode data file
$unicodeDataFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('core') . 'Resources/Private/Charsets/unidata/UnicodeData.txt';
if (!(\TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr($unicodeDataFile) && @is_file($unicodeDataFile))) {
if (!(GeneralUtility::validPathStr($unicodeDataFile) && @is_file($unicodeDataFile))) {
return FALSE;
}
$fh = fopen($unicodeDataFile, 'rb');
......@@ -1343,13 +1341,13 @@ class CharsetConverter {
fclose($fh);
// Process additional Unicode data for casing (allow folded characters to expand into a sequence)
$specialCasingFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('core') . 'Resources/Private/Charsets/unidata/SpecialCasing.txt';
if (\TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr($specialCasingFile) && @is_file($specialCasingFile)) {
if (GeneralUtility::validPathStr($specialCasingFile) && @is_file($specialCasingFile)) {
$fh = fopen($specialCasingFile, 'rb');
if ($fh) {
while (!feof($fh)) {
$line = fgets($fh, 4096);
if ($line[0] != '#' && trim($line) != '') {
list($char, $lower, $title, $upper, $cond) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';', $line);
list($char, $lower, $title, $upper, $cond) = GeneralUtility::trimExplode(';', $line);
if ($cond == '' || $cond[0] == '#') {
$utf8_char = $this->UnumberToChar(hexdec($char));
if ($char != $lower) {
......@@ -1381,13 +1379,13 @@ class CharsetConverter {
}
// Process custom decompositions
$customTranslitFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('core') . 'Resources/Private/Charsets/unidata/Translit.txt';
if (\TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr($customTranslitFile) && @is_file($customTranslitFile)) {
if (GeneralUtility::validPathStr($customTranslitFile) && @is_file($customTranslitFile)) {
$fh = fopen($customTranslitFile, 'rb');
if ($fh) {
while (!feof($fh)) {
$line = fgets($fh, 4096);
if ($line[0] != '#' && trim($line) != '') {
list($char, $translit) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';', $line);
list($char, $translit) = GeneralUtility::trimExplode(';', $line);
if (!$translit) {
$omit['U+' . $char] = 1;
}
......@@ -1441,10 +1439,10 @@ class CharsetConverter {
}
}
if ($cacheFileCase) {
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($cacheFileCase, serialize($utf8CaseFolding));
GeneralUtility::writeFileToTypo3tempDir($cacheFileCase, serialize($utf8CaseFolding));
}
if ($cacheFileASCII) {
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($cacheFileASCII, serialize($ascii));
GeneralUtility::writeFileToTypo3tempDir($cacheFileASCII, serialize($ascii));
}
return 3;
}
......@@ -1464,9 +1462,9 @@ class CharsetConverter {
return 1;
}
// Use cached version if possible
$cacheFile = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('typo3temp/cs/cscase_' . $charset . '.tbl');
$cacheFile = GeneralUtility::getFileAbsFileName('typo3temp/cs/cscase_' . $charset . '.tbl');
if ($cacheFile && @is_file($cacheFile)) {
$this->caseFolding[$charset] = unserialize(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($cacheFile));
$this->caseFolding[$charset] = unserialize(GeneralUtility::getUrl($cacheFile));
return 2;
}
// init UTF-8 conversion for this charset
......@@ -1506,7 +1504,7 @@ class CharsetConverter {
$this->caseFolding[$charset]['toLower'][chr($i)] = chr($i + 32);
}
if ($cacheFile) {
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($cacheFile, serialize($this->caseFolding[$charset]));
GeneralUtility::writeFileToTypo3tempDir($cacheFile, serialize($this->caseFolding[$charset]));
}
return 3;
}
......@@ -1526,9 +1524,9 @@ class CharsetConverter {
return 1;
}
// Use cached version if possible
$cacheFile = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('typo3temp/cs/csascii_' . $charset . '.tbl');
$cacheFile = GeneralUtility::getFileAbsFileName('typo3temp/cs/csascii_' . $charset . '.tbl');
if ($cacheFile && @is_file($cacheFile)) {
$this->toASCII[$charset] = unserialize(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($cacheFile));
$this->toASCII[$charset] = unserialize(GeneralUtility::getUrl($cacheFile));
return 2;
}
// Init UTF-8 conversion for this charset
......@@ -1548,7 +1546,7 @@ class CharsetConverter {
}
}
if ($cacheFile) {
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($cacheFile, serialize($this->toASCII[$charset]));
GeneralUtility::writeFileToTypo3tempDir($cacheFile, serialize($this->toASCII[$charset]));
}
return 3;
}
......@@ -1838,7 +1836,7 @@ class CharsetConverter {
}
// Move the iso codes to the (because we're comparing the keys with "isset" later on)
$allLanguageCodes = array_flip($allLanguageCodes);
$preferredLanguages = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $languageCodesList);
$preferredLanguages = GeneralUtility::trimExplode(',', $languageCodesList);
// Order the preferred languages after they key
$sortedPreferredLanguages = array();
foreach ($preferredLanguages as $preferredLanguage) {
......
......@@ -26,6 +26,9 @@ namespace TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Matching TypoScript conditions
*
......@@ -204,13 +207,13 @@ abstract class AbstractConditionMatcher {
* @return mixed Returns TRUE or FALSE based on the evaluation
*/
protected function evaluateConditionCommon($key, $value) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('browser,version,system,useragent', strtolower($key))) {
$browserInfo = $this->getBrowserInfo(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
if (GeneralUtility::inList('browser,version,system,useragent', strtolower($key))) {
$browserInfo = $this->getBrowserInfo(GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
}
$keyParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $key);
$keyParts = GeneralUtility::trimExplode('|', $key);
switch ($keyParts[0]) {
case 'browser':
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
// take all identified browsers into account, eg chrome deliver
// webkit=>532.5, chrome=>4.1, safari=>532.5
// so comparing string will be
......@@ -226,7 +229,7 @@ abstract class AbstractConditionMatcher {
}
break;
case 'version':
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if (strcspn($test, '=<>') == 0) {
switch (substr($test, 0, 1)) {
......@@ -252,7 +255,7 @@ abstract class AbstractConditionMatcher {
}
break;
case 'system':
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
// Take all identified systems into account, e.g. mac for iOS, Linux
// for android and Windows NT for Windows XP
$allSystems .= ' ' . implode(' ', $browserInfo['all_systems']);
......@@ -264,9 +267,9 @@ abstract class AbstractConditionMatcher {
break;
case 'device':
if (!isset($this->deviceInfo)) {
$this->deviceInfo = $this->getDeviceType(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
$this->deviceInfo = $this->getDeviceType(GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
}
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if ($this->deviceInfo == $test) {
return TRUE;
......@@ -280,25 +283,25 @@ abstract class AbstractConditionMatcher {
}
break;
case 'language':
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if (preg_match('/^\\*.+\\*$/', $test)) {
$allLanguages = preg_split('/[,;]/', \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE'));
$allLanguages = preg_split('/[,;]/', GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE'));
if (in_array(substr($test, 1, -1), $allLanguages)) {
return TRUE;
}
} elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE') == $test) {
} elseif (GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE') == $test) {
return TRUE;
}
}
break;
case 'IP':
if (\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $value)) {
if (GeneralUtility::cmpIP(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $value)) {
return TRUE;
}
break;
case 'hostname':
if (\TYPO3\CMS\Core\Utility\GeneralUtility::cmpFQDN(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $value)) {
if (GeneralUtility::cmpFQDN(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $value)) {
return TRUE;
}
break;
......@@ -342,7 +345,7 @@ abstract class AbstractConditionMatcher {
}
$theTestValue = intval($theTestValue);
// comp
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($test)) {
$test = '=' . $test;
......@@ -353,11 +356,11 @@ abstract class AbstractConditionMatcher {
}
break;
case 'compatVersion':
return \TYPO3\CMS\Core\Utility\GeneralUtility::compat_version($value);
return GeneralUtility::compat_version($value);
break;
case 'loginUser':
if ($this->isUserLoggedIn()) {
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
if ($test == '*' || !strcmp($this->getUserId(), $test)) {
return TRUE;
......@@ -379,7 +382,7 @@ abstract class AbstractConditionMatcher {
}
break;
case 'globalVar':
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
$point = strcspn($test, '!=<>');
$theVarName = substr($test, 0, $point);
......@@ -391,7 +394,7 @@ abstract class AbstractConditionMatcher {
}
break;
case 'globalString':
$values = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $value, TRUE);
$values = GeneralUtility::trimExplode(',', $value, TRUE);
foreach ($values as $test) {
$point = strcspn($test, '=');
$theVarName = substr($test, 0, $point);
......@@ -405,7 +408,7 @@ abstract class AbstractConditionMatcher {
case 'userFunc':
$values = preg_split('/\\(|\\)/', $value);
$funcName = trim($values[0]);
$funcValues = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $values[1]);
$funcValues = GeneralUtility::trimExplode(',', $values[1]);
if (function_exists($funcName) && call_user_func_array($funcName, $funcValues)) {
return TRUE;
}
......@@ -430,13 +433,13 @@ abstract class AbstractConditionMatcher {
if ($k) {
switch ((string) trim($vars[0])) {
case 'GP':
$value = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($k);
$value = GeneralUtility::_GP($k);
break;
case 'ENV':
$value = getenv($k);
break;
case 'IENV':
$value = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv($k);
$value = GeneralUtility::getIndpEnv($k);
break;
case 'LIT':
return trim($vars[1]);
......@@ -479,7 +482,7 @@ abstract class AbstractConditionMatcher {
// multiple values may be split with '|'
// see if none matches ("not in list")
$found = FALSE;
$rightValueParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $rightValue);
$rightValueParts = GeneralUtility::trimExplode('|', $rightValue);
foreach ($rightValueParts as $rightValueSingle) {
if ($leftValue == doubleval($rightValueSingle)) {
$found = TRUE;
......@@ -499,7 +502,7 @@ abstract class AbstractConditionMatcher {
// multiple values may be split with '|'
// see if one matches ("in list")
$found = FALSE;
$rightValueParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $rightValue);
$rightValueParts = GeneralUtility::trimExplode('|', $rightValue);
foreach ($rightValueParts as $rightValueSingle) {
if ($leftValue == $rightValueSingle) {
$found = TRUE;
......
......@@ -26,6 +26,10 @@ namespace TYPO3\CMS\Core\Database;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
/**
* Class used in module tools/dbint (advanced search) and which may hold code specific for that module
* However the class has a general principle in it which may be used in the web/export module.
......@@ -185,12 +189,12 @@ class QueryView {
// Show query
if ($saveArr['queryTable']) {
/** @var \TYPO3\CMS\Core\Database\QueryGenerator */
$qGen = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\QueryGenerator');
$qGen = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\QueryGenerator');
$qGen->init('queryConfig', $saveArr['queryTable']);
$qGen->makeSelectorTable($saveArr);
$qGen->enablePrefix = 1;
$qString = $qGen->getQuery($qGen->queryConfig);
$qCount = $GLOBALS['TYPO3_DB']->SELECTquery('count(*)', $qGen->table, $qString . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($qGen->table));
$qCount = $GLOBALS['TYPO3_DB']->SELECTquery('count(*)', $qGen->table, $qString . BackendUtility::deleteClause($qGen->table));
$qSelect = $qGen->getSelectQuery($qString);
$res = @$GLOBALS['TYPO3_DB']->sql_query($qCount);
if (!$GLOBALS['TYPO3_DB']->sql_error()) {
......@@ -238,7 +242,7 @@ class QueryView {
public function procesStoreControl() {
$storeArray = $this->initStoreArray();
$storeQueryConfigs = unserialize($GLOBALS['SOBE']->MOD_SETTINGS['storeQueryConfigs']);
$storeControl = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('storeControl');
$storeControl = GeneralUtility::_GP('storeControl');
$storeIndex = intval($storeControl['STORE']);
$saveStoreArray = 0;
$writeArray = array();
......@@ -248,9 +252,9 @@ class QueryView {
if ($storeIndex > 0) {
$writeArray = $this->loadStoreQueryConfigs($storeQueryConfigs, $storeIndex, $writeArray);
$saveStoreArray = 1;
$flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('query_loaded'), htmlspecialchars($storeArray[$storeIndex])));
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('query_loaded'), htmlspecialchars($storeArray[$storeIndex])));
} elseif ($storeIndex < 0 && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sys_action')) {
$actionRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('sys_action', abs($storeIndex));
$actionRecord = BackendUtility::getRecord('sys_action', abs($storeIndex));
if (is_array($actionRecord)) {
$dA = unserialize($actionRecord['t2_data']);
$dbSC = array();
......@@ -259,16 +263,16 @@ class QueryView {
}
$writeArray = $this->loadStoreQueryConfigs($dbSC, '0', $writeArray);
$saveStoreArray = 1;
$flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('query_from_action_loaded'), htmlspecialchars($actionRecord['title'])));
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('query_from_action_loaded'), htmlspecialchars($actionRecord['title'])));
}
}
} elseif ($storeControl['SAVE']) {
if ($storeIndex < 0) {
$qOK = $this->saveQueryInAction(abs($storeIndex));
if ($qOK) {
$flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('query_saved'));
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('query_saved'));
} else {
$flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('query_notsaved'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('query_notsaved'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
}
} else {
if (trim($storeControl['title'])) {
......@@ -281,12 +285,12 @@ class QueryView {
}
$storeQueryConfigs = $this->addToStoreQueryConfigs($storeQueryConfigs, $storeIndex);
$saveStoreArray = 1;
$flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('query_saved'));
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('query_saved'));
}
}
} elseif ($storeControl['REMOVE']) {
if ($storeIndex > 0) {
$flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('query_removed'), htmlspecialchars($storeArray[$storeControl['STORE']])));
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->getLL('query_removed'), htmlspecialchars($storeArray[$storeControl['STORE']])));
// Removing
unset($storeArray[$storeControl['STORE']]);
$saveStoreArray = 1;
......@@ -301,7 +305,7 @@ class QueryView {
unset($storeArray[0]);
$writeArray['storeArray'] = serialize($storeArray);
$writeArray['storeQueryConfigs'] = serialize($this->cleanStoreQueryConfigs($storeQueryConfigs, $storeArray));
$GLOBALS['SOBE']->MOD_SETTINGS = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleData($GLOBALS['SOBE']->MOD_MENU, $writeArray, $GLOBALS['SOBE']->MCONF['name'], 'ses');
$GLOBALS['SOBE']->MOD_SETTINGS = BackendUtility::getModuleData($GLOBALS['SOBE']->MOD_MENU, $writeArray, $GLOBALS['SOBE']->MCONF['name'], 'ses');
}
return $msg;
}
......@@ -326,7 +330,7 @@ class QueryView {
$output .= $GLOBALS['SOBE']->doc->spacer(20);
}
// Query Maker:
$qGen = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\QueryGenerator');
$qGen = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\QueryGenerator');
$qGen->init('queryConfig', $GLOBALS['SOBE']->MOD_SETTINGS['queryTable']);
if ($this->formName) {
$qGen->setFormName($this->formName);
......@@ -342,7 +346,7 @@ class QueryView {
$qString = $qGen->getQuery($qGen->queryConfig);
switch ($mQ) {
case 'count':
$qExplain = $GLOBALS['TYPO3_DB']->SELECTquery('count(*)', $qGen->table, $qString . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($qGen->table));
$qExplain = $GLOBALS['TYPO3_DB']->SELECTquery('count(*)', $qGen->table, $qString . BackendUtility::deleteClause($qGen->table));
break;
default:
$qExplain = $qGen->getSelectQuery($qString);
......@@ -393,7 +397,7 @@ class QueryView {
}
if (is_array($this->hookArray['beforeResultTable'])) {
foreach ($this->hookArray['beforeResultTable'] as $_funcRef) {
$out .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $GLOBALS['SOBE']->MOD_SETTINGS, $this);
$out .= GeneralUtility::callUserFunction($_funcRef, $GLOBALS['SOBE']->MOD_SETTINGS, $this);
}
}
if (count($rowArr)) {
......@@ -416,12 +420,12 @@ class QueryView {
$rowArr[] = $this->csvValues($row, ',', '"', $GLOBALS['TCA'][$table], $table);
}
if (count($rowArr)) {
$out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidthText($this->formW, '', 'off') . ' class="fixed-font">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea(implode(LF, $rowArr)) . '</textarea>';
$out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidthText($this->formW, '', 'off') . ' class="fixed-font">' . GeneralUtility::formatForTextarea(implode(LF, $rowArr)) . '</textarea>';
if (!$this->noDownloadB) {
$out .= '<BR><input type="submit" name="download_file" value="Click to download file" onClick="window.location.href=\'' . $this->downloadScript . '\';">';
}
// Downloads file:
if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('download_file')) {
if (GeneralUtility::_GP('download_file')) {
$filename = 'TYPO3_' . $table . '_export_' . date('dmy-Hi') . '.csv';
$mimeType = 'application/octet-stream';
header('Content-Type: ' . $mimeType);
......@@ -466,7 +470,7 @@ class QueryView {
$valueArray[$key] = $this->getProcessedValueExtra($table, $key, $val, $conf, ';');
}
}
return \TYPO3\CMS\Core\Utility\GeneralUtility::csvValues($valueArray, $delim, $quote);
return GeneralUtility::csvValues($valueArray, $delim, $quote);
}
/**
......@@ -504,7 +508,7 @@ class QueryView {
// Get query
$qp = $GLOBALS['TYPO3_DB']->searchQuery(array($swords), $list, $table);
// Count:
$count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $table, $qp . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table));
$count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', $table, $qp . BackendUtility::deleteClause($table));
if ($count || $showAlways) {
// Output header:
$out .= '<strong>TABLE:</strong> ' . $GLOBALS['LANG']->sL($conf['ctrl']['title']) . '<BR>';
......@@ -512,7 +516,7 @@ class QueryView {
// Show to limit
if ($count) {
$rowArr = array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,' . $conf['ctrl']['label'], $table, $qp . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table), '', '', $limit);
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,' . $conf['ctrl']['label'], $table, $qp . BackendUtility::deleteClause($table), '', '', $limit);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$rowArr[] = $this->resultRowDisplay($row, $conf, $table);
$lrow = $row;
......@@ -538,12 +542,12 @@ class QueryView {
*/
public function resultRowDisplay($row, $conf, $table) {
static $even = FALSE;
$tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
$SET = $GLOBALS['SOBE']->MOD_SETTINGS;
$out = '<tr class="bgColor' . ($even ? '6' : '4') . '">';
$even = !$even;
foreach ($row as $fN => $fV) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($SET['queryFields'], $fN) || !$SET['queryFields'] && $fN != 'pid' && $fN != 'deleted') {
if (GeneralUtility::inList($SET['queryFields'], $fN) || !$SET['queryFields'] && $fN != 'pid' && $fN != 'deleted') {
if ($SET['search_result_labels']) {
$fVnew = $this->getProcessedValueExtra($table, $fN, $fV, $conf, '<br />');
} else {
......@@ -556,26 +560,26 @@ class QueryView {
$out .= '<td nowrap>';
if (!$row['deleted']) {
$out .= '<a href="#" onClick="top.launchView(\'' . $table . '\',' . $row['uid'] . ',\'' . $GLOBALS['BACK_PATH'] . '\');return false;">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-dialog-information') . '</a>';
$out .= '<a href="#" onClick="' . \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'], (\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI') . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('SET', (array) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('SET')))) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
$out .= '<a href="#" onClick="' . BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'], (GeneralUtility::getIndpEnv('REQUEST_URI') . GeneralUtility::implodeArrayForUrl('SET', (array) GeneralUtility::_POST('SET')))) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
} else {
$out .= '<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl(($GLOBALS['BACK_PATH'] . 'tce_db.php'), array(
$out .= '<a href="' . GeneralUtility::linkThisUrl(($GLOBALS['BACK_PATH'] . 'tce_db.php'), array(
('cmd[' . $table . '][' . $row['uid'] . '][undelete]') => '1',
'redirect' => \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array())
)) . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '">';
'redirect' => GeneralUtility::linkThisScript(array())
)) . BackendUtility::getUrlToken('tceAction') . '">';
$out .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-restore', array('title' => 'undelete only')) . '</a>';
$out .= '<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl(($GLOBALS['BACK_PATH'] . 'tce_db.php'), array(
$out .= '<a href="' . GeneralUtility::linkThisUrl(($GLOBALS['BACK_PATH'] . 'tce_db.php'), array(
('cmd[' . $table . '][' . $row['uid'] . '][undelete]') => '1',
'redirect' => \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisUrl('alt_doc.php', array(
'redirect' => GeneralUtility::linkThisUrl('alt_doc.php', array(
('edit[' . $table . '][' . $row['uid'] . ']') => 'edit',
'returnUrl' => \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array())
'returnUrl' => GeneralUtility::linkThisScript(array())
))
)) . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '">';
)) . BackendUtility::getUrlToken('tceAction') . '">';
$out .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-restore-edit', array('title' => 'undelete and edit')) . '</a>';
}
$_params = array($table => $row);
if (is_array($this->hookArray['additionalButtons'])) {
foreach ($this->hookArray['additionalButtons'] as $_funcRef) {
$out .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);