Added feature #11843: Add a reports module
authorIngo Renner <ingo.renner@typo3.org>
Fri, 18 Sep 2009 10:16:37 +0000 (10:16 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Fri, 18 Sep 2009 10:16:37 +0000 (10:16 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5973 709f56b5-9817-0410-a4d7-c38de5d9e867

22 files changed:
ChangeLog
typo3/sysext/install/ext_autoload.php [new file with mode: 0644]
typo3/sysext/install/ext_tables.php
typo3/sysext/install/report/class.tx_install_report_installstatus.php [new file with mode: 0644]
typo3/sysext/install/requirements.php [new file with mode: 0644]
typo3/sysext/reports/ChangeLog [new file with mode: 0644]
typo3/sysext/reports/ext_autoload.php [new file with mode: 0644]
typo3/sysext/reports/ext_emconf.php [new file with mode: 0644]
typo3/sysext/reports/ext_icon.gif [new file with mode: 0644]
typo3/sysext/reports/ext_tables.php [new file with mode: 0644]
typo3/sysext/reports/interfaces/interface.tx_reports_report.php [new file with mode: 0644]
typo3/sysext/reports/interfaces/interface.tx_reports_statusprovider.php [new file with mode: 0644]
typo3/sysext/reports/mod/conf.php [new file with mode: 0644]
typo3/sysext/reports/mod/index.php [new file with mode: 0644]
typo3/sysext/reports/mod/locallang.xml [new file with mode: 0644]
typo3/sysext/reports/mod/mod_styles.css [new file with mode: 0644]
typo3/sysext/reports/mod/mod_template.html [new file with mode: 0644]
typo3/sysext/reports/mod/moduleicon.gif [new file with mode: 0644]
typo3/sysext/reports/reports/class.tx_reports_reports_status.php [new file with mode: 0644]
typo3/sysext/reports/reports/locallang.xml [new file with mode: 0644]
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_installtoolstatus.php [new file with mode: 0644]
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_status.php [new file with mode: 0644]

index 66cf7f2..8344c70 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-09-18  Ingo Renner  <ingo@typo3.org>
+
+       * Added feature #11843: Add a reports module
+
 2009-09-18  Steffen Kamper  <info@sk-typo3.de>
 
        * Follow-up to bug #11985: Move ExtJs CSS-assignment to renderJsKibraries
diff --git a/typo3/sysext/install/ext_autoload.php b/typo3/sysext/install/ext_autoload.php
new file mode 100644 (file)
index 0000000..bdf4095
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+/*
+ * Register necessary class names with autoloader
+ *
+ * $Id$
+ */
+return array(
+       'tx_install_report_installstatus' => t3lib_extMgm::extPath('install', 'report/class.tx_install_report_installstatus.php'),
+);
+?>
index 920f6e2..9945af8 100755 (executable)
@@ -3,6 +3,8 @@ if (!defined ('TYPO3_MODE'))    die ('Access denied.');
 
 if (TYPO3_MODE=='BE') {
        t3lib_extMgm::addModule('tools', 'install', '', t3lib_extMgm::extPath($_EXTKEY) . 'mod/');
+
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['_install'] = 'tx_install_report_InstallStatus';
 }
 
 ?>
\ No newline at end of file
diff --git a/typo3/sysext/install/report/class.tx_install_report_installstatus.php b/typo3/sysext/install/report/class.tx_install_report_installstatus.php
new file mode 100644 (file)
index 0000000..e3da157
--- /dev/null
@@ -0,0 +1,258 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+require_once(t3lib_extMgm::extPath('install', 'requirements.php'));
+
+
+/**
+ * Provides an installation status report
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage tx_install
+ */
+class tx_install_report_InstallStatus implements tx_reports_StatusProvider {
+
+       protected $reportList = 'Typo3Version,FileSystem,Php,PhpMemoryLimit,PhpRegisterGlobals,Webserver';
+
+       /**
+        * Compiles a collection of system status checks as a status report.
+        *
+        * @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus()
+        */
+       public function getStatus() {
+               $reports = array();
+               $reportMethods = explode(',', $this->reportList);
+
+               foreach ($reportMethods as $reportMethod) {
+                       $reports[$reportMethod] = $this->{'get' . $reportMethod . 'Status'}();
+               }
+
+               return $reports;
+       }
+
+       /**
+        * Simply gets the current TYPO3 version.
+        *
+        * @return      tx_reports_reports_status_Status
+        */
+       protected function getTypo3VersionStatus() {
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       'TYPO3',
+                       TYPO3_version,
+                       '',
+                       tx_reports_reports_status_Status::NOTICE
+               );
+       }
+
+       /**
+        * Checks for several directoris being writable.
+        *
+        * @return unknown_type
+        */
+       protected function getFileSystemStatus() {
+               $value    = 'Writable';
+               $message  = '';
+               $severity = tx_reports_reports_status_Status::OK;
+
+                       // Requirement level
+                       // -1 = not required, but if it exists may be writable or not
+                       //  0 = not required, if it exists the dir should be writable
+                       //  1 = required, don't has to be writable
+                       //  2 = required, has to be writable
+
+               $checkWritable = array(
+                       'typo3temp/'           => 2,
+                       'typo3temp/pics/'      => 2,
+                       'typo3temp/temp/'      => 2,
+                       'typo3temp/llxml/'     => 2,
+                       'typo3temp/cs/'        => 2,
+                       'typo3temp/GB/'        => 2,
+                       'typo3temp/locks/'     => 2,
+                       'typo3conf/'           => 2,
+                       'typo3conf/ext/'       => 0,
+                       'typo3conf/l10n/'      => 0,
+                       TYPO3_mainDir . 'ext/' => -1,
+                       'uploads/'             => 2,
+                       'uploads/pics/'        => 0,
+                       'uploads/media/'       => 0,
+                       'uploads/tf/'          => 0,
+                       'fileadmin/'           => -1,
+                       'fileadmin/_temp_/'    => 0,
+               );
+
+               foreach ($checkWritable as $relPath => $requirementLevel) {
+                       if (!@is_dir(PATH_site . $relPath)) {
+                                       // If the directory is missing, try to create it
+                               t3lib_div::mkdir(PATH_site . $relPath);
+                       }
+
+                       if (!@is_dir(PATH_site . $relPath)) {
+                               if ($requirementLevel > 0) {
+                                               // directory is required
+                                       $value = 'Required Directory Missing';
+                                       $message .= $relPath . ' does not exist and could not be created.<br />';
+                                       $severity = tx_reports_reports_status_Status::ERROR;
+                               } else {
+                                       if ($requirementLevel == 0) {
+                                               $message .= $relPath . ' does not exist but should be writable if it does exist.<br />';
+                                       } else {
+                                               $message .= $relPath . ' does not exist.<br />';
+                                       }
+
+                                       if ($severity < tx_reports_reports_status_Status::WARNING) {
+                                               $value = 'Directory not existing';
+                                               $severity = tx_reports_reports_status_Status::WARNING;
+                                       }
+                               }
+                       } else {
+                               if (!is_writable(PATH_site . $relPath)) {
+                                       switch ($requirementLevel) {
+                                               case 0:
+                                                       $message .= PATH_site . $relPath . ' should be writable.<br />';
+
+                                                       if ($severity < tx_reports_reports_status_Status::WARNING) {
+                                                               $value = 'Directory should be writable';
+                                                               $severity = tx_reports_reports_status_Status::WARNING;
+                                                       }
+                                                       break;
+                                               case 2:
+                                                       $value = 'Directory not writable';
+                                                       $message .= PATH_site . $relPath . ' must be writable.<br />';
+                                                       $severity = tx_reports_reports_status_Status::ERROR;
+                                                       break;
+                                       }
+                               }
+                       }
+               }
+
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       'File System',
+                       $value,
+                       $message,
+                       $severity
+               );
+       }
+
+       /**
+        * Reports the webserver TYPO3 is running on.
+        *
+        * @return      tx_reports_reports_status_Status        The server software as a status
+        */
+       protected function getWebserverStatus() {
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       'Web Server',
+                       $_SERVER['SERVER_SOFTWARE']
+               );
+       }
+
+       /**
+        * Checks the current PHP version against a minimum required version.
+        *
+        * @return      tx_reports_reports_status_Status        A status of whether a minimum PHP version requirment is met
+        */
+       protected function getPhpStatus() {
+               $message  = '';
+               $severity = tx_reports_reports_status_Status::OK;
+
+               if (version_compare(phpversion(), TYPO3_REQUIREMENTS_MINIMUM_PHP) < 0) {
+                       $message  = 'Your PHP installation is too old.';
+                       $severity = tx_reports_reports_status_Status::ERROR;
+               }
+
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       'PHP',
+                       phpversion(),
+                       $message,
+                       $severity
+               );
+       }
+
+       /**
+        * Checks the current memory limit against a minimum required version.
+        *
+        * @return      tx_reports_reports_status_Status        A status of whether a minimum memory limit requirment is met
+        */
+       protected function getPhpMemoryLimitStatus() {
+               $memoryLimit = ini_get('memory_limit');
+               $message     = '';
+               $severity    = tx_reports_reports_status_Status::OK;
+
+               if ($memoryLimit && t3lib_div::getBytesFromSizeMeasurement($memoryLimit) < t3lib_div::getBytesFromSizeMeasurement(TYPO3_REQUIREMENTS_RECOMMENDED_PHP_MEMORY_LIMIT)) {
+                       $message = 'Depending on your configuration, TYPO3 can run with a ' . $memoryLimit . ' PHP memory limit. However, a ' . TYPO3_REQUIREMENTS_RECOMMENDED_PHP_MEMORY_LIMIT . ' PHP memory limit or above is recommended, especially if your site uses additional extensions.';
+                       $severity = tx_reports_reports_status_Status::WARNING;
+               }
+
+               if ($memoryLimit && t3lib_div::getBytesFromSizeMeasurement($memoryLimit) < t3lib_div::getBytesFromSizeMeasurement(TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT)) {
+                       $message = 'Depending on your configuration, TYPO3 can run with a ' . $memoryLimit . ' PHP memory limit. However, a ' . TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT . ' PHP memory limit or above is required, especially if your site uses additional extensions.';
+                       $severity = tx_reports_reports_status_Status::ERROR;
+               }
+
+               if ($severity > tx_reports_reports_status_Status::OK) {
+                       if ($php_ini_path = get_cfg_var('cfg_file_path')) {
+                               $message .= ' Increase the memory limit by editing the memory_limit parameter in the file ' . $php_ini_path . ' and then restart your web server (or contact your system administrator or hosting provider for assistance).';
+                       } else {
+                               $message .= ' Contact your system administrator or hosting provider for assistance with increasing your PHP memory limit.';
+                       }
+               }
+
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       'PHP Memory Limit', $memoryLimit, $message, $severity
+               );
+       }
+
+       /**
+        * checks whether register globals is on or off.
+        *
+        * @return      tx_reports_reports_status_Status        A status of whether register globals is on or off
+        */
+       protected function getPhpRegisterGlobalsStatus() {
+               $value    = $GLOBALS['LANG']->getLL('status_disabled');
+               $message  = '';
+               $severity = tx_reports_reports_status_Status::OK;
+
+               $registerGlobals = trim(ini_get('register_globals'));
+
+                       // can't reliably check for 'on', therefore checking for the oposite 'off', '', or 0
+               if (!empty($registerGlobals) && strtolower($registerGlobals) != 'off') {
+                       $message = '<em>register_globals</em> is enabled. TYPO3 requires this configuration directive to be disabled. Your site may not be secure when <em>register_globals</em> is enabled. The PHP manual has instructions for <a href="http://php.net/configuration.changes">how to change configuration settings</a>.';
+                       $severity = tx_reports_reports_status_Status::ERROR;
+                       $value = $GLOBALS['LANG']->getLL('status_enabled')
+                               . ' (\'' . $registerGlobals . '\')';
+               }
+
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       'PHP Register Globals', $value, $message, $severity
+               );
+       }
+
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/install/report/class.tx_install_report_installstatus.php'])   {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/install/report/class.tx_install_report_installstatus.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/install/requirements.php b/typo3/sysext/install/requirements.php
new file mode 100644 (file)
index 0000000..54e41b3
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+       // $id$
+
+define('TYPO3_REQUIREMENTS_MINIMUM_PHP', '5.2.0');
+
+define('TYPO3_REQUIREMENTS_MINIMUM_PHP_MEMORY_LIMIT', '32M');
+define('TYPO3_REQUIREMENTS_RECOMMENDED_PHP_MEMORY_LIMIT', '64M');
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/reports/ChangeLog b/typo3/sysext/reports/ChangeLog
new file mode 100644 (file)
index 0000000..8eb69e7
--- /dev/null
@@ -0,0 +1,3 @@
+2009-09-18 Ingo Renner  <ingo@typo3.org>
+
+       * Integration of the reports module as a system extension
diff --git a/typo3/sysext/reports/ext_autoload.php b/typo3/sysext/reports/ext_autoload.php
new file mode 100644 (file)
index 0000000..0ed7854
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+/*
+ * Register necessary class names with autoloader
+ *
+ * $Id$
+ */
+$extensionPath = t3lib_extMgm::extPath('reports');
+return array(
+       'tx_reports_statusprovider' => $extensionPath . 'interfaces/interface.tx_reports_statusprovider.php',
+       'tx_reports_report' => $extensionPath . 'interfaces/interface.tx_reports_report.php',
+       'tx_reports_module' => $extensionPath . 'mod/index.php',
+       'tx_reports_reports_status' => $extensionPath . 'reports/class.tx_reports_reports_status.php',
+       'tx_reports_reports_status_installtoolstatus' => $extensionPath . 'reports/status/class.tx_reports_reports_status_installtoolstatus.php',
+       'tx_reports_reports_status_status' => $extensionPath . 'reports/status/class.tx_reports_reports_status_status.php',
+);
+?>
diff --git a/typo3/sysext/reports/ext_emconf.php b/typo3/sysext/reports/ext_emconf.php
new file mode 100644 (file)
index 0000000..d4090eb
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+########################################################################
+# Extension Manager/Repository config file for ext: "reports"
+#
+# Auto generated 18-09-2009 12:13
+#
+# Manual updates:
+# Only the data in the array - anything else is removed by next write.
+# "version" and "dependencies" must not be touched!
+########################################################################
+
+$EM_CONF[$_EXTKEY] = array(
+       'title' => 'System Reports',
+       'description' => 'The system reports module groups several system reports.',
+       'category' => 'module',
+       'author' => 'Ingo Renner',
+       'author_email' => 'ingo@typo3.org',
+       'shy' => '',
+       'dependencies' => '',
+       'conflicts' => '',
+       'priority' => '',
+       'module' => 'mod',
+       'state' => 'beta',
+       'internal' => '',
+       'uploadfolder' => 0,
+       'createDirs' => '',
+       'modify_tables' => '',
+       'clearCacheOnLoad' => 0,
+       'lockType' => '',
+       'author_company' => '',
+       'version' => '1.0.0',
+       'doNotLoadInFE' => 1,
+       'constraints' => array(
+               'depends' => array(
+               ),
+               'conflicts' => array(
+               ),
+               'suggests' => array(
+               ),
+       ),
+       '_md5_values_when_last_written' => 'a:16:{s:9:"ChangeLog";s:4:"f713";s:16:"ext_autoload.php";s:4:"a87e";s:12:"ext_icon.gif";s:4:"691d";s:14:"ext_tables.php";s:4:"06d0";s:42:"interfaces/interface.tx_reports_report.php";s:4:"32c9";s:50:"interfaces/interface.tx_reports_statusprovider.php";s:4:"b640";s:12:"mod/conf.php";s:4:"7fd9";s:13:"mod/index.php";s:4:"e089";s:17:"mod/locallang.xml";s:4:"7782";s:18:"mod/mod_styles.css";s:4:"eaeb";s:21:"mod/mod_template.html";s:4:"ff97";s:18:"mod/moduleicon.gif";s:4:"2ac9";s:43:"reports/class.tx_reports_reports_status.php";s:4:"5ef6";s:21:"reports/locallang.xml";s:4:"6c8d";s:68:"reports/status/class.tx_reports_reports_status_installtoolstatus.php";s:4:"2d14";s:57:"reports/status/class.tx_reports_reports_status_status.php";s:4:"4d36";}',
+       'suggests' => array(
+       ),
+);
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/reports/ext_icon.gif b/typo3/sysext/reports/ext_icon.gif
new file mode 100644 (file)
index 0000000..f9c5483
Binary files /dev/null and b/typo3/sysext/reports/ext_icon.gif differ
diff --git a/typo3/sysext/reports/ext_tables.php b/typo3/sysext/reports/ext_tables.php
new file mode 100644 (file)
index 0000000..664156e
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+if (!defined ('TYPO3_MODE')) {
+       die ('Access denied.');
+}
+
+if (TYPO3_MODE == 'BE') {
+       t3lib_extMgm::addModulePath('tools_txreportsM1', t3lib_extMgm::extPath($_EXTKEY) . 'mod/');
+       t3lib_extMgm::addModule('tools', 'txreportsM1', '', t3lib_extMgm::extPath($_EXTKEY) . 'mod/');
+
+       $statusReport = array(
+               'title'       => 'LLL:EXT:reports/reports/locallang.xml:status_report_title',
+               'description' => 'LLL:EXT:reports/reports/locallang.xml:status_report_description',
+               'report'      => 'tx_reports_reports_Status'
+       );
+
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status'] = array_merge(
+               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status'],
+               $statusReport
+       );
+
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['_installtool'] = 'tx_reports_reports_status_InstallToolStatus';
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/reports/interfaces/interface.tx_reports_report.php b/typo3/sysext/reports/interfaces/interface.tx_reports_report.php
new file mode 100644 (file)
index 0000000..3c99ac3
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+/**
+ * Interface for classes which provide a report.
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage tx_reports
+ */
+interface tx_reports_Report {
+
+       /**
+        * returns the content for a report
+        *
+        * @return      string  A reports rendered HTML
+        */
+       public function getReport();
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/reports/interfaces/interface.tx_reports_statusprovider.php b/typo3/sysext/reports/interfaces/interface.tx_reports_statusprovider.php
new file mode 100644 (file)
index 0000000..9427275
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+/**
+ * Interface for classes which provide a status report entry.
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage tx_reports
+ */
+interface tx_reports_StatusProvider {
+
+       /**
+        * returns the staus of an extension or (sub)system
+        *
+        * @return      array   An array of tx_reports_reports_status_Status objects
+        */
+       public function getStatus();
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/reports/mod/conf.php b/typo3/sysext/reports/mod/conf.php
new file mode 100644 (file)
index 0000000..1b1504f
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+       // DO NOT REMOVE OR CHANGE THESE 2 LINES:
+$MCONF['name'] = 'tools_txreportsM1';
+$MCONF['script'] = '_DISPATCH';
+
+$MCONF['access'] = 'admin';
+
+$MLANG['default']['tabs_images']['tab'] = 'moduleicon.gif';
+$MLANG['default']['ll_ref'] = 'LLL:EXT:reports/mod/locallang.xml';
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/reports/mod/index.php b/typo3/sysext/reports/mod/index.php
new file mode 100644 (file)
index 0000000..2eec2ad
--- /dev/null
@@ -0,0 +1,271 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/**
+ * [CLASS/FUNCTION INDEX of SCRIPT]
+ *
+ * Hint: use extdeveval to insert/update function index above.
+ */
+
+
+$LANG->includeLLFile('EXT:reports/mod/locallang.xml');
+       // This checks permissions and exits if the users has no permission for entry.
+$BE_USER->modAccess($MCONF, 1);
+
+
+/**
+ * Module 'Reports' for the 'reports' extension.
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @package    TYPO3
+ * @subpackage tx_reports
+ */
+class tx_reports_Module extends t3lib_SCbase {
+
+       protected $pageinfo;
+
+       /**
+        * Initializes the Module
+        *
+        * @return      void
+        */
+       public function __construct() {
+               parent::init();
+
+                       // initialize document
+               $this->doc = t3lib_div::makeInstance('template');
+               $this->doc->setModuleTemplate(
+                       t3lib_extMgm::extPath('reports') . 'mod/mod_template.html'
+               );
+               $this->doc->backPath = $GLOBALS['BACK_PATH'];
+               $this->doc->addStyleSheet(
+                       'tx_reports',
+                       '../' . t3lib_extMgm::siteRelPath('reports') . 'mod/mod_styles.css'
+               );
+       }
+
+       /**
+        * Adds items to the ->MOD_MENU array. Used for the function menu selector.
+        *
+        * @return      void
+        */
+       public function menuConfig() {
+               $reportsMenuItems = array();
+               $this->MOD_MENU   = array('function' => array());
+
+               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports'] as $extKey => $reports) {
+                       foreach ($reports as $reportName => $report) {
+                               $reportsMenuItems[$extKey . '.' . $reportName] = $GLOBALS['LANG']->sL($report['title']);
+                       }
+               }
+
+               asort($reportsMenuItems);
+               $reportsMenuItems = array_merge(
+                       array('index' => $GLOBALS['LANG']->getLL('reports_overview')),
+                       $reportsMenuItems
+               );
+
+               foreach ($reportsMenuItems as $key => $title) {
+                       $this->MOD_MENU['function'][$key] = $title;
+               }
+
+               parent::menuConfig();
+       }
+
+       /**
+        * Creates the module's content. In this case it rather acts as a kind of #
+        * dispatcher redirecting requests to specific reports.
+        *
+        * @return      void
+        */
+       public function main() {
+               $docHeaderButtons = $this->getButtons();
+
+                       // Access check!
+                       // The page will show only if user has admin rights
+               if ($GLOBALS['BE_USER']->user['admin']) {
+
+                               // Draw the form
+                       $this->doc->form = '<form action="" method="post" enctype="multipart/form-data">';
+
+                               // JavaScript
+                       $this->doc->JScode = '
+                               <script language="javascript" type="text/javascript">
+                                       script_ended = 0;
+                                       function jumpToUrl(URL) {
+                                               document.location = URL;
+                                       }
+                               </script>
+                       ';
+                       $this->doc->postCode='
+                               <script language="javascript" type="text/javascript">
+                                       script_ended = 1;
+                                       if (top.fsMod) {
+                                               top.fsMod.recentIds["web"] = 0;
+                                       }
+                               </script>
+                       ';
+                               // Render content:
+                       $this->renderModuleContent();
+               } else {
+                               // If no access or if ID == 0
+                       $docHeaderButtons['save'] = '';
+                       $this->content.=$this->doc->spacer(10);
+               }
+
+                       // compile document
+               $markers['FUNC_MENU'] = $GLOBALS['LANG']->getLL('choose_report')
+                       . t3lib_BEfunc::getFuncMenu(
+                               0,
+                               'SET[function]',
+                               $this->MOD_SETTINGS['function'],
+                               $this->MOD_MENU['function']
+                       );
+               $markers['CONTENT'] = $this->content;
+
+                               // Build the <body> for the module
+               $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
+               $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
+               $this->content.= $this->doc->endPage();
+               $this->content = $this->doc->insertStylesAndJS($this->content);
+       }
+
+       /**
+        * Prints out the module's HTML
+        *
+        * @return      void
+        */
+       public function printContent() {
+               echo $this->content . $this->doc->endPage();
+       }
+
+       /**
+        * Generates the module content by calling the selected report
+        *
+        * @return      void
+        */
+       protected function renderModuleContent() {
+               $action  = (string) $this->MOD_SETTINGS['function'];
+               $title   = '';
+               $content = '';
+
+               if ($action == 'index') {
+                       $content = $this->indexAction();
+                       $title   = $GLOBALS['LANG']->getLL('reports_overview');
+               } else {
+                       $content = '';
+                       list($extKey, $reportName) = explode('.', $action, 2);
+
+                       $reportClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports'][$extKey][$reportName]['report'];
+                       $title       = $GLOBALS['LANG']->sL($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports'][$extKey][$reportName]['title']);
+
+                       $reportInstance = t3lib_div::makeInstance($reportClass);
+
+                       if ($reportInstance instanceof tx_reports_Report) {
+                               $content = $reportInstance->getReport();
+                       } else {
+                               $content = $reportClass . ' does not implement the Report Interface which is necessary to be displayed here.';
+                       }
+               }
+
+               $this->content .= $this->doc->section($title, $content, false, true);
+       }
+
+       /**
+        * Shows an overview list of available reports.
+        *
+        * @return      string  list of available reports
+        */
+       protected function indexAction() {
+               $content = '<dl class="report-list">';
+               $reports = array();
+
+               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports'] as $extKey => $extensionReports) {
+                       foreach ($extensionReports as $reportName => $report) {
+                               $action = $extKey . '.' . $reportName;
+                               $link = 'mod.php?M=tools_txreportsM1&SET[function]=' . $action;
+
+                               $reportTitle = $GLOBALS['LANG']->sL($report['title']);
+
+                               $reportContent  = '<dt><a href="' . $link . '">' . $reportTitle. '</a></dt>';
+                               $reportContent .= '<dd>' . $GLOBALS['LANG']->sL($report['description']) . '</dd>';
+
+                               $reports[$reportTitle] = $reportContent;
+                       }
+               }
+
+               ksort($reports);
+
+               foreach ($reports as $reportContent) {
+                       $content .= $reportContent;
+               }
+
+               return $content . '</dl>';
+       }
+
+       /**
+        * Create the panel of buttons for submitting the form or otherwise
+        * perform operations.
+        *
+        * @return      array   all available buttons as an assoc. array
+        */
+       protected function getButtons() {
+               $buttons = array(
+                       'csh' => '',
+                       'shortcut' => '',
+                       'save' => ''
+               );
+                       // CSH
+               $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_func', '', $GLOBALS['BACK_PATH']);
+
+                       // Shortcut
+               if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
+                       $buttons['shortcut'] = $this->doc->makeShortcutIcon('', 'function', $this->MCONF['name']);
+               }
+
+               return $buttons;
+       }
+
+}
+
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/mod/index.php'])      {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/mod/index.php']);
+}
+
+
+
+
+// Make instance:
+$SOBE = t3lib_div::makeInstance('tx_reports_Module');
+
+// Include files?
+foreach($SOBE->include_once as $INC_FILE) {
+       include_once($INC_FILE);
+}
+
+$SOBE->main();
+$SOBE->printContent();
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/reports/mod/locallang.xml b/typo3/sysext/reports/mod/locallang.xml
new file mode 100644 (file)
index 0000000..043cfaa
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <type>module</type>
+               <description>Language labels for module &quot;tools_txreportsM1&quot;</description>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="mlang_tabs_tab">Reports</label>
+                       <label index="mlang_labels_tabdescr">Collection of several system reports.</label>
+                       <label index="mlang_labels_tablabel">System Reports</label>
+                       <label index="title">Reports</label>
+                       <label index="reports_overview">Overview</label>
+                       <label index="choose_report">Report:</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file
diff --git a/typo3/sysext/reports/mod/mod_styles.css b/typo3/sysext/reports/mod/mod_styles.css
new file mode 100644 (file)
index 0000000..6c9aad6
--- /dev/null
@@ -0,0 +1,83 @@
+
+body#ext-reports-mod-index-php {
+       margin: 0px;
+}
+
+#typo3-inner-docbody p.help {
+       font-size: 12px;
+}
+
+
+/* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */
+/* overview */
+
+.report-list dt {
+       font-weight: bold;
+       font-size: 11px;
+       background-image: url("moduleicon.gif");
+       background-repeat: no-repeat;
+       padding: 0px 0px 2px 20px;
+}
+
+.report-list dd {
+       margin: 2px 0px 15px 20px;
+}
+
+/* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */
+/* status report */
+
+table.system-status-report {
+       width: 100%;
+       margin: 10px 0px;
+       border-collapse: collapse;
+       border-top: 1px solid #595d66;
+}
+
+
+table.system-status-report th,
+table.system-status-report td {
+       border-width: 1px 0px;
+}
+
+table.system-status-report th,
+table.system-status-report td {
+       text-align: left;
+       padding: 6px;
+       font-size: 12px;
+}
+
+table.system-status-report th a,
+table.system-status-report td a {
+       color: #000;
+       font-weight: bold;
+       text-decoration: none;
+}
+
+table.system-status-report th a:hover,
+table.system-status-report td a:hover {
+       text-decoration: underline;
+}
+
+table.system-status-report th {
+       padding-left: 30px;
+       font-weight: bold;
+}
+
+table.system-status-report td.merge-down,
+table.system-status-report th.merge-down {
+       border-bottom-width: 0px !important;
+}
+
+table.system-status-report td.merge-up {
+       border-top-width: 0px !important;
+       background-image: none;
+       padding-left: 30px;
+}
+
+table.system-status-report tr td.typo3-message {
+       background-image: none;
+}
+
+
+
+
diff --git a/typo3/sysext/reports/mod/mod_template.html b/typo3/sysext/reports/mod/mod_template.html
new file mode 100644 (file)
index 0000000..59e33ff
--- /dev/null
@@ -0,0 +1,35 @@
+<!-- ###FULLDOC### begin -->
+<div class="typo3-fullDoc">
+       <!-- Page header with buttons, path details and csh -->
+       <div id="typo3-docheader">
+               <div id="typo3-docheader-row1">
+                       <div class="buttonsleft">###BUTTONLIST_LEFT###</div>
+                       <div class="buttonsright">###BUTTONLIST_RIGHT###</div>
+               </div>
+               <div id="typo3-docheader-row2">
+                       <div class="docheader-row2-left"><div class="docheader-funcmenu">###FUNC_MENU###</div></div>
+                       <div class="docheader-row2-right"> </div>
+               </div>
+       </div>
+       <!-- Content of module, for instance listing, info or editing -->
+       <div id="typo3-docbody">
+               <div id="typo3-inner-docbody">
+                       ###CONTENT###
+               </div>
+       </div>
+</div>
+<!-- ###FULLDOC### end -->
+
+<!-- Grouping the icons on top -->
+
+<!-- ###BUTTON_GROUP_WRAP### -->
+       <div class="buttongroup">###BUTTONS###</div>
+<!-- ###BUTTON_GROUP_WRAP### -->
+
+<!-- ###BUTTON_GROUPS_LEFT### -->
+
+<!-- ###BUTTON_GROUPS_LEFT### -->
+
+<!-- ###BUTTON_GROUPS_RIGHT### -->
+<!-- ###BUTTON_GROUP1### -->###SHORTCUT###<!-- ###BUTTON_GROUP1### -->
+<!-- ###BUTTON_GROUPS_RIGHT### -->
\ No newline at end of file
diff --git a/typo3/sysext/reports/mod/moduleicon.gif b/typo3/sysext/reports/mod/moduleicon.gif
new file mode 100644 (file)
index 0000000..04abfd4
Binary files /dev/null and b/typo3/sysext/reports/mod/moduleicon.gif differ
diff --git a/typo3/sysext/reports/reports/class.tx_reports_reports_status.php b/typo3/sysext/reports/reports/class.tx_reports_reports_status.php
new file mode 100644 (file)
index 0000000..ed0f451
--- /dev/null
@@ -0,0 +1,123 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+/**
+ * The status report
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage reports
+ */
+class tx_reports_reports_Status implements tx_reports_Report {
+
+       protected $statusProviders = array();
+
+       /**
+        * constructor for class tx_reports_report_Status
+        */
+       public function __construct() {
+               $this->getStatusProviders();
+
+               $GLOBALS['LANG']->includeLLFile('EXT:reports/reports/locallang.xml');
+       }
+
+       /**
+        * Takes care of creating / rendering the status report
+        *
+        * @return      string  The status report as HTML
+        */
+       public function getReport() {
+               $status  = array();
+               $content = '';
+
+               foreach ($this->statusProviders as $statusProvider) {
+                       $status += $statusProvider->getStatus();
+               }
+
+               $content .= '<p class="help">'
+                       . $GLOBALS['LANG']->getLL('status_report_explanation')
+                       . '</p>';
+
+               return $content . $this->renderStatus($status);
+       }
+
+       /**
+        * Gets all registered status providers and creates instances of them.
+        *
+        * @return      void
+        */
+       protected function getStatusProviders() {
+               ksort($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']);
+
+               foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status'] as $key => $statusProvider) {
+                       if (t3lib_div::inList('title,description,report', $key)) {
+                               continue; // skip (for this report) unneccessary data
+                       }
+
+                       $statusProviderInstance = t3lib_div::makeInstance($statusProvider);
+                       if ($statusProviderInstance instanceof tx_reports_StatusProvider) {
+                               $this->statusProviders[$key] = $statusProviderInstance;
+                       }
+               }
+       }
+
+       /**
+        * Renders a the system's status
+        *
+        * @param       array   An array of statuses as returned by the available status providers
+        * @return      string  The system status as an HTML table
+        */
+       protected function renderStatus(array $statusCollection) {
+               $content = '<table class="system-status-report">';
+               $classes = array(
+                       tx_reports_reports_status_Status::NOTICE  => 'notice',
+                       tx_reports_reports_status_Status::INFO    => 'information',
+                       tx_reports_reports_status_Status::OK      => 'ok',
+                       tx_reports_reports_status_Status::WARNING => 'warning',
+                       tx_reports_reports_status_Status::ERROR   => 'error',
+               );
+
+               foreach ($statusCollection as $status) {
+                       $class = 'typo3-message message-' . $classes[$status->getSeverity()];
+                       $description = $status->getMessage();
+
+                       if (empty($description)) {
+                               $content .= '<tr><th class="'. $class .'">'. $status->getTitle() .'</th><td class="'. $class .'">'. $status->getValue() .'</td></tr>';
+                       } else {
+                               $content .= '<tr><th class="'. $class .' merge-down">'. $status->getTitle() .'</th><td class="'. $class .' merge-down">'. $status->getValue() .'</td></tr>';
+                               $content .= '<tr><td class="'. $class .' merge-up" colspan="2">'. $description .'</td></tr>';
+                       }
+               }
+
+               return $content . '</table>';
+       }
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/reports/class.tx_reports_reports_status.php'])        {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/reports/class.tx_reports_reports_status.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/reports/reports/locallang.xml b/typo3/sysext/reports/reports/locallang.xml
new file mode 100644 (file)
index 0000000..1066d37
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <type>module</type>
+               <description>Language labels for module 'tools_txreportsM1'</description>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="status_report_title">Status Report</label>
+                       <label index="status_report_description">Get a status report about your site's operation and any detected problems.</label>
+                       <label index="status_report_explanation">Here you can find a short overview of your site's parameters as well as any problems detected with your installation. It may be useful to copy and paste this information into support requests filed on TYPO3's support mailinglists and project issue trackers.</label>
+                       <label index="status_ok">OK</label>
+                       <label index="status_insecure">Insecure</label>
+                       <label index="status_disabled">Disabled</label>
+                       <label index="status_enabled">Enabled</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file
diff --git a/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_installtoolstatus.php b/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_installtoolstatus.php
new file mode 100644 (file)
index 0000000..cf7d311
--- /dev/null
@@ -0,0 +1,167 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+/**
+ * Performs some checks about the install tool protection status
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage reports
+ */
+class tx_reports_reports_status_InstallToolStatus implements tx_reports_StatusProvider {
+
+       /**
+        * Determines the Install Tool's status, mainly concerning its protection.
+        *
+        * @see typo3/sysext/reports/interfaces/tx_reports_StatusProvider::getStatus()
+        */
+       public function getStatus() {
+               $this->executeAdminCommand();
+
+               return array(
+                       'installToolEnabled'  => $this->getInstallToolProtectionStatus(),
+                       'installToolPassword' => $this->getInstallToolPasswordStatus(),
+                       'adminUserAccount'    => $this->getAdminAccountStatus()
+               );
+       }
+
+       /**
+        * Executes commands like removing the Install Tool enable file.
+        *
+        * @return      void
+        */
+       protected function executeAdminCommand() {
+               $command = t3lib_div::_GET('adminCmd');
+
+               switch($command) {
+                       case 'remove_ENABLE_INSTALL_TOOL':
+                               unlink(PATH_site . 'typo3conf/ENABLE_INSTALL_TOOL');
+                       break;
+               }
+       }
+
+       /**
+        * Checks whether the Install Tool password is set to its default value.
+        *
+        * @return      tx_reports_reports_status_Status        An tx_reports_reports_status_Status object representing the security of the install tool password
+        */
+       protected function getInstallToolPasswordStatus() {
+               $value    = $GLOBALS['LANG']->getLL('status_ok');
+               $message  = '';
+               $severity = tx_reports_reports_status_Status::OK;
+
+               if ($GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'] == md5('joh316')) {
+                       $value    = $GLOBALS['LANG']->getLL('status_insecure');
+                       $severity = tx_reports_reports_status_Status::ERROR;
+
+                       $changeInstallToolPasswordUrl = 'install/index.php?redirect_url=index.php'
+                               . urlencode('?TYPO3_INSTALL[type]=about');
+
+                       $message = sprintf(
+                               $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.install_password'),
+                               '<a href="' . $changeInstallToolPasswordUrl . '">',
+                               '</a>'
+                       );
+               }
+
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       'Install Tool Password', $value, $message, $severity
+               );
+       }
+
+       /**
+        * Checks whether a an BE user account named admin with default password exists.
+        *
+        * @return      tx_reports_reports_status_Status        An tx_reports_reports_status_Status object representing whether a default admin account exists
+        */
+       protected function getAdminAccountStatus() {
+               $value    = $GLOBALS['LANG']->getLL('status_ok');
+               $message  = '';
+               $severity = tx_reports_reports_status_Status::OK;
+
+               $whereClause = 'username = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('admin', 'be_users')
+                       . ' AND password = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('5f4dcc3b5aa765d61d8327deb882cf99', 'be_users')
+                       . t3lib_BEfunc::deleteClause('be_users');
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                       'uid, username, password',
+                       'be_users',
+                       $whereClause
+               );
+               if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                       $value    = $GLOBALS['LANG']->getLL('status_insecure');
+                       $severity = tx_reports_reports_status_Status::ERROR;
+
+                       $editUserAccountUrl = 'alt_doc.php?returnUrl=index.php&edit[be_users][' . $row['uid'] . ']=edit';
+                       $message = sprintf(
+                               $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.backend_admin'),
+                               '<a href="' . $editUserAccountUrl . '">',
+                               '</a>'
+                       );
+               }
+               $GLOBALS['TYPO3_DB']->sql_free_result($res);
+
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       'Admin User Account', $value, $message, $severity
+               );
+       }
+
+       /**
+        * Checks for the existance of the ENABLE_INSTALL_TOOL file.
+        *
+        * @return      tx_reports_reports_status_Status        An tx_reports_reports_status_Status object representing whether ENABLE_INSTALL_TOOL exists
+        */
+       protected function getInstallToolProtectionStatus() {
+               $enableInstallToolFile = PATH_site . 'typo3conf/ENABLE_INSTALL_TOOL';
+               $value    = $GLOBALS['LANG']->getLL('status_disabled');
+               $message  = '';
+               $severity = tx_reports_reports_status_Status::OK;
+
+               if (@is_file($enableInstallToolFile)) {
+                       $value    = $GLOBALS['LANG']->getLL('status_enabled');
+                       $severity = tx_reports_reports_status_Status::WARNING;
+
+                       $disableInstallToolUrl = t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')
+                               . '&adminCmd=remove_ENABLE_INSTALL_TOOL';
+
+                       $message = sprintf(
+                               $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.install_enabled'),
+                               '<span style="white-space: nowrap;">' . $enableInstallToolFile . '</span>');
+                       $message .= ' <a href="' . $disableInstallToolUrl . '">'
+                               . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.install_enabled_cmd')
+                               . '</a>';
+               }
+
+               return t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       'Install Tool', $value, $message, $severity
+               );
+       }
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/reports/status/class.tx_reports_reports_status_installtoolstatus.php'])       {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/reports/status/class.tx_reports_reports_status_installtoolstatus.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_status.php b/typo3/sysext/reports/reports/status/class.tx_reports_reports_status_status.php
new file mode 100644 (file)
index 0000000..b07e059
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+/**
+ * A class representing a certain status
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage reports
+ */
+class tx_reports_reports_status_Status {
+
+       const NOTICE  = -2;
+       const INFO    = -1;
+       const OK      = 0;
+       const WARNING = 1;
+       const ERROR   = 2;
+
+       protected $title;
+       protected $value;
+       protected $message;
+       protected $severity;
+
+       /**
+        * constructor for class tx_reports_report_status_Status
+        *
+        * @param       string  the status' title
+        * @param       string  the status' value
+        * @param       string  an optional message further describing the status
+        * @param       integer a severity level, one of
+        */
+       public function __construct($title, $value, $message = '', $severity = self::OK) {
+               $this->title    = (string) $title;
+               $this->value    = (string) $value;
+               $this->message  = (string) $message;
+
+               $this->severity = t3lib_div::intInRange(
+                       $severity,
+                       self::NOTICE, self::ERROR, self::OK
+               );
+       }
+
+       /**
+        * gets the status' title
+        *
+        * @return      string
+        */
+       public function getTitle() {
+               return $this->title;
+       }
+
+       /**
+        * gets the status' value
+        *
+        * @return      string
+        */
+       public function getValue() {
+               return $this->value;
+       }
+
+       /**
+        * gets the status' message (if any)
+        *
+        * @return      string
+        */
+       public function getMessage() {
+               return $this->message;
+       }
+
+       /**
+        * gets the status' severity
+        *
+        * @return      integer
+        */
+       public function getSeverity() {
+               return $this->severity;
+       }
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/reports/status/class.tx_reports_reports_status_status.php'])  {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/reports/status/class.tx_reports_reports_status_status.php']);
+}
+
+?>
\ No newline at end of file