[BUGFIX] Deny to create localization based on "All Languages" 09/44409/4
authorMathias Schreiber <mathias.schreiber@wmdb.de>
Fri, 30 Oct 2015 15:19:20 +0000 (16:19 +0100)
committerAndreas Fernandez <typo3@scripting-base.de>
Fri, 30 Oct 2015 17:28:34 +0000 (18:28 +0100)
We no longer allow to localize a record based on records that run
in all languages because... it just doesn't make sense

Resolves: #38940
Releases: master
Change-Id: I8b3b2304966b51cf04c3433ead8d0f083519106c
Reviewed-on: https://review.typo3.org/44409
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Philipp Gampe <philipp.gampe@typo3.org>
Tested-by: Philipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Gernot Schulmeister <gernotschulmeister@gmx.at>
Tested-by: Gernot Schulmeister <gernotschulmeister@gmx.at>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/frontend/Classes/Page/PageRepository.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index 3defe3c..294c8e5 100644 (file)
@@ -493,7 +493,7 @@ class PageRepository
                     // sys_language_content value is larger than zero.
                     if ($sys_language_content > 0) {
                         // Must be default language or [All], otherwise no overlaying:
-                        if ($row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] <= 0) {
+                        if ((int)$row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] === 0) {
                             // Select overlay record:
                             $res = $this->getDatabaseConnection()->exec_SELECTquery('*', $table, 'pid=' . (int)$row['pid'] . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . (int)$sys_language_content . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . (int)$row['uid'] . $this->enableFields($table), '', '', '1');
                             $olrow = $this->getDatabaseConnection()->sql_fetch_assoc($res);
index 65042bc..672dbdc 100644 (file)
@@ -1805,6 +1805,12 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
 
         // Language title and icon:
         $out[0] = $this->languageFlag($row[$GLOBALS['TCA'][$table]['ctrl']['languageField']]);
+        // Guard clause so we can quickly return if a record is localized to "all languages"
+        // It should only be possible to localize a record off default (uid 0)
+        // Reasoning: The Parent is for ALL languages... why overlay with a localization?
+        if ((int)$row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] === -1) {
+            return $out;
+        }
 
         $translations = $this->translateTools->translationInfo($table, $row['uid'], 0, $row, $this->selFieldList);
         if (is_array($translations)) {