Documentation TYPO3 par Ameos

class.tx_install.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 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 ***************************************************************/
00151 require_once (PATH_t3lib.'class.t3lib_install.php');
00152 require_once (PATH_t3lib.'class.t3lib_stdgraphic.php');
00153 
00162 class tx_install extends t3lib_install {
00163         var $getGD_start_string='<h2 align="center"><a name="module_gd">gd</a></h2>';   // Used to identify the GD section in the output from phpinfo()
00164         var $getGD_end_string = '</table>';     // Used to identify the end of the GD section (found with getGD_start_string) in the output from phpinfo()
00165         var $getTTF_string = 'with TTF library';        // Used to identify whether TTF-lib is included with GD
00166         var $getTTF_string_alt = 'with freetype';       // Used to identify whether TTF-lib is included with GD
00167         var $action = '';               // The url that calls this script
00168         var $scriptSelf = 'index.php';          // The url that calls this script
00169         var $fontTag2='<span class="bodytext">';
00170         var $fontTag1='<span class="smalltext">';
00171         var $updateIdentity = 'TYPO3 Install Tool';
00172         var $headerStyle ='';
00173         var $contentBeforeTable='';
00174         var $setAllCheckBoxesByDefault=0;
00175 
00176         var $allowFileEditOutsite_typo3conf_dir=0;
00177 
00178         var $INSTALL =array();          // In constructor: is set to global GET/POST var TYPO3_INSTALL
00179         var $checkIMlzw = 0;            // If set, lzw capabilities of the available ImageMagick installs are check by actually writing a gif-file and comparing size
00180         var $checkIM = 0;                       // If set, ImageMagick is checked.
00181         var $dumpImCommands=1;                  // If set, the image Magick commands are always outputted in the image processing checker
00182         var $mode = ''; // If set to "123" then only most vital information is displayed.
00183         var $step = 0;  // If set to 1,2,3 or GO it signifies various functions.
00184 
00185         // internal
00186         var $passwordOK=0;                      // This is set, if the password check was ok. The function init() will exit if this is not set
00187         var $silent=1;                          // If set, the check routines don't add to the message-array
00188         var $messageFunc_nl2br=1;
00189         var $sections=array();          // Used to gather the message information.
00190         var $fatalError=0;                      // This is set if some error occured that will definitely prevent TYpo3 from running.
00191         var $sendNoCacheHeaders=1;
00192         var $config_array = array(      // Flags are set in this array if the options are available and checked ok.
00193                 'gd'=>0,
00194                 'gd_gif'=>0,
00195                 'gd_png'=>0,
00196                 'gd_jpg'=>0,
00197                 'freetype' => 0,
00198                 'safemode' => 0,
00199                 'dir_typo3temp' => 0,
00200                 'dir_temp' => 0,
00201                 'im_versions' => array(),
00202                 'im' => 0,
00203                 'sql.safe_mode_user' => '',
00204                 'mysqlConnect' => 0,
00205                 'no_database' => 0
00206         );
00207         var $typo3temp_path='';
00208 
00209         var $menuitems = array(
00210                 'config' => 'Basic Configuration',
00211                 'database' => 'Database Analyser',
00212                 'update' => 'Update Wizard',
00213                 'images' => 'Image Processing',
00214                 'extConfig' => 'All Configuration',
00215                 'typo3temp' => 'typo3temp/',
00216                 'cleanup' => 'Clean up database',
00217                 'phpinfo' => 'phpinfo()',
00218                 'typo3conf_edit' => 'Edit files in typo3conf/',
00219                 'about' => 'About'
00220         );
00221         var $cookie_name = 'Typo3InstallTool';
00222         var $JSmessage = '';
00223 
00224 
00225 
00226 
00227 
00228 
00234         function tx_install()   {
00235                 parent::t3lib_install();
00236 
00237                 if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'])  die("Install Tool deactivated.<br />You must enable it by setting a password in typo3conf/localconf.php. If you insert the line below, the password will be 'joh316':<br /><br />\$TYPO3_CONF_VARS['BE']['installToolPassword'] = 'bacb98acf97e0b6112b1d1b650b84971';");
00238 
00239                 if ($this->sendNoCacheHeaders)  {
00240                         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
00241                         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
00242                         header('Expires: 0');
00243                         header('Cache-Control: no-cache, must-revalidate');
00244                         header('Pragma: no-cache');
00245                 }
00246 
00247                         // ****************************
00248                         // Initializing incoming vars.
00249                         // ****************************
00250                 $this->INSTALL = t3lib_div::_GP('TYPO3_INSTALL');
00251                 $this->mode = t3lib_div::_GP('mode');
00252                 $this->step = t3lib_div::_GP('step');
00253                 $this->redirect_url = t3lib_div::_GP('redirect_url');
00254 
00255                 if ($_GET['TYPO3_INSTALL']['type'])     {
00256                         $this->INSTALL['type'] = $_GET['TYPO3_INSTALL']['type'];
00257                 }
00258 
00259                 if ($this->step==3)     {
00260                         $this->INSTALL['type']='database';
00261                 }
00262 
00263                 if ($this->mode=='123') {
00264                         $tempItems = $this->menuitems;
00265                         unset($this->menuitems);
00266                         $this->menuitems['config'] = $tempItems['config'];
00267                         $this->menuitems['database'] = $tempItems['database'];
00268                         if (!$this->INSTALL['type'] || !isset($this->menuitems[$this->INSTALL['type']]))        $this->INSTALL['type'] = 'config';
00269                 } else {
00270                         if (!$this->INSTALL['type'] || !isset($this->menuitems[$this->INSTALL['type']]))        $this->INSTALL['type'] = 'about';
00271                 }
00272 
00273                 $this->action = $this->scriptSelf.'?TYPO3_INSTALL[type]='.$this->INSTALL['type'].($this->mode?'&mode='.rawurlencode($this->mode):'').($this->step?'&step='.rawurlencode($this->step):'');
00274                 $this->typo3temp_path = PATH_site.'typo3temp/';
00275 
00276 
00277                         // ****************
00278                         // Check password
00279                         // ****************
00280                         // Getting a unique session key, used to encode the session-access cookie later...
00281                 $uKey = $_COOKIE[$this->cookie_name.'_key'];
00282                 if (!$uKey)     {
00283                         $uKey = md5(uniqid(microtime()));
00284                         SetCookie($this->cookie_name.'_key', $uKey, 0, '/');            // Cookie is set
00285 
00286                         $this->JSmessage='SECURITY:
00287 Make sure to protect the Install Tool with another password than "joh316".
00288 Better yet you can add a die() function call to typo3/install/index.php after usage.
00289 
00290 IF THE INSTALL TOOL CRASHES...
00291 The Install Tool is checking PHPs support for image formats. However certain versions of PHP (fx. 4.3.0 with bundled GD) will crash when trying to read the PNG test file. If this happens you will see a blank screen or error message.
00292 Workaround: Open the file typo3/sysext/install/mod/class.tx_install.php, go to the line where the function "isPNG()" is defined and make it return "0" hardcoded. PNG is not checked anymore and the rest of the Install Tool will work as expected. The same has been known with the other image formats as well. You can use a similar method to bypass the testing if that is also a problem.
00293 On behalf of PHP we regret this inconvenience.
00294 
00295 BTW: This Install Tool will only work if cookies are accepted by your web browser. If this dialog pops up over and over again you didn\'t enable cookies.
00296 ';
00297 
00298                 }
00299                         // Check if the password from TYPO3_CONF_VARS combined with uKey matches the sKey cookie. If not, ask for password.
00300                 $sKey = $_COOKIE[$this->cookie_name];
00301 
00302                 if (md5($GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'].'|'.$uKey) == $sKey || $this->checkPassword($uKey))    {
00303                         $this->passwordOK=1;
00304                         if($this->redirect_url) {
00305                                 header('Location: '.$this->redirect_url);
00306                         }
00307                 } else {
00308                         $this->loginForm();
00309                 }
00310         }
00311 
00318         function checkPassword($uKey)   {
00319                 $p = t3lib_div::_GP('password');
00320 
00321                 if ($p && md5($p)==$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'])    {
00322                         $sKey = md5($GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'].'|'.$uKey);
00323                         SetCookie($this->cookie_name, $sKey, 0, '/');
00324 
00325                                 // Sending warning email
00326                         $wEmail = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'];
00327                         if ($wEmail)    {
00328                                 $subject="Install Tool Login at '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."'";
00329                                 $email_body="There has been a Install Tool login at TYPO3 site '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."' (".t3lib_div::getIndpEnv('HTTP_HOST').") from remote address '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndpEnv('REMOTE_HOST').')';
00330                                 mail($wEmail,
00331                                         $subject,
00332                                         $email_body,
00333                                         'From: TYPO3 Install Tool WARNING <>'
00334                                 );
00335                         }
00336                         return true;
00337                 } else {
00338                                 // Bad password, send warning:
00339                         if ($p) {
00340                                 $wEmail = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'];
00341                                 if ($wEmail)    {
00342                                         $subject="Install Tool Login ATTEMPT at '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."'";
00343                                         $email_body="There has been a Install Tool login attempt at TYPO3 site '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."' (".t3lib_div::getIndpEnv('HTTP_HOST').").
00344 Password tried was '".$p."'
00345 REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndpEnv('REMOTE_HOST').')';
00346                                         mail($wEmail,
00347                                                 $subject,
00348                                                 $email_body,
00349                                                 'From: TYPO3 Install Tool WARNING <>'
00350                                         );
00351                                 }
00352                         }
00353                         return false;
00354                 }
00355         }
00356 
00362         function loginForm()    {
00363                 $p = t3lib_div::_GP('password');
00364                 $redirect_url = $this->redirect_url ? $this->redirect_url : $this->action;
00365 
00366                 $this->messageFunc_nl2br=0;
00367                 $this->silent=0;
00368 
00369                 $content = '<form action="index.php" method="post" name="passwordForm">
00370                         <input type="password" name="password"><br />
00371                         <input type="hidden" name="redirect_url" value="'.$redirect_url.'">
00372                         <input type="submit" value="Log in"><br />
00373                         <br />
00374 
00375                         '.$this->fw('The Install Tool Password is <i>not</i> the admin password of TYPO3.<br />
00376                                 If you don\'t know the current password, you can set a new one by setting the value of $TYPO3_CONF_VARS[\'BE\'][\'installToolPassword\'] in typo3conf/localconf.php to the md5() hash value of the password you desire.'.
00377                                 ($p ? '<br /><br />The password you just tried has this md5-value: <br /><br />'.md5($p) : '')
00378                                 ).'
00379                         </form>
00380                         <script type="text/javascript">
00381                         <!--
00382                                 document.passwordForm.password.focus();
00383                         //-->
00384                         </script>';
00385 
00386                 $this->message('Password', 'Enter the Install Tool Password', $content,3);
00387                 echo $this->outputWrapper($this->printAll());
00388         }
00389 
00396         function init() {
00397                 if (!defined('PATH_typo3'))     exit;           // Must be called after inclusion of init.php (or from init.php)
00398                 if (!$this->passwordOK) exit;
00399 //              debug($_COOKIE);
00400 
00401                         // Setting stuff...
00402                 $this->check_mail();
00403                 $this->setupGeneral();
00404                 $this->generateConfigForm();
00405                 if (count($this->messages))     t3lib_div::debug($this->messages);
00406 
00407                 if ($this->step)        {
00408                         echo $this->outputWrapper($this->stepOutput());
00409                 } else {
00410                                 // Menu...
00411                         switch($this->INSTALL['type'])  {
00412                                 case 'images':
00413                                         $this->checkIM=1;
00414                                         $this->checkTheConfig();
00415                                         $this->silent=0;
00416                                         $this->checkTheImageProcessing();
00417                                 break;
00418                                 case 'database':
00419                                         $this->checkTheConfig();
00420                                         $this->silent=0;
00421                                         $this->checkTheDatabase();
00422                                 break;
00423                                 case 'update':
00424                                         $this->checkDatabase();
00425                                         $this->silent=0;
00426                                         $this->updateWizard();
00427                                 break;
00428                                 case 'config':
00429                                         $this->silent=0;
00430                                         $this->checkIM=1;
00431                                         $this->message('About configuration','How to configure TYPO3',$this->generallyAboutConfiguration());
00432                                         $this->checkTheConfig();
00433 
00434                                         $ext = 'Write config to localconf.php';
00435                                         if ($this->fatalError)  {
00436                                                 if ($this->config_array['no_database'] || !$this->config_array['mysqlConnect']) {
00437                                                         $this->message($ext, 'Database not configured yet!', '
00438                                                                 You need to specify database username, password and host as one of the first things.
00439                                                                 Next you\'ll have to select a database to use with TYPO3.
00440                                                                 Use the form below:
00441                                                         ',2);
00442                                                 } else {
00443                                                         $this->message($ext, 'Fatal error encountered!', '
00444                                                                 Somewhere above a fatal configuration problem is encountered. Please make sure that you\'ve fixed this error before you submit the configuration. TYPO3 will not run if this problem is not fixed!
00445                                                                 You should also check all warnings that may appear.
00446                                                         ',2);
00447                                                 }
00448                                         } elseif ($this->mode=='123') {
00449                                                 if (!$this->fatalError) {
00450                                                         $this->message($ext, 'Basic configuration completed', '
00451                                                                 You have no fatal errors in your basic configuration. You may have warnings though. Please pay attention to them! However you may continue and install the database.
00452 
00453                                                                 <strong><span style="color:#f00;">Step 2:</span></strong> <a href="'.$this->scriptSelf.'?TYPO3_INSTALL[type]=database'.($this->mode?'&mode='.rawurlencode($this->mode):'').'">Click here to install the database.</a>
00454                                                         ',-1,1);
00455                                                 }
00456                                         }
00457                                         $this->message($ext, 'Very Important: Changing Image Processing settings', "
00458                                                 When you change the settings for Image Processing you <i>must</i> take into account that <u>old images</u> may still be in typo3temp/ folder and prevent new files from being generated! This is especially important to know, if you're trying to set up image processing for the very first time.
00459                                                 The problem is solved by <a href=\"".htmlspecialchars($this->setScriptName('typo3temp'))."\">clearing the typo3temp/ folder</a>. Also make sure to clear the cache_pages table.
00460                                                 ",1,1);
00461                                         $this->message($ext, 'Very Important: Changing Encryption Key setting', "
00462                                                 When you change the setting for the Encryption Key you <i>must</i> take into account that a change to this value might invalidate temporary information, URLs etc.
00463                                                 The problem is solved by <a href=\"".htmlspecialchars($this->setScriptName('typo3temp'))."\">clearing the typo3temp/ folder</a>. Also make sure to clear the cache_pages table.
00464                                                 ",1,1);
00465                                         $this->message($ext, 'Update localconf.php', "
00466                                                 This form updates the localconf.php file with the suggested values you see below. The values are based on the analysis above.
00467                                                 You can change the values in case you have alternatives to the suggested defaults.
00468                                                 By this final step you will configure TYPO3 for immediate use provided that you have no fatal errors left above."
00469                                                 .$this->setupGeneral('get_form'),0,1);
00470 
00471                                         echo $this->outputWrapper($this->printAll());
00472 
00473                                 break;
00474                                 case 'extConfig':
00475                                         $this->silent=0;
00476 
00477                                         $this->generateConfigForm('get_form');
00478 
00479                                         $content = $this->printAll();
00480                                         $content = '<form action="'.$this->action.'" method="post">'.$content.'<input type="submit" value="Write to localconf.php"><br /><br />
00481                                         '.$this->fw('<strong>NOTICE: </strong>By clicking this button, localconf.php is updated with new values for the parameters listed above!<br />').'
00482                                         </form>';
00483                                         echo $this->outputWrapper($content);
00484                                 break;
00485                                 case 'typo3temp':
00486                                         $this->checkTheConfig();
00487                                         $this->silent=0;
00488                                         $this->typo3TempManager();
00489                                 break;
00490                                 case 'cleanup':
00491                                         $this->checkTheConfig();
00492                                         $this->silent=0;
00493                                         $this->cleanupManager();
00494                                 break;
00495                                 case 'phpinfo':
00496                                         $this->silent=0;
00497                                         $this->phpinformation();
00498                                 break;
00499                                 case 'typo3conf_edit':
00500                                         $this->silent=0;
00501                                         $this->typo3conf_edit();
00502                                 break;
00503                                 case 'about':
00504                                 default:
00505                                         $this->silent=0;
00506                                         $this->message('About', 'Warning - very important!', $this->securityRisk().$this->alterPasswordForm(),2);
00507 
00508                                         $this->message('About', 'Using this script', "
00509                                         Installing TYPO3 has always been a hot topic on the mailing list and forums. Therefore we've developed this tool which will help you through configuration and testing.
00510                                         There are three primary steps for you to take:
00511 
00512                                         <strong>1: Basic Configuration</strong>
00513                                         In this step your PHP-configuration is checked. If there are any settings that will prevent TYPO3 from running correctly you'll get warnings and errors with a description of the problem.
00514                                         You'll have to enter a database username, password and hostname. Then you can choose to create a new database or select an existing one.
00515                                         Finally the image processing settings are entered and verified and you can choose to let the script update the configuration file, typo3conf/localconf.php with the suggested settings.
00516 
00517                                         <strong>2: Database Analyser</strong>
00518                                         In this step you can either install a new database or update the database from any previous TYPO3 version.
00519                                         You can also get an overview of extra/missing fields/tables in the database compared to a raw sql-file.
00520                                         The database is also verified agains your 'tables.php' configuration (\$TCA) and you can even see suggestions to entries in \$TCA or new fields in the database.
00521 
00522                                         <strong>3: Update Wizard</strong>
00523                                         Here you will find update methods taking care of changes to the TYPO3 core which are not backwards compatible.
00524                                         It is recommended to run this wizard after every update to make sure everything will still work flawlessly.
00525 
00526                                         <strong>4: Image Processing</strong>
00527                                         This step is a visual guide to verify your configuration of the image processing software.
00528                                         You'll be presented to a list of images that should all match in pairs. If some irregularity appears, you'll get a warning. Thus you're able to track an error before you'll discover it on your website.
00529 
00530                                         <strong>5: All Configuration</strong>
00531                                         This gives you access to any of the configuration options in the TYPO3_CONF_VARS array. Every option is also presented with a comment explaining what it does.
00532 
00533                                         <strong>6: typo3temp/</strong>
00534                                         Here you can manage the files in typo3temp/ folder in a simple manner. typo3temp/ contains temporary files, which may still be used by the website, but some may not. By searching for files with old access-dates, you can possibly manage to delete unused files rather than files still used. However if you delete a temporary file still in use, it's just regenerated as long as you make sure to clear the cache tables afterwards.
00535                                         ");
00536 
00537                                         $this->message('About', 'Why is this script stand-alone?', "
00538                                         You would think that this script should rather be a module in the backend and access-controlled to only admin-users from the database. But that's not how it works.
00539                                         The reason is, that this script must not be depending on the success of the configuration of TYPO3 and whether or not there is a working database behind. Therefore the script is invoked from the backend init.php file, which allows access if the constant 'TYPO3_enterInstallScript' has been defined and is not false. That is and should be the case <i>only</i> when calling the script 'typo3/install/index.php' - this script!
00540                                         ");
00541 
00542 
00543                                         $headCode='Header legend';
00544                                         $this->message($headCode, 'Just information', '
00545                                         This is a simple message with some information about something.
00546                                         ');
00547                                         $this->message($headCode, 'Check was successful', '
00548                                         Indicates that something was checked and returned an expected result.
00549                                         ',-1);
00550                                         $this->message($headCode, 'Notice!', '
00551                                         Indicates that something is important to be aware of.
00552                                         This does <em>not</em> indicate an error.
00553                                         ',1);
00554                                         $this->message($headCode, 'Warning!', '
00555                                         Indicates that something may very well cause trouble and you should definitely look into it before proceeding.
00556                                         This indicates a <em>potential</em> error.
00557                                         ',2);
00558                                         $this->message($headCode, 'Error!', '
00559                                         Indicates that something is definitely wrong and that TYPO3 will most likely not perform as expected if this problem is not solved.
00560                                         This indicates an actual error.
00561                                         ',3);
00562 
00563                                         echo $this->outputWrapper($this->printAll());
00564                                 break;
00565                         }
00566                 }
00567         }
00568 
00574         function stepOutput()   {
00575                 $this->checkTheConfig();
00576                 $error_missingConnect='<br />
00577                         '.$this->fontTag2.'<img src="'.$this->backPath.'gfx/icon_fatalerror.gif" width="18" height="16" class="absmiddle">
00578                         There is no connection to the database!<br />
00579                         (Username: <i>'.TYPO3_db_username.'</i>, Password: <i>'.TYPO3_db_password.'</i>, Host: <i>'.TYPO3_db_host.'</i>).<br />
00580                         <br />
00581                         <strong>Go to Step 1</strong> and enter a proper username/password!</span>
00582                         <br />
00583                         <br />
00584                 ';
00585                 $error_missingDB='<br />
00586                         '.$this->fontTag2.'<img src="'.$this->backPath.'gfx/icon_fatalerror.gif" width="18" height="16" class="absmiddle">
00587                         There is no access to the database (<i>'.TYPO3_db.'</i>)!<br />
00588                         <br />
00589                         <strong>Go to Step 2</strong> and select an accessible database!</span>
00590                         <br />
00591                         <br />
00592                 ';
00593 
00594                 $whichTables=$this->getListOfTables();
00595                 $dbInfo='
00596                                         <table border="0" cellpadding="1" cellspacing="0">
00597                                                 <tr>
00598                                                         <td valign="top" nowrap="nowrap" colspan="2" align="center">'.$this->fontTag2.'<strong><img src="'.$this->backPath.'gfx/icon_note.gif" hspace="5" width="18" height="16" class="absmiddle">Database summary:</strong></span></td>
00599                                                 </tr>
00600                                                 <tr>
00601                                                         <td valign="top" nowrap="nowrap">'.$this->fontTag1.'Username:</span></td>
00602                                                         <td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db_username.'</span></strong></td>
00603                                                 </tr>
00604                                                 <tr>
00605                                                         <td valign="top" nowrap="nowrap">'.$this->fontTag1.'Password:</span></td>
00606                                                         <td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db_password.'</span></strong></td>
00607                                                 </tr>
00608                                                 <tr>
00609                                                         <td valign="top" nowrap="nowrap">'.$this->fontTag1.'Host:</span></td>
00610                                                         <td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db_host.'</span></strong></td>
00611                                                 </tr>
00612                                                 <tr>
00613                                                         <td valign="top" nowrap="nowrap">'.$this->fontTag1.'Database:</span></td>
00614                                                         <td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db.'</span></strong></td>
00615                                                 </tr>
00616                                                 <tr>
00617                                                         <td valign="top" nowrap="nowrap">'.$this->fontTag1.'# of tables:</span></td>
00618                                                         <td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.(count($whichTables)?'<span style="color:#f00;">'.count($whichTables).'</span>':count($whichTables)).'</span></strong></td>
00619                                                 </tr>
00620                                         </table>
00621                 ';
00622                 $error_emptyDB='<br />
00623                         '.$this->fontTag2.'<img src="'.$this->backPath.'gfx/icon_fatalerror.gif" width="18" height="16" class="absmiddle">
00624                         The database is still empty. There are no tables!<br />
00625                         <br />
00626                         <strong>Go to Step 3</strong> and import a database!</span>
00627                         <br />
00628                         <br />
00629                 ';
00630 
00631                 switch(strtolower($this->step)) {
00632                         case 1:
00633                                 $msg='
00634 <br />
00635 <br />
00636                                         <table border="0">
00637                                            <form action="'.$this->action.'" method="post">
00638                                                 <tr>
00639                                                         <td valign="top" nowrap="nowrap"><strong>
00640                                                            '.$this->fontTag2.'Username:</span></strong>
00641                                                         </td>
00642                                                         <td>    &nbsp;
00643                                                         </td>
00644                                                         <td valign="top">
00645                                                            '.$this->fontTag2.'
00646                                                            <input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_username]" value="'.TYPO3_db_username.'"></span><br />
00647                                                         </td>
00648                                                 </tr>
00649                                                 <tr>
00650                                                         <td valign="top" nowrap="nowrap"><strong>
00651                                                            '.$this->fontTag2.'Password:</span></strong>
00652                                                         </td>
00653                                                         <td>    &nbsp;
00654                                                         </td>
00655                                                         <td valign="top">
00656                                                            '.$this->fontTag2.'
00657                                                            <input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_password]" value="'.TYPO3_db_password.'"></span><br />
00658                                                         </td>
00659                                                 </tr>
00660                                                 <tr>
00661                                                         <td valign="top" nowrap="nowrap"><strong>
00662                                                            '.$this->fontTag2.'Host:</span></strong>
00663                                                         </td>
00664                                                         <td>    &nbsp;
00665                                                         </td>
00666                                                         <td valign="top">
00667                                                            '.$this->fontTag2.'
00668                                                            <input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_host]" value="'.(TYPO3_db_host?TYPO3_db_host:'localhost').'"></span><br />
00669                                                         </td>
00670                                                 </tr>
00671                                                 <tr>
00672                                                         <td valign="top" nowrap="nowrap"><strong>
00673                                                            '.$this->fontTag1.'</span></strong>
00674                                                         </td>
00675                                                         <td>    &nbsp;
00676                                                         </td>
00677                                                         <td valign="top">
00678                                                            '.$this->fontTag1.'<br />
00679                                                            <input type="hidden" name="step" value="2">
00680                                                            <input type="hidden" name="TYPO3_INSTALL[localconf.php][encryptionKey]" value="'.md5(uniqid(rand(),true)).'">
00681                                                                  <input type="hidden" name="TYPO3_INSTALL[localconf.php][compat_version]" value="'.TYPO3_version.'">
00682                                                            <input type="submit" value="Continue"><br /><br /><strong>NOTICE: </strong>By clicking this button, typo3conf/localconf.php is updated with new values for the parameters listed above!</span><br />
00683                                                         </td>
00684                                                 </tr>
00685                                            </form>
00686                                         </table>
00687 <br />
00688 <br />
00689                                 ';
00690                         break;
00691                         case 2:
00692                                 if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password))  {
00693                                         $dbArr = $this->getDatabaseList();
00694                                         reset($dbArr);
00695                                         $options='';
00696                                         $options.='<option value="">[ SELECT DATABASE ]</option>';
00697                                         $dbIncluded=0;
00698                                         while(list(,$dbname)=each($dbArr))      {
00699                                                 $options.='<option value="'.htmlspecialchars($dbname).'"'.($dbname==TYPO3_db?' selected="selected"':'').'>'.htmlspecialchars($dbname).'</option>';
00700                                                 if ($dbname==TYPO3_db)  $dbIncluded=1;
00701                                         }
00702                                         if (!$dbIncluded && TYPO3_db)   {
00703                                                 $options.='<option value="'.htmlspecialchars(TYPO3_db).'" selected="selected">'.htmlspecialchars(TYPO3_db).' (NO ACCESS!)</option>';
00704                                         }
00705                                         $select='<select name="TYPO3_INSTALL[localconf.php][typo_db]">'.$options.'</select>';
00706                                         $msg='
00707 <br />
00708 <br />
00709                                         <table border="0">
00710                                            <form action="'.$this->action.'" method="post">
00711                                                 <tr>
00712                                                         <td valign="top" nowrap="nowrap"><strong>
00713                                                            '.$this->fontTag2.'
00714                                                            You have two options:<br />
00715                                                            <br /><br />
00716 
00717                                                            1: Select an existing <u>EMPTY</u> database:</span></strong>
00718                                                         </td>
00719                                                 </tr>
00720                                                 <tr>
00721                                                         <td valign="top">
00722                                                            '.$this->fontTag1.'Any existing tables which are used by TYPO3 will be overwritten in Step 3. So make sure this database is empty:<br />'.$select.'</span><br />
00723                                                         </td>
00724                                                 </tr>
00725                                                 <tr>
00726                                                         <td valign="top" nowrap="nowrap"><br />
00727                                                         <br />
00728 <strong>
00729                                                            '.$this->fontTag2.'2: Create new database (recommended):</span></strong>
00730                                                         </td>
00731                                                 </tr>
00732                                                 <tr>
00733                                                         <td valign="top">
00734                                                            '.$this->fontTag1.'Enter the desired name of the database here:<br /><input type="text" name="TYPO3_INSTALL[localconf.php][NEW_DATABASE_NAME]" value=""></span><br />
00735                                                         </td>
00736                                                 </tr>
00737                                                 <tr>
00738                                                         <td valign="top">                  <br />
00739 
00740                                                            '.$this->fontTag1.'<br />
00741                                                            <input type="hidden" name="step" value="3">
00742                                                            <input type="submit" value="Continue"><br /><br /><strong>NOTICE: </strong>By clicking this button, typo3conf/localconf.php is updated with new values for the parameters listed above!</span><br />
00743                                                         </td>
00744                                                 </tr>
00745                                            </form>
00746                                         </table>
00747 <br />
00748 <br />
00749                                 ';
00750                                 } else {
00751                                         $msg=$error_missingConnect;
00752                                 }
00753                         break;
00754                         case 3:
00755                                 if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password))  {
00756                                         if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db))      {
00757                                                 $sFiles = t3lib_div::getFilesInDir(PATH_typo3conf,'sql',1,1);
00758 
00759                                                         // Check if default database scheme "database.sql" already exists, otherwise create it
00760                                                 if (!strstr(implode(',',$sFiles).',', '/database.sql,'))        {
00761                                                         array_unshift($sFiles,'Create default database tables');
00762                                                 }
00763 
00764                                                 $opt='';
00765                                                 foreach ($sFiles as $f) {
00766                                                         if ($f=='Create default database tables')       $key='CURRENT_TABLES+STATIC';
00767                                                         else $key=htmlspecialchars($f);
00768 
00769                                                         $opt.='<option value="import|'.$key.'">'.htmlspecialchars(basename($f)).'</option>';
00770                                                 }
00771 
00772 
00773                                                 $content='
00774                                                         '.$this->fontTag2.'Please select a database dump:</span><br />
00775                                                         <input type="hidden" name="TYPO3_INSTALL[database_import_all]" value=1>
00776                                                    <input type="hidden" name="step" value="">
00777                                                    <input type="hidden" name="goto_step" value="go">
00778                                                         <select name="TYPO3_INSTALL[database_type]">'.$opt.'</select><br />';
00779 
00780                                                 $content = $this->getUpdateDbFormWrap('import', $content, 'Import database');
00781 
00782                                                 $msg='
00783                                                 <br />
00784                                                 '.$dbInfo.'<br />
00785                                                 <br />
00786                                                 '.$content.'
00787 
00788                                                 ';
00789 
00790                                         } else {
00791                                                 $msg=$error_missingDB;
00792                                         }
00793                                 } else {
00794                                         $msg=$error_missingConnect;
00795                                 }
00796                         break;
00797                         case 'go':
00798                                 if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password))  {
00799                                         if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db))      {
00800                                                 if (count($whichTables))        {
00801                                                         $msg='
00802                                                         <br />
00803                                                         '.$this->fontTag2.'
00804                                                         '.nl2br($this->messageBasicFinished()).'
00805                                                         <br />
00806                                                         <hr />
00807                                                         <div align="center"><strong><img src="'.$this->backPath.'gfx/icon_warning.gif" hspace="5" width="18" height="16" class="absmiddle">IMPORTANT</strong></div><br />
00808                                                         <span class="smalltext">'.nl2br($this->securityRisk()).'
00809                                                         <br />
00810                                                         <strong>Enter <a href="'.$this->scriptSelf.'">"Normal" mode for the Install Tool</a> to change this!</strong><br />
00811 
00812                                                         </span>
00813                                                         </span><br />
00814                                                         ';
00815                                                 } else {
00816                                                         $msg=$error_emptyDB;
00817                                                 }
00818                                         } else {
00819                                                 $msg=$error_missingDB;
00820                                         }
00821                                 } else {
00822                                         $msg=$error_missingConnect;
00823                                 }
00824                         break;
00825                         default:
00826                         break;
00827                 }
00828                 return $msg;
00829         }
00830 
00836         function checkTheConfig()       {
00837                         // Order important:
00838                 $this->checkDirs();
00839                 $this->checkConfiguration();
00840                 $this->checkExtensions();
00841 
00842                 if (TYPO3_OS=='WIN')    {
00843                         $paths=array($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'], $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'], 'c:\\php\\imagemagick\\', 'c:\\apache\\ImageMagick\\');
00844                 } else {
00845                         $paths=array($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'], $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'], '/usr/local/bin/','/usr/bin/','/usr/X11R6/bin/');
00846                 }
00847 
00848                 asort($paths);
00849                 if (ini_get('safe_mode'))       {
00850                         $paths=array(ini_get('safe_mode_exec_dir'),'/usr/local/php/bin/');
00851                 }
00852                 if ($this->INSTALL['checkIM']['lzw'])   {
00853                         $this->checkIMlzw=1;
00854                 }
00855                 if ($this->INSTALL['checkIM']['path'])  {
00856                         $paths[]=trim($this->INSTALL['checkIM']['path']);
00857                 }
00858                 if ($this->checkIM)     $this->checkImageMagick($paths);
00859                 $this->checkDatabase();
00860         }
00861 
00867         function typo3conf_edit()       {
00868                 $EDIT_path = PATH_typo3conf;    // default:
00869                 if ($this->allowFileEditOutsite_typo3conf_dir && $this->INSTALL['FILE']['EDIT_path'])   {
00870                         if (t3lib_div::validPathStr($this->INSTALL['FILE']['EDIT_path']) && substr($this->INSTALL['FILE']['EDIT_path'],-1)=='/')        {
00871                                 $tmp_path = PATH_site.$this->INSTALL['FILE']['EDIT_path'];
00872                                 if (is_dir($tmp_path))  {
00873                                         $EDIT_path=$tmp_path;
00874                                 } else {debug("'".$tmp_path."' was not dir");}
00875                         } else {
00876                                 debug('BAD DIR_NAME (must be like t3lib/ or media/script/)');
00877                         }
00878                 }
00879 
00880                 $headCode = 'Edit files in '.basename($EDIT_path).'/';
00881                 $this->contentBeforeTable='';
00882 
00883                 if ($this->INSTALL['SAVE_FILE'])        {
00884                         $save_to_file = $this->INSTALL['FILE']['name'];
00885                         if (@is_file($save_to_file))    {
00886                                 $save_to_file_md5 = md5($save_to_file);
00887                                 if (isset($this->INSTALL['FILE'][$save_to_file_md5]) && t3lib_div::isFirstPartOfStr($save_to_file,$EDIT_path.'') && substr($save_to_file,-1)!='~' && !strstr($save_to_file,'_bak'))     {
00888                                         $this->INSTALL['typo3conf_files'] = $save_to_file;
00889                                         $save_fileContent = $this->INSTALL['FILE'][$save_to_file_md5];
00890 
00891                                         if ($this->INSTALL['FILE']['win_to_unix_br'])   {
00892                                                 $save_fileContent = str_replace(chr(13).chr(10),chr(10),$save_fileContent);
00893                                         }
00894 
00895                                         $backupFile = $this->getBackupFilename($save_to_file);
00896                                         if ($this->INSTALL['FILE']['backup'])   {
00897                                                 if (@is_file($backupFile))      { unlink($backupFile); }
00898                                                 rename($save_to_file,$backupFile);
00899                                                 $this->contentBeforeTable.='Backup written to <strong>'.$backupFile.'</strong><br />';
00900                                         }
00901 
00902                                         t3lib_div::writeFile($save_to_file,$save_fileContent);
00903                                         $this->contentBeforeTable.='
00904                                                 File saved: <strong>'.$save_to_file.'</strong><br />
00905                                                 MD5-sum: '.$this->INSTALL['FILE']['prevMD5'].' (prev)<br />
00906                                                 MD5-sum: '.md5($save_fileContent).' (new)<br />
00907                                         ';
00908                                 }
00909                         }
00910                 }
00911 
00912 
00913                         // Filelist:
00914                 $typo3conf_files = t3lib_div::getFilesInDir($EDIT_path,'',1,1);
00915                 reset($typo3conf_files);
00916                 $lines=array();
00917                 $fileFound = 0;
00918                 while(list($k,$file)=each($typo3conf_files))    {
00919                         if ($this->INSTALL['typo3conf_files'] && !strcmp($this->INSTALL['typo3conf_files'],$file))      {
00920                                 $wrap=array('<strong><span style="color:navy;">','</span></strong>');
00921                                 $fileFound = 1;
00922                         } else {$wrap=array();}
00923                         $lines[]='<tr><td nowrap="nowrap"><a href="'.$this->action.'&TYPO3_INSTALL[typo3conf_files]='.rawurlencode($file).($this->allowFileEditOutsite_typo3conf_dir?'&TYPO3_INSTALL[FILE][EDIT_path]='.rawurlencode($this->INSTALL['FILE']['EDIT_path']):"").'">'.$this->fw($wrap[0].basename($file).$wrap[1].'&nbsp;&nbsp;&nbsp;').'</a></td><td>'.$this->fw(t3lib_div::formatSize(filesize($file))).'</td></tr>';
00924                 }
00925                 $fileList='<table border="0" cellpadding="0" cellspacing="0">'.implode('',$lines).'</table>';
00926                 $fileList.='<br />('.$EDIT_path.')';
00927 
00928                 if ($this->allowFileEditOutsite_typo3conf_dir)  {
00929                         $fileList.='<br /><form action="'.$this->action.'" method="post">
00930                         '.PATH_site.'<input type="text" name="TYPO3_INSTALL[FILE][EDIT_path]" value="'.$this->INSTALL['FILE']['EDIT_path'].'"><input type="submit" name="" value="Set">
00931                         </form>';
00932                 }
00933 
00934                 if ($fileFound && @is_file($this->INSTALL['typo3conf_files']))  {
00935                         $this->headerStyle = '
00936                         <style type="text/css"><!--
00937                                 SELECT {font-family: Verdana,Arial,Helvetica,Sans-serif; font-size: 10px;}
00938                                 TEXTAREA  {font-family: Verdana,Arial,Helvetica,Sans-serif; font-size: 10px;}
00939                                 INPUT {font-family: Verdana,Arial,Helvetica,Sans-serif; font-size: 10px;}
00940                         //--></style>
00941                         ';
00942 
00943                         $backupFile = $this->getBackupFilename($this->INSTALL['typo3conf_files']);
00944                         $fileContent = t3lib_div::getUrl($this->INSTALL['typo3conf_files']);
00945                         $this->contentBeforeTable.= '<form action="'.$this->action.'" method="post">'.(substr($this->INSTALL['typo3conf_files'],-1)!='~' && !strstr($this->INSTALL['typo3conf_files'],'_bak') ? '
00946                                 <input type="submit" name="TYPO3_INSTALL[SAVE_FILE]" value="Save file">&nbsp;' : '').'
00947                                 <input type="submit" name="_close" value="Close">
00948                                 <br />File: '.$this->INSTALL['typo3conf_files'].'
00949                                 <br />MD5-sum: '.md5($fileContent).'
00950                                 <br />
00951 
00952                                 <input type="hidden" name="TYPO3_INSTALL[FILE][name]" value="'.$this->INSTALL['typo3conf_files'].'">
00953                                 '.($this->allowFileEditOutsite_typo3conf_dir?'<input type="hidden" name="TYPO3_INSTALL[FILE][EDIT_path]" value="'.$this->INSTALL['FILE']['EDIT_path'].'">':'').'
00954                                 <input type="hidden" name="TYPO3_INSTALL[FILE][prevMD5]" value="'.md5($fileContent).'">
00955                                 <textarea rows="30" name="TYPO3_INSTALL[FILE]['.md5($this->INSTALL['typo3conf_files']).']" wrap="off"'.$this->formWidthText(48,'width:98%;height:80%','off').' class="fixed-font enable-tab">'.t3lib_div::formatForTextarea($fileContent).'</textarea><br />
00956                                 <input type="checkbox" name="TYPO3_INSTALL[FILE][win_to_unix_br]" value="1"'.(TYPO3_OS=='WIN'?'':' checked="checked"').'> Convert Windows linebreaks (13-10) to Unix (10)<br />
00957                                 <input type="checkbox" name="TYPO3_INSTALL[FILE][backup]" value="1"'.(@is_file($backupFile) ? ' checked="checked"' : '').'> Make backup copy (rename to '.basename($backupFile).')<br />
00958                                 '.
00959                         '</form>';
00960                 }
00961 
00962                 if ($this->contentBeforeTable)  {
00963                         $this->contentBeforeTable = $this->fw($this->contentBeforeTable);
00964                 }
00965 
00966                 $this->message($headCode,'Files in folder',$fileList);
00967 
00968                 echo $this->outputWrapper($this->printAll());
00969         }
00970 
00976         function phpinformation()       {
00977                 $headCode = 'PHP information';
00978 
00979                 $sVar = t3lib_div::getIndpEnv('_ARRAY');
00980                 $sVar['CONST: PHP_OS']=PHP_OS;
00981                 $sVar['CONST: TYPO3_OS']=TYPO3_OS;
00982                 $sVar['CONST: PATH_thisScript']=PATH_thisScript;
00983                 $sVar['CONST: php_sapi_name()']=php_sapi_name();
00984                 $sVar['OTHER: TYPO3_VERSION']=$GLOBALS['TYPO_VERSION'];
00985                 $sVar['OTHER: PHP_VERSION']=phpversion();
00986                 $sVar['imagecreatefromgif()']=function_exists('imagecreatefromgif');
00987                 $sVar['imagecreatefrompng()']=function_exists('imagecreatefrompng');
00988                 $sVar['imagecreatefromjpeg()']=function_exists('imagecreatefromjpeg');
00989                 $sVar['imagegif()']=function_exists('imagegif');
00990                 $sVar['imagepng()']=function_exists('imagepng');
00991                 $sVar['imagejpeg()']=function_exists('imagejpeg');
00992                 $sVar['imagettftext()']=function_exists('imagettftext');
00993                 $sVar['OTHER: IMAGE_TYPES']=function_exists('imagetypes') ? imagetypes() : 0;
00994                 $sVar['OTHER: memory_limit']=ini_get('memory_limit');
00995 
00996                 $gE_keys = explode(',','SERVER_PORT,SERVER_SOFTWARE,GATEWAY_INTERFACE,SCRIPT_NAME,PATH_TRANSLATED');
00997                 while(list(,$k)=each($gE_keys)) {
00998                         $sVar['SERVER: '.$k]=$_SERVER[$k];
00999                 }
01000 
01001                 $gE_keys = explode(',','image_processing,gdlib,gdlib_png,gdlib_2,im,im_path,im_path_lzw,im_version_5,im_negate_mask,im_imvMaskState,im_combine_filename');
01002                 while(list(,$k)=each($gE_keys)) {
01003                         $sVar['T3CV_GFX: '.$k]=$GLOBALS['TYPO3_CONF_VARS']['GFX'][$k];
01004                 }
01005 
01006                 $debugInfo=array();
01007                 $debugInfo[]='### DEBUG SYSTEM INFORMATION - START ###';
01008                 reset($sVar);
01009                 while(list($kkk,$vvv)=each($sVar))      {
01010                         $debugInfo[]=str_pad(substr($kkk,0,20),20).': '.$vvv;
01011                 }
01012                 $debugInfo[]='### DEBUG SYSTEM INFORMATION - END ###';
01013 
01014                 $buf=$this->messageFunc_nl2br;
01015                 $this->messageFunc_nl2br=0;
01016                 $this->message($headCode,'DEBUG information','Please copy/paste the information from this text field into an email or bug-report as "Debug System Information" whenever you wish to get support or report problems. This information helps others to check if your system has some obvious misconfiguration and you\'ll get your help faster!<br />
01017                 <form action=""><textarea rows="10" '.$this->formWidthText(80,'','off').' wrap="off" class="fixed-font">'.t3lib_div::formatForTextarea(implode(chr(10),$debugInfo)).'</textarea></form>');
01018                 $this->messageFunc_nl2br=$buf;
01019 
01020                 $getEnvArray = array();
01021                 $gE_keys = explode(',','QUERY_STRING,HTTP_ACCEPT,HTTP_ACCEPT_ENCODING,HTTP_ACCEPT_LANGUAGE,HTTP_CONNECTION,HTTP_COOKIE,HTTP_HOST,HTTP_USER_AGENT,REMOTE_ADDR,REMOTE_HOST,REMOTE_PORT,SERVER_ADDR,SERVER_ADMIN,SERVER_NAME,SERVER_PORT,SERVER_SIGNATURE,SERVER_SOFTWARE,GATEWAY_INTERFACE,SERVER_PROTOCOL,REQUEST_METHOD,SCRIPT_NAME,PATH_TRANSLATED,HTTP_REFERER,PATH_INFO');
01022                 while(list(,$k)=each($gE_keys)) {
01023                         $getEnvArray[$k] = getenv($k);
01024                 }
01025                 $this->message($headCode,'t3lib_div::getIndpEnv()',t3lib_div::view_array(t3lib_div::getIndpEnv('_ARRAY')));
01026                 $this->message($headCode,'getenv()',t3lib_div::view_array($getEnvArray));
01027                 $this->message($headCode,'_ENV',t3lib_div::view_array($_ENV));
01028                 $this->message($headCode,'_SERVER',t3lib_div::view_array($_SERVER));
01029                 $this->message($headCode,'_COOKIE',t3lib_div::view_array($_COOKIE));
01030                 $this->message($headCode,'_GET',t3lib_div::view_array($_GET));
01031 
01032                 ob_start();
01033                 phpinfo();
01034                 $contents = explode('<body>',ob_get_contents());
01035                 ob_end_clean();
01036                 $contents = explode('</body>',$contents[1]);
01037 
01038                 $this->message($headCode,'phpinfo()',$contents[0]);
01039 
01040 
01041 
01042 $this->headerStyle = '
01043 <style type="text/css"><!--
01044 a { text-decoration: none; }
01045 a:hover { text-decoration: underline; }
01046 h1 { font-family: verdana,arial, helvetica, sans-serif; font-size: 14pt; font-weight: bold;}
01047 h2 { font-family: verdana,arial, helvetica, sans-serif; font-size: 12pt; font-weight: bold;}
01048 body, td { font-family: verdana,arial, helvetica, sans-serif; font-size: 10pt; }
01049 th { font-family: verdana,arial, helvetica, sans-serif; font-size: 10pt; font-weight: bold; }
01050 //--></style>
01051 ';
01052 
01053                 echo $this->outputWrapper($this->printAll());
01054         }
01055 
01056 
01057 
01058 
01059 
01060 
01061 
01062 
01063 
01064 
01065 
01066 
01067 
01068         /*******************************
01069          *
01070          * typo3temp/ manager
01071          *
01072          *******************************/
01073 
01079         function typo3TempManager()     {
01080                 $headCode = 'typo3temp/ directory';
01081                 $this->message($headCode,'What is it?','
01082                 TYPO3 uses this directory for temporary files, mainly processed and cached images.
01083                 The filenames are very cryptic; They are unique representations of the file properties made by md5-hashing a serialized array with information.
01084                 Anyway this directory may contain many thousand files and a lot of them may be of no use anymore.
01085 
01086                 With this test you can delete the files in this folder. When you do that, you should also clear the cache database tables afterwards.
01087                 ');
01088 
01089                 if (!$this->config_array['dir_typo3temp'])      {
01090                         $this->message('typo3temp/ directory','typo3temp/ not writable!',"
01091                                 You must make typo3temp/ write enabled before you can proceed with this test.
01092                         ",2);
01093                         echo $this->outputWrapper($this->printAll());
01094                         return;
01095                 }
01096 
01097                         // Run through files
01098                 $fileCounter = 0;
01099                 $deleteCounter = 0;
01100                 $criteriaMatch = 0;
01101                 $tmap=array('day'=>1, 'week'=>7, 'month'=>30);
01102                 $tt = $this->INSTALL['typo3temp_delete'];
01103                 $subdir = $this->INSTALL['typo3temp_subdir'];
01104                 if (strlen($subdir) && !ereg('^[[:alnum:]_]+/$',$subdir))       die('subdir "'.$subdir.'" was not allowed!');
01105                 $action = $this->INSTALL['typo3temp_action'];
01106                 $d = @dir($this->typo3temp_path.$subdir);
01107                 if (is_object($d))      {
01108                         while($entry=$d->read()) {
01109                                 $theFile = $this->typo3temp_path.$subdir.$entry;
01110                                 if (@is_file($theFile)) {
01111                                         $ok = 0;
01112                                         $fileCounter++;
01113                                         if ($tt)        {
01114                                                 if (t3lib_div::testInt($tt))    {
01115                                                         if (filesize($theFile) > $tt*1024)      $ok=1;
01116                                                 } else {
01117                                                         if (fileatime($theFile) < time()-(intval($tmap[$tt])*60*60*24)) $ok=1;
01118                                                 }
01119                                         } else {
01120                                                 $ok = 1;
01121                                         }
01122                                         if ($ok)        {
01123                                                 $hashPart=substr(basename($theFile),-14,10);
01124                                                 if (!ereg('[^a-f0-9]',$hashPart) || substr($theFile,-6)==='.cache' || substr($theFile,-4)==='.tbl' || substr(basename($theFile),0,8)==='install_')      {               // This is a kind of check that the file being deleted has a 10 char hash in it
01125                                                         if ($action && $deleteCounter<$action)  {
01126                                                                 $deleteCounter++;
01127                                                                 unlink($theFile);
01128                                                         } else {
01129                                                                 $criteriaMatch++;
01130                                                         }
01131                                                 }
01132                                         }
01133                                 }
01134                         }
01135                         $d->close();
01136                 }
01137 
01138                         // Find sub-dirs:
01139                 $subdirRegistry = array(''=>'');
01140                 $d = @dir($this->typo3temp_path);
01141                 if (is_object($d))      {
01142                         while($entry=$d->read()) {
01143                                 $theFile = $entry;
01144                                 if (@is_dir($this->typo3temp_path.$theFile) && $theFile!='..' && $theFile!='