Project

General

Profile

Bug #20970 » 11843.diff

Administrator Admin, 2009-09-16 19:07

View differences:

typo3/sysext/reports/ChangeLog (revision 0)
2009-03-24 Ingo Renner <ingo@typo3.org>
* initial code generated with kickstarter
typo3/sysext/reports/ext_autoload.php (revision 0)
<?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_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',
);
?>
typo3/sysext/reports/ext_emconf.php (revision 0)
<?php
########################################################################
# Extension Manager/Repository config file for ext: "reports"
#
# Auto generated 24-03-2009 16:34
#
# 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' => '',
'state' => 'beta',
'internal' => '',
'uploadfolder' => 0,
'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'lockType' => '',
'author_company' => '',
'version' => '1.0.0',
'constraints' => array(
'depends' => array(
),
'conflicts' => array(
),
'suggests' => array(
),
),
'_md5_values_when_last_written' => 'a:11:{s:9:"ChangeLog";s:4:"e186";s:12:"ext_icon.gif";s:4:"1bdc";s:14:"ext_tables.php";s:4:"2d62";s:19:"doc/wizard_form.dat";s:4:"23eb";s:20:"doc/wizard_form.html";s:4:"efc8";s:13:"mod1/conf.php";s:4:"fcbe";s:14:"mod1/index.php";s:4:"f03e";s:18:"mod1/locallang.xml";s:4:"7e6e";s:22:"mod1/locallang_mod.xml";s:4:"1210";s:22:"mod1/mod_template.html";s:4:"7c59";s:19:"mod1/moduleicon.gif";s:4:"8074";}',
);
?>
typo3/sysext/reports/ext_tables.php (revision 0)
<?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' => 'Status Report',
'description' => 'Get a status report about your site\'s operation and any detected problems.',
'report' => 'EXT:reports/reports/class.tx_reports_reports_status.php:tx_reports_reports_Status->getStatusReport'
);
$GLOBALS['TYPO3_REPORTS']['tx_reports']['status'] = array_merge(
$GLOBALS['TYPO3_REPORTS']['tx_reports']['status'],
$statusReport
);
$GLOBALS['TYPO3_REPORTS']['tx_reports']['status']['_installtool'] = 'tx_reports_reports_status_InstallToolStatus';
}
?>
typo3/sysext/reports/interfaces/interface.tx_reports_statusprovider.php (revision 0)
<?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();
}
?>
typo3/sysext/reports/mod/conf.php (revision 0)
<?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';
?>
typo3/sysext/reports/mod/index.php (revision 0)
<?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');
require_once(PATH_t3lib . 'class.t3lib_scbase.php');
// 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() {
global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
parent::init();
// initialize document
$this->doc = t3lib_div::makeInstance('template');
$this->doc->setModuleTemplate(
t3lib_extMgm::extPath('reports') . 'mod/mod_template.html'
);
$this->doc->backPath = $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() {
$this->MOD_MENU = array('function' => array('index' => 'Overview'));
foreach ($GLOBALS['TYPO3_REPORTS'] as $extKey => $reports) {
foreach ($reports as $reportName => $report) {
$this->MOD_MENU['function'][$extKey . '.' . $reportName] = $report['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() {
global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
// Access check
$this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
$access = is_array($this->pageinfo) ? 1 : 0;
$docHeaderButtons = $this->getButtons();
if (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id)) {
// 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'] = 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($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 = '';
if ($action == 'index') {
$content = $this->indexAction();
$title = 'Overview';
} else {
list($extKey, $reportName) = explode('.', $action, 2);
$report = $GLOBALS['TYPO3_REPORTS'][$extKey][$reportName]['report'];
$title = $GLOBALS['TYPO3_REPORTS'][$extKey][$reportName]['title'];
$parameters = array();
$content = t3lib_div::callUserFunction($report, $parameters, $this);
}
$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_REPORTS'] as $extKey => $extensionReports) {
foreach ($extensionReports as $reportName => $report) {
$action = $extKey . '.' . $reportName;
$link = 'mod.php?M=tools_txreportsM1&SET[function]=' . $action;
$content .= '<dt><a href="' . $link . '">' . $report['title']. '</a></dt>';
$content .= '<dd>' . $report['description'] . '</dd>';
}
}
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();
?>
typo3/sysext/reports/mod/locallang.xml (revision 0)
<?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>
</languageKey>
</data>
</T3locallang>
typo3/sysext/reports/mod/mod_styles.css (revision 0)
body#ext-reports-mod-index-php {
margin: 0px;
}
#typo3-inner-docbody p.help {
font-size: 12px;
}
/* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */
/* overview */
.report-list dt {
font-weight: bold;
}
.report-list dd {
margin: 0px 0px 5px 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;
}
typo3/sysext/reports/mod/mod_template.html (revision 0)
<!-- ###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">Report: ###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### -->
typo3/sysext/reports/reports/class.tx_reports_reports_status.php (revision 0)
<?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('reports', 'interfaces/interface.tx_reports_statusprovider.php'));
require_once(t3lib_extMgm::extPath('reports', 'reports/status/class.tx_reports_reports_status_status.php'));
/**
* The status report
*
* @author Ingo Renner <ingo@typo3.org>
* @package TYPO3
* @subpackage reports
*/
class tx_reports_reports_Status {
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 getStatusReport() {
$status = array();
$content = '';
foreach ($this->statusProviders as $key => $statusProvider) {
$status += $statusProvider->getStatus();
}
$content .= '<p class="help">'
. $GLOBALS['LANG']->getLL('status_report_explaination')
. '</p>';
return $content . $this->renderStatus($status);
}
/**
* Gets all registered status providers and creates instances of them.
*
* @return void
*/
protected function getStatusProviders() {
ksort($GLOBALS['TYPO3_REPORTS']['tx_reports']['status']);
foreach ($GLOBALS['TYPO3_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 $key => $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/report/class.tx_reports_reports_status.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/report/class.tx_reports_reports_status.php']);
}
?>
typo3/sysext/reports/reports/locallang.xml (revision 0)
<?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_explaination">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>
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_installtoolstatus.php (revision 0)
<?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
*
* @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']);
}
?>
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_status.php (revision 0)
<?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_report_status_status.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/reports/reports/status/class.tx_reports_report_status_status.php']);
}
?>
typo3/sysext/install/ext_autoload.php (revision 0)
<?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'),
);
?>
typo3/sysext/install/requirements.php (revision 0)
<?php
// $id$
define('TYPO3_MINIMUM_PHP', '5.2.0');
define('TYPO3_MINIMUM_PHP_MEMORY_LIMIT', '32M');
define('TYPO3_RECOMMENDED_PHP_MEMORY_LIMIT', '64M');
?>
typo3/sysext/install/report/class.tx_install_report_installstatus.php (revision 0)
<?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_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_RECOMMENDED_PHP_MEMORY_LIMIT)) {
$message = 'Depending on your configuration, TYPO3 can run with a ' . $memoryLimit . ' PHP memory limit. However, a ' . TYPO3_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_MINIMUM_PHP_MEMORY_LIMIT)) {
$message = 'Depending on your configuration, TYPO3 can run with a ' . $memoryLimit . ' PHP memory limit. However, a ' . TYPO3_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']);
}
?>
typo3/sysext/install/ext_tables.php (working copy)
if (TYPO3_MODE=='BE') {
t3lib_extMgm::addModule('tools', 'install', '', t3lib_extMgm::extPath($_EXTKEY) . 'mod/');
$GLOBALS['TYPO3_REPORTS']['tx_reports']['status']['_install'] = 'tx_install_report_InstallStatus';
}
?>
(1-1/2)