[TASK] Missing report for deprecated setting magic_quotes_gpc
[Packages/TYPO3.CMS.git] / typo3 / sysext / reports / reports / status / class.tx_reports_reports_status_configurationstatus.php
index 39df349..d91a42e 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2009-2010 Ingo Renner <ingo@typo3.org>
+*  (c) 2009-2011 Ingo Renner <ingo@typo3.org>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -29,8 +29,6 @@
  * @author             Ingo Renner <ingo@typo3.org>
  * @package            TYPO3
  * @subpackage reports
- *
- * $Id$
  */
 class tx_reports_reports_status_ConfigurationStatus implements tx_reports_StatusProvider {
 
@@ -41,7 +39,7 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status
 
        /**
         * Backpath to the typo3 main directory
-        * 
+        *
         * @var string
         */
        protected $backPath = '../';
@@ -54,8 +52,10 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status
         */
        public function getStatus() {
                $statuses = array(
-                       'emptyReferenceIndex' => $this->getReferenceIndexStatus(),
-                       'deprecationLog'      => $this->getDeprecationLogStatus()
+                       'emptyReferenceIndex'   => $this->getReferenceIndexStatus(),
+                       'deprecationLog'        => $this->getDeprecationLogStatus(),
+                       'safeModeEnabled'       => $this->getPhpSafeModeStatus(),
+                       'magicQuotesGpcEnabled' => $this->getPhpMagicQuotesGpcStatus(),
                );
 
                if ($this->isMemcachedUsed()) {
@@ -96,10 +96,52 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status
                );
        }
 
+       /**
+        * Checks if PHP safe_mode is enabled.
+        *
+        * @return      tx_reports_reports_status_Status        A tx_reports_reports_status_Status object representing whether the safe_mode is enabled or not
+        */
+       protected function getPhpSafeModeStatus() {
+               $value    = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:disabled');
+               $message  = '';
+               $severity = tx_reports_reports_status_Status::OK;
+
+               if (t3lib_utility_PhpOptions::isSafeModeEnabled()) {
+                       $value    = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:enabled');
+                       $severity = tx_reports_reports_status_Status::WARNING;
+                       $message  = $GLOBALS['LANG']->getLL('status_configuration_PhpSafeModeEnabled');
+               }
+
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       $GLOBALS['LANG']->getLL('status_PhpSafeMode'), $value, $message, $severity
+               );
+       }
+
+       /**
+        * Checks if PHP magic_quotes_gpc is enabled.
+        *
+        * @return      tx_reports_reports_status_Status        A tx_reports_reports_status_Status object representing whether the magic_quote_gpc is enabled or not
+        */
+       protected function getPhpMagicQuotesGpcStatus() {
+               $value    = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:disabled');
+               $message  = '';
+               $severity = tx_reports_reports_status_Status::OK;
+
+               if (t3lib_utility_PhpOptions::isMagicQuotesGpcEnabled()) {
+                       $value    = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:enabled');
+                       $severity = tx_reports_reports_status_Status::WARNING;
+                       $message  = $GLOBALS['LANG']->getLL('status_configuration_PhpMagicQuotesGpcEnabled');
+               }
+
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       $GLOBALS['LANG']->getLL('status_PhpMagicQuotesGpc'), $value, $message, $severity
+               );
+       }
+
        /**
         * Checks whether memcached is configured, if that's the case we asume it's also used.
         *
-        * @return      boolean True if memcached is used, false otherwise.
+        * @return      boolean TRUE if memcached is used, FALSE otherwise.
         */
        protected function isMemcachedUsed() {
                $memcachedUsed = FALSE;
@@ -168,7 +210,7 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status
                                        }
                                }
                                $memcachedConnection = @memcache_connect($host, $port);
-                               if ($memcachedConnection != null) {
+                               if ($memcachedConnection != NULL) {
                                        memcache_close($memcachedConnection);
                                } else {
                                        $failedConnections[] = $configuredServer;
@@ -260,8 +302,8 @@ class tx_reports_reports_status_ConfigurationStatus implements tx_reports_Status
 }
 
 
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php']) {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php']);
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php']);
 }
 
 ?>
\ No newline at end of file