Project

General

Profile

Bug #22410 » 14050_cleaning_t3lib_superadmin.patch

Administrator Admin, 2010-11-24 16:30

View differences:

t3lib/class.t3lib_superadmin.php (revision )
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2010 Kasper Sk?rh?j (kasperYYYY@typo3.com)
* 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!
***************************************************************/
* Copyright notice
*
* (c) 1999-2010 Kasper Sk?rh?j (kasperYYYY@typo3.com)
* 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!
***************************************************************/
/**
* Super Admin class has functions for the administration of multiple TYPO3 sites in folders
* See 'misc/superadmin.php' for details on how to use!
......
*
* 134: class t3lib_superadmin
*
* SECTION: Initialize stuff
* SECTION: Initialize stuff
* 180: function t3lib_superadmin()
* 180: function t3lib_superadmin()
* 192: function init($parentDirs)
* 192: function init($parentDirs)
*
* SECTION: Main functions
* SECTION: Main functions
* 215: function defaultSet()
* 215: function defaultSet()
* 271: function make()
* 271: function make()
*
* SECTION: Output preparation
* SECTION: Output preparation
* 376: function setMenuItem($code,$label)
* 376: function setMenuItem($code,$label)
* 390: function error($str)
* 390: function error($str)
* 401: function headerParentDir($str)
* 401: function headerParentDir($str)
* 412: function headerSiteDir($str)
* 412: function headerSiteDir($str)
*
* SECTION: Collection information
* SECTION: Collection information
* 444: function initProcess()
* 444: function initProcess()
* 482: function processSiteDir($path,$dir)
* 482: function processSiteDir($path,$dir)
* 524: function includeLocalconf($localconf)
* 524: function includeLocalconf($localconf)
* 554: function connectToDatabase($siteInfo)
* 554: function connectToDatabase($siteInfo)
* 576: function getDBInfo($key)
* 576: function getDBInfo($key)
*
* SECTION: Content: Installation Overview
* SECTION: Content: Installation Overview
* 626: function makeTable()
* 626: function makeTable()
*
* SECTION: Content: Local extensions
* SECTION: Content: Local extensions
* 729: function localExtensions()
* 729: function localExtensions()
* 902: function getExtensionInfo($path,$extKey,$k)
* 902: function getExtensionInfo($path,$extKey,$k)
* 956: function getAllFilesAndFoldersInPath($fileArr,$extPath,$extList='',$regDirs=0)
* 956: function getAllFilesAndFoldersInPath($fileArr,$extPath,$extList='',$regDirs=0)
* 978: function findMostRecent($fileArr,$extPath)
* 978: function findMostRecent($fileArr,$extPath)
* 996: function removePrefixPathFromList($fileArr,$extPath)
* 996: function removePrefixPathFromList($fileArr,$extPath)
*
* SECTION: Content: Other
* SECTION: Content: Other
* 1033: function singleSite($exp)
* 1033: function singleSite($exp)
* 1064: function loginLog($DB)
* 1064: function loginLog($DB)
* 1102: function log_getDetails($text,$data)
* 1102: function log_getDetails($text,$data)
* 1116: function rmCachedFiles($exp)
* 1116: function rmCachedFiles($exp)
* 1149: function menuContent($exp)
* 1149: function menuContent($exp)
* 1221: function makeAdminLogin()
* 1221: function makeAdminLogin()
* 1295: function changeAdminPasswordsForm()
* 1295: function changeAdminPasswordsForm()
* 1330: function setNewPasswords()
* 1330: function setNewPasswords()
*
* TOTAL FUNCTIONS: 28
* (This index is automatically created/updated by the extension "extdeveval")
......
*/
// *******************************
// Set error reporting
// *******************************
// *******************************
// Set error reporting
// *******************************
if (defined('E_DEPRECATED')) {
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
} else {
error_reporting(E_ALL ^ E_NOTICE);
}
define('TYPO3_mainDir', 'typo3/'); // This is the directory of the backend administration for the sites of this TYPO3 installation.
define('TYPO3_mainDir', 'typo3/'); // This is the directory of the backend administration for the sites of this TYPO3 installation.
// Dependency:
// Dependency:
$path_t3lib = './typo3_src/t3lib/';
include_once($path_t3lib.'class.t3lib_div.php');
include_once($path_t3lib . 'class.t3lib_div.php');
include_once($path_t3lib.'class.t3lib_db.php');
include_once($path_t3lib . 'class.t3lib_db.php');
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
......
* @param string Header string
* @return void
*/
function debug($p1,$p2='') {
function debug($p1, $p2 = '') {
t3lib_div::debug($p1,$p2);
t3lib_div::debug($p1, $p2);
}
/**
* Super Admin class has functions for the administration of multiple TYPO3 sites in folders
* NOTICE: Only compliant with single MySQL database usage per installation!
......
var $scriptName = 'superadmin.php';
// GP vars:
var $show; // "menu", "all", "admin", "info", "rmTempCached", "localext"
var $show; // "menu", "all", "admin", "info", "rmTempCached", "localext"
var $type; // "phpinfo", "page" - default renders a frameset
var $type; // "phpinfo", "page" - default renders a frameset
var $exp; // Additional parameter, typically a md5-hash pointing to an installation of TYPO3
var $exp; // Additional parameter, typically a md5-hash pointing to an installation of TYPO3
// Internal, static:
var $parentDirs = array(); // Configured directories to search
var $parentDirs = array(); // Configured directories to search
var $globalSiteInfo = array(); // Array with information about found TYPO3 installations
var $globalSiteInfo = array(); // Array with information about found TYPO3 installations
var $currentUrl = '';
var $mapDBtoKey = array();
......
var $collectInstallPasswords = array();
// Control:
var $full = 0; // If set, the full information array per site is printed.
var $full = 0; // If set, the full information array per site is printed.
var $noCVS = 0; // See tools/em/index.php....
var $noCVS = 0; // See tools/em/index.php....
/**********************************
*
* Initialize stuff
......
*
* @return void
*/
function t3lib_superadmin() {
function t3lib_superadmin() {
$this->show = t3lib_div::_GP('show');
$this->type = t3lib_div::_GP('type');
$this->exp = t3lib_div::_GP('exp');
......
* @param array Numerical array with arrays having two keys, 'dir' and 'url' where 'dir' is the absolute path to a directory with TYPO3 installations inside.
* @return void
*/
function init($parentDirs) {
function init($parentDirs) {
$this->parentDirs = $parentDirs;
}
/**************************
*
* Main functions
......
*
* @return void
*/
function defaultSet() {
function defaultSet() {
// Creating content based on "type" variable:
switch($this->type) {
switch ($this->type) {
case 'phpinfo':
phpinfo();
break;
case 'page':
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
.redclass {color: red;}
P {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px}
BODY {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px}
H1 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 20px; color: #000066;}
H2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 17px; color: #000066;}
H3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #000066;}
H4 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: maroon;}
TD {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px}
.redclass {
color: red;
}
P {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px
}
BODY {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px
}
H1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
color: #000066;
}
H2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 17px;
color: #000066;
}
H3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
color: #000066;
}
H4 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: maroon;
}
TD {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px
}
</style>
<title>TYPO3 Super Admin</title>
</head>
<body>
<?php
echo $this->make();
?>
</body>
</html>
<?php
</style>
<title>TYPO3 Super Admin</title>
</head>
<body>
<?php
echo $this->make();
?>
</body>
</html>
<?php
break;
default:
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>TYPO3 Super Admin</title>
</head>
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>TYPO3 Super Admin</title>
</head>
<frameset cols="250,*">
<frameset cols="250,*">
<frame name="TSAmenu" src="superadmin.php?type=page&show=menu" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
<frame name="TSApage" src="superadmin.php?type=page" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
<frame name="TSAmenu" src="superadmin.php?type=page&show=menu" marginwidth="10" marginheight="10"
scrolling="auto" frameborder="0">
<frame name="TSApage" src="superadmin.php?type=page" marginwidth="10" marginheight="10"
scrolling="auto" frameborder="0">
</frameset>
</html>
<?php
</frameset>
</html>
<?php
break;
}
}
......
*
* @return string HTML content.
*/
function make() {
function make() {
$retVal = '';
......
$content = $this->initProcess();
// Output mode:
switch($this->show) {
switch ($this->show) {
case 'menu':
$lines=array();
$lines = array();
$lines[]=$this->setMenuItem('info','INFO');
$lines[] = $this->setMenuItem('info', 'INFO');
$lines[]=$this->setMenuItem('update','UPDATE');
$lines[] = $this->setMenuItem('update', 'UPDATE');
$lines[]='';
$lines[] = '';
$lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page').'" target="TSApage">Default</a>';
$lines[] = '<a href="' . htmlspecialchars($this->scriptName . '?type=page') . '" target="TSApage">Default</a>';
$lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=all').'" target="TSApage">All details</a>';
$lines[] = '<a href="' . htmlspecialchars($this->scriptName . '?type=page&show=all') . '" target="TSApage">All details</a>';
$lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=admin').'" target="TSApage">Admin logins</a>';
$lines[] = '<a href="' . htmlspecialchars($this->scriptName . '?type=page&show=admin') . '" target="TSApage">Admin logins</a>';
$lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=phpinfo').'" target="TSApage">phpinfo()</a>';
$lines[] = '<a href="' . htmlspecialchars($this->scriptName . '?type=phpinfo') . '" target="TSApage">phpinfo()</a>';
$lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=localext').'" target="TSApage">Local extensions</a>';
$lines[] = '<a href="' . htmlspecialchars($this->scriptName . '?type=page&show=localext') . '" target="TSApage">Local extensions</a>';
$lines[]='';
$lines[] = '';
$content = implode('<br />',$lines);
$content = implode('<br />', $lines);
$content.= '<hr />';
$content .= '<hr />';
$content.=$this->menuContent($this->exp);
$content .= $this->menuContent($this->exp);
$retVal = '<h2 align="center">TYPO3<br />Super Admin</h2>'.$content;
$retVal = '<h2 align="center">TYPO3<br />Super Admin</h2>' . $content;
break;
case 'all':
$retVal = '
<h1>All details:</h1>
<h2>Overview:</h2>
'.$this->makeTable().'
' . $this->makeTable() . '
<br /><hr /><br />
<h1>Details per site:</h1>
'.$content;
' . $content;
break;
case 'admin':
$content = $this->setNewPasswords();
$this->makeTable();
$retVal = $content.'
$retVal = $content . '
<h1>Admin options:</h1>
<h2>Admin logins:</h2>
'.$this->makeAdminLogin().'
' . $this->makeAdminLogin() . '
<br /><hr /><br />
<h2>TBE Admin Passwords:</h2>
'.t3lib_div::view_array($this->collectAdminPasswords).'
' . t3lib_div::view_array($this->collectAdminPasswords) . '
<br /><hr /><br />
<h2>Install Tool Passwords:</h2>
'.t3lib_div::view_array($this->collectInstallPasswords).'
' . t3lib_div::view_array($this->collectInstallPasswords) . '
<br /><hr /><br />
<h2>Change TBE Admin Passwords:</h2>
'.$this->changeAdminPasswordsForm().'
' . $this->changeAdminPasswordsForm() . '
<br /><hr /><br />';
break;
case 'info':
$retVal = '
<h1>Single site details</h1>
'.$this->singleSite($this->exp).
' . $this->singleSite($this->exp) .
'<br />';
'<br />';
break;
case 'rmTempCached':
$retVal = '
<h1>Removing temp_CACHED_*.php files</h1>
'.$this->rmCachedFiles($this->exp).
' . $this->rmCachedFiles($this->exp) .
'<br />';
'<br />';
break;
case 'localext':
$retVal = '
<h1>Local Extensions Found:</h1>
'.$this->localExtensions().
' . $this->localExtensions() .
'<br />';
'<br />';
break;
default:
$retVal = '
<h1>Default info:</h1>'.
<h1>Default info:</h1>' .
$content;
$content;
break;
}
return $retVal;
}
/********************************
*
* Output preparation
......
* @param string The label
* @return string Wrapped value
*/
function setMenuItem($code,$label) {
function setMenuItem($code, $label) {
$out = '<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=menu&exp='.$code).'" target="TSAmenu">'.htmlspecialchars($label).'</a>';
$out = '<a href="' . htmlspecialchars($this->scriptName . '?type=page&show=menu&exp=' . $code) . '" target="TSAmenu">' . htmlspecialchars($label) . '</a>';
if ($code==$this->exp) {
if ($code == $this->exp) {
$out = '<span style="color:red;">&gt;&gt;</span>'.$out;
$out = '<span style="color:red;">&gt;&gt;</span>' . $out;
}
return $out;
}
......
* @param string Input string
* @return string Output string
*/
function error($str) {
function error($str) {
$out = '<span style="color:red; font-size: 14px; font-weight: bold;">'.htmlspecialchars($str).'</span>';
$out = '<span style="color:red; font-size: 14px; font-weight: bold;">' . htmlspecialchars($str) . '</span>';
return $out;
}
......
* @param string Input string
* @return string Output string, wrapped in <h2>
*/
function headerParentDir($str) {
function headerParentDir($str) {
$out = '<h2>'.htmlspecialchars($str).'</h2>';
$out = '<h2>' . htmlspecialchars($str) . '</h2>';
return $out;
}
......
* @param string Input string
* @return string Output string, wrapped in <h3>
*/
function headerSiteDir($str) {
function headerSiteDir($str) {
$out = '<h3>'.htmlspecialchars($str).'</h3>';
$out = '<h3>' . htmlspecialchars($str) . '</h3>';
return $out;
}
/********************************
*
* Collection information
......
*
* @return string HTML content (The default view seen when starting the superadmin.php script)
*/
function initProcess() {
function initProcess() {
$content = '';
foreach($this->parentDirs as $k => $v) {
foreach ($this->parentDirs as $k => $v) {
$dir = rtrim($v['dir'], '/');
$baseUrl=rtrim($v['url'], '/');
$baseUrl = rtrim($v['url'], '/');
$content.='<br /><br /><br />';
$content .= '<br /><br /><br />';
$content.=$this->headerParentDir($dir);
$content .= $this->headerParentDir($dir);
if (@is_dir($dir)) {
if (@is_dir($dir)) {
$in_dirs = t3lib_div::get_dirs($dir);
asort($in_dirs);
$dirArr=array();
$dirArr = array();
foreach ($in_dirs as $k => $v) {
if (substr($v,0,9)!='typo3_src') {
if (substr($v, 0, 9) != 'typo3_src') {
$this->currentUrl = $baseUrl.'/'.$v;
$this->currentUrl = $baseUrl . '/' . $v;
$content.= $this->headerSiteDir($v);
$content .= $this->headerSiteDir($v);
$content.= $this->processSiteDir($dir.'/'.$v,$dir);
$content .= $this->processSiteDir($dir . '/' . $v, $dir);
}
}
} else {
$content.=$this->error('"'.$dir.'" was not a directory!');
$content .= $this->error('"' . $dir . '" was not a directory!');
}
}
......
* @access private
* @see initProcess()
*/
function processSiteDir($path,$dir) {
function processSiteDir($path, $dir) {
if (@is_dir($path)) {
if (@is_dir($path)) {
$localconf = $path.'/typo3conf/localconf.php';
$localconf = $path . '/typo3conf/localconf.php';
if (@is_file($localconf)) {
if (@is_file($localconf)) {
$key = md5($localconf);
$this->includeLocalconf($localconf);
$this->mapDBtoKey[$this->globalSiteInfo[$key]['siteInfo']['TYPO3_db']] = $key;
$this->globalSiteInfo[$key]['siteInfo']['MAIN_DIR'] = $dir;
$this->globalSiteInfo[$key]['siteInfo']['SA_PATH'] = $path;
$this->globalSiteInfo[$key]['siteInfo']['URL'] = $this->currentUrl.'/';
$this->globalSiteInfo[$key]['siteInfo']['URL'] = $this->currentUrl . '/';
$this->globalSiteInfo[$key]['siteInfo']['ADMIN_URL'] = $this->currentUrl.'/'.TYPO3_mainDir;
$this->globalSiteInfo[$key]['siteInfo']['ADMIN_URL'] = $this->currentUrl . '/' . TYPO3_mainDir;
$this->globalSiteInfo[$key]['siteInfo']['INSTALL_URL'] = $this->currentUrl.'/'.TYPO3_mainDir.'install/';
$this->globalSiteInfo[$key]['siteInfo']['INSTALL_URL'] = $this->currentUrl . '/' . TYPO3_mainDir . 'install/';
// Connect to database:
$conMsg = $this->connectToDatabase($this->globalSiteInfo[$key]['siteInfo']);
if (!$conMsg) {
if (!$conMsg) {
$this->getDBInfo($key);
$out.='';
$out .= '';
} else {
$out = $conMsg;
}
// Show details:
if ($this->full) {
if ($this->full) {
$out.=t3lib_div::view_array($this->globalSiteInfo[$key]);
$out .= t3lib_div::view_array($this->globalSiteInfo[$key]);
} else {
$out.=t3lib_div::view_array($this->globalSiteInfo[$key]['siteInfo']);
$out .= t3lib_div::view_array($this->globalSiteInfo[$key]['siteInfo']);
}
} else $out = $this->error($localconf.' is not a file!');
} else $out = $this->error($path.' is not a directory!');
} else {
$out = $this->error($localconf . ' is not a file!');
}
} else {
$out = $this->error($path . ' is not a directory!');
}
return $out;
}
......
* @access private
* @see processSiteDir()
*/
function includeLocalconf($localconf) {
function includeLocalconf($localconf) {
$TYPO3_CONF_VARS = array();
$typo_db = '';
$typo_db_username = '';
......
include($localconf);
$siteInfo=array();
$siteInfo = array();
$siteInfo['sitename'] = $TYPO3_CONF_VARS['SYS']['sitename'];
$siteInfo['TYPO3_db'] = $typo_db;
$siteInfo['TYPO3_db_username'] = $typo_db_username;
......
$siteInfo['warningEmailAddress'] = $TYPO3_CONF_VARS['BE']['warning_email_addr'];
$siteInfo['warningMode'] = $TYPO3_CONF_VARS['BE']['warning_mode'];
$this->globalSiteInfo[md5($localconf)] = array('siteInfo'=>$siteInfo,'TYPO3_CONF_VARS'=>$TYPO3_CONF_VARS);
$this->globalSiteInfo[md5($localconf)] = array('siteInfo' => $siteInfo, 'TYPO3_CONF_VARS' => $TYPO3_CONF_VARS);
return $siteInfo;
}
......
* @param array $siteInfo array, containing username/password/host/database values.
* @return string Array message if any
*/
function connectToDatabase($siteInfo) {
function connectToDatabase($siteInfo) {
if (@mysql_pconnect($siteInfo['TYPO3_db_host'], $siteInfo['TYPO3_db_username'], $siteInfo['TYPO3_db_password'])) {
if (@mysql_pconnect($siteInfo['TYPO3_db_host'], $siteInfo['TYPO3_db_username'], $siteInfo['TYPO3_db_password'])) {
if (!$siteInfo['TYPO3_db']) {
if (!$siteInfo['TYPO3_db']) {
return $this->error('No database selected');
} elseif (!mysql_select_db($siteInfo['TYPO3_db'])) {
} elseif (!mysql_select_db($siteInfo['TYPO3_db'])) {
return $this->error('Cannot connect to the current database, "'.$siteInfo['TYPO3_db'].'"');
return $this->error('Cannot connect to the current database, "' . $siteInfo['TYPO3_db'] . '"');
}
} else {
return $this->error('The current username, password or host was not accepted when the connection to the database was attempted to be established!');
......
* @access private
* @see processSiteDir()
*/
function getDBInfo($key) {
function getDBInfo($key) {
$DB = $this->globalSiteInfo[$key]['siteInfo']['TYPO3_db'];
// Non-admin users
......
// Select Admin users
$query = $GLOBALS['TYPO3_DB']->SELECTquery('uid,username,password,email,realName,disable', 'be_users', 'admin!=0 AND deleted=0');
$res = mysql($DB, $query);
while($row = mysql_fetch_assoc($res)) {
while ($row = mysql_fetch_assoc($res)) {
$this->globalSiteInfo[$key]['siteInfo']['ADMINS'][] = $row;
}
}
/******************************
*
* Content: Installation Overview
......
*
* @return string HTML table
*/
function makeTable() {
function makeTable() {
// Header row
$info = array();
......
$info[] = 'W.mode';
$mainArrRows[] = '
<tr bgcolor="#eeeeee">
<td nowrap="nowrap" valign="top">'.implode('</td>
<td nowrap="nowrap" valign="top">' . implode('</td>
<td nowrap="nowrap" valign="top">',$info).'</td>
<td nowrap="nowrap" valign="top">', $info) . '</td>
</tr>';
// Traverse globalSiteInfo for each site:
foreach($this->globalSiteInfo as $k => $all) {
foreach ($this->globalSiteInfo as $k => $all) {
$info = array();
// Sitename and Database details:
$info[] = htmlspecialchars($all['siteInfo']['sitename']);
$info[] = '<span style="color:#666666;">'.htmlspecialchars($all['siteInfo']['MAIN_DIR']).'</span>'.htmlspecialchars(substr($all['siteInfo']['SA_PATH'],strlen($all['siteInfo']['MAIN_DIR'])));
$info[] = '<span style="color:#666666;">' . htmlspecialchars($all['siteInfo']['MAIN_DIR']) . '</span>' . htmlspecialchars(substr($all['siteInfo']['SA_PATH'], strlen($all['siteInfo']['MAIN_DIR'])));
$info[] = htmlspecialchars($all['siteInfo']['TYPO3_db']);
$info[] = htmlspecialchars($all['siteInfo']['TYPO3_db_username']);
$info[] = htmlspecialchars($all['siteInfo']['TYPO3_db_password']);
$info[] = htmlspecialchars($all['siteInfo']['TYPO3_db_host']);
// URL
$info[] = '<a href="'.htmlspecialchars($all['siteInfo']['URL']).'" target="'.$this->targetWindow.'">Site</a>'.
$info[] = '<a href="' . htmlspecialchars($all['siteInfo']['URL']) . '" target="' . $this->targetWindow . '">Site</a>' .
' / <a href="'.htmlspecialchars($all['siteInfo']['ADMIN_URL']).'" target="'.$this->targetWindowAdmin.'">Admin</a>'.
' / <a href="' . htmlspecialchars($all['siteInfo']['ADMIN_URL']) . '" target="' . $this->targetWindowAdmin . '">Admin</a>' .
' / <a href="'.htmlspecialchars($all['siteInfo']['INSTALL_URL']).'" target="'.$this->targetWindowInstall.'">Install</a>';
' / <a href="' . htmlspecialchars($all['siteInfo']['INSTALL_URL']) . '" target="' . $this->targetWindowInstall . '">Install</a>';
$info[] = htmlspecialchars($all['siteInfo']['BE_USERS_NONADMIN'].'/'.$all['siteInfo']['BE_USERS_ADMIN']);
$info[] = htmlspecialchars($all['siteInfo']['BE_USERS_NONADMIN'] . '/' . $all['siteInfo']['BE_USERS_ADMIN']);
// Admin
if (is_array($all['siteInfo']['ADMINS'])) {
if (is_array($all['siteInfo']['ADMINS'])) {
$lines = array();
foreach($all['siteInfo']['ADMINS'] as $vArr) {
foreach ($all['siteInfo']['ADMINS'] as $vArr) {
$lines[] = htmlspecialchars($vArr['password'].' - '.$vArr['username'].' ('.$vArr['realName'].', '.$vArr['email'].')');
$lines[] = htmlspecialchars($vArr['password'] . ' - ' . $vArr['username'] . ' (' . $vArr['realName'] . ', ' . $vArr['email'] . ')');
$this->collectAdminPasswords[$vArr['password']][] = array(
'path' => $all['siteInfo']['SA_PATH'],
'site' => $all['siteInfo']['sitename'],
'database' => $all['siteInfo']['TYPO3_db'],
'user' => $vArr['username'],
'name_email' => $vArr['realName'].', '.$vArr['email']
'name_email' => $vArr['realName'] . ', ' . $vArr['email']
);
$this->changeAdminPasswords[$vArr['password']][] = $all['siteInfo']['TYPO3_db'].':'.$vArr['uid'].':'.$vArr['username'];
$this->changeAdminPasswords[$vArr['password']][] = $all['siteInfo']['TYPO3_db'] . ':' . $vArr['uid'] . ':' . $vArr['username'];
}
$info[] = implode('<br />',$lines);
$info[] = implode('<br />', $lines);
} else {
$info[] = $this->error('No DB connection!');
}
// Install
$info[] = htmlspecialchars($all['siteInfo']['installToolPassword']);
$this->collectInstallPasswords[$all['siteInfo']['installToolPassword']][] = $all['siteInfo']['SA_PATH'].' - '.$all['siteInfo']['sitename'].' - ('.$all['siteInfo']['TYPO3_db'].')';
$this->collectInstallPasswords[$all['siteInfo']['installToolPassword']][] = $all['siteInfo']['SA_PATH'] . ' - ' . $all['siteInfo']['sitename'] . ' - (' . $all['siteInfo']['TYPO3_db'] . ')';
$info[] = htmlspecialchars($all['siteInfo']['warningEmailAddress']);
$info[] = htmlspecialchars($all['siteInfo']['warningMode']);
......
// compile
$mainArrRows[] = '
<tr>
<td nowrap="nowrap" valign="top">'.implode('</td>
<td nowrap="nowrap" valign="top">' . implode('</td>
<td nowrap="nowrap" valign="top">',$info).'</td>
<td nowrap="nowrap" valign="top">', $info) . '</td>
</tr>';
}
// Compile / return table finally:
$table = '<table border="1" cellpadding="1" cellspacing="1">'.implode('',$mainArrRows).'</table>';
$table = '<table border="1" cellpadding="1" cellspacing="1">' . implode('', $mainArrRows) . '</table>';
return $table;
}
/******************************
*
* Content: Local extensions
......
*
* @return string HTML
*/
function localExtensions() {
function localExtensions() {
$this->extensionInfoArray=array();
$this->extensionInfoArray = array();
// Traverse $this->globalSiteInfo for local extensions:
foreach($this->globalSiteInfo as $k => $all) {
foreach ($this->globalSiteInfo as $k => $all) {
if ($all['siteInfo']['SA_PATH']) {
if ($all['siteInfo']['SA_PATH']) {
$extDir = $all['siteInfo']['SA_PATH'].'/typo3conf/ext/';
$extDir = $all['siteInfo']['SA_PATH'] . '/typo3conf/ext/';
if (@is_dir($extDir)) {
if (@is_dir($extDir)) {
$this->extensionInfoArray['site'][$k] = array();
// Get extensions in local directory
$extensions=t3lib_div::get_dirs($extDir);
$extensions = t3lib_div::get_dirs($extDir);
if (is_array($extensions)) {
if (is_array($extensions)) {
foreach($extensions as $extKey) {
foreach ($extensions as $extKey) {
// Getting and setting information for extension:
$eInfo = $this->getExtensionInfo($extDir,$extKey,$k);
$eInfo = $this->getExtensionInfo($extDir, $extKey, $k);
$this->extensionInfoArray['site'][$k][$extKey] = $eInfo;
$this->extensionInfoArray['ext'][$extKey][$k] = $eInfo;
}
......
}
// Display results:
$out='';
$out = '';
$headerRow = '
<tr bgcolor="#ccccee" style="font-weight:bold;">
<td>Extension key</td>
......
';
// PER EXTENSION:
if (is_array($this->extensionInfoArray['ext'])) {
if (is_array($this->extensionInfoArray['ext'])) {
$extensionKeysCollect=array();
$extensionKeysCollect = array();
ksort($this->extensionInfoArray['ext']);
reset($this->extensionInfoArray['ext']);
$rows=array(
$rows = array(
'reg'=>array(),
'reg' => array(),
'user'=>array()
'user' => array()
);
foreach($this->extensionInfoArray['ext'] as $extKey => $instances) {
foreach ($this->extensionInfoArray['ext'] as $extKey => $instances) {
$mtimes = array();
// Find most recent mtime of the options:
......
$c = 0;
// So, traverse all sites with the extension present:
foreach($instances as $k => $eInfo) {
foreach ($instances as $k => $eInfo) {
// Set background color if mtime matches
if ($maxMtime==$eInfo['mtime']) {
if ($maxMtime == $eInfo['mtime']) {
$this->extensionInfoArray['site'][$k][$extKey]['_highlight']=1;
$this->extensionInfoArray['site'][$k][$extKey]['_highlight'] = 1;
$bgCol = $eInfo['dirtype']=='link' ? ' bgcolor="#ffcccc"' : ' bgcolor="#eeeeee"';
$bgCol = $eInfo['dirtype'] == 'link' ? ' bgcolor="#ffcccc"' : ' bgcolor="#eeeeee"';
} else {
$bgCol = ' style="color: #999999; font-style: italic;"';
}
// Make row:
$type = substr($extKey,0,5)!='user_' ? 'reg' : 'user';
$type = substr($extKey, 0, 5) != 'user_' ? 'reg' : 'user';
if ($type=='reg') $extensionKeysCollect[] = $extKey;
if ($type == 'reg') {
$extensionKeysCollect[] = $extKey;
}
if (!is_array($eInfo)) {
if (!is_array($eInfo)) {
// Standard listing:
$rows[$type][] = '
<tr>
'.(!$c?'<td rowspan="'.count($instances).'">'.htmlspecialchars($extKey).'</td>':'').'
' . (!$c ? '<td rowspan="' . count($instances) . '">' . htmlspecialchars($extKey) . '</td>' : '') . '
<td nowrap="nowrap" bgcolor="#ccddcc">'.htmlspecialchars($this->globalSiteInfo[$k]['siteInfo']['SA_PATH']).'</td>
<td nowrap="nowrap" bgcolor="#ccddcc">' . htmlspecialchars($this->globalSiteInfo[$k]['siteInfo']['SA_PATH']) . '</td>
<td nowrap="nowrap" bgcolor="#ccddcc" colspan="8"><em>'.htmlspecialchars($eInfo).'</em></td>
<td nowrap="nowrap" bgcolor="#ccddcc" colspan="8"><em>' . htmlspecialchars($eInfo) . '</em></td>
</tr>
';
} else {
// Standard listing:
$rows[$type][] = '
<tr>
'.(!$c?'<td rowspan="'.count($instances).'">'.htmlspecialchars($extKey).'</td>':'').'
' . (!$c ? '<td rowspan="' . count($instances) . '">' . htmlspecialchars($extKey) . '</td>' : '') . '
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($this->globalSiteInfo[$k]['siteInfo']['SA_PATH']).'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($this->globalSiteInfo[$k]['siteInfo']['SA_PATH']) . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['title']).'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['title']) . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['version']).'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['version']) . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['numberfiles']).'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['numberfiles']) . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['manual']?'M':'-').'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['manual'] ? 'M' : '-') . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['mtime']?date('d-m-y H:i:s',$eInfo['mtime']):'').'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['mtime'] ? date('d-m-y H:i:s', $eInfo['mtime']) : '') . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['mtime_hash']).'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['mtime_hash']) . '</td>
<td'.$bgCol.'>'.htmlspecialchars($eInfo['TYPO3_version']).'</td>
<td' . $bgCol . '>' . htmlspecialchars($eInfo['TYPO3_version']) . '</td>
<td'.$bgCol.'><img src="clear.gif" width="150" height="1" alt="" /><br />'.htmlspecialchars($eInfo['CGLcompliance'].($eInfo['CGLcompliance_note'] ? ' - '.$eInfo['CGLcompliance_note'] : '')).'</td>
<td' . $bgCol . '><img src="clear.gif" width="150" height="1" alt="" /><br />' . htmlspecialchars($eInfo['CGLcompliance'] . ($eInfo['CGLcompliance_note'] ? ' - ' . $eInfo['CGLcompliance_note'] : '')) . '</td>
</tr>
';
}
......
}
// Extensions with registered extension keys:
$out.='
$out .= '
<h3>Registered extensions:</h3>
<table border="1">'.$headerRow.implode('',$rows['reg']).'</table>';
<table border="1">' . $headerRow . implode('', $rows['reg']) . '</table>';
// List of those extension keys in a form field:
$extensionKeysCollect = array_unique($extensionKeysCollect);
asort($extensionKeysCollect);
$out.='<form action=""><textarea cols="80" rows="10">'.implode(LF,$extensionKeysCollect).'</textarea></form>';
$out .= '<form action=""><textarea cols="80" rows="10">' . implode(LF, $extensionKeysCollect) . '</textarea></form>';
// USER extension (prefixed "user_")
$out.='<br />
$out .= '<br />
<h3>User extensions:</h3>
<table border="1">'.$headerRow.implode('',$rows['user']).'</table>';
<table border="1">' . $headerRow . implode('', $rows['user']) . '</table>';
}
// PER SITE:
if (is_array($this->extensionInfoArray['site'])) {
if (is_array($this->extensionInfoArray['site'])) {
$rows = array();
foreach($this->extensionInfoArray['site'] as $k => $extensions) {
foreach ($this->extensionInfoArray['site'] as $k => $extensions) {
// So, traverse all sites with the extension present:
$c = 0;
foreach($extensions as $extKey => $eInfo) {
foreach ($extensions as $extKey => $eInfo) {
// Set background color if mtime matches
if ($eInfo['_highlight']) {
if ($eInfo['_highlight']) {
$bgCol = $eInfo['dirtype']=='link' ? ' bgcolor="#ffcccc"' : ' bgcolor="#eeeeee"';
$bgCol = $eInfo['dirtype'] == 'link' ? ' bgcolor="#ffcccc"' : ' bgcolor="#eeeeee"';
} else {
$bgCol = ' style="color: #999999; font-style: italic;"';
}
......
// Make row:
$rows[] = '
<tr>
'.(!$c?'<td rowspan="'.count($extensions).'">'.htmlspecialchars($this->globalSiteInfo[$k]['siteInfo']['SA_PATH']).'</td>':'').'
' . (!$c ? '<td rowspan="' . count($extensions) . '">' . htmlspecialchars($this->globalSiteInfo[$k]['siteInfo']['SA_PATH']) . '</td>' : '') . '
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($extKey).'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($extKey) . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['title']).'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['title']) . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['version']).'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['version']) . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['numberfiles']).'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['numberfiles']) . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['mtime']?date('d-m-y H:i:s',$eInfo['mtime']):'').'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['mtime'] ? date('d-m-y H:i:s', $eInfo['mtime']) : '') . '</td>
<td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['mtime_hash']).'</td>
<td nowrap="nowrap"' . $bgCol . '>' . htmlspecialchars($eInfo['mtime_hash']) . '</td>
</tr>
';
$c++;
}
}
$out.='<br />
$out .= '<br />
<h3>Sites:</h3>
<table border="1">'.implode('',$rows).'</table>';
<table border="1">' . implode('', $rows) . '</table>';
}
// Return content
......
* @param string Key to globalSiteInformation array
* @return array Information array (unless an error occured)
*/
function getExtensionInfo($path,$extKey,$k) {
function getExtensionInfo($path, $extKey, $k) {
$file = $path.$extKey.'/ext_emconf.php';
$file = $path . $extKey . '/ext_emconf.php';
if (@is_file($file)) {
if (@is_file($file)) {
$_EXTKEY = $extKey;
$EM_CONF = array();
include($file);
......
$eInfo['TYPO3_version'] = $EM_CONF[$extKey]['TYPO3_version'];
$filesHash = unserialize($EM_CONF[$extKey]['_md5_values_when_last_written']);
if (!is_array($filesHash) || count($filesHash)<500) {
if (!is_array($filesHash) || count($filesHash) < 500) {
// Get all files list (may take LOONG time):
$extPath = $path.$extKey.'/';
$extPath = $path . $extKey . '/';
$fileArr = array();
$fileArr = $this->removePrefixPathFromList($this->getAllFilesAndFoldersInPath($fileArr,$extPath),$extPath);
$fileArr = $this->removePrefixPathFromList($this->getAllFilesAndFoldersInPath($fileArr, $extPath), $extPath);
if (!is_array($fileArr)) {
if (!is_array($fileArr)) {
debug(array($fileArr,$extKey,$extPath,$this->getAllFilesAndFoldersInPath(array(),$extPath)),'ERROR');
debug(array($fileArr, $extKey, $extPath, $this->getAllFilesAndFoldersInPath(array(), $extPath)), 'ERROR');
}
// Number of files:
$eInfo['numberfiles'] = count($fileArr);
$eInfo['dirtype'] = filetype($path.$extKey);
$eInfo['dirtype'] = filetype($path . $extKey);
// Most recent modification:
$eInfo['mtime_files'] = $this->findMostRecent($fileArr,$extPath);
$eInfo['mtime_files'] = $this->findMostRecent($fileArr, $extPath);
if (count($eInfo['mtime_files'])) $eInfo['mtime'] = max($eInfo['mtime_files']);
if (count($eInfo['mtime_files'])) {
$eInfo['mtime'] = max($eInfo['mtime_files']);
}
$eInfo['mtime_hash'] = md5(implode(',',$eInfo['mtime_files']));
$eInfo['mtime_hash'] = md5(implode(',', $eInfo['mtime_files']));
} else {
$eInfo['mtime_hash'] = 'No calculation done, too many files in extension: '.count($filesHash);
$eInfo['mtime_hash'] = 'No calculation done, too many files in extension: ' . count($filesHash);
}
$eInfo['manual'] = @is_file($path.$extKey.'/doc/manual.sxw');
$eInfo['manual'] = @is_file($path . $extKey . '/doc/manual.sxw');
return $eInfo;
} else return 'ERROR: No emconf.php file: '.$file;
} else {
return 'ERROR: No emconf.php file: ' . $file;
}
}
}
/**
* Recursively gather all files and folders of extension path.
......
* @param boolean If set, directories are included as well.
* @return array $fileArr with new entries added.
*/
function getAllFilesAndFoldersInPath($fileArr,$extPath,$extList='',$regDirs=0) {
function getAllFilesAndFoldersInPath($fileArr, $extPath, $extList = '', $regDirs = 0) {
if ($regDirs) $fileArr[] = $extPath;
if ($regDirs) {
$fileArr[] = $extPath;
}
$fileArr = array_merge($fileArr,t3lib_div::getFilesInDir($extPath,$extList,1,1));
$fileArr = array_merge($fileArr, t3lib_div::getFilesInDir($extPath, $extList, 1, 1));
$dirs = t3lib_div::get_dirs($extPath);
if (is_array($dirs)) {
if (is_array($dirs)) {
foreach($dirs as $subdirs) {
foreach ($dirs as $subdirs) {
if ($subdirs && (strcmp($subdirs,'CVS') || !$this->noCVS)) {
if ($subdirs && (strcmp($subdirs, 'CVS') || !$this->noCVS)) {
$fileArr = $this->getAllFilesAndFoldersInPath($fileArr,$extPath.$subdirs.'/',$extList,$regDirs);
$fileArr = $this->getAllFilesAndFoldersInPath($fileArr, $extPath . $subdirs . '/', $extList, $regDirs);
}
}
}
......
* @param string Abs path prefix for files.
* @return array Array with modification times of files (filenames are keys)
*/
function findMostRecent($fileArr,$extPath) {
function findMostRecent($fileArr, $extPath) {
$mtimeArray = array();
foreach($fileArr as $fN) {
foreach ($fileArr as $fN) {
if ($fN!='ext_emconf.php') {
if ($fN != 'ext_emconf.php') {
$mtime = filemtime($extPath.$fN);
$mtime = filemtime($extPath . $fN);
$mtimeArray[$fN] = $mtime;
}
}
......
* @param string Prefix to remove
* @return array Modified file array (or error string)
*/
function removePrefixPathFromList($fileArr,$extPath) {
function removePrefixPathFromList($fileArr, $extPath) {
foreach ($fileArr as $k => $absFileRef) {
if(t3lib_div::isFirstPartOfStr($absFileRef,$extPath)) {
if (t3lib_div::isFirstPartOfStr($absFileRef, $extPath)) {
$fileArr[$k]=substr($absFileRef,strlen($extPath));
$fileArr[$k] = substr($absFileRef, strlen($extPath));
} else return 'ERROR: One or more of the files was NOT prefixed with the prefix-path!';
} else {
return 'ERROR: One or more of the files was NOT prefixed with the prefix-path!';
}
}
}
return $fileArr;
}
/******************************
*
* Content: Other
......
* @param string KEY pointing to installation
* @return string HTML content
*/
function singleSite($exp) {
function singleSite($exp) {
$all = $this->globalSiteInfo[$exp];
// General information:
$content = '
<h2>'.htmlspecialchars($all['siteInfo']['sitename'].' (DB: '.$all['siteInfo']['TYPO3_db']).')</h2>
<h2>' . htmlspecialchars($all['siteInfo']['sitename'] . ' (DB: ' . $all['siteInfo']['TYPO3_db']) . ')</h2>
<hr />
<h3>Main details:</h3>
LINKS: <a href="'.htmlspecialchars($all['siteInfo']['URL']).'" target="'.$this->targetWindow.'">Site</a> / <a href="'.htmlspecialchars($all['siteInfo']['ADMIN_URL']).'" target="'.$this->targetWindowAdmin.'">Admin</a> / <a href="'.htmlspecialchars($all['siteInfo']['INSTALL_URL']).'" target="'.$this->targetWindowInstall.'">Install</a>
LINKS: <a href="' . htmlspecialchars($all['siteInfo']['URL']) . '" target="' . $this->targetWindow . '">Site</a> / <a href="' . htmlspecialchars($all['siteInfo']['ADMIN_URL']) . '" target="' . $this->targetWindowAdmin . '">Admin</a> / <a href="' . htmlspecialchars($all['siteInfo']['INSTALL_URL']) . '" target="' . $this->targetWindowInstall . '">Install</a>
<br /><br />';
// Add all information in globalSiteInfo array:
$content.= t3lib_div::view_array($all);
$content .= t3lib_div::view_array($all);
// Last-login:
$content.= '
$content .= '
<h3>Login-Log for last month:</h3>';
$content.= $this->loginLog($all['siteInfo']['TYPO3_db']);
$content .= $this->loginLog($all['siteInfo']['TYPO3_db']);
// Return content
return $content;
......
* @param string Database
* @return string HTML
*/
function loginLog($DB) {
function loginLog($DB) {
// Non-admin users
//1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent
$query = $GLOBALS['TYPO3_DB']->SELECTquery(
'sys_log.*, be_users.username AS username, be_users.admin AS admin',
'sys_log,be_users',
'be_users.uid=sys_log.userid AND sys_log.type=255 AND sys_log.tstamp > ' . ($GLOBALS['EXEC_TIME'] - (60 * 60 * 24 * 30)),
'',
'sys_log.tstamp DESC'
);
'sys_log.*, be_users.username AS username, be_users.admin AS admin',
'sys_log,be_users',
'be_users.uid=sys_log.userid AND sys_log.type=255 AND sys_log.tstamp > ' . ($GLOBALS['EXEC_TIME'] - (60 * 60 * 24 * 30)),
'',
'sys_log.tstamp DESC'
);
$res = mysql($DB,$query);
$res = mysql($DB, $query);
$dayRef = '';
$lines = array();
while($row = mysql_fetch_assoc($res)) {
while ($row = mysql_fetch_assoc($res)) {
$day = date('d-m-Y',$row['tstamp']);
$day = date('d-m-Y', $row['tstamp']);
if ($dayRef!=$day) {
if ($dayRef != $day) {
$lines[] = '
<h4>'.$day.':</h4>';
<h4>' . $day . ':</h4>';
$dayRef=$day;
$dayRef = $day;
}
$theLine = date('H:i',$row['tstamp']).': '.str_pad(substr($row['username'],0,10),10).' '.$this->log_getDetails($row['details'],unserialize($row['log_data']));
$theLine = date('H:i', $row['tstamp']) . ': ' . str_pad(substr($row['username'], 0, 10), 10) . ' ' . $this->log_getDetails($row['details'], unserialize($row['log_data']));
$theLine = htmlspecialchars($theLine);
$lines[]= $row['admin'] ? '<span class="redclass">'.$theLine.'</span>' : $theLine;
$lines[] = $row['admin'] ? '<span class="redclass">' . $theLine . '</span>' : $theLine;
// debug($row);
}
return '<pre>'.implode(LF,$lines).'</pre>';
return '<pre>' . implode(LF, $lines) . '</pre>';
}
/**
......
* @param array Data array to insert in log message
* @return string Log details.
*/
function log_getDetails($text,$data) {
function log_getDetails($text, $data) {
// $code is used later on to substitute errormessages with language-corrected values...
if (is_array($data)) {
if (is_array($data)) {
return sprintf($text, $data[0],$data[1],$data[2],$data[3],$data[4]);
return sprintf($text, $data[0], $data[1], $data[2], $data[3], $data[4]);
} else return $text;
} else {
return $text;
}
}
}
/**
......
* @param string KEY pointing to installation
* @return string HTML content
*/
function rmCachedFiles($exp) {
function rmCachedFiles($exp) {
$all = $this->globalSiteInfo[$exp];
$content = '
<h2>'.htmlspecialchars($all['siteInfo']['sitename'].' (DB: '.$all['siteInfo']['TYPO3_db']).')</h2>
<h2>' . htmlspecialchars($all['siteInfo']['sitename'] . ' (DB: ' . $all['siteInfo']['TYPO3_db']) . ')</h2>
<hr />
<h3>typo3conf/temp_CACHED_* files:</h3>';
$path = $all['siteInfo']['SA_PATH'].'/typo3conf/';
$path = $all['siteInfo']['SA_PATH'] . '/typo3conf/';
if (@is_dir($path)) {
if (@is_dir($path)) {
$filesInDir = t3lib_div::getFilesInDir($path,'php',1);
$filesInDir = t3lib_div::getFilesInDir($path, 'php', 1);
foreach($filesInDir as $kk => $vv) {
foreach ($filesInDir as $kk => $vv) {
if (t3lib_div::isFirstPartOfStr(basename($vv),'temp_CACHED_')) {
if (t3lib_div::isFirstPartOfStr(basename($vv), 'temp_CACHED_')) {
if (strstr(basename($vv),'ext_localconf.php') || strstr(basename($vv),'ext_tables.php')) {
if (strstr(basename($vv), 'ext_localconf.php') || strstr(basename($vv), 'ext_tables.php')) {
$content.='REMOVED: '.$vv.'<br />';
$content .= 'REMOVED: ' . $vv . '<br />';
unlink($vv);
if (file_exists($vv)) $content.= $this->error('ERROR: File still exists, so could not be removed anyways!').'<br />';
if (file_exists($vv)) {
$content .= $this->error('ERROR: File still exists, so could not be removed anyways!') . '<br />';
}
}
}
}
}
}
}
} else {
$content.= $this->error('ERROR: '.$path.' was not a directory!');
$content .= $this->error('ERROR: ' . $path . ' was not a directory!');
}
return $content;
......
* @param string Action key "update" or "info"
* @return string HTML output.
*/
function menuContent($exp) {
function menuContent($exp) {
if ($exp) {
if ($exp) {
// Initialize:
$lines = array();
$head = '';
foreach($this->globalSiteInfo as $k => $all) {
foreach ($this->globalSiteInfo as $k => $all) {
// Setting section header, if needed.
if ($head!=$all['siteInfo']['MAIN_DIR']) {
if ($head != $all['siteInfo']['MAIN_DIR']) {
$lines[] = '
<h4 style="white-space: nowrap;">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($all['siteInfo']['MAIN_DIR'],-18)).'</h4>';
<h4 style="white-space: nowrap;">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($all['siteInfo']['MAIN_DIR'], -18)) . '</h4>';
$head = $all['siteInfo']['MAIN_DIR']; // Set new head...
$head = $all['siteInfo']['MAIN_DIR']; // Set new head...
}
// Display mode:
switch($exp) {
switch ($exp) {
case 'update':
// Label:
$label = $all['siteInfo']['sitename'] ? $all['siteInfo']['sitename'] : '(DB: '.$all['siteInfo']['TYPO3_db'].')';
$label = $all['siteInfo']['sitename'] ? $all['siteInfo']['sitename'] : '(DB: ' . $all['siteInfo']['TYPO3_db'] . ')';
$lines[] = '
<hr />
<strong>'.htmlspecialchars($label).'</strong> ('.htmlspecialchars(substr($all['siteInfo']['SA_PATH'],strlen($all['siteInfo']['MAIN_DIR'])+1)).')<br />';
<strong>' . htmlspecialchars($label) . '</strong> (' . htmlspecialchars(substr($all['siteInfo']['SA_PATH'], strlen($all['siteInfo']['MAIN_DIR']) + 1)) . ')<br />';
// To avoid "visited links" display on next hit:
// To avoid "visited links" display on next hit:
$tempVal='&_someUniqueValue=' . $GLOBALS['EXEC_TIME'];
$tempVal = '&_someUniqueValue=' . $GLOBALS['EXEC_TIME'];
// Add links for update:
// Add links for update:
$url = $this->scriptName.'?type=page&show=rmTempCached&exp='.$k.$tempVal;
$url = $this->scriptName . '?type=page&show=rmTempCached&exp=' . $k . $tempVal;
$lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="TSApage">Remove temp_CACHED files</a></span>';
$lines[] = '<span style="white-space: nowrap;"><a href="' . htmlspecialchars($url) . '" target="TSApage">Remove temp_CACHED files</a></span>';
$url = $all['siteInfo']['INSTALL_URL'].'index.php?TYPO3_INSTALL[type]=database&TYPO3_INSTALL[database_type]=import|CURRENT_STATIC'."&presetWholeTable=1".$tempVal.'#bottom';
$url = $all['siteInfo']['INSTALL_URL'] . 'index.php?TYPO3_INSTALL[type]=database&TYPO3_INSTALL[database_type]=import|CURRENT_STATIC' . "&presetWholeTable=1" . $tempVal . '#bottom';
$lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="TSApage">CURRENT_STATIC</a></span>';
$lines[] = '<span style="white-space: nowrap;"><a href="' . htmlspecialchars($url) . '" target="TSApage">CURRENT_STATIC</a></span>';
$url = $all['siteInfo']['INSTALL_URL'].'index.php?TYPO3_INSTALL[type]=database&TYPO3_INSTALL[database_type]=cmpFile|CURRENT_TABLES'.$tempVal.'#bottom';
$url = $all['siteInfo']['INSTALL_URL'] . 'index.php?TYPO3_INSTALL[type]=database&TYPO3_INSTALL[database_type]=cmpFile|CURRENT_TABLES' . $tempVal . '#bottom';
$lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="TSApage">CURRENT_TABLES</a></span>';
$lines[] = '<span style="white-space: nowrap;"><a href="' . htmlspecialchars($url) . '" target="TSApage">CURRENT_TABLES</a></span>';
// Cache
// Cache
$url = $all['siteInfo']['INSTALL_URL'].'index.php?TYPO3_INSTALL[type]=database&TYPO3_INSTALL[database_type]=cache|'.
$url = $all['siteInfo']['INSTALL_URL'] . 'index.php?TYPO3_INSTALL[type]=database&TYPO3_INSTALL[database_type]=cache|' .
"&PRESET[database_clearcache][cache_pages]=1".
"&PRESET[database_clearcache][cache_pages]=1" .
'&PRESET[database_clearcache][cache_pagesection]=1'.
'&PRESET[database_clearcache][cache_pagesection]=1' .
"&PRESET[database_clearcache][cache_hash]=1".
"&PRESET[database_clearcache][cache_hash]=1" .
$tempVal.
$tempVal .
'#bottom';
'#bottom';
$lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="TSApage">Clear cache</a></span>';
$lines[] = '<span style="white-space: nowrap;"><a href="' . htmlspecialchars($url) . '" target="TSApage">Clear cache</a></span>';
// Admin link
// Admin link
$url = $all['siteInfo']['ADMIN_URL'].'index.php';
$url = $all['siteInfo']['ADMIN_URL'] . 'index.php';
$lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="'.$this->targetWindowAdmin.'">Admin -></a></span>';
$lines[] = '<span style="white-space: nowrap;"><a href="' . htmlspecialchars($url) . '" target="' . $this->targetWindowAdmin . '">Admin -></a></span>';
break;
case 'info':
// item
$label = $all['siteInfo']['sitename'] ? $all['siteInfo']['sitename'] : '(DB: '.$all['siteInfo']['TYPO3_db'].')';
$label = $all['siteInfo']['sitename'] ? $all['siteInfo']['sitename'] : '(DB: ' . $all['siteInfo']['TYPO3_db'] . ')';
$url = $this->scriptName.'?type=page&show=info&exp='.$k;
$url = $this->scriptName . '?type=page&show=info&exp=' . $k;
$lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="TSApage">'.htmlspecialchars($label).'</a> ('.htmlspecialchars(substr($all['siteInfo']['SA_PATH'],strlen($all['siteInfo']['MAIN_DIR'])+1)).'/)</span>';
$lines[] = '<span style="white-space: nowrap;"><a href="' . htmlspecialchars($url) . '" target="TSApage">' . htmlspecialchars($label) . '</a> (' . htmlspecialchars(substr($all['siteInfo']['SA_PATH'], strlen($all['siteInfo']['MAIN_DIR']) + 1)) . '/)</span>';
break;
}
}
// Return result.
return implode('<br />',$lines).'<br />';
return implode('<br />', $lines) . '<br />';
}
}
......
*
* @return string HTML table
*/
function makeAdminLogin() {
function makeAdminLogin() {
// Initialize:
$lines = array();
$head = '';
// Traverse installations found:
foreach($this->globalSiteInfo as $k => $all) {
foreach ($this->globalSiteInfo as $k => $all) {
// Setting section header, if needed.
if ($head!=$all['siteInfo']['MAIN_DIR']) {
if ($head != $all['siteInfo']['MAIN_DIR']) {
$lines[] = '
<tr>
<td colspan="2"><br />
<h4>'.htmlspecialchars($all['siteInfo']['MAIN_DIR']).'</h4>
<h4>' . htmlspecialchars($all['siteInfo']['MAIN_DIR']) . '</h4>
</td>
</tr>';
$head = $all['siteInfo']['MAIN_DIR'];
... This diff was truncated because it exceeds the maximum size that can be displayed.
(57-57/93)