"TYPO3 4.0.1: typo3_src-4.0.1/t3lib/class.t3lib_superadmin.php Source File", "datetime" => "Sat Dec 2 19:22:19 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>

class.t3lib_superadmin.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00099 // *******************************
00100 // Set error reporting
00101 // *******************************
00102 error_reporting (E_ALL ^ E_NOTICE);
00103 define('TYPO3_mainDir', 'typo3/');              // This is the directory of the backend administration for the sites of this TYPO3 installation.
00104 
00105 
00106 // Dependency:
00107 $path_t3lib = './typo3_src/t3lib/';
00108 include_once($path_t3lib.'class.t3lib_div.php');
00109 include_once($path_t3lib.'class.t3lib_db.php');
00110 $TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
00111 
00112 
00120 function debug($p1,$p2='')      {
00121         t3lib_div::debug($p1,$p2);
00122 }
00123 
00124 
00125 
00134 class t3lib_superadmin {
00135 
00136                 // External, static:
00137         var $targetWindow = 'superAdminWindow';
00138         var $targetWindowAdmin = 'superAdminWindowAdmin';
00139         var $targetWindowInstall = 'superAdminWindowInstall';
00140         var $scriptName = 'superadmin.php';
00141 
00142                 // GP vars:
00143         var $show;                      // "menu", "all", "admin", "info", "rmTempCached", "localext"
00144         var $type;                      // "phpinfo", "page" - default renders a frameset
00145         var $exp;                       // Additional parameter, typically a md5-hash pointing to an installation of TYPO3
00146 
00147                 // Internal, static:
00148         var $parentDirs = array();                      // Configured directories to search
00149         var $globalSiteInfo = array();          // Array with information about found TYPO3 installations
00150 
00151         var $currentUrl = '';
00152         var $mapDBtoKey = array();
00153         var $collectAdminPasswords = array();
00154         var $changeAdminPasswords = array();
00155         var $collectInstallPasswords = array();
00156 
00157                 // Control:
00158         var $full = 0;  // If set, the full information array per site is printed.
00159 
00160         var $noCVS = 0; // See tools/em/index.php....
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 
00169         /**********************************
00170          *
00171          * Initialize stuff
00172          *
00173          **********************************/
00174 
00180         function t3lib_superadmin()     {
00181                 $this->show = t3lib_div::_GP('show');
00182                 $this->type = t3lib_div::_GP('type');
00183                 $this->exp = t3lib_div::_GP('exp');
00184         }
00185 
00192         function init($parentDirs)      {
00193                 $this->parentDirs = $parentDirs;
00194         }
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203         /**************************
00204          *
00205          * Main functions
00206          *
00207          **************************/
00208 
00215         function defaultSet()   {
00216 
00217                         // Creating content based on "type" variable:
00218                 switch($this->type)     {
00219                         case 'phpinfo':
00220                                 phpinfo();
00221                         break;
00222                         case 'page':
00223 ?>
00224 <!DOCTYPE html
00225      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
00226      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
00227 <html>
00228 <head>
00229         <style type="text/css">
00230                 .redclass {color: red;}
00231                 P {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px}
00232                 BODY {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px}
00233                 H1 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 20px; color: #000066;}
00234                 H2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 17px; color: #000066;}
00235                 H3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; color: #000066;}
00236                 H4 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: maroon;}
00237                 TD {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px}
00238         </style>
00239         <title>TYPO3 Super Admin</title>
00240 </head>
00241 <body>
00242 <?php
00243         echo $this->make();
00244 ?>
00245 </body>
00246 </html>
00247 <?php
00248                         break;
00249                         default:
00250 ?>
00251 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
00252 <html>
00253 <head>
00254         <title>TYPO3 Super Admin</title>
00255 </head>
00256 <frameset  cols="250,*">
00257     <frame name="TSAmenu" src="superadmin.php?type=page&show=menu" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
00258     <frame name="TSApage" src="superadmin.php?type=page" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
00259 </frameset>
00260 </html>
00261 <?php
00262                         break;
00263                 }
00264         }
00265 
00271         function make() {
00272 
00273                 $retVal = '';
00274 
00275                         // Creating information about the sites found:
00276                 $content = $this->initProcess();
00277 
00278                         // Output mode:
00279                 switch($this->show)     {
00280                         case 'menu':
00281                                 $lines=array();
00282                                 $lines[]=$this->setMenuItem('info','INFO');
00283                                 $lines[]=$this->setMenuItem('update','UPDATE');
00284                                 $lines[]='';
00285                                 $lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page').'" target="TSApage">Default</a>';
00286                                 $lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=all').'" target="TSApage">All details</a>';
00287                                 $lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=admin').'" target="TSApage">Admin logins</a>';
00288                                 $lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=phpinfo').'" target="TSApage">phpinfo()</a>';
00289                                 $lines[]='<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=localext').'" target="TSApage">Local extensions</a>';
00290                                 $lines[]='';
00291                                 $content = implode('<br />',$lines);
00292                                 $content.= '<hr />';
00293                                 $content.=$this->menuContent($this->exp);
00294                                 $retVal = '<h2 align="center">TYPO3<br />Super Admin</h2>'.$content;
00295                         break;
00296                         case 'all':
00297                                 $retVal = '
00298                                         <h1>All details:</h1>
00299                                         <h2>Overview:</h2>
00300                                         '.$this->makeTable().'
00301                                         <br /><hr /><br />
00302                                         <h1>Details per site:</h1>
00303                                         '.$content;
00304                         break;
00305                         case 'admin':
00306                                 $content = $this->setNewPasswords();
00307                                 $this->makeTable();
00308                                 $retVal = $content.'
00309                                         <h1>Admin options:</h1>
00310 
00311                                         <h2>Admin logins:</h2>
00312                                         '.$this->makeAdminLogin().'
00313                                         <br /><hr /><br />
00314 
00315                                         <h2>TBE Admin Passwords:</h2>
00316                                         '.t3lib_div::view_array($this->collectAdminPasswords).'
00317                                         <br /><hr /><br />
00318 
00319                                         <h2>Install Tool Passwords:</h2>
00320                                         '.t3lib_div::view_array($this->collectInstallPasswords).'
00321                                         <br /><hr /><br />
00322 
00323                                         <h2>Change TBE Admin Passwords:</h2>
00324                                         '.$this->changeAdminPasswordsForm().'
00325                                         <br /><hr /><br />';
00326                         break;
00327                         case 'info':
00328                                 $retVal = '
00329                                         <h1>Single site details</h1>
00330                                         '.$this->singleSite($this->exp).
00331                                         '<br />';
00332                         break;
00333                         case 'rmTempCached':
00334                                 $retVal = '
00335                                         <h1>Removing temp_CACHED_*.php files</h1>
00336                                         '.$this->rmCachedFiles($this->exp).
00337                                         '<br />';
00338                         break;
00339                         case 'localext':
00340                                 $retVal = '
00341                                         <h1>Local Extensions Found:</h1>
00342                                         '.$this->localExtensions().
00343                                         '<br />';
00344                         break;
00345                         default:
00346                                 $retVal = '
00347                                         <h1>Default info:</h1>'.
00348                                         $content;
00349                         break;
00350                 }
00351                 return $retVal;
00352         }
00353 
00354 
00355 
00356 
00357 
00358 
00359 
00360 
00361 
00362 
00363         /********************************
00364          *
00365          * Output preparation
00366          *
00367          *******************************/
00368 
00376         function setMenuItem($code,$label)      {
00377                 $out = '<a href="'.htmlspecialchars($this->scriptName.'?type=page&show=menu&exp='.$code).'" target="TSAmenu">'.htmlspecialchars($label).'</a>';
00378                 if ($code==$this->exp)  {
00379                         $out = '<span style="color:red;">&gt;&gt;</span>'.$out;
00380                 }
00381                 return $out;
00382         }
00383 
00390         function error($str)    {
00391                 $out = '<span style="color:red; font-size: 14px; font-weight: bold;">'.htmlspecialchars($str).'</span>';
00392                 return $out;
00393         }
00394 
00401         function headerParentDir($str)  {
00402                 $out = '<h2>'.htmlspecialchars($str).'</h2>';
00403                 return $out;
00404         }
00405 
00412         function headerSiteDir($str)    {
00413                 $out = '<h3>'.htmlspecialchars($str).'</h3>';
00414                 return $out;
00415         }
00416 
00417 
00418 
00419 
00420 
00421 
00422 
00423 
00424 
00425 
00426 
00427 
00428 
00429 
00430 
00431 
00432 
00433         /********************************
00434          *
00435          * Collection information
00436          *
00437          *******************************/
00438 
00444         function initProcess()  {
00445                 $content = '';
00446 
00447                 foreach($this->parentDirs as $k => $v)  {
00448                         $dir = ereg_replace('/$','',$v['dir']);
00449                         $baseUrl=ereg_replace('/$','',$v['url']);
00450                         $content.='<br /><br /><br />';
00451                         $content.=$this->headerParentDir($dir);
00452                         if (@is_dir($dir))      {
00453                                 $in_dirs = t3lib_div::get_dirs($dir);
00454                                 asort($in_dirs);
00455                                 reset($in_dirs);
00456                                 $dirArr=array();
00457                                 while(list($k,$v)=each($in_dirs))       {
00458                                         if (substr($v,0,9)!='typo3_src')        {
00459                                                 $this->currentUrl = $baseUrl.'/'.$v;
00460                                                 $content.= $this->headerSiteDir($v);
00461                                                 $content.= $this->processSiteDir($dir.'/'.$v,$dir);
00462                                         }
00463                                 }
00464                         } else {
00465                                 $content.=$this->error('"'.$dir.'" was not a directory!');
00466                         }
00467                 }
00468 
00469                 return $content;
00470         }
00471 
00482         function processSiteDir($path,$dir)     {
00483                 if (@is_dir($path))     {
00484                         $localconf = $path.'/typo3conf/localconf.php';
00485                         if (@is_file($localconf))       {
00486                                 $key = md5($localconf);
00487                                 $this->includeLocalconf($localconf);
00488 
00489                                 $this->mapDBtoKey[$this->globalSiteInfo[$key]['siteInfo']['TYPO3_db']] = $key;
00490                                 $this->globalSiteInfo[$key]['siteInfo']['MAIN_DIR'] = $dir;
00491                                 $this->globalSiteInfo[$key]['siteInfo']['SA_PATH'] = $path;
00492                                 $this->globalSiteInfo[$key]['siteInfo']['URL'] = $this->currentUrl.'/';
00493                                 $this->globalSiteInfo[$key]['siteInfo']['ADMIN_URL'] = $this->currentUrl.'/'.TYPO3_mainDir;
00494                                 $this->globalSiteInfo[$key]['siteInfo']['INSTALL_URL'] = $this->currentUrl.'/'.TYPO3_mainDir.'install/';
00495 
00496                                         // Connect to database:
00497                                 $conMsg = $this->connectToDatabase($this->globalSiteInfo[$key]['siteInfo']);
00498                                 if (!$conMsg)   {
00499                                         $this->getDBInfo($key);
00500                                         $out.='';
00501                                 } else {
00502                                         $out = $conMsg;
00503                                 }
00504 
00505                                         // Show details:
00506                                 if ($this->full)        {
00507                                         $out.=t3lib_div::view_array($this->globalSiteInfo[$key]);
00508                                 } else {
00509                                         $out.=t3lib_div::view_array($this->globalSiteInfo[$key]['siteInfo']);
00510                                 }
00511                         } else $out = $this->error($localconf.' is not a file!');
00512                 } else $out = $this->error($path.' is not a directory!');
00513                 return $out;
00514         }
00515 
00524         function includeLocalconf($localconf)   {
00525                 $TYPO3_CONF_VARS = array();
00526                 $typo_db = '';
00527                 $typo_db_username = '';
00528                 $typo_db_password = '';
00529                 $typo_db_host = '';
00530 
00531                 include($localconf);
00532 
00533                 $siteInfo=array();
00534                 $siteInfo['sitename'] = $TYPO3_CONF_VARS['SYS']['sitename'];
00535                 $siteInfo['TYPO3_db'] = $typo_db;
00536                 $siteInfo['TYPO3_db_username'] = $typo_db_username;
00537                 $siteInfo['TYPO3_db_password'] = $typo_db_password;
00538                 $siteInfo['TYPO3_db_host'] = $typo_db_host;
00539                 $siteInfo['installToolPassword'] = $TYPO3_CONF_VARS['BE']['installToolPassword'];
00540                 $siteInfo['warningEmailAddress'] = $TYPO3_CONF_VARS['BE']['warning_email_addr'];
00541                 $siteInfo['warningMode'] = $TYPO3_CONF_VARS['BE']['warning_mode'];
00542 
00543                 $this->globalSiteInfo[md5($localconf)] = array('siteInfo'=>$siteInfo,'TYPO3_CONF_VARS'=>$TYPO3_CONF_VARS);
00544                 return $siteInfo;
00545         }
00546 
00554         function connectToDatabase($siteInfo)   {
00555                 if (@mysql_pconnect($siteInfo['TYPO3_db_host'], $siteInfo['TYPO3_db_username'], $siteInfo['TYPO3_db_password']))        {
00556                         if (!$siteInfo['TYPO3_db'])     {
00557                                 return $this->error('No database selected');
00558                         } elseif (!mysql_select_db($siteInfo['TYPO3_db']))      {
00559                                 return $this->error('Cannot connect to the current database, "'.$siteInfo['TYPO3_db'].'"');
00560                         }
00561                 } else {
00562                         return $this->error('The current username, password or host was not accepted when the connection to the database was attempted to be established!');
00563                 }
00564         }
00565 
00566 
00576         function getDBInfo($key)        {
00577                 $DB = $this->globalSiteInfo[$key]['siteInfo']['TYPO3_db'];
00578 
00579                         // Non-admin users
00580                 $query = $GLOBALS['TYPO3_DB']->SELECTquery('count(*)', 'be_users', 'admin=0 AND deleted=0');
00581                 $res = mysql($DB, $query);
00582                 $row = mysql_fetch_row($res);
00583                 $this->globalSiteInfo[$key]['siteInfo']['BE_USERS_NONADMIN'] = $row[0];
00584 
00585                         // Admin users
00586                 $query = $GLOBALS['TYPO3_DB']->SELECTquery('count(*)', 'be_users', 'admin!=0 AND deleted=0');
00587                 $res = mysql($DB, $query);
00588                 $row = mysql_fetch_row($res);
00589                 $this->globalSiteInfo[$key]['siteInfo']['BE_USERS_ADMIN'] = $row[0];
00590 
00591                         // Select Admin users
00592                 $query = $GLOBALS['TYPO3_DB']->SELECTquery('uid,username,password,email,realName,disable', 'be_users', 'admin!=0 AND deleted=0');
00593                 $res = mysql($DB, $query);
00594                 while($row = mysql_fetch_assoc($res))   {
00595                         $this->globalSiteInfo[$key]['siteInfo']['ADMINS'][] = $row;
00596                 }
00597         }
00598 
00599 
00600 
00601 
00602 
00603 
00604 
00605 
00606 
00607 
00608 
00609 
00610 
00611 
00612 
00613 
00614 
00615         /******************************
00616          *
00617          * Content: Installation Overview
00618          *
00619          ******************************/
00620 
00626         function makeTable()    {
00627 
00628                         // Header row
00629                 $info = array();
00630                 $info[] = 'Site:';
00631                 $info[] = 'Path:';
00632                 $info[] = 'Database:';
00633                 $info[] = 'Username';
00634                 $info[] = 'Password';
00635                 $info[] = 'Host';
00636                 $info[] = 'Links (new win)';
00637                 $info[] = '#Users NA/A';
00638                 $info[] = 'Admin be_users Info';
00639                 $info[] = 'Install Tool Password';
00640                 $info[] = 'Warning email address';
00641                 $info[] = 'W.mode';
00642                 $mainArrRows[] = '
00643                         <tr bgcolor="#eeeeee">
00644                                 <td nowrap="nowrap" valign="top">'.implode('</td>
00645                                 <td nowrap="nowrap" valign="top">',$info).'</td>
00646                         </tr>';
00647 
00648                         // Traverse globalSiteInfo for each site:
00649                 foreach($this->globalSiteInfo as $k => $all)    {
00650                         $info = array();
00651 
00652                                 // Sitename and Database details:
00653                         $info[] = htmlspecialchars($all['siteInfo']['sitename']);
00654                         $info[] = '<span style="color:#666666;">'.htmlspecialchars($all['siteInfo']['MAIN_DIR']).'</span>'.htmlspecialchars(substr($all['siteInfo']['SA_PATH'],strlen($all['siteInfo']['MAIN_DIR'])));
00655                         $info[] = htmlspecialchars($all['siteInfo']['TYPO3_db']);
00656                         $info[] = htmlspecialchars($all['siteInfo']['TYPO3_db_username']);
00657                         $info[] = htmlspecialchars($all['siteInfo']['TYPO3_db_password']);
00658                         $info[] = htmlspecialchars($all['siteInfo']['TYPO3_db_host']);
00659 
00660                                 // URL
00661                         $info[] = '<a href="'.htmlspecialchars($all['siteInfo']['URL']).'" target="'.$this->targetWindow.'">Site</a>'.
00662                                                 ' / <a href="'.htmlspecialchars($all['siteInfo']['ADMIN_URL']).'" target="'.$this->targetWindowAdmin.'">Admin</a>'.
00663                                                 ' / <a href="'.htmlspecialchars($all['siteInfo']['INSTALL_URL']).'" target="'.$this->targetWindowInstall.'">Install</a>';
00664                         $info[] = htmlspecialchars($all['siteInfo']['BE_USERS_NONADMIN'].'/'.$all['siteInfo']['BE_USERS_ADMIN']);
00665 
00666                                 // Admin
00667                         if (is_array($all['siteInfo']['ADMINS']))       {
00668                                 $lines = array();
00669                                 foreach($all['siteInfo']['ADMINS'] as $vArr)    {
00670                                         $lines[] = htmlspecialchars($vArr['password'].' - '.$vArr['username'].' ('.$vArr['realName'].', '.$vArr['email'].')');
00671                                         $this->collectAdminPasswords[$vArr['password']][] = array(
00672                                                 'path' => $all['siteInfo']['SA_PATH'],
00673                                                 'site' => $all['siteInfo']['sitename'],
00674                                                 'database' => $all['siteInfo']['TYPO3_db'],
00675                                                 'user' => $vArr['username'],
00676                                                 'name_email' => $vArr['realName'].', '.$vArr['email']
00677                                         );
00678                                         $this->changeAdminPasswords[$vArr['password']][] = $all['siteInfo']['TYPO3_db'].':'.$vArr['uid'].':'.$vArr['username'];
00679                                 }
00680                                 $info[] = implode('<br />',$lines);
00681                         } else {
00682                                 $info[] = $this->error('No DB connection!');
00683                         }
00684                                 // Install
00685                         $info[] = htmlspecialchars($all['siteInfo']['installToolPassword']);
00686                         $this->collectInstallPasswords[$all['siteInfo']['installToolPassword']][] = $all['siteInfo']['SA_PATH'].' - '.$all['siteInfo']['sitename'].' - ('.$all['siteInfo']['TYPO3_db'].')';
00687 
00688                         $info[] = htmlspecialchars($all['siteInfo']['warningEmailAddress']);
00689                         $info[] = htmlspecialchars($all['siteInfo']['warningMode']);
00690 
00691                                 // compile
00692                         $mainArrRows[] = '
00693                                 <tr>
00694                                         <td nowrap="nowrap" valign="top">'.implode('</td>
00695                                         <td nowrap="nowrap" valign="top">',$info).'</td>
00696                                 </tr>';
00697                 }
00698 
00699                         // Compile / return table finally:
00700                 $table = '<table border="1" cellpadding="1" cellspacing="1">'.implode('',$mainArrRows).'</table>';
00701                 return $table;
00702         }
00703 
00704 
00705 
00706 
00707 
00708 
00709 
00710 
00711 
00712 
00713 
00714 
00715 
00716 
00717         /******************************
00718          *
00719          * Content: Local extensions
00720          *
00721          ******************************/
00722 
00729         function localExtensions()      {
00730                 $this->extensionInfoArray=array();
00731 
00732                         // Traverse $this->globalSiteInfo for local extensions:
00733                 foreach($this->globalSiteInfo as $k => $all)    {
00734                         if ($all['siteInfo']['SA_PATH'])        {
00735                                 $extDir = $all['siteInfo']['SA_PATH'].'/typo3conf/ext/';
00736                                 if (@is_dir($extDir))   {
00737                                         $this->extensionInfoArray['site'][$k] = array();
00738 
00739                                                 // Get extensions in local directory
00740                                         $extensions=t3lib_div::get_dirs($extDir);
00741                                         if (is_array($extensions))      {
00742                                                 foreach($extensions as $extKey) {
00743                                                                 // Getting and setting information for extension:
00744                                                         $eInfo = $this->getExtensionInfo($extDir,$extKey,$k);
00745                                                         $this->extensionInfoArray['site'][$k][$extKey] = $eInfo;
00746                                                         $this->extensionInfoArray['ext'][$extKey][$k] = $eInfo;
00747                                                 }
00748                                         }
00749                                 }
00750                         }
00751                 }
00752 
00753                         // Display results:
00754                 $out='';
00755                 $headerRow = '
00756                                         <tr bgcolor="#ccccee" style="font-weight:bold;">
00757                                                 <td>Extension key</td>
00758                                                 <td>Path</td>
00759                                                 <td>Title</td>
00760                                                 <td>Ver.</td>
00761                                                 <td>Files</td>
00762                                                 <td><span title="If M, then there is a manual.">M</span></td>
00763                                                 <td>Last mod. time</td>
00764                                                 <td>Hash off all file mod. times:</td>
00765                                                 <td>TYPO3 ver. req.</td>
00766                                                 <td>CGL compliance</td>
00767                                         </tr>
00768                                         ';
00769 
00770                         // PER EXTENSION:
00771                 if (is_array($this->extensionInfoArray['ext'])) {
00772                         $extensionKeysCollect=array();
00773 
00774                         ksort($this->extensionInfoArray['ext']);
00775                         reset($this->extensionInfoArray['ext']);
00776                         $rows=array(
00777                                 'reg'=>array(),
00778                                 'user'=>array()
00779                         );
00780 
00781                         foreach($this->extensionInfoArray['ext'] as $extKey => $instances)      {
00782                                 $mtimes = array();
00783 
00784                                         // Find most recent mtime of the options:
00785                                 reset($instances);
00786                                 while(list($k,$eInfo)=each($instances)) {
00787                                         $mtimes[] = $eInfo['mtime'];
00788                                 }
00789                                         // Max mtime:
00790                                 $maxMtime = max($mtimes);
00791                                 $c = 0;
00792 
00793                                         // So, traverse all sites with the extension present:
00794                                 foreach($instances as $k => $eInfo)     {
00795                                                 // Set background color if mtime matches
00796                                         if ($maxMtime==$eInfo['mtime']) {
00797                                                 $this->extensionInfoArray['site'][$k][$extKey]['_highlight']=1;
00798                                                 $bgCol = $eInfo['dirtype']=='link' ? ' bgcolor="#ffcccc"' : ' bgcolor="#eeeeee"';
00799                                         } else {
00800                                                 $bgCol = ' style="color: #999999; font-style: italic;"';
00801                                         }
00802 
00803                                                 // Make row:
00804                                         $type = substr($extKey,0,5)!='user_' ? 'reg' : 'user';
00805                                         if ($type=='reg')       $extensionKeysCollect[] = $extKey;
00806 
00807                                         if (!is_array($eInfo))  {
00808                                                         // Standard listing:
00809                                                 $rows[$type][] = '
00810                                                 <tr>
00811                                                         '.(!$c?'<td rowspan="'.count($instances).'">'.htmlspecialchars($extKey).'</td>':'').'
00812                                                         <td nowrap="nowrap" bgcolor="#ccddcc">'.htmlspecialchars($this->globalSiteInfo[$k]['siteInfo']['SA_PATH']).'</td>
00813                                                         <td nowrap="nowrap" bgcolor="#ccddcc" colspan="8"><em>'.htmlspecialchars($eInfo).'</em></td>
00814                                                 </tr>
00815                                                 ';
00816                                         } else {
00817                                                         // Standard listing:
00818                                                 $rows[$type][] = '
00819                                                 <tr>
00820                                                         '.(!$c?'<td rowspan="'.count($instances).'">'.htmlspecialchars($extKey).'</td>':'').'
00821                                                         <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($this->globalSiteInfo[$k]['siteInfo']['SA_PATH']).'</td>
00822                                                         <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['title']).'</td>
00823                                                         <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['version']).'</td>
00824                                                         <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['numberfiles']).'</td>
00825                                                         <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['manual']?'M':'-').'</td>
00826                                                         <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['mtime']?date('d-m-y H:i:s',$eInfo['mtime']):'').'</td>
00827                                                         <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['mtime_hash']).'</td>
00828 
00829                                                         <td'.$bgCol.'>'.htmlspecialchars($eInfo['TYPO3_version']).'</td>
00830                                                         <td'.$bgCol.'><img src="clear.gif" width="150" height="1" alt="" /><br />'.htmlspecialchars($eInfo['CGLcompliance'].($eInfo['CGLcompliance_note'] ? ' - '.$eInfo['CGLcompliance_note'] : '')).'</td>
00831                                                 </tr>
00832                                                 ';
00833                                         }
00834                                         $c++;
00835                                 }
00836                         }
00837 
00838                                 // Extensions with registered extension keys:
00839                         $out.='
00840                                 <h3>Registered extensions:</h3>
00841                                 <table border="1">'.$headerRow.implode('',$rows['reg']).'</table>';
00842 
00843                                 // List of those extension keys in a form field:
00844                         $extensionKeysCollect = array_unique($extensionKeysCollect);
00845                         asort($extensionKeysCollect);
00846                         $out.='<form action=""><textarea cols="80" rows="10">'.implode(chr(10),$extensionKeysCollect).'</textarea></form>';
00847 
00848                                 // USER extension (prefixed "user_")
00849                         $out.='<br />
00850                                 <h3>User extensions:</h3>
00851                                 <table border="1">'.$headerRow.implode('',$rows['user']).'</table>';
00852                 }
00853 
00854                         // PER SITE:
00855                 if (is_array($this->extensionInfoArray['site']))        {
00856                         $rows = array();
00857                         foreach($this->extensionInfoArray['site'] as $k => $extensions) {
00858 
00859                                         // So, traverse all sites with the extension present:
00860                                 $c = 0;
00861                                 foreach($extensions as $extKey => $eInfo)       {
00862 
00863                                                 // Set background color if mtime matches
00864                                         if ($eInfo['_highlight'])       {
00865                                                 $bgCol = $eInfo['dirtype']=='link' ? ' bgcolor="#ffcccc"' : ' bgcolor="#eeeeee"';
00866                                         } else {
00867                                                 $bgCol = ' style="color: #999999; font-style: italic;"';
00868                                         }
00869 
00870                                                 // Make row:
00871                                         $rows[] = '
00872                                         <tr>
00873                                                 '.(!$c?'<td rowspan="'.count($extensions).'">'.htmlspecialchars($this->globalSiteInfo[$k]['siteInfo']['SA_PATH']).'</td>':'').'
00874                                                 <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($extKey).'</td>
00875                                                 <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['title']).'</td>
00876                                                 <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['version']).'</td>
00877                                                 <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['numberfiles']).'</td>
00878                                                 <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['mtime']?date('d-m-y H:i:s',$eInfo['mtime']):'').'</td>
00879                                                 <td nowrap="nowrap"'.$bgCol.'>'.htmlspecialchars($eInfo['mtime_hash']).'</td>
00880                                         </tr>
00881                                         ';
00882                                         $c++;
00883                                 }
00884                         }
00885                         $out.='<br />
00886                                 <h3>Sites:</h3>
00887                                 <table border="1">'.implode('',$rows).'</table>';
00888                 }
00889 
00890                         // Return content
00891                 return $out;
00892         }
00893 
00902         function getExtensionInfo($path,$extKey,$k)     {
00903                 $file = $path.$extKey.'/ext_emconf.php';
00904                 if (@is_file($file))    {
00905                         $_EXTKEY = $extKey;
00906                         $EM_CONF = array();
00907                         include($file);
00908 
00909                         $eInfo = array();
00910                                 // Info from emconf:
00911                         $eInfo['title'] = $EM_CONF[$extKey]['title'];
00912                         $eInfo['version'] = $EM_CONF[$extKey]['version'];
00913                         $eInfo['CGLcompliance'] = $EM_CONF[$extKey]['CGLcompliance'];
00914                         $eInfo['CGLcompliance_note'] = $EM_CONF[$extKey]['CGLcompliance_note'];
00915                         $eInfo['TYPO3_version'] = $EM_CONF[$extKey]['TYPO3_version'];
00916                         $filesHash = unserialize($EM_CONF[$extKey]['_md5_values_when_last_written']);
00917 
00918                         if (!is_array($filesHash) || count($filesHash)<500)     {
00919 
00920                                         // Get all files list (may take LOONG time):
00921                                 $extPath = $path.$extKey.'/';
00922                                 $fileArr = array();
00923                                 $fileArr = $this->removePrefixPathFromList($this->getAllFilesAndFoldersInPath($fileArr,$extPath),$extPath);
00924 
00925                                 if (!is_array($fileArr))        {
00926                                         debug(array($fileArr,$extKey,$extPath,$this->getAllFilesAndFoldersInPath(array(),$extPath)),'ERROR');
00927                                 }
00928 
00929                                         // Number of files:
00930                                 $eInfo['numberfiles'] = count($fileArr);
00931                                 $eInfo['dirtype'] = filetype($path.$extKey);
00932 
00933                                         // Most recent modification:
00934                                 $eInfo['mtime_files'] = $this->findMostRecent($fileArr,$extPath);
00935                                 if (count($eInfo['mtime_files']))       $eInfo['mtime'] = max($eInfo['mtime_files']);
00936                                 $eInfo['mtime_hash'] = md5(implode(',',$eInfo['mtime_files']));
00937                         } else {
00938                                 $eInfo['mtime_hash'] = 'No calculation done, too many files in extension: '.count($filesHash);
00939                         }
00940 
00941                         $eInfo['manual'] = @is_file($path.$extKey.'/doc/manual.sxw');
00942 
00943                         return $eInfo;
00944                 } else return 'ERROR: No emconf.php file: '.$file;
00945         }
00946 
00956         function getAllFilesAndFoldersInPath($fileArr,$extPath,$extList='',$regDirs=0)  {
00957                 if ($regDirs)   $fileArr[] = $extPath;
00958                 $fileArr = array_merge($fileArr,t3lib_div::getFilesInDir($extPath,$extList,1,1));
00959 
00960                 $dirs = t3lib_div::get_dirs($extPath);
00961                 if (is_array($dirs))    {
00962                         foreach($dirs as $subdirs)      {
00963                                 if ($subdirs && (strcmp($subdirs,'CVS') || !$this->noCVS))      {
00964                                         $fileArr = $this->getAllFilesAndFoldersInPath($fileArr,$extPath.$subdirs.'/',$extList,$regDirs);
00965                                 }
00966                         }
00967                 }
00968                 return $fileArr;
00969         }
00970 
00978         function findMostRecent($fileArr,$extPath)      {
00979                 $mtimeArray = array();
00980                 foreach($fileArr as $fN)        {
00981                         if ($fN!='ext_emconf.php')      {
00982                                 $mtime = filemtime($extPath.$fN);
00983                                 $mtimeArray[$fN] = $mtime;
00984                         }
00985                 }
00986                 return $mtimeArray;
00987         }
00988 
00996         function removePrefixPathFromList($fileArr,$extPath)    {
00997                 reset($fileArr);
00998                 while(list($k,$absFileRef)=each($fileArr))      {
00999                         if(t3lib_div::isFirstPartOfStr($absFileRef,$extPath))   {
01000                                 $fileArr[$k]=substr($absFileRef,strlen($extPath));
01001                         } else return 'ERROR: One or more of the files was NOT prefixed with the prefix-path!';
01002                 }
01003                 return $fileArr;
01004         }
01005 
01006 
01007 
01008 
01009 
01010 
01011 
01012 
01013 
01014 
01015 
01016 
01017 
01018 
01019 
01020 
01021         /******************************
01022          *
01023          * Content: Other
01024          *
01025          ******************************/
01026 
01033         function singleSite($exp)       {
01034                 $all = $this->globalSiteInfo[$exp];
01035 
01036                         // General information:
01037                 $content = '
01038                         <h2>'.htmlspecialchars($all['siteInfo']['sitename'].' (DB: '.$all['siteInfo']['TYPO3_db']).')</h2>
01039                         <hr />
01040 
01041                         <h3>Main details:</h3>
01042 
01043                         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>
01044                         <br /><br />';
01045 
01046                         // Add all information in globalSiteInfo array:
01047                 $content.= t3lib_div::view_array($all);
01048 
01049                         // Last-login:
01050                 $content.= '
01051                         <h3>Login-Log for last month:</h3>';
01052                 $content.= $this->loginLog($all['siteInfo']['TYPO3_db']);
01053 
01054                         // Return content
01055                 return $content;
01056         }
01057 
01064         function loginLog($DB)  {
01065                         // Non-admin users
01066                         //1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent
01067                 $query = $GLOBALS['TYPO3_DB']->SELECTquery(
01068                                                 'sys_log.*, be_users.username  AS username, be_users.admin AS admin',
01069                                                 'sys_log,be_users',
01070                                                 'be_users.uid=sys_log.userid AND sys_log.type=255 AND sys_log.tstamp > '.(time()-(60*60*24*30)),
01071                                                 '',
01072                                                 'sys_log.tstamp DESC'
01073                                         );
01074                 $res = mysql($DB,$query);
01075 
01076                 $dayRef = '';
01077                 $lines = array();
01078 
01079                 while($row = mysql_fetch_assoc($res))   {
01080                         $day = date('d-m-Y',$row['tstamp']);
01081                         if ($dayRef!=$day)      {
01082                                 $lines[] = '
01083                                 <h4>'.$day.':</h4>';
01084                                 $dayRef=$day;
01085                         }
01086                         $theLine = date('H:i',$row['tstamp']).':   '.str_pad(substr($row['username'],0,10),10).'    '.$this->log_getDetails($row['details'],unserialize($row['log_data']));
01087                         $theLine = htmlspecialchars($theLine);
01088                         $lines[]= $row['admin'] ? '<span class="redclass">'.$theLine.'</span>' : $theLine;
01089 
01090                         // debug($row);
01091                 }
01092                 return '<pre>'.implode(chr(10),$lines).'</pre>';
01093         }
01094 
01102         function log_getDetails($text,$data)    {
01103                         // $code is used later on to substitute errormessages with language-corrected values...
01104                 if (is_array($data))    {
01105                         return sprintf($text, $data[0],$data[1],$data[2],$data[3],$data[4]);
01106                 } else return $text;
01107         }
01108 
01109 
01116         function rmCachedFiles($exp)    {
01117                 $all = $this->globalSiteInfo[$exp];
01118                 $content = '
01119                         <h2>'.htmlspecialchars($all['siteInfo']['sitename'].' (DB: '.$all['siteInfo']['TYPO3_db']).')</h2>
01120                         <hr />
01121                         <h3>typo3conf/temp_CACHED_* files:</h3>';
01122 
01123                 $path = $all['siteInfo']['SA_PATH'].'/typo3conf/';
01124                 if (@is_dir($path))     {
01125                         $filesInDir = t3lib_div::getFilesInDir($path,'php',1);
01126 
01127                         foreach($filesInDir as $kk => $vv)      {
01128                                 if (t3lib_div::isFirstPartOfStr(basename($vv),'temp_CACHED_'))  {
01129                                         if (strstr(basename($vv),'ext_localconf.php') || strstr(basename($vv),'ext_tables.php'))        {
01130                                                 $content.='REMOVED: '.$vv.'<br />';
01131                                                 unlink($vv);
01132                                                 if (file_exists($vv))   $content.= $this->error('ERROR: File still exists, so could not be removed anyways!').'<br />';
01133                                         }
01134                                 }
01135                         }
01136                 } else {
01137                         $content.= $this->error('ERROR: '.$path.' was not a directory!');
01138                 }
01139 
01140                 return $content;
01141         }
01142 
01149         function menuContent($exp)      {
01150                 if ($exp)       {
01151 
01152                                 // Initialize:
01153                         $lines = array();
01154                         $head = '';
01155 
01156                         foreach($this->globalSiteInfo as $k => $all)    {
01157 
01158                                         // Setting section header, if needed.
01159                                 if ($head!=$all['siteInfo']['MAIN_DIR'])        {
01160                                         $lines[] = '
01161                                                 <h4 style="white-space: nowrap;">'.htmlspecialchars(t3lib_div::fixed_lgd_pre($all['siteInfo']['MAIN_DIR'],18)).'</h4>';
01162                                         $head = $all['siteInfo']['MAIN_DIR'];   // Set new head...
01163                                 }
01164 
01165                                         // Display mode:
01166                                 switch($exp)    {
01167                                         case 'update':
01168 
01169                                                         // Label:
01170                                                 $label = $all['siteInfo']['sitename'] ? $all['siteInfo']['sitename'] : '(DB: '.$all['siteInfo']['TYPO3_db'].')';
01171                                                 $lines[] = '
01172                                                         <hr />
01173                                                         <b>'.htmlspecialchars($label).'</b> ('.htmlspecialchars(substr($all['siteInfo']['SA_PATH'],strlen($all['siteInfo']['MAIN_DIR'])+1)).')<br />';
01174 
01175                                                                 // To avoid "visited links" display on next hit:
01176                                                         $tempVal='&_someUniqueValue='.time();
01177 
01178                                                                 // Add links for update:
01179                                                         $url = $this->scriptName.'?type=page&show=rmTempCached&exp='.$k.$tempVal;
01180                                                         $lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="TSApage">Remove temp_CACHED files</a></span>';
01181 
01182                                                         $url = $all['siteInfo']['INSTALL_URL'].'index.php?TYPO3_INSTALL[type]=database&TYPO3_INSTALL[database_type]=import|CURRENT_STATIC'."&presetWholeTable=1".$tempVal.'#bottom';
01183                                                         $lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="TSApage">CURRENT_STATIC</a></span>';
01184 
01185                                                         $url = $all['siteInfo']['INSTALL_URL'].'index.php?TYPO3_INSTALL[type]=database&TYPO3_INSTALL[database_type]=cmpFile|CURRENT_TABLES'.$tempVal.'#bottom';
01186                                                         $lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="TSApage">CURRENT_TABLES</a></span>';
01187 
01188                                                                 // Cache
01189                                                         $url = $all['siteInfo']['INSTALL_URL'].'index.php?TYPO3_INSTALL[type]=database&TYPO3_INSTALL[database_type]=cache|'.
01190                                                                                         "&PRESET[database_clearcache][cache_pages]=1".
01191                                                                                         '&PRESET[database_clearcache][cache_pagesection]=1'.
01192                                                                                         "&PRESET[database_clearcache][cache_hash]=1".
01193                                                                                         $tempVal.
01194                                                                                         '#bottom';
01195                                                         $lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="TSApage">Clear cache</a></span>';
01196 
01197                                                                 // Admin link
01198                                                         $url = $all['siteInfo']['ADMIN_URL'].'index.php';
01199                                                         $lines[] = '<span style="white-space: nowrap;"><a href="'.htmlspecialchars($url).'" target="'.$this->targetWindowAdmin.'">Admin -></a></span>';
01200                                         break;
01201                                         case 'info':
01202                                                         // item
01203                                                 $label = $all['siteInfo']['sitename'] ? $all['siteInfo']['sitename'] : '(DB: '.$all['siteInfo']['TYPO3_db'].')';
01204 
01205                                                 $url = $this->scriptName.'?type=page&show=info&exp='.$k;
01206                                                 $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>';
01207                                         break;
01208                                 }
01209                         }
01210 
01211                                 // Return result.
01212                         return implode('<br />',$lines).'<br />';
01213                 }
01214         }
01215 
01221         function makeAdminLogin()       {
01222 
01223                         // Initialize:
01224                 $lines = array();
01225                 $head = '';
01226 
01227                         // Traverse installations found:
01228                 foreach($this->globalSiteInfo as $k => $all)    {
01229 
01230                                 // Setting section header, if needed.
01231                         if ($head!=$all['siteInfo']['MAIN_DIR'])        {
01232                                 $lines[] = '
01233                                         <tr>
01234                                                 <td colspan="2"><br />
01235                                                 <h4>'.htmlspecialchars($all['siteInfo']['MAIN_DIR']).'</h4>
01236                                                 </td>
01237                                         </tr>';
01238                                 $head = $all['siteInfo']['MAIN_DIR'];
01239                         }
01240 
01241                                 // item
01242                         $label = $all['siteInfo']['sitename'] ? $all['siteInfo']['sitename'] : '(DB: '.$all['siteInfo']['TYPO3_db'].')';
01243                         $unique = md5(microtime());
01244 
01245                         $opts = array();
01246                         $defUName = '';
01247 
01248                         if (is_array($all['siteInfo']['ADMINS']))       {
01249 
01250                                 foreach($all['siteInfo']['ADMINS'] as $vArr)    {
01251                                         $chalVal = md5($vArr['username'].':'.$vArr['password'].':'.$unique);
01252                                         $opts[] = '<option value="'.$chalVal.'">'.htmlspecialchars($vArr['username'].($vArr['disable']?' [DISABLED]':'')).'</option>';
01253                                         if (!$defUName) { $defUName = $vArr['username']; }
01254                                 }
01255                         }
01256                         if (count($opts)>1)     {
01257                                         $userident = '
01258                                         <select name="userident" onchange="document[\''.$k.'\'].username.value=this.options[this.selectedIndex].text;">
01259                                                 '.implode('
01260                                                 ',$opts).'
01261                                         </select>
01262                                 ';
01263                         } else {
01264                                 $userident = '
01265                                         ('.$defUName.')<br />
01266                                         <input type="hidden" name="userident" value="'.$chalVal.'" />';
01267                         }
01268 
01269                         $form='
01270                         <form name="'.$k.'" action="'.$all['siteInfo']['ADMIN_URL'].'index.php" target="EXTERnalWindow" method="post">
01271                                 <input type="submit" name="submit" value="Login" />
01272                                 <input type="hidden" name="username" value="'.$defUName.'" />
01273                                 <input type="hidden" name="challenge" value="'.$unique.'" />
01274                                 <input type="hidden" name="redirect_url" value="" />
01275                                 <input type="hidden" name="login_status" value="login" />
01276                                 '.trim($userident).'
01277                         </form>';
01278 
01279                         $lines[] = '
01280                                 <tr>
01281                                         <td><strong>'.htmlspecialchars($label).'</strong></td>
01282                                         <td nowrap="nowrap">'.trim($form).'</td>
01283                                 </tr>';
01284                 }
01285 
01286                         // Return login table:
01287                 return '<table border="1" cellpadding="5" cellspacing="1">'.implode('',$lines).'</table>';
01288         }
01289 
01295         function changeAdminPasswordsForm()     {
01296                 $content='';
01297 
01298                 foreach($this->changeAdminPasswords as $k => $p)        {
01299                         $content.='
01300                                 <h3>'.$k.'</h3>';
01301 
01302                         foreach($p as $kk => $pp)       {
01303                                 $content.= '<span style="white-space: nowrap;">';
01304                                 $content.= '<input type="checkbox" name="SETFIELDS[]" value="'.$pp.'" /> '.$pp.' - ';
01305                                 $content.= htmlspecialchars(implode(' - ',$this->collectAdminPasswords[$k][$kk]));
01306                                 $content.= '</span><br />';
01307                         }
01308                 }
01309 
01310                 $content.='New password: <input type="text" name="NEWPASS" /><br />';
01311                 $content.='New password (md5): <input type="text" name="NEWPASS_md5" /><br />
01312                         (This overrules any plain password above!)
01313                 <br />';
01314                 $content='
01315                 <form action="'.htmlspecialchars($this->scriptName.'?type=page&show=admin').'" method="post">
01316                 '.$content.'
01317                 <input type="submit" name="Set" />
01318                 </form>
01319                 ';
01320 
01321                 return $content;
01322         }
01323 
01330         function setNewPasswords()      {
01331                 $whichFields = t3lib_div::_POST('SETFIELDS');
01332                 $pass = trim(t3lib_div::_POST('NEWPASS'));
01333                 $passMD5 = t3lib_div::_POST('NEWPASS_md5');
01334 
01335                 $updatedFlag = 0;
01336                 if (($pass || $passMD5) && is_array($whichFields))      {
01337                         $pass = $passMD5 ? $passMD5 : md5($pass);
01338 
01339                         foreach($whichFields as $values)        {
01340                                 $parts = explode(':',$values);
01341                                 if (count($parts)>2)    {
01342                                         $key = $this->mapDBtoKey[$parts[0]];
01343                                         if ($key && isset($this->globalSiteInfo[$key]['siteInfo']))     {
01344                                                 $error = $this->connectToDatabase($this->globalSiteInfo[$key]['siteInfo']);
01345                                                 if (!$error)    {
01346                                                         $DB = $this->globalSiteInfo[$key]['siteInfo']['TYPO3_db'];
01347                                                         $content.='<h3>Updating '.$DB.':</h3>';
01348 
01349                                                         $query = $GLOBALS['TYPO3_DB']->UPDATEquery(
01350                                                                                                         'be_users',
01351                                                                                                         'uid='.intval($parts[1]).' AND username="'.addslashes($parts[2]).'" AND admin!=0',
01352                                                                                                         array('password' => $pass)
01353                                                                                                 );      // username/admin are added to security. But they are certainly redundant!!
01354                                                         mysql($DB,$query);
01355 
01356                                                         $content.= 'Affected rows: '.mysql_affected_rows().'<br /><hr />';
01357                                                         $updatedFlag = '1';
01358                                                 }
01359                                         }
01360                                 }
01361                         }
01362                 }
01363 
01364                 $this->initProcess();
01365                 return $content;
01366         }
01367 }
01368 
01369 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_superadmin.php'])        {
01370         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_superadmin.php']);
01371 }
01372 ?>