Fixed bug #6775 Page and info module ignore 'Limit to language'
authorWolfgang Klinger <wolfgang@stufenlos.net>
Fri, 23 Nov 2007 10:21:18 +0000 (10:21 +0000)
committerWolfgang Klinger <wolfgang@stufenlos.net>
Fri, 23 Nov 2007 10:21:18 +0000 (10:21 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2753 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/cms/layout/class.tx_cms_layout.php
typo3/sysext/cms/web_info/class.tx_cms_webinfo_lang.php

index 755b32a..5d0f5c9 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-11-23  Wolfgang Klinger <wk@plan2.net> 
+
+       * Fixed bug #6775: Page and info module ignore "Limit to language"
+
 2007-11-22  Ernesto Baschny  <ernst@cron-it.de>
 
        * Fixed bugs #1697, #1465, #4849, #5183: Datetime input fields and timezone shift bug
index 7e75805..70b46a4 100755 (executable)
@@ -1984,6 +1984,21 @@ class tx_cms_layout extends recordList {
                        while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
                                unset($langSelItems[$row['uid']]);
                        }
+                               // Remove disallowed languages
+                       if (count($langSelItems) > 1 && 
+                               !$GLOBALS['BE_USER']->user['admin'] &&
+                               strlen($GLOBALS['BE_USER']->dataLists['allowed_languages'])) {
+
+                               $allowed_languages = array_flip(explode(',', $GLOBALS['BE_USER']->dataLists['allowed_languages']));
+
+                               if (count($allowed_languages)) {
+                                       foreach($langSelItems as $key => $value) {
+                                               if (!isset($allowed_languages[$key]) && $key != 0) {
+                                                       unset($langSelItems[$key]);
+                                               }
+                                       }
+                               }
+                       }
 
                                // If any languages are left, make selector:
                        if (count($langSelItems)>1)             {
index d12d49d..7bdcd2e 100644 (file)
@@ -337,6 +337,12 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
         * @return      array           System language records in an array.
         */
        function getSystemLanguages()   {
+               if (!$GLOBALS['BE_USER']->user['admin'] &&
+                       strlen($GLOBALS['BE_USER']->dataLists['allowed_languages'])) {
+
+                       $allowed_languages = array_flip(explode(',', $GLOBALS['BE_USER']->dataLists['allowed_languages']));
+               }
+
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                        '*',
                        'sys_language',
@@ -345,7 +351,14 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
 
                $outputArray = array();
                while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
-                       $outputArray[] = $row;
+                       if (is_array($allowed_languages) && count($allowed_languages)) {
+                               if (isset($allowed_languages[$row['uid']])) {
+                                       $outputArray[] = $row;
+                               }
+                       }
+                       else {
+                               $outputArray[] = $row;
+                       }
                }
 
                return $outputArray;
@@ -406,4 +419,4 @@ class tx_cms_webinfo_lang extends t3lib_extobjbase {
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/web_info/class.tx_cms_webinfo_lang.php']) {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/web_info/class.tx_cms_webinfo_lang.php']);
 }
-?>
\ No newline at end of file
+?>