[BUGFIX] Show pages with "show at any login" in view module 82/41982/2
authorDaniel Goerz <ervaude@gmail.com>
Sun, 26 Jul 2015 14:08:14 +0000 (16:08 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Mon, 27 Jul 2015 14:54:46 +0000 (16:54 +0200)
Resolves: #67752
Releases: master, 6.2
Change-Id: I9e8e54012bcfb994e508eae0269493d250cc005a
Reviewed-on: http://review.typo3.org/41982
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index a3d84cb..7cccb9c 100644 (file)
@@ -143,7 +143,7 @@ class BackendUtility {
         * @param string $table Table name (not necessarily in TCA)
         * @param string $where WHERE clause
         * @param string $fields $fields is a list of fields to select, default is '*'
-        * @return array First row found, if any, FALSE otherwise
+        * @return array|bool First row found, if any, FALSE otherwise
         */
        static public function getRecordRaw($table, $where = '', $fields = '*') {
                $row = FALSE;
@@ -4217,8 +4217,18 @@ class BackendUtility {
         * @internal
         */
        static public function ADMCMD_previewCmds($pageinfo) {
+               $simUser = '';
+               $simTime = '';
                if ($pageinfo['fe_group'] > 0) {
                        $simUser = '&ADMCMD_simUser=' . $pageinfo['fe_group'];
+               } elseif ((int)$pageinfo['fe_group'] === -2) {
+                       // -2 means "show at any login". We simulate first available fe_group.
+                       /** @var \TYPO3\CMS\Frontend\Page\PageRepository $sysPage */
+                       $sysPage = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
+                       $activeFeGroupRow = BackendUtility::getRecordRaw('fe_groups', '1=1' . $sysPage->enableFields('fe_groups'), 'uid');
+                       if (!empty($activeFeGroupRow)) {
+                               $simUser = '&ADMCMD_simUser=' . $activeFeGroupRow['uid'];
+                       }
                }
                if ($pageinfo['starttime'] > $GLOBALS['EXEC_TIME']) {
                        $simTime = '&ADMCMD_simTime=' . $pageinfo['starttime'];