[BUGFIX] Fix notice of ttl of ENABLE_INSTALL_TOOL 16/35616/2
authorFrederic Gaus <gaus@flagbit.de>
Sat, 20 Dec 2014 20:12:33 +0000 (21:12 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 21 Dec 2014 20:27:25 +0000 (21:27 +0100)
This patch fixes the notice of the install tool protection status
in the reports module, which has been accidentally been removed
with #57072

Change-Id: Idfad1340a1bd395b67c9ff2a60fec69e6a0add97
Resolves: #64003
Releases: master, 6.2
Reviewed-on: http://review.typo3.org/35616
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/reports/Classes/Report/Status/SecurityStatus.php

index ba1b96f..5975577 100644 (file)
@@ -237,30 +237,34 @@ class SecurityStatus implements \TYPO3\CMS\Reports\StatusProviderInterface {
         * @return \TYPO3\CMS\Reports\Status An object representing whether ENABLE_INSTALL_TOOL exists
         */
        protected function getInstallToolProtectionStatus() {
-               $enableInstallToolFile = PATH_site . 'typo3conf/ENABLE_INSTALL_TOOL';
+               $enableInstallToolFile = PATH_site . EnableFileService::INSTALL_TOOL_ENABLE_FILE_PATH;
                $value = $GLOBALS['LANG']->getLL('status_disabled');
                $message = '';
                $severity = \TYPO3\CMS\Reports\Status::OK;
                if (EnableFileService::installToolEnableFileExists()) {
                        if (EnableFileService::isInstallToolEnableFilePermanent()) {
                                $severity = \TYPO3\CMS\Reports\Status::WARNING;
-                               $disableInstallToolUrl = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL') . '&amp;adminCmd=remove_ENABLE_INSTALL_TOOL';
+                               $disableInstallToolUrl = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL') . '&adminCmd=remove_ENABLE_INSTALL_TOOL';
                                $value = $GLOBALS['LANG']->getLL('status_enabledPermanently');
-                               $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled'), '<span style="white-space: nowrap;">' . $enableInstallToolFile . '</span>');
-                               $message .= ' <a href="' . $disableInstallToolUrl . '">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled_cmd') . '</a>';
+                               $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled'),
+                                       '<span style="white-space: nowrap;">' . $enableInstallToolFile . '</span>');
+                               $message .= ' <a href="' . htmlspecialchars($disableInstallToolUrl) . '">' .
+                                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled_cmd') . '</a>';
                        } else {
                                if (EnableFileService::installToolEnableFileLifetimeExpired()) {
                                        EnableFileService::removeInstallToolEnableFile();
                                } else {
                                        $severity = \TYPO3\CMS\Reports\Status::NOTICE;
-                                       $disableInstallToolUrl = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL') . '&amp;adminCmd=remove_ENABLE_INSTALL_TOOL';
+                                       $disableInstallToolUrl = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL') . '&adminCmd=remove_ENABLE_INSTALL_TOOL';
                                        $value = $GLOBALS['LANG']->getLL('status_enabledTemporarily');
-                                       $message = sprintf($GLOBALS['LANG']->getLL('status_installEnabledTemporarily'), '<span style="white-space: nowrap;">' . $enableInstallToolFile . '</span>', floor($enableInstallToolFileTtl / 60));
-                                       $message .= ' <a href="' . $disableInstallToolUrl . '">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled_cmd') . '</a>';
+                                       $message = sprintf($GLOBALS['LANG']->getLL('status_installEnabledTemporarily'),
+                                               '<span style="white-space: nowrap;">' . $enableInstallToolFile . '</span>', floor((@filemtime($enableInstallToolFile) + EnableFileService::INSTALL_TOOL_ENABLE_FILE_LIFETIME - time()) / 60));
+                                       $message .= ' <a href="' . htmlspecialchars($disableInstallToolUrl) . '">' .
+                                               $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled_cmd') . '</a>';
                                }
                        }
                }
                return GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->getLL('status_installTool'), $value, $message, $severity);
        }
 
-}
+}
\ No newline at end of file