Commit 406f69af authored by Damjan's avatar Damjan
Browse files

[TASK] Resolving in-code todo-s.

- $_SESSION[$sessID] => $this->session
parent c8c45900
......@@ -120,8 +120,6 @@ class EditFileController extends AbstractBackendController {
* @return void
*/
protected function prepareEditFileViewMainSectionContent(array $langData, $buttonType) {
$sessID = 'tx_lfeditor_sessionVariables'; // TODO: Use $this->session
$extConfig = $this->configurationService->getExtConfig();
$numConstantsPerPage = $extConfig['numSiteConsts'];
......@@ -154,9 +152,9 @@ class EditFileController extends AbstractBackendController {
$sessionLangDataConstantsIterator -= $numberLastPageConstants;
}
// delete old data in session // TODO: Use $this->session
unset($_SESSION[$sessID]['langfileEditNewLangData']);
unset($_SESSION[$sessID]['langfileEditConstantsList']);
// delete old data in session
$this->session->setDataByKey('langfileEditNewLangData', NULL);
$this->session->setDataByKey('langfileEditConstantsList', NULL);
// get language data
if ($constTypeList == 'untranslated') {
......@@ -168,18 +166,19 @@ class EditFileController extends AbstractBackendController {
} else {
$myLangData = $langDefault;
}
$_SESSION[$sessID]['langfileEditConstantsList'] = array_keys($myLangData);
$this->session->setDataByKey('langfileEditConstantsList', array_keys($myLangData));
} elseif ($buttonType == 1) // back button
{
$sessionLangDataConstantsIterator -= ($numConstantsPerPage + $numberLastPageConstants);
}
// get language constants
$langData = $_SESSION[$sessID]['langfileEditConstantsList'];
$langData = $this->session->getDataByKey('langfileEditConstantsList');
$numConsts = count($langData);
if (!count($langData)) {
throw new LFException('failure.select.emptyLangDataArray', 1);
}
$langfileEditNewLangData = $this->session->getDataByKey('langfileEditNewLangData');
// prepare constant list for this page
$numberLastPageConstants = 0;
......@@ -194,19 +193,19 @@ class EditFileController extends AbstractBackendController {
// set constant value (maybe already changed in this session)
$constant = $langData[$sessionLangDataConstantsIterator];
$editLangVal = $langEdit[$constant];
if (!isset($_SESSION[$sessID]['langfileEditNewLangData'][$langList][$constant])) {
$_SESSION[$sessID]['langfileEditNewLangData'][$langList][$constant] = $editLangVal;
if (!isset($langfileEditNewLangData[$langList][$constant])) {
$langfileEditNewLangData[$langList][$constant] = $editLangVal;
} else {
$editLangVal = $_SESSION[$sessID]['langfileEditNewLangData'][$langList][$constant];
$editLangVal = $langfileEditNewLangData[$langList][$constant];
}
// set constant value (maybe already changed in this session)
$editPatternVal = $langPattern[$constant];
if (!isset($_SESSION[$sessID]['langfileEditNewLangData'][$patternList][$constant])) {
$_SESSION[$sessID]['langfileEditNewLangData'][$patternList][$constant] = $editPatternVal;
if (!isset($langfileEditNewLangData[$patternList][$constant])) {
$langfileEditNewLangData[$patternList][$constant] = $editPatternVal;
} else {
$editPatternVal =
$_SESSION[$sessID]['langfileEditNewLangData'][$patternList][$constant];
$langfileEditNewLangData[$patternList][$constant];
}
// save information about the constant
......@@ -215,6 +214,7 @@ class EditFileController extends AbstractBackendController {
$constValues[$constant]['default'] = $langDefault[$constant];
} while (++$sessionLangDataConstantsIterator % $numConstantsPerPage);
$this->session->setDataByKey('langfileEditNewLangData', $langfileEditNewLangData);
$this->session->setDataByKey('sessionLangDataConstantsIterator', $sessionLangDataConstantsIterator);
$this->session->setDataByKey('numberLastPageConstants', $numberLastPageConstants);
......@@ -251,30 +251,30 @@ class EditFileController extends AbstractBackendController {
*/
public function editFileSaveAction($buttonType, array $editFileTextArea) {
try {
$sessID = 'tx_lfeditor_sessionVariables'; // TODO: Use $this->session
$languageSelection = $this->session->getDataByKey('languageSelection');
$referenceLanguageSelection = $this->session->getDataByKey('referenceLanguageSelection');
$langDataSessionContinued = $buttonType != 3;
$_SESSION[$sessID]['langfileEditNewLangData'][$languageSelection] =
$langfileEditNewLangData = $this->session->getDataByKey('langfileEditNewLangData');
$langfileEditNewLangData[$languageSelection] =
array_merge(
$_SESSION[$sessID]['langfileEditNewLangData'][$languageSelection],
$langfileEditNewLangData[$languageSelection],
$editFileTextArea[$languageSelection]
);
// parallel edit mode?
if ($referenceLanguageSelection != '###default###' && $referenceLanguageSelection != $languageSelection) {
$_SESSION[$sessID]['langfileEditNewLangData'][$referenceLanguageSelection] =
$langfileEditNewLangData[$referenceLanguageSelection] =
array_merge(
$_SESSION[$sessID]['langfileEditNewLangData'][$referenceLanguageSelection],
$langfileEditNewLangData[$referenceLanguageSelection],
$editFileTextArea[$referenceLanguageSelection]
);
}
$this->session->setDataByKey('langfileEditNewLangData', $langfileEditNewLangData);
// write if no session continued
if (!$langDataSessionContinued) {
$this->configurationService->execWrite($_SESSION[$sessID]['langfileEditNewLangData']);
$this->configurationService->execWrite($langfileEditNewLangData);
$this->addFlashMessage(
LocalizationUtility::translate('lang.file.write.success', 'lfeditor'),
'',
......
......@@ -78,7 +78,7 @@ class FileBasePHPService extends FileBaseService {
throw new LFException('failure.select.noLangfile');
}
include($file); //TODO: Is "include($file)" OK to be used?
include($file);
/** @var array $LOCAL_LANG */
if (!is_array($LOCAL_LANG) || !count($LOCAL_LANG)) {
......
......@@ -52,7 +52,7 @@ class FileOverrideService extends FileBaseXMLService {
}
$overrideFileAbsolutePath = Typo3Lib::fixFilePath(
PATH_site . '/' .
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$typo3ExtRelativeFilePath][0] //TODO: this can support more than 1 override files?
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$typo3ExtRelativeFilePath][0]
);
if (!is_file($overrideFileAbsolutePath)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment