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

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_branch.'">
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']=TYPO3_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!='.') {
01145                                         $subdirRegistry[$theFile.'/'] = $theFile.'/ (Files: '.count(t3lib_div::getFilesInDir($this->typo3temp_path.$theFile)).')';
01146                                 }
01147                         }
01148                 }
01149 
01150                 $deleteType=array(
01151                         '0' => 'All',
01152                         'day' => 'Last access more than a day ago',
01153                         'week' => 'Last access more than a week ago',
01154                         'month' => 'Last access more than a month ago',
01155                         '10' => 'Filesize greater than 10 kb',
01156                         '50' => 'Filesize greater than 50 kb',
01157                         '100' => 'Filesize greater than 100 kb'
01158                 );
01159 
01160                 $actionType=array(
01161                         '0' => "Don't delete, just display statistics",
01162                         '100' => 'Delete 100',
01163                         '500' => 'Delete 500',
01164                         '1000' => 'Delete 1000'
01165                 );
01166 
01167                 $content='<select name="TYPO3_INSTALL[typo3temp_delete]">'.$this->getSelectorOptions($deleteType,$tt).'</select>
01168                 <br />
01169 Number of files at a time:
01170                 <select name="TYPO3_INSTALL[typo3temp_action]">'.$this->getSelectorOptions($actionType).'</select>
01171 
01172 From sub-directory:
01173                 <select name="TYPO3_INSTALL[typo3temp_subdir]">'.$this->getSelectorOptions($subdirRegistry, $this->INSTALL['typo3temp_subdir']).'</select>
01174                 ';
01175 
01176                 $form = '<form action="'.$this->action.'" method="post">'.$content.'
01177 
01178                 <input type="submit" value="Execute">
01179                 </form>
01180                 This tool will delete files only if the last 10 characters before the extension (3 chars+\'.\') are hexadecimal valid ciphers, which are lowercase a-f and 0-9.';
01181 
01182                 $this->message($headCode,'Statistics','
01183                 Number of temporary files: <strong>'.($fileCounter-$deleteCounter)."</strong>
01184                 Number matching '".htmlspecialchars($deleteType[$tt])."': <strong>".$criteriaMatch.'</strong>
01185                 Number deleted: <strong>'.$deleteCounter.'</strong>
01186                 <br />
01187                 '.$form,1);
01188 
01189                 echo $this->outputWrapper($this->printAll());
01190         }
01191 
01199         function getSelectorOptions($deleteType,$tt='') {
01200                 $out='';
01201                 if (is_array($deleteType))      {
01202                         reset($deleteType);
01203                         while(list($v,$l)=each($deleteType))    {
01204                                 $out.='<option value="'.htmlspecialchars($v).'"'.(!strcmp($v,$tt)?' selected="selected"':'').'>'.htmlspecialchars($l).'</option>';
01205                         }
01206                 }
01207                 return $out;
01208         }
01209 
01210 
01211 
01212 
01213 
01214 
01215 
01216 
01217 
01218         /*******************************
01219          *
01220          * cleanup manager
01221          *
01222          *******************************/
01223 
01231         function cleanupManager()       {
01232                 $headCode = 'Clean up database';
01233                 $this->message($headCode,'What is it?','
01234                 This function will become a general clean up manager for various tables used by TYPO3. By now you can only empty the cache which is used for storing image sizes of all pictures used in TYPO3.
01235 
01236                 <strong>Clear cached image sizes</strong>
01237                 Clears the cache used for memorizing sizes of all images used in your website. This information is cached in order to gain performance and will be stored each time a new image is being displayed in the frontend.
01238 
01239                 You should <em>Clear All Cache</em> in the backend after clearing this cache.
01240                 ');
01241 
01242                 $tables = $this->getListOfTables();
01243                 $action = $this->INSTALL['cleanup_type'];
01244 
01245                 if (($action == 'cache_imagesizes' || $action == 'all') && isset ($tables['cache_imagesizes'])) {
01246                         $GLOBALS['TYPO3_DB']->exec_DELETEquery ('cache_imagesizes','');
01247                 }
01248 
01249                 $cleanupType = array (
01250                         'all' => 'Clean up everything',
01251                 );
01252 
01253                         // Get cache_imagesizes info
01254                 if (isset ($tables['cache_imagesizes'])) {
01255                         $cleanupType['cache_imagesizes'] = 'Clear cached image sizes only';
01256                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('COUNT(*) AS icount', 'cache_imagesizes', '');
01257                         $resArr = $GLOBALS['TYPO3_DB']->sql_fetch_assoc ($res);
01258                         $cachedImageSizesCounter = intval ($resArr['icount']);
01259                 } else {
01260                         $this->message($headCode,'Table cache_imagesizes does not exist!',"
01261                                 The table cache_imagesizes was not found. Please check your database settings in Basic Configuration and compare your table definition with the Database Analyzer.
01262                         ",2);
01263                         $cachedImageSizesCounter = 'unknown';
01264                 }
01265 
01266                 $content = '<select name="TYPO3_INSTALL[cleanup_type]">'.$this->getSelectorOptions($cleanupType).'</select> ';
01267                 $form = '<form action="'.$this->action.'" method="post">'.$content.'<input type="submit" value="Execute"></form>';
01268                 $this->message($headCode,'Statistics','
01269                         Number cached image sizes: <strong>'.$cachedImageSizesCounter.'</strong><br />
01270                 '.$form,1);
01271 
01272                 echo $this->outputWrapper($this->printAll());
01273         }
01274 
01275 
01276 
01277 
01278 
01279 
01280 
01281 
01282 
01283 
01284 
01285 
01286 
01287         /*******************************
01288          *
01289          * CONFIGURATION FORM
01290          *
01291          ********************************/
01292 
01299         function generateConfigForm($type='')   {
01300                 $default_config_content = t3lib_div::getUrl(PATH_t3lib.'config_default.php');
01301                 $commentArr = $this->getDefaultConfigArrayComments($default_config_content);
01302 
01303                 switch($type)   {
01304                         case 'get_form':
01305                                 reset($GLOBALS['TYPO3_CONF_VARS']);
01306                                 $this->messageFunc_nl2br=0;
01307                                 while(list($k,$va)=each($GLOBALS['TYPO3_CONF_VARS']))   {
01308                                         $ext='['.$k.']';
01309                                         $this->message($ext, '$TYPO3_CONF_VARS[\''.$k.'\']',$commentArr[0][$k],1);
01310 
01311                                         while(list($vk,$value)=each($va))       {
01312                                                 $description = trim($commentArr[1][$k][$vk]);
01313                                                 $isTextarea = preg_match('/^string \(textarea\)/i',$description) ? TRUE : FALSE;
01314 
01315                                                 if (!is_array($value) && ($this->checkForBadString($value) || $isTextarea))     {
01316                                                         $k2='['.$vk.']';
01317                                                         $msg=$description.'<br /><br /><em>'.$ext.$k2.' = '.htmlspecialchars(t3lib_div::fixed_lgd($value,60)).'</em><br />';
01318 
01319                                                         if ($isTextarea)        {
01320                                                                 $form='<textarea name="TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']" cols="60" rows="5" wrap="off">'.htmlspecialchars($value).'</textarea>';
01321                                                         } elseif (preg_match('/^boolean/i',$description)) {
01322                                                                 $form='<input type="hidden" name="TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']" value="0">';
01323                                                                 $form.='<input type="checkbox" name="TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']"'.($value?' checked="checked"':'').' value="'.($value&&strcmp($value,'0')?htmlspecialchars($value):1).'">';
01324                                                         } else {
01325                                                                 $form='<input type="text" size="40" name="TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']" value="'.htmlspecialchars($value).'">';
01326                                                         }
01327                                                         $this->message($ext, $k2,$msg.$form);
01328                                                 }
01329                                         }
01330                                 }
01331                         break;
01332                         default:
01333                                 if (is_array($this->INSTALL['extConfig']))              {
01334                                         reset($this->INSTALL['extConfig']);
01335                                         $lines = $this->writeToLocalconf_control();
01336                                         while(list($k,$va)=each($this->INSTALL['extConfig']))   {
01337                                                 if (is_array($GLOBALS['TYPO3_CONF_VARS'][$k]))  {
01338                                                         while(list($vk,$value)=each($va))       {
01339                                                                 if (isset($GLOBALS['TYPO3_CONF_VARS'][$k][$vk]))        {
01340                                                                         $doit=1;
01341                                                                         if ($k=='BE' && $vk=='installToolPassword')     {
01342                                                                                 if ($value)     {
01343                                                                                         if (isset($_POST['installToolPassword_check']) && (!t3lib_div::_GP('installToolPassword_check') || strcmp(t3lib_div::_GP('installToolPassword_check'),$value))) {
01344                                                                                                 $doit=0;
01345                                                                                                 t3lib_div::debug('ERROR: The two passwords did not match! The password was not changed.');
01346                                                                                         }
01347                                                                                         if (t3lib_div::_GP('installToolPassword_md5'))  $value =md5($value);
01348                                                                                 } else $doit=0;
01349                                                                         }
01350 
01351                                                                         $description = trim($commentArr[1][$k][$vk]);
01352                                                                         if (preg_match('/^string \(textarea\)/i', $description))        {
01353                                                                                 $value = str_replace(chr(13),'',$value);        // Force Unix linebreaks in textareas
01354                                                                                 $value = str_replace(chr(10),"'.chr(10).'",$value);     // Preserve linebreaks
01355                                                                         }
01356 
01357                                                                         if ($doit && strcmp($GLOBALS['TYPO3_CONF_VARS'][$k][$vk],$value))       $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\''.$k.'\'][\''.$vk.'\']', $value);
01358                                                                 }
01359                                                         }
01360                                                 }
01361                                         }
01362                                         $this->writeToLocalconf_control($lines);
01363                                 }
01364                         break;
01365                 }
01366         }
01367 
01376         function getDefaultConfigArrayComments($string,$mainArray=array(),$commentArray=array())        {
01377                 $lines = explode(chr(10),$string);
01378                 $in=0;
01379                 $mainKey='';
01380                 while(list(,$lc)=each($lines))  {
01381                         $lc = trim($lc);
01382                         if ($in) {
01383                                 if (!strcmp($lc,');'))  {
01384                                         $in=0;
01385                                 } else {
01386                                         if (preg_match('/["\']([[:alnum:]_-]*)["\'][[:space:]]*=>(.*)/i',$lc,$reg))     {
01387                                                 preg_match('/,[\t\s]*\/\/(.*)/i',$reg[2],$creg);
01388                                                 $theComment = trim($creg[1]);
01389                                                 if (substr(strtolower(trim($reg[2])),0,5)=='array' && !strcmp($reg[1],strtoupper($reg[1])))     {
01390                                                         $mainKey=trim($reg[1]);
01391                                                         $mainArray[$mainKey]=$theComment;
01392                                                 } elseif ($mainKey) {
01393                                                         $commentArray[$mainKey][$reg[1]]=$theComment;
01394                                                 }
01395                                         }
01396                                 }
01397                         }
01398                         if (!strcmp($lc,'$TYPO3_CONF_VARS = Array('))   {
01399                                 $in=1;
01400                         }
01401                 }
01402                 return array($mainArray,$commentArray);
01403         }
01404 
01405 
01406 
01407 
01408 
01409 
01410 
01411 
01412 
01413 
01414 
01415 
01416 
01417         /*******************************
01418          *
01419          * CHECK CONFIGURATION FUNCTIONS
01420          *
01421          *******************************/
01422 
01428         function checkConfiguration()   {
01429                 $ext='php.ini configuration checked';
01430                 $this->message($ext);
01431 
01432                         // *****************
01433                         // Incoming values:
01434                         // *****************
01435 
01436                         // Includepath
01437                 $incPaths = t3lib_div::trimExplode(TYPO3_OS=='WIN'?';':':', ini_get('include_path'));
01438                 if (!in_array('.',$incPaths))   {
01439                         $this->message($ext, 'Current dir (./) is not in include path!',"
01440                                 <i>include_path=".ini_get('include_path')."</i>
01441                                 Normally the current path, '.', is included in the include_path of PHP. Although TYPO3 is made to work around this it is an unusual setting that may introduce problems.
01442                         ",1);
01443                 } else $this->message($ext, 'Current dir in include path',"",-1);
01444 
01445                         // *****************
01446                         // File uploads
01447                         // *****************
01448                 if (!ini_get('file_uploads'))   {
01449                         $this->message($ext, 'File uploads not allowed',"
01450                                 <i>file_uploads=".ini_get('file_uploads')."</i>
01451                                 TYPO3 uses the ability to upload files from the browser in various cases.
01452                                 As long as this flag is disabled, you'll not be able to upload files.
01453                                 But it doesn't end here, because not only are files not accepted by the server - ALL content in the forms are discarded and therefore nothing at all will be editable if you don't set this flag!
01454                                 However if you cannot enable fileupload for some reason alternatively you change the default form encoding value with \$TYPO3_CONF_VARS[SYS][form_enctype].
01455                         ",3);
01456                 } else $this->message($ext, 'File uploads allowed',"",-1);
01457                 $upload_max_filesize = $this->convertByteSize(ini_get('upload_max_filesize'));
01458                 if ($upload_max_filesize<10000*1024)    {
01459                         $this->message($ext, 'Max Upload filesize too small?',"
01460                                 <i>upload_max_filesize=".ini_get('upload_max_filesize')."</i>
01461                                 By default TYPO3 supports uploading, copying and moving files of sizes up to 10000 kb (10 MB) (You can alter the TYPO3 defaults by the config option TYPO3_CONF_VARS[BE][maxFileSize]).
01462                                 Your current value is below this, so at this point, PHP sets the limits for uploaded filesizes and not TYPO3.
01463                                 <strong>Notice:</strong> The limits for filesizes attached to database records are set in the tables.php configuration file (\$TCA) for each group/file field.
01464                         ",1);
01465                 }
01466 
01467                         // *****************
01468                         // Memory and functions
01469                         // *****************
01470                 $memory_limit_value = $this->convertByteSize(ini_get('memory_limit'));
01471                 if ($memory_limit_value && $memory_limit_value < 16*1024*1024)  {
01472                         $this->message($ext, 'Memory Limit below 16 MB',"
01473                                 <i>memory_limit=".ini_get('memory_limit')."</i>
01474                                 Your system is configured to enforce a memory limit of PHP scripts lower than 16 MB. The Extension Manager needs to include more PHP-classes than will fit into this memory space. There is nothing else to do than raise the limit. To be safe, ask the system administrator of the webserver to raise the limit to over 25 MB.
01475                         ",3);
01476                 } elseif(!$memory_limit_value) {
01477                         $this->message($ext, 'Memory Limit',"<i>No Memory Limit in effect.</i>",-1);
01478                 } else $this->message($ext, 'Memory Limit',"<i>memory_limit=".ini_get('memory_limit')."</i>",-1);
01479                 if (ini_get('max_execution_time')<30)   {
01480                         $this->message($ext, 'Max Execution Time below default 30 seconds',"
01481                                 <i>max_execution_time=".ini_get('max_execution_time')."</i>
01482                                 May impose problems if too low.
01483                         ",1);
01484                 } else $this->message($ext, 'Max Execution Time',"<i>max_execution_time=".ini_get('max_execution_time')."</i>",-1);
01485                 if (ini_get('disable_functions'))       {
01486                         $this->message($ext, 'Functions disabled!',"
01487                                 <i>disable_functions=".ini_get('disable_functions')."</i>
01488                                 The above list of functions are disabled. If TYPO3 use any of these there might be trouble.
01489                                 TYPO3 is designed to use the default set of PHP4.0.6+ functions plus the functions from GDLib.
01490                                 Possibly these functions are disabled due to security risks and most likely the list would include a function like <i>exec()</i> which is use by TYPO3 to access ImageMagick.
01491                         ",2);
01492                 } else $this->message($ext, 'Functions disabled: none',"",-1);
01493                 if (!ini_get('sendmail_path'))  {
01494                         $this->message($ext, 'Sendmail path not defined!',"
01495                                 <i>sendmail_path=".ini_get('sendmail_path')."</i>
01496                                 This may be critical to TYPO3's use of the mail() function. Please be sure that the mail() function in your php-installation works!
01497                         ".$this->check_mail('get_form'),1);
01498                 } else {
01499                         list($prg) = explode(' ',ini_get('sendmail_path'));
01500                         if (TYPO3_OS=='WIN')    {
01501                                 $this->message($ext, 'Sendmail program not searched for on Windows',"",1);
01502                         } else {
01503                                 if (!@is_executable($prg))      {
01504                                         $this->message($ext, 'Sendmail program not found or not executable?',"
01505                                                 <i>sendmail_path=".ini_get('sendmail_path')."</i>
01506                                                 This may be critical to TYPO3's use of the mail() function. Please be sure that the mail() function in your php-installation works!
01507                                         ".$this->check_mail('get_form'),1);
01508                                 } else {
01509                                         $this->message($ext, 'Sendmail OK',"
01510                                                 <i>sendmail_path=".ini_get('sendmail_path').'</i>
01511                                                 You may check the mail() function by entering your emailaddress here:
01512                                         '.$this->check_mail('get_form'),-1);
01513                                 }
01514                         }
01515                 }
01516 
01517                         // *****************
01518                         // Safe mode related
01519                         // *****************
01520                 if (ini_get('safe_mode'))       {
01521                         $this->message($ext, 'Safe mode turned on',"
01522                                 <i>safe_mode=".ini_get('safe_mode')."</i>
01523                                 In safe_mode PHP is restricted in several ways. This is a good thing because it adds protection to your (and others) scripts. But it may also introduce problems. In TYPO3 this <em>may be</em> a problem in two areas: File administration and execution of external programs, in particular ImageMagick.
01524                                 If you just ignore this warning, you'll most likely find, that TYPO3 seems to work except from the image-generation. The problem in that case is that the external ImageMagick programs are not allowed to be executed from the regular paths like \"/usr/bin/\" or \"/usr/X11R6/bin/\".
01525                                 If you use safe_mode with TYPO3, you should disable use of external programs ([BE][disable_exec_function]=1).
01526                                 In safe mode you must ensure that all the php-scripts and upload folders are owned by the same user.
01527 
01528                                         <i>safe_mode_exec_dir=".ini_get('safe_mode_exec_dir')."</i>
01529                                         If the ImageMagick utilities are located in this directory, everything is fine. Below on this page, you can see if ImageMagick is found here. If not, ask you ISP to put the three ImageMagick programs, 'convert', 'combine'/'composite' and 'identify' there (eg. with symlinks if Unix server)
01530 
01531 
01532                                         <strong>Example of safe_mode settings:</strong>
01533                                         Set this in the php.ini file:
01534 
01535                                         ; Safe Mode
01536                                         safe_mode               =       On
01537                                         safe_mode_exec_dir      = /usr/bin/
01538 
01539                                         ...and the ImageMagick '/usr/bin/convert' will be executable.
01540                                         The last slash is important (..../) and you can only specify one directory.
01541 
01542                                         <strong>Notice: </strong>
01543                                         ImageMagick 4.2.9 is recommended and the binaries are normally installed by RPM in /usr/X11R6/bin or by compiling in /usr/local/bin. Please look in the \"Inside TYPO3\" pdf-document for extensive information about ImageMagick issues.
01544                                         Paths to ImageMagick are defined in localconf.php and may be something else than /usr/bin/, but this is default for ImageMagick 5+
01545 
01546 
01547                         ",2);
01548                         if (ini_get('doc_root'))        {
01549                                 $this->message($ext, 'doc_root set',"
01550                                         <i>doc_root=".ini_get('doc_root')."</i>
01551                                         PHP cannot execute scripts outside this directory. If that is a problem is please correct it.
01552                                 ",1);
01553                         }
01554                         $this->config_array['safemode']=1;
01555                 } else $this->message($ext, 'safe_mode: off',"",-1);
01556                 if (ini_get('sql.safe_mode'))   {
01557                         $this->message($ext, 'sql.safe_mode is enabled',"
01558                                 <i>sql.safe_mode=".ini_get('sql.safe_mode').'</i>
01559                                 This means that you can only connect to the database with a username corresponding to the user of the webserver process or fileowner. Consult your ISP for information about this. Also see '.$this->linkIt('http://www.wrox.com/Consumer/Store/Books/2963/29632002.htm').'
01560                                 The owner of the current file is: <strong>'.get_current_user ()."</strong>
01561                         ",1);
01562                         $this->config_array['sql.safe_mode_user'] = get_current_user();
01563                 } else $this->message($ext, 'sql.safe_mode: off',"",-1);
01564                 if (ini_get('open_basedir'))    {
01565                         $this->message($ext, 'open_basedir set',"
01566                                 <i>open_basedir=".ini_get('open_basedir')."</i>
01567                                 This restricts TYPO3 to open and include files only in this path. Please make sure that this does not prevent TYPO3 from running.
01568                                 <strong>Notice (UNIX):</strong> Before checking a path according to open_basedir, PHP resolves all symbolic links.
01569                         ",1);
01570 //      ????                    If this option was set falsely you probably didn't see this page in the first place, but this option <strong>may spoil this configuration test</strong> when checking for such as ImageMagick executables.
01571                 } else $this->message($ext, 'open_basedir: off',"",-1);
01572 
01573         }
01574 
01581         function check_mail($cmd='')    {
01582                 switch($cmd)    {
01583                         case 'get_form':
01584                                 $out='
01585                                 You can check the mail() function by entering your email address here and press the button. You should then receive a testmail from test@test.test.<br /> Since almost all mails in TYPO3 are sent using the t3lib_htmlmail class, sending with this class can be tested by checking the box <strong>Test t3lib_htmlmail</strong> below. The return-path of the mail is set to null@'.t3lib_div::getIndpEnv('HTTP_HOST').'. Some mail servers won\'t send the mail if the host of the return-path is not resolved correctly.
01586                                 <form action="'.$this->action.'" method="post"><input type="text" name="TYPO3_INSTALL[check_mail]"><br /><input type="checkbox" name="TYPO3_INSTALL[use_htmlmail]" >Test t3lib_htmlmail.
01587                                         <input type="submit" value="Send test mail"></form>';
01588                         break;
01589                         default:
01590                                 if (trim($this->INSTALL['check_mail'])) {
01591                                         $subject = 'TEST SUBJECT';
01592                                         $email = trim($this->INSTALL['check_mail']);
01593 
01594                                         if($this->INSTALL['use_htmlmail'])      {
01595                                                 require_once (PATH_t3lib.'class.t3lib_htmlmail.php');
01596                                                 $emailObj = t3lib_div::makeInstance('t3lib_htmlmail');
01597                                                 $emailObj->start();
01598                                                 $emailObj->subject = $subject;
01599                                                 $emailObj->from_email = 'test@test.test';
01600                                                 $emailObj->from_name = 'TYPO3 Install Tool';
01601                                                 $emailObj->returnPath = 'null@'.t3lib_div::getIndpEnv('HTTP_HOST');
01602                                                 $emailObj->addPlain('TEST CONTENT');
01603                                                 $emailObj->setHTML($emailObj->encodeMsg('<html><body>HTML TEST CONTENT</body></html>'));
01604                                                 $emailObj->send($email);
01605                                         } else {
01606                                                 t3lib_div::plainMailEncoded($email,$subject,'TEST CONTENT','From: test@test.test');
01607                                         }
01608                                         $this->messages[]= 'MAIL WAS SENT TO: '.$email;
01609                                 }
01610                         break;
01611                 }
01612                 return $out;
01613         }
01614 
01620         function checkExtensions()      {
01621                 $ext = 'GDLib';
01622                 $this->message($ext);
01623 
01624                 $software_info=1;
01625                 if (extension_loaded('gd') && $this->isGD())    {
01626                         $this->config_array['gd']=1;
01627                         $this->message($ext, 'GDLib found',"",-1);
01628                         if ($this->isPNG()) {
01629                                 $this->config_array['gd_png']=1;
01630                                 $this->message($ext, 'PNG supported',"",-1);
01631                         }
01632                         if ($this->isGIF()) {
01633                                 $this->config_array['gd_gif']=1;
01634                                 $this->message($ext, 'GIF supported',"",-1);
01635                         }
01636                         if ($this->isJPG()) {
01637                                 $this->config_array['gd_jpg']=1;
01638                                 $this->message($ext, 'JPG supported (not used by TYPO3)','');
01639                         }
01640                         if (!$this->config_array['gd_gif'] && !$this->config_array['gd_png'])   {
01641                                 $this->message($ext, 'PNG or GIF not supported', nl2br(trim('
01642                                         Your GDLib supports either GIF nor PNG. It must support either one of them.
01643                                 ')), 2);
01644                         } else {
01645                                 $msg=array();
01646                                 if ($this->config_array['gd_gif'] && $this->config_array['gd_png'])             {
01647                                         $msg[0]='You can choose between generating GIF or PNG files, as your GDLib supports both.';
01648                                 }
01649                                 if ($this->config_array['gd_gif'])              {
01650                                         $msg[10]="You should watch out for the generated size of the GIF-files because some versions of the GD library do not compress them with LZW, but RLE and ImageMagick is subsequently used to compress with LZW. But in the case of ImageMagick failing this task (eg. not being compiled with LZW which is the case with some versions) you'll end up with GIF-filesizes all too big!
01651                                         This install tool tests what kinds of GIF compression are available in the ImageMagick installations by a physical test. You can also check it manually by opening a TYPO3 generated gif-file with Photoshop and save it in a new file. If the file sizes of the original and the new file are almost the same, you're having LZW compression and everything is fine.";
01652                                 }
01653                                 if ($this->config_array['gd_png'])              {
01654                                         $msg[20]='TYPO3 prefers the use of GIF-files and most likely your visitors on your website does too as not all browsers support PNG yet.';
01655                                 }
01656                                 $this->message($ext, 'GIF / PNG issues', nl2br(trim(implode($msg,chr(10)))), 1);
01657                         }
01658                         if (!$this->isTTF())    {
01659                                 $this->message($ext, 'FreeType is apparently not installed', "
01660                                         It looks like the FreeType library is not compiled into GDLib. This is required when TYPO3 uses GDLib and you'll most likely get errors like 'ImageTTFBBox is not a function' or 'ImageTTFText is not a function'.
01661                                 ", 2);
01662                         } else {
01663                                 $this->message($ext, 'FreeType Quick-test ('.($this->isGIF()?'as GIF':'as PNG').')', '<img src="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI').'&testingTrueTypeSupport=1').'" alt=""><br />(If the text is exceeding the image borders you are using Freetype 2 and need to set TYPO3_CONF_VARS[GFX][TTFdpi]=96.<br />If there is no image at all Freetype is most likely NOT available and you can just as well disable GDlib for TYPO3...)', -1);
01664                                 $this->config_array['freetype']=1;
01665                         }
01666                 } else {
01667                         $this->message($ext, 'GDLib not found', "
01668                                 GDLib is required if you want to use the GIFBUILDER object in TypoScript. GIFBUILDER is in charge of all advanced image generation in TypoScript, including graphical menuitems.
01669                                 GDLib is also used in the TYPO3 Backend (TBE) to generate record icons and new module tabs.
01670                                 It's highly recommended to install this library. Remember to compile GD with FreeType which is also required.
01671                                 If you choose not to install GDLib, you can disable it in the configuration with [GFX][gdlib]=0;.
01672                         ", 2);
01673                 }
01674                 $this->message($ext, 'GDLib software information', nl2br(trim($this->getGDSoftwareInfo())));
01675         }
01676 
01682         function checkDirs()    {
01683                 // Check typo3/temp/
01684                 $ext='Directories';
01685                 $this->message($ext);
01686 
01687                 $uniqueName = md5(uniqid(microtime()));
01688 
01689                         // The requirement level (the integer value, ie. the second value of the value array) has the following meanings:
01690                         // -1 = not required, but if it exists may be writable or not
01691                         //  0 = not required, if it exists the dir should be writable
01692                         //  1 = required, don't has to be writable
01693                         //  2 = required, has to be writable
01694 
01695                 $checkWrite=array(
01696                         'typo3temp/' => array('This folder is used by both the frontend (FE) and backend (BE) interface for image manipulated files.',2,'dir_typo3temp'),
01697                         'typo3temp/pics/' => array('This folder is part of the typo3temp/ section. It needs to be writable, too.',2,'dir_typo3temp'),
01698                         'typo3temp/temp/' => array('This folder is part of the typo3temp/ section. It needs to be writable, too.',2,'dir_typo3temp'),
01699                         'typo3temp/llxml/' => array('This folder is part of the typo3temp/ section. It needs to be writable, too.',2,'dir_typo3temp'),
01700                         'typo3temp/cs/' => array('This folder is part of the typo3temp/ section. It needs to be writable, too.',2,'dir_typo3temp'),
01701                         'typo3temp/GB/' => array('This folder is part of the typo3temp/ section. It needs to be writable, too.',2,'dir_typo3temp'),
01702                         'typo3conf/' => array('This directory contains the local configuration files of your website. TYPO3 must be able to write to these configuration files during setup and when the Extension Manager (EM) installs extensions.',2),
01703                         'typo3conf/ext/' => array('Location for local extensions. Must be writable if the Extension Manager is supposed to install extensions for this website.',0),
01704                         'typo3conf/l10n/' => array('Location for translations. Must be writable if the Extension Manager is supposed to install translations for extensions.',0),
01705                         TYPO3_mainDir.'ext/' => array('Location for global extensions. Must be writable if the Extension Manager is supposed to install extensions globally in the source.',-1),
01706                         'uploads/' => array('Location for uploaded files from RTE + in the subdirs for tables.',2),
01707                         'uploads/pics/' => array('Typical location for uploaded files (images especially).',0),
01708                         'uploads/media/' => array('Typical location for uploaded files (non-images especially).',0),
01709                         'uploads/tf/' => array('Typical location for uploaded files (TS template resources).',0),
01710                         'fileadmin/' => array('Location for local files such as templates, independent uploads etc.',-1),
01711                         'fileadmin/_temp_/' => array('Typical temporary location for default upload of files by administrators.',0),
01712                 );
01713 
01714                 foreach ($checkWrite as $relpath => $descr)     {
01715 
01716                                 // Check typo3temp/
01717                         $general_message = $descr[0];
01718 
01719                         if (!@is_dir(PATH_site.$relpath))       {       // If the directory is missing, try to create it
01720                                 t3lib_div::mkdir(PATH_site.$relpath);
01721                         }
01722 
01723                         if (!@is_dir(PATH_site.$relpath))       {
01724                                 if ($descr[1])  {       // required...
01725                                         $this->message($ext, $relpath.' directory does not exist and could not be created','
01726                                         <em>Full path: '.PATH_site.$relpath.'</em>
01727                                         '.$general_message.'
01728 
01729                                         This error should not occur as '.$relpath.' must always be accessible in the root of a TYPO3 website.
01730                                         ',3);
01731                                 } else {
01732                                         if ($descr[1] == 0)     {
01733                                                 $msg = 'This directory does not necessarily have to exist but if it does it must be writable.';
01734                                         } else {
01735                                                 $msg = 'This directory does not necessarily have to exist and if it does it can be writable or not.';
01736                                         }
01737                                         $this->message($ext, $relpath.' directory does not exist','
01738                                         <em>Full path: '.PATH_site.$relpath.'</em>
01739                                         '.$general_message.'
01740 
01741                                         '.$msg.'
01742                                         ',2);
01743                                 }
01744                         } else {
01745                                 $file = PATH_site.$relpath.$uniqueName;
01746                                 @touch($file);
01747                                 if (@is_file($file))    {
01748                                         unlink($file);
01749                                         if ($descr[2])  { $this->config_array[$descr[2]]=1; }
01750                                         $this->message($ext, $relpath.' writable','',-1);
01751                                 } else {
01752                                         $severity = ($descr[1]==2 || $descr[1]==0) ? 3 : 2;
01753                                         if ($descr[1] == 0 || $descr[1] == 2) {
01754                                                 $msg = 'The directory '.$relpath.' must be writable!';
01755                                         } elseif ($descr[1] == -1 || $descr[1] == 1) {
01756                                                 $msg = 'The directory '.$relpath.' does not neccesarily have to be writable.';
01757                                         }
01758                                         $this->message($ext, $relpath.' directory not writable','
01759                                         <em>Full path: '.$file.'</em>
01760                                         '.$general_message.'
01761 
01762                                         Tried to write this file (with touch()) but didn\'t succeed.
01763                                         '.$msg.'
01764                                         ',$severity);
01765                                 }
01766                         }
01767                 }
01768         }
01769 
01778         function checkImageMagick($paths)       {
01779                 $ext='Check Image Magick';
01780                 $this->message($ext);
01781 
01782                 $paths = array_unique($paths);
01783 
01784                 $programs = explode(',','gm,convert,combine,composite,identify');
01785                 $isExt = TYPO3_OS=="WIN" ? ".exe" : "";
01786                 $this->config_array['im_combine_filename']='combine';
01787                 reset($paths);
01788                 while(list($k,$v)=each($paths)) {
01789                         reset($programs);
01790                         if (!ereg('[\\\/]$',$v)) $v.='/';
01791                         while(list(,$filename)=each($programs)) {
01792                                 if (ini_get('open_basedir') || (@file_exists($v)&&@is_file($v.$filename.$isExt))) {
01793                                         $version = $this->_checkImageMagick_getVersion($filename,$v);
01794                                         if($version > 0)        {
01795                                                 if($filename=='gm')     {       // Assume GraphicsMagick
01796                                                         $index[$v]['gm']=$version;
01797                                                         continue;       // No need to check for "identify" etc.
01798                                                 } else  {       // Assume ImageMagick
01799                                                         $index[$v][$filename]=$version;
01800                                                 }
01801                                         }
01802                                 }
01803                         }
01804                         if (count($index[$v])>=3 || $index[$v]['gm'])   { $this->config_array['im']=1; }
01805 
01806                         if ($index[$v]['gm'] || (!$index[$v]['composite'] && $index[$v]['combine'])) {
01807                                 $this->config_array['im_combine_filename']='combine';
01808                         } elseif ($index[$v]['composite'] && !$index[$v]['combine'])  {
01809                                 $this->config_array['im_combine_filename']='composite';
01810                         }
01811 
01812                         if (isset($index[$v]['convert']) && $this->checkIMlzw)  {
01813                                 $index[$v]['gif_capability'] = ''.$this->_checkImageMagickGifCapability($v);
01814                         }
01815                 }
01816                 $this->config_array['im_versions']=$index;
01817                 if (!$this->config_array['im']) {
01818                         $this->message($ext, 'No ImageMagick install available',"
01819                         It seems that there is no adequate ImageMagick installation available at the checked locations (".implode($paths, ', ').")
01820                         An 'adequate' installation for requires 'convert', 'combine'/'composite' and 'identify' to be available
01821                         ",2);
01822                 } else {
01823                         $theCode='';
01824                         reset($this->config_array['im_versions']);
01825                         while(list($p,$v)=each($this->config_array['im_versions']))     {
01826                                 $ka=array();
01827                                 reset($v);
01828                                 while(list($ka[])=each($v)){}
01829                                 $theCode.='<tr><td>'.$this->fw($p).'</td><td>'.$this->fw(implode($ka,'<br />')).'</td><td>'.$this->fw(implode($v,'<br />')).'</td></tr>';
01830                         }
01831                         $this->message($ext, 'Available ImageMagick/GraphicsMagick installations:','<table border="1" cellpadding="2" cellspacing="2">'.$theCode.'</table>',-1);
01832                 }
01833                 $this->message($ext, 'Search for ImageMagick:','
01834                         <form action="'.$this->action.'" method="post">
01835                                 <input type="checkbox" name="TYPO3_INSTALL[checkIM][lzw]" value="1"'.($this->INSTALL['checkIM']['lzw']?' checked="checked"':'').'> Check LZW capabilities.
01836 
01837                                 Check this path for ImageMagick installation:
01838                                 <input type="text" name="TYPO3_INSTALL[checkIM][path]" value="'.htmlspecialchars($this->INSTALL['checkIM']['path']).'">
01839                                 (Eg. "D:\wwwroot\im537\ImageMagick\" for windows or "/usr/bin/" for Unix)<br />
01840 
01841                                 <input type="submit" value="Send">
01842                         </form>
01843                 ',0);
01844 
01845         }
01846 
01853         function _checkImageMagickGifCapability($path)  {
01854                 if ($this->config_array['dir_typo3temp'])       {               //  && !$this->config_array['safemode']
01855                         $tempPath = $this->typo3temp_path;
01856                         $uniqueName = md5(uniqid(microtime()));
01857                         $dest = $tempPath.$uniqueName.'.gif';
01858                         $src = $this->backPath.'gfx/typo3logo.gif';
01859                         if (@is_file($src) && !strstr($src,' ') && !strstr($dest,' '))  {
01860                                 $cmd = t3lib_div::imageMagickCommand('convert', $src.' '.$dest, $path);
01861                                 exec($cmd);
01862                         } else die('No typo3/gfx/typo3logo.gif file!');
01863                         $out='';
01864                         if (@is_file($dest))    {
01865                                 $new_info = @getimagesize($dest);
01866                                 clearstatcache();
01867                                 $new_size = filesize($dest);
01868                                 $src_info = @getimagesize($src);
01869                                 clearstatcache();
01870                                 $src_size = @filesize($src);
01871 
01872                                 if ($new_info[0]!=$src_info[0] || $new_info[1]!=$src_info[1] || !$new_size || !$src_size)       {
01873                                         $out='error';
01874                                 } else {
01875                                         if ($new_size/$src_size > 4) {  // NONE-LZW ratio was 5.5 in test
01876                                                 $out='NONE';
01877                                         } elseif ($new_size/$src_size > 1.5) {  // NONE-RLE ratio was not tested
01878                                                 $out='RLE';
01879                                         } else {
01880                                                 $out='LZW';
01881                                         }
01882                                 }
01883                                 unlink($dest);
01884                         }
01885                         return $out;
01886                 }
01887         }
01888 
01896         function _checkImageMagick_getVersion($file, $path)     {
01897                         // Temporarily override some settings
01898                 $im_version = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'];
01899                 $combine_filename = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename'];
01900 
01901                 if ($file=='gm')        {
01902                         $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] = 'gm';
01903                         $file = 'identify';             // Work-around, preventing execution of "gm gm"
01904                         $parameters = '-version';       // Work-around - GM doesn't like to be executed without any arguments
01905                 } else {
01906                         $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] = 'im5';
01907 
01908                         if($file=='combine' || $file=='composite')      {       // Override the combine_filename setting
01909                                 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename'] = $file;
01910                         }
01911                 }
01912 
01913                 $cmd = t3lib_div::imageMagickCommand($file, $parameters, $path);
01914                 $retVal = false;
01915                 exec($cmd, $retVal);
01916                 $string = $retVal[0];
01917                 list(,$ver) = explode('Magick', $string);
01918                 list($ver) = explode(' ',trim($ver));
01919 
01920                         // Restore the values
01921                 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'] = $im_version;
01922                 $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename'] = $combine_filename;
01923                 return trim($ver);
01924         }
01925 
01931         function checkDatabase()                {
01932                 $ext='Check database';
01933                 $this->message($ext);
01934 
01935                 if (!extension_loaded('mysql') && !t3lib_extMgm::isLoaded('dbal'))      {
01936                         $this->message($ext, 'MySQL not available',"
01937                                 PHP does not feature MySQL support (which is pretty unusual).
01938                         ",2);
01939                 } else {
01940                         $cInfo='
01941                                 Username: <strong>'.TYPO3_db_username.'</strong>
01942                                 Password: <strong>'.TYPO3_db_password.'</strong>
01943                                 Host: <strong>'.TYPO3_db_host.'</strong>
01944                         ';
01945                         if (!TYPO3_db_host || !TYPO3_db_username)       {
01946                                 $this->message($ext, 'Username, password or host not set',"
01947                                         You may need to enter data for these values:
01948                                         ".trim($cInfo)."
01949 
01950                                         Use the form below.
01951                                 ",2);
01952                         }
01953                         if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password))  {
01954                                 $this->message($ext, 'Connected to SQL database successfully',"
01955                                 ".trim($cInfo)."
01956                                 ",-1,1);
01957                                 $this->config_array['mysqlConnect']=1;
01958                                 if (!TYPO3_db)  {
01959                                         $this->message($ext, 'No database selected',"
01960                                                 Currently you have no database selected.
01961                                                 Please select one or create a new database.
01962                                         ",3);
01963                                         $this->config_array['no_database']=1;
01964                                 } elseif (!$GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db))  {
01965                                         $this->message($ext, 'Database',"
01966                                                 '".TYPO3_db."' could not be selected as database!
01967                                                 Please select another one or create a new database.
01968                                         ",3,1);
01969                                         $this->config_array['no_database']=1;
01970                                 } else  {
01971                                         $this->message($ext, 'Database',"
01972                                                 <strong>".TYPO3_db."</strong> is selected as database.
01973                                         ",1,1);
01974                                 }
01975                         } else {
01976                                 $this->message($ext, 'Could not connect to SQL database!',"
01977                                 Connecting to SQL database failed with these settings:
01978                                 ".trim($cInfo)."
01979 
01980                                 Make sure you're using the correct set of data.".($this->config_array['sql.safe_mode_user']? "
01981                                 <strong>Notice:</strong> <em>sql.safe_mode</em> is turned on, so apparently your username to the database is the same as the scriptowner, which is '".$this->config_array['sql.safe_mode_user']."'":"")."
01982                                 ",3);
01983                         }
01984                 }
01985         }
01986 
01993         function setupGeneral($cmd='')  {
01994                 switch($cmd)    {
01995                         case 'get_form':
01996                                         // Database:
01997                                 $out='
01998                                 <form name="setupGeneral" action="'.$this->action.'" method="post">
01999                                 <table border="0" cellpadding="0" cellspacing="0">';
02000 
02001                                 $out.=$this->wrapInCells('Username:', '<input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_username]" value="'.htmlspecialchars(TYPO3_db_username?TYPO3_db_username:($this->config_array['sql.safe_mode_user']?$this->config_array['sql.safe_mode_user']:"")).'">'.($this->config_array['sql.safe_mode_user']?"<br />sql.safe_mode_user: <strong>".$this->config_array['sql.safe_mode_user']."</strong>":""));
02002                                 $out.=$this->wrapInCells('Password:', '<input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_password]" value="'.htmlspecialchars(TYPO3_db_password).'">');
02003                                 $out.=$this->wrapInCells('Host:', '<input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_host]" value="'.htmlspecialchars(TYPO3_db_host).'">');
02004                                 if ($this->config_array['mysqlConnect'])        {
02005                                         $dbArr = $this->getDatabaseList();
02006                                         reset($dbArr);
02007                                         $options='';
02008                                         $dbIncluded=0;
02009                                         while(list(,$dbname)=each($dbArr))      {
02010                                                 $options.='<option value="'.htmlspecialchars($dbname).'"'.($dbname==TYPO3_db?' selected="selected"':'').'>'.htmlspecialchars($dbname).'</option>';
02011                                                 if ($dbname==TYPO3_db)  $dbIncluded=1;
02012                                         }
02013                                         if (!$dbIncluded && TYPO3_db)   {
02014                                                 $options.='<option value="'.htmlspecialchars(TYPO3_db).'" selected="selected">'.htmlspecialchars(TYPO3_db).' (NO ACCESS!)</option>';
02015                                         }
02016                                         $theCode='<select name="TYPO3_INSTALL[localconf.php][typo_db]">'.$options.'</select><br />Create database? (Enter name):<br /><input type="text" name="TYPO3_INSTALL[localconf.php][NEW_DATABASE_NAME]" value="">';
02017                                 } else {
02018                                         $theCode='<strong>'.htmlspecialchars(TYPO3_db).'</strong><br />(Can only select database if username/password/host is correctly set first)<input type="hidden" name="TYPO3_INSTALL[localconf.php][typo_db]" value="'.htmlspecialchars(TYPO3_db).'">';
02019                                 }
02020                                 $out.=$this->wrapInCells('', '<br />');
02021                                 $out.=$this->wrapInCells('Database:', $theCode);
02022                                 $out.=$this->wrapInCells('', '<br />');
02023 
02024                                 if ($this->mode!='123') {
02025                                         $out.=$this->wrapInCells('Site name:', '<input type="text" name="TYPO3_INSTALL[localconf.php][sitename]" value="'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']).'">');
02026                                         $out.=$this->wrapInCells('', '<br />');
02027                                         $out.='<script type="text/javascript" src="../md5.js"></script><script type="text/javascript">function generateEncryptionKey(key) {time=new Date(); key=MD5(time.getMilliseconds().toString());while(key.length<66){key=key+MD5(key)};return key;}</script>';
02028                                         $out.=$this->wrapInCells('Encryption key:', '<a name="set_encryptionKey"></a><input type="text" name="TYPO3_INSTALL[localconf.php][encryptionKey]" value="'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']).'"><br /><input type="button" onclick="document.forms[\'setupGeneral\'].elements[\'TYPO3_INSTALL[localconf.php][encryptionKey]\'].value=generateEncryptionKey(document.forms[\'setupGeneral\'].elements[\'TYPO3_INSTALL[localconf.php][encryptionKey]\'].value);" value="Generate random key">');
02029                                         $out.=$this->wrapInCells('', '<br />');
02030 
02031                                                 // Other
02032                                         $fA = $this->setupGeneralCalculate();
02033 
02034                                         if (is_array($fA['disable_exec_function']))     {
02035                                                 $out.=$this->wrapInCells('[BE][disable_exec_function]=', $this->getFormElement($fA['disable_exec_function'], $fA['disable_exec_function'], 'TYPO3_INSTALL[localconf.php][disable_exec_function]', $GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function']));
02036                                         }
02037                                         if (is_array($fA['gdlib']))     {
02038                                                 $out.=$this->wrapInCells('[GFX][gdlib]=', $this->getFormElement($fA['gdlib'], $fA['gdlib'], 'TYPO3_INSTALL[localconf.php][gdlib]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']));
02039                                                 if (is_array($fA['gdlib_png']) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'])  {
02040                                                         $out.=$this->wrapInCells('[GFX][gdlib_png]=', $this->getFormElement($this->setLabelValueArray($fA['gdlib_png'],2), $fA['gdlib_png'], 'TYPO3_INSTALL[localconf.php][gdlib_png]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png']));
02041                                                 }
02042                                         }
02043                                         if (is_array($fA['im']))        {
02044                                                 $out.=$this->wrapInCells('[GFX][im]=', $this->getFormElement($fA['im'], $fA['im'], 'TYPO3_INSTALL[localconf.php][im]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im']));
02045                                                 $out.=$this->wrapInCells('[GFX][im_combine_filename]=', $this->getFormElement($fA['im_combine_filename'], ($fA['im_combine_filename']?$fA['im_combine_filename']:"combine"), 'TYPO3_INSTALL[localconf.php][im_combine_filename]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename']));
02046                                                 $out.=$this->wrapInCells('[GFX][im_version_5]=', $this->getFormElement($fA['im_version_5'], ($fA['im_version_5']?$fA['im_version_5']:''), 'TYPO3_INSTALL[localconf.php][im_version_5]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']));
02047                                                 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im'])   {
02048                                                         if (is_array($fA['im_path']))   {
02049                                                                 $out.=$this->wrapInCells('[GFX][im_path]=', $this->getFormElement($this->setLabelValueArray($fA['im_path'],1), $this->setLabelValueArray($fA['im_path'],0), 'TYPO3_INSTALL[localconf.php][im_path]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path']));
02050                                                         }
02051                                                         if (is_array($fA['im_path_lzw']))       {
02052                                                                 $out.=$this->wrapInCells('[GFX][im_path_lzw]=', $this->getFormElement($this->setLabelValueArray($fA['im_path_lzw'],1), $this->setLabelValueArray($fA['im_path_lzw'],0), 'TYPO3_INSTALL[localconf.php][im_path_lzw]', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw']));
02053                                                         }
02054                                                 }
02055                                         }
02056                                         $out.=$this->wrapInCells('[GFX][TTFdpi]=', '<input type="text" name="TYPO3_INSTALL[localconf.php][TTFdpi]" value="'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['GFX']['TTFdpi']).'">');
02057                                 }
02058 
02059 
02060                                 $out.=$this->wrapInCells('', '<br /><input type="submit" value="Update localconf.php"><br />
02061                                 <strong>NOTICE: </strong>By clicking this button, localconf.php is updated with new values for the parameters listed above!');
02062                                 $out.='
02063                                 </table>
02064                                 </form>';
02065                         break;
02066                         default:
02067                                 if (is_array($this->INSTALL['localconf.php']))          {
02068                                         $errorMessages=array();
02069                                         $lines = $this->writeToLocalconf_control();
02070 
02071                                                 // New database?
02072 #debug($this->INSTALL);
02073                                         if (trim($this->INSTALL['localconf.php']['NEW_DATABASE_NAME'])) {
02074                                                 $newdbname=trim($this->INSTALL['localconf.php']['NEW_DATABASE_NAME']);
02075                                                 if (!ereg('[^[:alnum:]_-]',$newdbname)) {
02076                                                         if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password))  {
02077                                                                 if ($GLOBALS['TYPO3_DB']->admin_query('CREATE DATABASE '.$newdbname)) {
02078                                                                         $this->INSTALL['localconf.php']['typo_db'] = $newdbname;
02079                                                                         $this->messages[]= "Database '".$newdbname."' created";
02080                                                                 } else $this->messages[]= $errorMessages[] = "Could not create database '".$newdbname."' (...not created)";
02081                                                         } else $this->messages[]= $errorMessages[] = "Could not connect to database when creating database '".$newdbname."' (...not created)";
02082                                                 } else $this->messages[]= $errorMessages[] = "The NEW database name '".$newdbname."' was not alphanumeric, a-zA-Z0-9_- (...not created)";
02083                                         }
02084 #debug($this->messages)         ;
02085                                                 // Parsing values
02086                                         reset($this->INSTALL['localconf.php']);
02087                                         while(list($key,$value)=each($this->INSTALL['localconf.php']))          {
02088                                                 switch((string)$key)    {
02089                                                         case 'typo_db_username':
02090                                                                 if (strlen($value)<50)  {
02091                                                                         if (strcmp(TYPO3_db_username,$value))           $this->setValueInLocalconfFile($lines, '$typo_db_username', trim($value));
02092                                                                 } else $this->messages[]= $errorMessages[] = "Username '".$value."' was longer than 50 chars (...not saved)";
02093                                                         break;
02094                                                         case 'typo_db_password':
02095                                                                 if (strlen($value)<50)  {
02096                                                                         if (strcmp(TYPO3_db_password,$value))           $this->setValueInLocalconfFile($lines, '$typo_db_password',  trim($value));
02097                                                                 } else $this->messages[]= $errorMessages[] = "Password '".$value."' was longer than 50 chars (...not saved)";
02098                                                         break;
02099                                                         case 'typo_db_host':
02100                                                                 if (!ereg("[^[:alnum:]_\.:-]",$value) && strlen($value)<50)     {
02101                                                                         if (strcmp(TYPO3_db_host,$value))               $this->setValueInLocalconfFile($lines, '$typo_db_host', $value);
02102                                                                 } else $this->messages[]= $errorMessages[] = "Host '".$value."' was not alphanumeric, a-zA-Z0-9_-:., or longer than 50 chars (...not saved)";
02103                                                         break;
02104                                                         case 'typo_db':
02105                                                                 if (strlen($value)<50)  {
02106                                                                         if (strcmp(TYPO3_db,$value))            $this->setValueInLocalconfFile($lines, '$typo_db',  trim($value));
02107                                                                 } else $this->messages[]= $errorMessages[] = "Database name '".$value."' was longer than 50 chars (...not saved)";
02108                                                         break;
02109                                                         case 'disable_exec_function':
02110                                                                 if (strcmp($GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function'],$value))  $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'BE\'][\'disable_exec_function\']', $value?1:0);
02111                                                         break;
02112                                                         case 'sitename':
02113                                                                 if (strcmp($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],$value))      $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'SYS\'][\'sitename\']', $value);
02114                                                         break;
02115                                                         case 'encryptionKey':
02116                                                                 if (strcmp($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'],$value)) $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'SYS\'][\'encryptionKey\']', $value);
02117                                                         break;
02118                                                         case 'compat_version':
02119                                                                 if (strcmp($GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version'],$value))        $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'SYS\'][\'compat_version\']', $value);
02120                                                         break;
02121                                                         case 'im_combine_filename':
02122                                                                 if (strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_combine_filename'],$value))   $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\'][\'im_combine_filename\']', $value);
02123                                                         break;
02124                                                         case 'gdlib':
02125                                                         case 'gdlib_png':
02126                                                         case 'im':
02127                                                                 if (strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX'][$key],$value))    $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\']["'.$key.'"]', $value?1:0);
02128                                                         break;
02129                                                         case 'im_path':
02130                                                                 list($value,$version) = explode('|',$value);
02131                                                                 if (!ereg('[[:space:]]',$value,$reg) && strlen($value)<100)     {
02132                                                                         if (strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX'][$key],$value))    {
02133                                                                                 $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\']["'.$key.'"]', $value);
02134                                                                         }
02135                                                                         if(doubleval($version)>0 && doubleval($version)<4)      {       // Assume GraphicsMagick
02136                                                                                 $value_ext = 'gm';
02137                                                                         } elseif(doubleval($version)<5) {       // Assume ImageMagick 4.x
02138                                                                                 $value_ext = '';
02139                                                                         } else  {       // Assume ImageMagick 5+
02140                                                                                 $value_ext = 'im5';
02141                                                                         }
02142                                                                         if (strcmp(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']),$value_ext))  {
02143                                                                                 $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\'][\'im_version_5\']', $value_ext);
02144                                                                         }
02145         //                                                              if (strcmp(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']),$value))      $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS['GFX']['im_version_5']', $value);
02146                                                                 } else $this->messages[]= $errorMessages[] = "Path '".$value."' contains spaces or is longer than 100 chars (...not saved)";
02147                                                         break;
02148                                                         case 'im_path_lzw':
02149                                                                 list($value) = explode('|',$value);
02150                                                                 if (!ereg('[[:space:]]',$value) && strlen($value)<100)  {
02151                                                                         if (strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX'][$key],$value))    $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\']["'.$key.'"]', $value);
02152                                                                 } else $this->messages[]= $errorMessages[] = "Path '".$value."' contains spaces or is longer than 100 chars (...not saved)";
02153                                                         break;
02154                                                         case 'TTFdpi':
02155                                                                 if (strcmp($GLOBALS['TYPO3_CONF_VARS']['GFX']['TTFdpi'],$value))        $this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'GFX\'][\'TTFdpi\']', $value);
02156                                                         break;
02157                                                 }
02158 
02159 
02160                                         }
02161 
02162                                         if (count($errorMessages))      {
02163                                                 echo '<h3>ERRORS</h3>';
02164                                                 echo t3lib_div::view_array($errorMessages);
02165                                                 echo 'Click the browsers "Back" button to reenter the values.';
02166                                                 exit;
02167                                         }
02168                                         $this->writeToLocalconf_control($lines);
02169                                 }
02170                         break;
02171                 }
02172                 return $out;
02173         }
02174 
02182         function writeToLocalconf_control($lines="", $showOutput=1)     {
02183                 $returnVal = parent::writeToLocalconf_control($lines);
02184 
02185                 if ($showOutput)        {
02186                         switch($returnVal)      {
02187                                 case 'continue':
02188                                         $content = '<br /><br />'.implode($this->messages,'<hr />').'<br /><br /><a href="'.$this->action.'">Click to continue...</a>';
02189                                         $this->outputExitBasedOnStep($content);
02190                                 break;
02191                                 case 'nochange':
02192                                         $content = '<strong>Writing to \'localconf.php\':</strong><br /><br />No values were changed, so nothing is updated!<br /><br /><a href="'.$this->action.'">Click to continue...</a>';
02193                                         $this->outputExitBasedOnStep('<br />'.$content);
02194                                 break;
02195                         }
02196                 }
02197                 return $returnVal;
02198         }
02199 
02206         function outputExitBasedOnStep($content)        {
02207                 if ($this->step)        {
02208                         Header('Location: '.t3lib_div::locationHeaderUrl($this->action));
02209                 } else {
02210                         echo $this->outputWrapper($content);
02211                 }
02212                 exit;
02213         }
02214 
02222         function setLabelValueArray($arr,$type) {
02223                 reset($arr);
02224                 while(list($k,$v)=each($arr))   {
02225                         if($this->config_array['im_versions'][$v]['gm'])        {
02226                                 $program = 'gm';
02227                         } else  {
02228                                 $program = 'convert';
02229                         }
02230 
02231                         switch($type)   {
02232                                 case 0: // value, im
02233                                         $arr[$k].='|'.$this->config_array['im_versions'][$v][$program];
02234                                 break;
02235                                 case 1: // labels, im
02236                                         if($this->config_array['im_versions'][$v][$program])    {
02237                                                 $arr[$k].= ' ('.$this->config_array['im_versions'][$v][$program];
02238                                                 $arr[$k].= ($this->config_array['im_versions'][$v]['gif_capability'] ? ', '.$this->config_array['im_versions'][$v]['gif_capability'] : '');
02239                                                 $arr[$k].= ')';
02240                                         } else  {
02241                                                 $arr[$k].= '';
02242                                         }
02243                                 break;
02244                                 case 2: // labels, gd
02245                                         $arr[$k].=' ('.($v==1?'PNG':'GIF').')';
02246                                 break;
02247                         }
02248                 }
02249                 return $arr;
02250         }
02251 
02262         function getFormElement($labels,$values,$fieldName,$default,$msg='')    {
02263                 $out.='<strong>'.htmlspecialchars(current($labels)).'</strong><br />current value is '.htmlspecialchars($default).($msg?'<br />'.$msg:'');
02264                 if (count($labels)>1)           {
02265                         reset($labels);
02266                         while(list($k,$v)=each($labels))        {
02267                                 list($cleanV) =explode('|',$values[$k]);
02268                                 $options.='<option value="'.htmlspecialchars($values[$k]).'"'.(!strcmp($default,$cleanV)?' selected="selected"':'').'>'.htmlspecialchars($v).'</option>';
02269                         }
02270                         $out.='<br /><select name="'.$fieldName.'">'.$options.'</select>';
02271                 } else {
02272                         $out.='<input type="hidden" name="'.$fieldName.'" value="'.htmlspecialchars(current($values)).'">';
02273                 }
02274                 return $out.'<br />';
02275         }
02276 
02282         function getDatabaseList()      {
02283                 $dbArr=array();
02284                 if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password))  {
02285                         $dbArr = $GLOBALS['TYPO3_DB']->admin_get_dbs();
02286                 }
02287                 return $dbArr;
02288         }
02289 
02306         function setupGeneralCalculate()        {
02307                 $formArray['disable_exec_function']=array(0);
02308                 $formArray['im_path']=array('');
02309                 $formArray['im_path_lzw']=array('');
02310                 $formArray['im_combine_filename']=array('');
02311                 $formArray['im_version_5']=array('');
02312                 $formArray['im']=array(1);
02313                 $formArray['gdlib']=array(1);
02314                 if ($this->config_array['gd'] && ($this->config_array['gd_gif'] || $this->config_array['gd_png']))      {
02315                         if ($this->config_array['gd_gif'] && !$this->config_array['gd_png'])    {
02316                                 $formArray['gdlib_png']=array(0);
02317                         } elseif (!$this->config_array['gd_gif'] && $this->config_array['gd_png'])      {
02318                                 $formArray['gdlib_png']=array(1);
02319                         } else {
02320                                 $formArray['gdlib_png']=array(0,1);
02321                         }
02322                 } else {
02323                         $formArray['gdlib']=array(0);
02324                 }
02325                 if ($this->config_array['safemode'])    {
02326                         $formArray['disable_exec_function']=array(1);
02327                 }
02328                 if ($this->config_array['im'])  {
02329                         $formArray['im']=array(1);
02330                         $LZW_found=0;
02331                         $found=0;
02332                         reset($this->config_array['im_versions']);
02333                         $totalArr=array();
02334                         while(list($path,$dat)=each($this->config_array['im_versions']))        {
02335                                 if (count($dat)>=3)     {
02336                                         if (doubleval($dat['convert'])<5)       {
02337                                                 $formArray['im_version_5']=array(0);
02338                                                 if ($dat['gif_capability']=='LZW')      {
02339                                                         $formArray['im_path']=array($path);
02340                                                         $found=2;
02341                                                 } elseif ($found<2)     {
02342                                                         $formArray['im_path']=array($path);
02343                                                         $found=1;
02344                                                 }
02345                                         } elseif (!$found)      {
02346                                                 $formArray['im_version_5']=array('im5');
02347                                                 $formArray['im_path']=array($path);
02348                                                 $found=1;
02349                                         }
02350                                 } elseif ($dat['gm'])   {
02351                                         $formArray['im_version_5']=array('gm');
02352                                         if ($dat['gif_capability']=='LZW')      {
02353                                                 $formArray['im_path']=array($path);
02354                                                 $found=2;
02355                                         } elseif ($found<2)     {
02356                                                 $formArray['im_path']=array($path);
02357                                                 $found=1;
02358                                         }
02359                                 }
02360                                 if ($dat['gif_capability']=='LZW')      {
02361                                         if (doubleval($dat['convert'])<5 || !$LZW_found)        {
02362                                                 $formArray['im_path_lzw']=array($path);
02363                                                 $LZW_found=1;
02364                                         }
02365                                 } elseif ($dat['gif_capability']=="RLE" && !$LZW_found) {
02366                                         $formArray['im_path_lzw']=array($path);
02367                                 }
02368                                 $totalArr[]=$path;
02369                         }
02370                         $formArray['im_path']=array_unique(array_merge($formArray['im_path'],$totalArr));
02371                         $formArray['im_path_lzw']=array_unique(array_merge($formArray['im_path_lzw'],$totalArr));
02372                         $formArray['im_combine_filename']=array($this->config_array['im_combine_filename']);
02373                 } else {
02374                         $formArray['im']=array(0);
02375                 }
02376                 return $formArray;
02377         }
02378 
02384         function getGDPartOfPhpinfo()   {
02385                 ob_start();
02386                 phpinfo();
02387                 $contents = ob_get_contents();
02388                 ob_end_clean();
02389                 $start_string = $this->getGD_start_string;
02390                 $end_string = $this->getGD_end_string;
02391                 list(,$gdpart_tmp) = explode($start_string,$contents,2);
02392                 list($gdpart) = explode($end_string,$start_string.$gdpart_tmp,2);
02393                 $gdpart.=$end_string;
02394                 return $gdpart;
02395         }
02396 
02403         function isTTF($phpinfo='')     {
02404 /*              $phpinfo = $phpinfo?$phpinfo:$this->getGDPartOfPhpinfo();
02405                 if (stristr($phpinfo, $this->getTTF_string))    return 1;
02406                 if (stristr($phpinfo, $this->getTTF_string_alt))        return 1;
02407                 */
02408 
02409                 if (!function_exists('imagettftext'))   return 0;       // Return right away if imageTTFtext does not exist.
02410 
02411                         // try, print truetype font:
02412                 $im = @imagecreate (300, 50);
02413                 $background_color = imagecolorallocate ($im, 255, 255, 55);
02414                 $text_color = imagecolorallocate ($im, 233, 14, 91);
02415 
02416                 $test = @imagettftext($im, t3lib_div::freetypeDpiComp(20), 0, 10, 20, $text_color, PATH_t3lib."/fonts/vera.ttf", 'Testing Truetype support');
02417                 if (t3lib_div::_GP('testingTrueTypeSupport'))   {
02418                         if ($this->isGIF())     {
02419                                 header ('Content-type: image/gif');
02420                                 imagegif ($im);
02421                         } else {
02422                                 header ('Content-type: image/png');
02423                                 imagepng ($im);
02424                         }
02425                         exit;
02426                 }
02427                 return is_array($test)?1:0;
02428         }
02429 
02430 
02431 
02432 
02433 
02434 
02435 
02436 
02437 
02438 
02439 
02440         /*****************************************
02441          *
02442          * ABOUT the isXXX functions.
02443          *
02444          * I had a very real experience that these checks DID NOT fail eg PNG support if it didn't exist!
02445          * So first (1) we check if the functions are there. If they ARE we are going to make further investigations (2) by creating an actual image.
02446          * And if THAT succeeds also, then we can be certain of the support!
02447          */
02448 
02452         function isGD() {
02453                 if (function_exists('imagecreate'))     {
02454                         if (@imagecreate (50, 100))     return 1;
02455                 }
02456         }
02457 
02463         function isGIF()        {
02464                 if (function_exists('imagecreatefromgif') && function_exists('imagegif') && ($this->ImageTypes() & IMG_GIF))    {       // If GIF-functions exists, also do a real test of them:
02465                         $im = @imagecreatefromgif(t3lib_extMgm::extPath('install').'imgs/jesus.gif');
02466                         return $im?1:0;
02467                 }
02468         }
02469 
02475         function isJPG()        {
02476                 if (function_exists('imagecreatefromjpeg') && function_exists('imagejpeg') && ($this->ImageTypes() & IMG_JPG))  {
02477                         return 1;
02478                 }
02479         }
02480 
02486         function isPNG()        {
02487                 if (function_exists('imagecreatefrompng') && function_exists('imagepng') && ($this->ImageTypes() & IMG_PNG))    {
02488                         $im = imagecreatefrompng(t3lib_extMgm::extPath('install').'imgs/jesus.png');
02489                         return $im?1:0;
02490                 }
02491         }
02492 
02498         function ImageTypes()   {
02499                 if (phpversion()!='4.1.2')      {
02500                         return imagetypes();
02501                 } else return IMG_GIF+IMG_JPG+IMG_PNG; // all...
02502         }
02503 
02509         function getGDSoftwareInfo()    {
02510                 return trim('
02511                 You can get GDLib in the PNG version from '.$this->linkIt('http://www.boutell.com/gd/').'.<br />FreeType is for download at '.$this->linkIt('http://www.freetype.org/').'.
02512                 Generally, software for TYPO3 is found at '.$this->linkIt('http://typo3.sunsite.dk/software/').' and packages listed at '.$this->linkIt('http://typo3.org/1274.0.html').'.
02513                 ');
02514         }
02515 
02521         function generallyAboutConfiguration()  {
02522                 $out='
02523                 Local configuration is done by overriding default values in the included file, typo3conf/localconf.php. In this file you enter the database information along with values in the global array TYPO3_CONF_VARS.
02524                 The options in the TYPO3_CONF_VARS array and how to use it for your own purposes is discussed in the base configuration file, t3lib/config_default.php. This file sets up the default values and subsequently includes the localconf.php file in which you can then override values.
02525                 See this page for '.$this->linkIt('http://typo3.org/1275.0.html','more information about system requirements.').'
02526                 ';
02527                 return trim($out);
02528         }
02529 
02530 
02531 
02532 
02533 
02534 
02535 
02536 
02537 
02538 
02539 
02540 
02541 
02542         /**********************
02543          *
02544          * IMAGE processing
02545          *
02546          **********************/
02547 
02581         function checkTheImageProcessing()      {
02582                 $this->message('Image Processing','What is it?',"
02583                 TYPO3 is known for its ability to process images on the server.
02584                 In the backend interface (TBE) thumbnails are automatically generated (by ImageMagick in thumbs.php) as well as icons, menu items and pane tabs (by GDLib).
02585                 In the TypoScript enabled frontend all kinds of graphical elements are processed. Typically images are scaled down to fit the pages (by ImageMagick) and menu items, graphical headers and such are generated automatically (by GDLib + ImageMagick).
02586                 In addition TYPO3 is able to handle many file formats (thanks to ImageMagick), for example TIF, BMP, PCX, TGA, AI and PDF in addition to the standard web formats; JPG, GIF, PNG.
02587 
02588                 In order to do this, TYPO3 uses two sets of tools:
02589 
02590                 <strong>ImageMagick:</strong>
02591                 For conversion of non-web formats to webformats, combining images with alpha-masks, performing image-effects like blurring and sharpening.
02592                 ImageMagick is a collection of external programs on the server called by the exec() function in PHP. TYPO3 uses three of these, namely 'convert' (converting fileformats, scaling, effects), 'combine'/'composite' (combining images with masks) and 'identify' (returns image information).
02593                 Because ImageMagick are external programs, two requirements must be met: 1) The programs must be installed on the server and working and 2) if safe_mode is enabled, the programs must be located in the folder defined by the php.ini setting, <em>safe_mode_exec_dir</em> (else they are not executed).
02594                 ImageMagick is available for both Windows and Unix. The current version is 5+, but TYPO3 enthusiasts prefer an old version 4.2.9 because that version has three main advantages: It's faster in some operations, the blur-function works, the sharpen-function works. Anyway you do it, you must tell TYPO3 by configuration whether you're using version 5+ or 4.2.9. (flag: [GFX][im_version_5])
02595                 ImageMagick homepage is at ".$this->linkIt('http://www.imagemagick.org/')."
02596 
02597                 <strong>GDLib:</strong>
02598                 For drawing boxes and rendering text on images with truetype fonts. Also used for icons, menuitems and generally the TypoScript GIFBUILDER object is based on GDlib, but extensively utilizing ImageMagick to process intermediate results.
02599                 GDLib is accessed through internal functions in PHP, so in this case, you have no safe_mode problems, but you'll need a version of PHP with GDLib compiled in. Also in order to use TrueType fonts with GDLib you'll need FreeType compiled in as well.
02600                 ".$this->getGDSoftwareInfo().'
02601 
02602                 You can disable all image processing options in TYPO3 ([GFX][image_processing]=0), but that would seriously disable TYPO3.
02603                 ');
02604 
02605                 $this->message('Image Processing','Verifying the image processing capabilities of your server',"
02606                 This page performs image processing and displays the result. It's a thorough check that everything you've configured is working correctly.
02607                 It's quite simple to verify your installation; Just look down the page, the images in pairs should look like each other. If some images are not alike, something is wrong. You may also notice warnings and errors if this tool found signs of any problems.
02608 
02609                 The image to the right is the reference image (how it should be) and to the left the image made by your server.
02610                 The reference images are made with the classic ImageMagick install based on the 4.2.9 RPM and 5.2.3 RPM. If the version 5 flag is set, the reference images are made by the 5.2.3 RPM.
02611 
02612                 This test will work only if your ImageMagick/GDLib configuration allows it to. The typo3temp/ folder must be writable for all the temporary image files. They are all prefixed 'install_' so they are easy to recognize and delete afterwards.
02613                 ");
02614 
02615                 $im_path = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'];
02616                 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']=='gm')   {
02617                         $im_path_version = $this->config_array['im_versions'][$im_path]['gm'];
02618                 } else {
02619                         $im_path_version = $this->config_array['im_versions'][$im_path]['convert'];
02620                 }
02621                 $im_path_lzw = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'];
02622                 $im_path_lzw_version = $this->config_array['im_versions'][$im_path_lzw]['convert'];
02623                 $msg = '
02624                 ImageMagick enabled: <strong>'.$GLOBALS['TYPO3_CONF_VARS']['GFX']['im'].'</strong>
02625                 ImageMagick path: <strong>'.$im_path.'</strong> ('.$im_path_version.')
02626                 ImageMagick path/LZW: <strong>'.$im_path_lzw.'</strong>  ('.$im_path_lzw_version.')
02627                 Version 5/GraphicsMagick flag: <strong>'.$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'].'</strong>
02628 
02629                 GDLib enabled: <strong>'.$GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'].'</strong>
02630                 GDLib using PNG: <strong>'.$GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png'].'</strong>
02631                 GDLib 2 enabled: <strong>'.$GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_2'].'</strong>
02632                 IM5 effects enabled: <strong>'.$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_v5effects'].'</strong> (Blurring/Sharpening with IM 5+)
02633                 Freetype DPI: <strong>'.$GLOBALS['TYPO3_CONF_VARS']['GFX']['TTFdpi'].'</strong> (Should be 96 for Freetype 2)
02634                 Mask invert: <strong>'.$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_imvMaskState'].'</strong> (Should be set for some IM versions approx. 5.4+)
02635 
02636                 File Formats: <strong>'.$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'].'</strong>
02637                 ';
02638 
02639                         // Various checks to detect IM/GM version mismatches
02640                 $mismatch=false;
02641                 switch (strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'])) {
02642                         case 'gm':
02643                                 if (doubleval($im_path_version)>=2)     $mismatch=true;
02644                         break;
02645                         case 'im4':
02646                                 if (doubleval($im_path_version)>=5)     $mismatch=true;
02647                         break;
02648                         default:
02649                                 if (($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']?true:false) != (doubleval($im_path_version)>=5))        $mismatch=true;
02650                         break;
02651                 }
02652 
02653                 if ($mismatch)  {
02654                         $msg.= 'Warning: Mismatch between the version of ImageMagick'.
02655                                         ' ('.$im_path_version.') and the configuration of '.
02656                                         '[GFX][im_version_5] ('.$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5'].')';
02657                         $etype=2;
02658                 } else $etype=1;
02659 
02660                 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']=='gm')   {
02661                         $msg = str_replace('ImageMagick','GraphicsMagick',$msg);
02662                 }
02663 
02664                 $this->message('Image Processing','Current configuration',$msg,$etype);
02665 
02666 
02667 
02668 
02669                 if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['image_processing'])    {
02670                         $this->message('Image Processing','Image Processing disabled!',"
02671                                 Image Processing is disabled by the config flag <nobr>[GFX][image_processing]</nobr> set to false (zero)
02672                         ",2);
02673                         echo $this->outputWrapper($this->printAll());
02674                         return;
02675                 }
02676                 if (!$this->config_array['dir_typo3temp'])      {
02677                         $this->message('Image Processing','typo3temp/ not writable!',"
02678                                 You must make typo3temp/ write enabled before you can proceed with this test.
02679                         ",2);
02680                         echo $this->outputWrapper($this->printAll());
02681                         return;
02682                 }
02683 
02684 
02685 
02686                 $msg='<a name="testmenu"></a>Click each of these links in turn to test a topic. <strong>Please be aware that each test may take several seconds!</strong>:
02687 
02688                 '.$this->imagemenu();
02689                 $this->message('Image Processing','Testmenu',$msg,'');
02690 
02691 
02692                 $this->messageFunc_nl2br=0;
02693                 $parseStart = microtime();
02694                 $imageProc = t3lib_div::makeInstance('t3lib_stdGraphic');
02695                 $imageProc->init();
02696                 $imageProc->tempPath = $this->typo3temp_path;
02697                 $imageProc->dontCheckForExistingTempFile=1;
02698 //              $imageProc->filenamePrefix='install_'.($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_version_5']?"v5":"");
02699                 $imageProc->filenamePrefix='install_';
02700                 $imageProc->dontCompress=1;
02701                 $imageProc->alternativeOutputKey='TYPO3_INSTALL_SCRIPT';
02702                 $imageProc->noFramePrepended=$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_noFramePrepended'];
02703 
02704                 // Very temporary!!!
02705                 $imageProc->dontUnlinkTempFiles=0;
02706 
02707 
02708                 $imActive = ($this->config_array['im'] && $im_path);
02709                 $gdActive = ($this->config_array['gd'] && $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']);
02710 
02711                 switch($this->INSTALL['images_type'])   {
02712                         case 'read':
02713                                 $refParseTime='5600';   // 4.2.9
02714                                 $refParseTime='3300';   // 5.2.3
02715                                 $headCode = 'Reading and converting images';
02716                                 $this->message($headCode,'Supported file formats',"
02717                                 This verifies that your ImageMagick installation is able to read the nine default file formats; JPG, GIF, PNG, TIF, BMP, PCX, TGA, PDF, AI.
02718                                 The tool 'identify' will be used to read the pixeldimensions of non-web formats.
02719                                 The tool 'convert' is used to read the image and write a temporary JPG-file
02720                                 ");
02721 
02722                                 if ($imActive)  {
02723                                                 // Reading formats - writing JPG
02724 
02725                                         $extArr = explode(',','jpg,gif,png,tif,bmp,pcx,tga');
02726                                         while(list(,$ext)=each($extArr))        {
02727                                                 if ($this->isExtensionEnabled($ext, $headCode, "Read ".strtoupper($ext)))       {
02728                                                         $imageProc->IM_commands=array();
02729                                                         $theFile = t3lib_extMgm::extPath('install').'imgs/jesus.'.$ext;
02730                                                         if (!@is_file($theFile))        die('Error: '.$theFile.' was not a file');
02731 
02732                                                         $imageProc->imageMagickConvert_forceFileNameBody='read_'.$ext;
02733                                                         $fileInfo = $imageProc->imageMagickConvert($theFile,'jpg',"",'',"",'',"",1);
02734                                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02735                                                         $this->message($headCode,"Read ".strtoupper($ext),$result[0],$result[1]);
02736                                                 }
02737                                         }
02738 
02739                                         if ($this->isExtensionEnabled('pdf', $headCode, 'Read PDF'))    {
02740                                                 $imageProc->IM_commands=array();
02741                                                 $theFile = t3lib_extMgm::extPath('install').'imgs/pdf_from_imagemagick.pdf';
02742                                                 if (!@is_file($theFile))        die('Error: '.$theFile.' was not a file');
02743 
02744                                                 $imageProc->imageMagickConvert_forceFileNameBody='read_pdf';
02745                                                 $fileInfo = $imageProc->imageMagickConvert($theFile,'jpg',"170",'',"",'',"",1);
02746                                                 $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02747                                                 $this->message($headCode,'Read PDF',$result[0],$result[1]);
02748                                         }
02749                                         if ($this->isExtensionEnabled('ai', $headCode, 'Read AI'))      {
02750                                                 $imageProc->IM_commands=array();
02751                                                 $theFile = t3lib_extMgm::extPath('install').'imgs/typo3logotype.ai';
02752                                                 if (!@is_file($theFile))        die('Error: '.$theFile.' was not a file');
02753 
02754                                                 $imageProc->imageMagickConvert_forceFileNameBody='read_ai';
02755                                                 $fileInfo = $imageProc->imageMagickConvert($theFile,'jpg',"170",'',"",'',"",1);
02756                                                 $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02757                                                 $this->message($headCode,'Read AI',$result[0],$result[1]);
02758                                         }
02759                                 } else {
02760                                         $this->message($headCode,'Test skipped',"
02761                                         Use of ImageMagick has been disabled in the configuration.
02762                                         Refer to section 'Basic Configuration' to change or review you configuration settings
02763                                         ",2);
02764                                 }
02765                         break;
02766                         case 'write':
02767                                 $refParseTime='300';
02768 
02769                                         // Writingformats - writing JPG
02770                                 $headCode = 'Writing images';
02771                                 $this->message($headCode,'Writing GIF and PNG','
02772                                 This verifies that ImageMagick is able to write GIF and PNG files.
02773                                 The GIF-file is attempted compressed with LZW by the t3lib_div::gif_compress() function.
02774                                 ');
02775 
02776                                 if ($imActive)  {
02777                                                 // Writing GIF
02778                                         $imageProc->IM_commands=array();
02779                                         $theFile = t3lib_extMgm::extPath('install').'imgs/jesus.gif';
02780                                         if (!@is_file($theFile))        die('Error: '.$theFile.' was not a file');
02781 
02782                                         $imageProc->imageMagickConvert_forceFileNameBody='write_gif';
02783                                         $fileInfo = $imageProc->imageMagickConvert($theFile,'gif',"",'',"",'',"",1);
02784                                         if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gif_compress']) {
02785                                                 clearstatcache();
02786                                                 $prevSize=t3lib_div::formatSize(@filesize($fileInfo[3]));
02787                                                 $returnCode = t3lib_div::gif_compress($fileInfo[3],'');
02788                                                 clearstatcache();
02789                                                 $curSize=t3lib_div::formatSize(@filesize($fileInfo[3]));
02790                                                 $note = array('Note on gif_compress() function:',"The 'gif_compress' method used was '".$returnCode."'.<br />Previous filesize: ".$prevSize.'. Current filesize:'.$curSize);
02791                                         } else  $note=array('Note on gif_compress() function:','<em>Not used! Disabled by [GFX][gif_compress]</em>');
02792                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands, $note);
02793                                         $this->message($headCode,'Write GIF',$result[0],$result[1]);
02794 
02795 
02796                                                 // Writing PNG
02797                                         $imageProc->IM_commands=array();
02798                                         $theFile = t3lib_extMgm::extPath('install').'imgs/jesus.gif';
02799 
02800                                         $imageProc->imageMagickConvert_forceFileNameBody='write_png';
02801                                         $fileInfo = $imageProc->imageMagickConvert($theFile,'png',"",'',"",'',"",1);
02802                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02803                                         $this->message($headCode,'Write PNG',$result[0],$result[1]);
02804                                 } else {
02805                                         $this->message($headCode,'Test skipped',"
02806                                         Use of ImageMagick has been disabled in the configuration.
02807                                         Refer to section 'Basic Configuration' to change or review you configuration settings
02808                                         ",2);
02809                                 }
02810                         break;
02811                         case 'scaling':
02812                                 $refParseTime='650';
02813 
02814                                         // Scaling
02815                                 $headCode = 'Scaling images';
02816                                 $this->message($headCode,'Scaling transparent images','
02817                                 This shows how ImageMagick reacts when scaling transparent GIF and PNG files.
02818                                 ');
02819 
02820                                 if ($imActive)  {
02821                                                 // Scaling transparent image
02822                                         $imageProc->IM_commands=array();
02823                                         $theFile = t3lib_extMgm::extPath('install').'imgs/jesus2_transp.gif';
02824                                         if (!@is_file($theFile))        die('Error: '.$theFile.' was not a file');
02825 
02826                                         $imageProc->imageMagickConvert_forceFileNameBody='scale_gif';
02827                                         $fileInfo = $imageProc->imageMagickConvert($theFile,'gif',"150",'',"",'',"",1);
02828                                         if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gif_compress']) {
02829                                                 clearstatcache();
02830                                                 $prevSize=t3lib_div::formatSize(@filesize($fileInfo[3]));
02831                                                 $returnCode = t3lib_div::gif_compress($fileInfo[3],'');
02832                                                 clearstatcache();
02833                                                 $curSize=t3lib_div::formatSize(@filesize($fileInfo[3]));
02834                                                 $note = array('Note on gif_compress() function:',"The 'gif_compress' method used was '".$returnCode."'.<br />Previous filesize: ".$prevSize.'. Current filesize:'.$curSize);
02835                                         } else $note=array('Note on gif_compress() function:','<em>Not used! Disabled by [GFX][gif_compress]</em>');
02836                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands,$note);
02837                                         $this->message($headCode,'GIF to GIF, 150 pixels wide',$result[0],$result[1]);
02838 
02839                                         $imageProc->IM_commands=array();
02840                                         $theFile = t3lib_extMgm::extPath('install').'imgs/jesus2_transp.png';
02841                                         if (!@is_file($theFile))        die('Error: '.$theFile.' was not a file');
02842 
02843                                         $imageProc->imageMagickConvert_forceFileNameBody='scale_png';
02844                                         $fileInfo = $imageProc->imageMagickConvert($theFile,'png',"150",'',"",'',"",1);
02845                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02846                                         $this->message($headCode,'PNG to PNG, 150 pixels wide',$result[0],$result[1]);
02847 
02848                                         $imageProc->IM_commands=array();
02849                                         $theFile = t3lib_extMgm::extPath('install').'imgs/jesus2_transp.gif';
02850                                         if (!@is_file($theFile))        die('Error: '.$theFile.' was not a file');
02851                                         $imageProc->imageMagickConvert_forceFileNameBody='scale_jpg';
02852                                         $fileInfo = $imageProc->imageMagickConvert($theFile,'jpg',"150",'',"",'',"",1);
02853                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02854                                         $this->message($headCode,'GIF to JPG, 150 pixels wide',$result[0],$result[1]);
02855                                 } else {
02856                                         $this->message($headCode,'Test skipped',"
02857                                         Use of ImageMagick has been disabled in the configuration.
02858                                         Refer to section 'Basic Configuration' to change or review you configuration settings
02859                                         ",2);
02860                                 }
02861                         break;
02862                         case 'combining':
02863                                 $refParseTime='150';    // 4.2.9
02864                                 $refParseTime='250';    // 5.2.3
02865                                                                         // Combine
02866                                 $headCode = 'Combining images';
02867                                 $this->message($headCode,'Combining images',"
02868                                 This verifies that the ImageMagick tool, 'combine'/'composite', is able to combine two images through a grayscale mask.<br />
02869                                 If the masking seems to work but inverted, that just means you'll have to make sure the invert flag is set (some combination of im_negate_mask/im_imvMaskState)
02870                                 ");
02871 
02872                                 if ($imActive)  {
02873                                         $imageProc->IM_commands=array();
02874                                         $input = t3lib_extMgm::extPath('install').'imgs/greenback.gif';
02875                                         $overlay = t3lib_extMgm::extPath('install').'imgs/jesus.jpg';
02876                                         $mask = t3lib_extMgm::extPath('install').'imgs/blackwhite_mask.gif';
02877                                                 if (!@is_file($input))  die('Error: '.$input.' was not a file');
02878                                                 if (!@is_file($overlay))        die('Error: '.$overlay.' was not a file');
02879                                                 if (!@is_file($mask))   die('Error: '.$mask.' was not a file');
02880 
02881                                         $output = $imageProc->tempPath.$imageProc->filenamePrefix.t3lib_div::shortMD5($imageProc->alternativeOutputKey.'combine1').'.jpg';
02882                                         $imageProc->combineExec($input,$overlay,$mask,$output, true);
02883                                         $fileInfo = $imageProc->getImageDimensions($output);
02884                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02885                                         $this->message($headCode,'Combine using a GIF mask with only black and white',$result[0],$result[1]);
02886 
02887                                         // Combine
02888                                         $imageProc->IM_commands=array();
02889                                         $input = t3lib_extMgm::extPath('install').'imgs/combine_back.jpg';
02890                                         $overlay = t3lib_extMgm::extPath('install').'imgs/jesus.jpg';
02891                                         $mask = t3lib_extMgm::extPath('install').'imgs/combine_mask.jpg';
02892                                                 if (!@is_file($input))  die('Error: '.$input.' was not a file');
02893                                                 if (!@is_file($overlay))        die('Error: '.$overlay.' was not a file');
02894                                                 if (!@is_file($mask))   die('Error: '.$mask.' was not a file');
02895 
02896                                         $output = $imageProc->tempPath.$imageProc->filenamePrefix.t3lib_div::shortMD5($imageProc->alternativeOutputKey.'combine2').'.jpg';
02897                                         $imageProc->combineExec($input,$overlay,$mask,$output, true);
02898                                         $fileInfo = $imageProc->getImageDimensions($output);
02899                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02900                                         $this->message($headCode,'Combine using a JPG mask with graylevels',$result[0],$result[1]);
02901                                 } else {
02902                                         $this->message($headCode,'Test skipped',"
02903                                         Use of ImageMagick has been disabled in the configuration.
02904                                         Refer to section 'Basic Configuration' to change or review you configuration settings
02905                                         ",2);
02906                                 }
02907                         break;
02908                         case 'gdlib':
02909                                 $refParseTime='1800';   // GIF / 4.2.9 / LZW (5.2.3)
02910                                 $refParseTime='2700';   // PNG / 4.2.9 / LZW (5.2.3)
02911                                 $refParseTime='1600';   // GIF / 5.2.3 / LZW (5.2.3)
02912                                         // GDLibrary
02913                                 $headCode = 'GDLib';
02914                                 $this->message($headCode,'Testing GDLib','
02915                                 This verifies that the GDLib installation works properly.
02916                                 ');
02917 
02918 
02919                                 if ($gdActive)  {
02920                                         // GD with box
02921                                         $imageProc->IM_commands=array();
02922                                         $im = $imageProc->imageCreate(170,136);
02923                                         $Bcolor = ImageColorAllocate ($im, 0, 0, 0);
02924                                         ImageFilledRectangle($im, 0, 0, 170, 136, $Bcolor);
02925                                         $workArea=array(0,0,170,136);
02926                                         $conf=array(
02927                                                 'dimensions' => '10,50,150,36',
02928                                                 'color' => 'olive'
02929                                         );
02930                                         $imageProc->makeBox($im,$conf,$workArea);
02931                                         $output = $imageProc->tempPath.$imageProc->filenamePrefix.t3lib_div::shortMD5('GDbox').'.'.$imageProc->gifExtension;
02932                                         $imageProc->ImageWrite($im,$output);
02933                                         $fileInfo = $imageProc->getImageDimensions($output);
02934                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02935                                         $this->message($headCode,'Create simple image',$result[0],$result[1]);
02936 
02937 
02938                                         // GD from image with box
02939                                         $imageProc->IM_commands=array();
02940                                         $input = t3lib_extMgm::extPath('install').'imgs/jesus.'.$imageProc->gifExtension;
02941                                                 if (!@is_file($input))  die('Error: '.$input.' was not a file');
02942                                         $im = $imageProc->imageCreateFromFile($input);
02943                                         $workArea=array(0,0,170,136);
02944                                         $conf=array();
02945                                         $conf['dimensions']='10,50,150,36';
02946                                         $conf['color']='olive';
02947                                         $imageProc->makeBox($im,$conf,$workArea);
02948                                         $output = $imageProc->tempPath.$imageProc->filenamePrefix.t3lib_div::shortMD5('GDfromImage+box').'.'.$imageProc->gifExtension;
02949                                         $imageProc->ImageWrite($im,$output);
02950                                         $fileInfo = $imageProc->getImageDimensions($output);
02951                                         $GDWithBox_filesize = @filesize($output);
02952                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02953                                         $this->message($headCode,'Create image from file',$result[0],$result[1]);
02954 
02955 
02956                                         // GD with text
02957                                         $imageProc->IM_commands=array();
02958                                         $im = $imageProc->imageCreate(170,136);
02959                                         $Bcolor = ImageColorAllocate ($im, 128,128,150);
02960                                         ImageFilledRectangle($im, 0, 0, 170, 136, $Bcolor);
02961                                         $workArea=array(0,0,170,136);
02962                                         $conf=array(
02963                                                 'iterations' => 1,
02964                                                 'angle' => 0,
02965                                                 'antiAlias' => 1,
02966                                                 'text' => 'HELLO WORLD',
02967                                                 'fontColor' => '#003366',
02968                                                 'fontSize' => 18,
02969                                                 'fontFile' => $this->backPath.'../t3lib/fonts/vera.ttf',
02970                                                 'offset' => '17,40'
02971                                         );
02972                                         $conf['BBOX'] = $imageProc->calcBBox($conf);
02973                                         $imageProc->makeText($im,$conf,$workArea);
02974 
02975                                         $output = $imageProc->tempPath.$imageProc->filenamePrefix.t3lib_div::shortMD5('GDwithText').'.'.$imageProc->gifExtension;
02976                                         $imageProc->ImageWrite($im,$output);
02977                                         $fileInfo = $imageProc->getImageDimensions($output);
02978                                         $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands);
02979                                         $this->message($headCode,'Render text with TrueType font',$result[0],$result[1]);
02980 
02981                                         if ($imActive)  {
02982                                                         // extension: GD with text, niceText
02983                                                 $conf['offset'] = '17,65';
02984                                                 $conf['niceText'] = 1;
02985                                                 $imageProc->makeText($im,$conf,$workArea);
02986 
02987                                                 $output = $imageProc->tempPath.$imageProc->filenamePrefix.t3lib_div::shortMD5('GDwithText-niceText').'.'.$imageProc->gifExtension;
02988                                                 $imageProc->ImageWrite($im,$output);
02989                                                 $fileInfo = $imageProc->getImageDimensions($output);
02990                                                 $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands, array("Note on 'niceText':","'niceText' is a concept that tries to improve the antialiasing of the rendered type by actually rendering the textstring in double size on a black/white mask, downscaling the mask and masking the text onto the image through this mask. This involves ImageMagick 'combine'/'composite' and 'convert'."));
02991                                                 $this->message($headCode,"Render text with TrueType font using 'niceText' option",
02992                                                         "(If the image has another background color than the image above (eg. dark background color with light text) then you will have to set TYPO3_CONF_VARS[GFX][im_imvMaskState]=1)<br /><br />".
02993                                                         $result[0],$result[1]);
02994                                         } else {
02995                                                 $this->message($headCode,"Render text with TrueType font using 'niceText' option","
02996                                                 <strong>Test is skipped!</strong><br /><br />
02997 
02998                                                 Use of ImageMagick has been disabled in the configuration. ImageMagick is needed to generate text with the niceText option.
02999                                                 Refer to section 'Basic Configuration' to change or review you configuration settings
03000                                                 ",2);
03001                                         }
03002 
03003                                         if ($imActive)  {
03004                                                         // extension: GD with text, niceText AND shadow
03005                                                 $conf['offset'] = '17,90';
03006                                                 $conf['niceText'] = 1;
03007                                                 $conf['shadow.'] = array(
03008                                                         'offset'=>'2,2',
03009                                                         'blur' => $imageProc->V5_EFFECTS?"20":"90",
03010                                                         'opacity' => '50',
03011                                                         'color' => 'black'
03012                                                 );
03013                                                 $imageProc->makeShadow($im,$conf['shadow.'],$workArea,$conf);
03014                                                 $imageProc->makeText($im,$conf,$workArea);
03015 
03016                                                 $output = $imageProc->tempPath.$imageProc->filenamePrefix.t3lib_div::shortMD5('GDwithText-niceText-shadow').'.'.$imageProc->gifExtension;
03017                                                 $imageProc->ImageWrite($im,$output);
03018                                                 $fileInfo = $imageProc->getImageDimensions($output);
03019                                                 $result = $this->displayTwinImage($fileInfo[3],$imageProc->IM_commands, array('Note on drop shadows:','Drop shadows are done my using ImageMagick to blur a mask through which the drop shadow is generated. The blurring of the mask only works in ImageMagick 4.2.9 and <i>not</i> ImageMagick 5 - which is why you may see a hard and not soft shadow.'));
03020                                                 $this->message($headCode,"Render 'niceText' with a shadow under",
03021                                                         "(This test makes sense only if the above test had a correct output. But if so, you may not see a soft dropshadow from the third text string as you should. In that case you are most likely using ImageMagick 5 and should set the flag TYPO3_CONF_VARS[GFX][im_v5effects]. However this may cost server performance!<br />Finally if you see no drop shadow at all or if the shadow is still not soft, then check if you are using GDlib2 and if so set TYPO3_CONF_VARS[GFX][gdlib_2]=1)<br /><br />".
03022                                                         $result[0],$result[1]);
03023                                         } else {
03024                                                 $this->message($headCode,"Render 'niceText' with a shadow under","
03025                                                 <strong>Test is skipped!</strong><br /><br />
03026 
03027                                                 Use of ImageMagick has been disabled in the configuration. ImageMagick is needed to generate shadows.
03028                                                 Refer to section 'Basic Configuration' to change or review you configuration settings
03029                                                 ",2);
03030                                         }
03031 
03032                                         if ($imageProc->gifExtension=='gif')    {
03033                                                 $buffer=20;
03034                                                 $assess = "This assessment is based on the filesize from 'Create image from file' test, which were ".$GDWithBox_filesize.' bytes';
03035                                                 $goodNews = "If the image was LZW compressed you would expect to have a size of less than 9000 bytes. If you open the image with Photoshop and saves it from Photoshop, you'll a filesize like that.<br />The good news is (hopefully) that your [GFX][im_path_lzw] path is correctly set so the gif_compress() function will take care of the compression for you!";
03036                                                 if ($GDWithBox_filesize<8784+$buffer)   {
03037                                                         $msg="<strong>Your GDLib appears to have LZW compression!</strong><br />
03038                                                                 This assessment is based on the filesize from 'Create image from file' test, which were ".$GDWithBox_filesize." bytes.<br />
03039                                                                 This is a real advantage for you because you don't need to use ImageMagick for LZW compressing. In order to make sure that GDLib is used, <strong>please set the config option [GFX][im_path_lzw] to an empty string!</strong><br />
03040                                                                 When you disable the use of ImageMagick for LZW compressing, you'll see that the gif_compress() function has a return code of 'GD' (for GDLib) instead of 'IM' (for ImageMagick)
03041                                                                 ";
03042                                                 } elseif ($GDWithBox_filesize>19000)    {
03043                                                         $msg='<strong>Your GDLib appears to have no compression at all!</strong><br />
03044                                                                 '.$assess.'<br />'.$goodNews;
03045                                                 } else {
03046                                                         $msg='Your GDLib appears to have RLE compression<br />
03047                                                                 '.$assess.'<br />'.$goodNews;
03048                                                 }
03049                                                 $this->message($headCode,'GIF compressing in GDLib',"
03050                                                 ".$msg."
03051                                                 ",1);
03052                                         }
03053 
03054                                 } else {
03055                                         $this->message($headCode,'Test skipped',"
03056                                         Use of GDLib has been disabled in the configuration.
03057                                         Refer to section 'Basic Configuration' to change or review you configuration settings
03058                                         ",2);
03059                                 }
03060                         break;
03061                 }
03062 
03063                 if ($this->INSTALL['images_type'])      {
03064                         // End info
03065                         if ($this->fatalError)  {
03066                                 $this->message('Info','Errors',"
03067                                 It seems that you had some fatal errors in this test. Please make sure that your ImageMagick and GDLib settings are correct.
03068                                 Refer to the 'Basic Configuration' section for more information and debugging of your settings.
03069                                 ");
03070                         }
03071 
03072                         $parseStop = microtime();
03073                         $parseMS = t3lib_div::convertMicrotime($parseStop)-t3lib_div::convertMicrotime($parseStart);
03074                         $this->message('Info','Parsetime',$parseMS.' ms');
03075                 }
03076                 echo $this->outputWrapper($this->printAll());
03077         }
03078 
03087         function isExtensionEnabled($ext, $headCode, $short)    {
03088                 if (!t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$ext))       {
03089                         $this->message($headCode,$short,'Skipped - extension not in the list of allowed extensions ([GFX][imagefile_ext]).',1);
03090                 } else {
03091                         return 1;
03092                 }
03093         }
03094 
03103         function displayTwinImage ($imageFile, $IMcommands=array(), $note='')   {
03104                 $ex_rows='';
03105                 $errorLevels=array(-1);
03106                 if ($imageFile) {
03107                         $verifyFile = t3lib_extMgm::extPath('install').'verify_imgs/'.basename($imageFile);
03108 #debug(array($imageFile,$this->backPath.'../'.substr($imageFile,strlen(PATH_site))),1);
03109                         $destImg = @getImageSize($imageFile);
03110                         $destImgCode ='<img src="'.$this->backPath.'../'.substr($imageFile,strlen(PATH_site)).'" '.$destImg[3].'>';
03111                         $verifyImg = @getImageSize($verifyFile);
03112                         $verifyImgCode = '<img src="'.$this->backPath.t3lib_extMgm::extRelPath('install').'verify_imgs/'.basename($verifyFile).'" '.$verifyImg[3].'>';
03113                         if (!$verifyImg)        {
03114                                 $gifVersion=1;
03115                                 $verifyFile_alt = substr($verifyFile,0,-3).'gif';
03116                                 $verifyImg = @getImageSize($verifyFile_alt);
03117                                 if ($verifyImg) {
03118 // FIXME what is that? old code? t3lib/install/verify_imgs/ do not exist
03119                                         $verifyImgCode = '<img src="'.$this->backPath.'t3lib/install/verify_imgs/'.basename($verifyFile_alt).'" '.$verifyImg[3].'>';
03120                                         $verifyImgCode= '<table border="0" cellpadding="4" cellspacing="0" bgcolor="red"><tr><td align="center">'.$verifyImgCode.'<br />'.$this->fw('<strong>NO REFERENCE FOUND!</strong><br /><br />GIF version looks like this.').'</td></tr></table>';
03121                                 } else {
03122                                         $verifyImgCode= '<table border="0" cellpadding="4" cellspacing="0" bgcolor="red"><tr><td align="center">'.$this->fw('<strong>NO REFERENCE FOUND!</strong><br /><br />'.basename($verifyFile)).'</td></tr></table>';
03123                                 }
03124                         }
03125 
03126                         clearstatcache();
03127                         $destImg['filesize'] = @filesize($imageFile);
03128                         clearstatcache();
03129                         $verifyImg['filesize'] = @filesize($verifyFile);
03130 
03131                         $ex_rows.='<tr>';
03132                         $ex_rows.='<td>'.$destImgCode.'</td>';
03133                         $ex_rows.='<td><img src="clear.gif" width="30" height="1"></td>';
03134                         $ex_rows.='<td>'.$verifyImgCode.'</td>';
03135                         $ex_rows.='</tr>';
03136 
03137                         $ex_rows.=$this->getTwinImageMessage('', 'Your server:', 'Reference:');
03138                         $ex_rows.=$this->getTwinImageMessage('', t3lib_div::formatSize($destImg['filesize']).', '.$destImg[0].'x'.$destImg[1].' pixels', t3lib_div::formatSize($verifyImg['filesize']).', '.$verifyImg[0].'x'.$verifyImg[1].' pixels');
03139 
03140                         if (($destImg['filesize']!=$verifyImg['filesize']) && (intval($destImg['filesize']) && ($destImg['filesize']-$verifyImg['filesize']) > 2048))   {       // Display a warning if the generated image is more than 2KB larger than its reference...
03141                                 $ex_rows.=$this->getTwinImageMessage('File size is very different from reference', $destImg['filesize'], $verifyImg['filesize']);
03142                                 $errorLevels[]=2;
03143                         }
03144                         if ($destImg[0]!=$verifyImg[0] || $destImg[1]!=$verifyImg[1])   {
03145                                 $ex_rows.=$this->getTwinImageMessage('Pixel dimension are not equal!');
03146                                 $errorLevels[]=2;
03147                         }
03148                         if ($note)      {
03149                                 $ex_rows.=$this->getTwinImageMessage($note[0],$note[1]);
03150                         }
03151                         if ($this->dumpImCommands && count($IMcommands))        {
03152                                 $ex_rows.=$this->getTwinImageMessage('ImageMagick commands executed:',$this->formatImCmds($IMcommands));
03153                         }
03154                 } else {
03155                         $ex_rows.=$this->getTwinImageMessage('There was no result from the ImageMagick operation', "Below there's a dump of the ImageMagick commands executed:<br />".$this->formatImCmds($IMcommands));
03156                         $errorLevels[]=3;
03157                 }
03158                 $out='<table border="0" cellpadding="0" cellspacing="0" align="center" width="300">'.$ex_rows.'</table>';
03159 
03160                 return array($out,max($errorLevels));
03161         }
03162 
03171         function getTwinImageMessage($message, $label_1="", $label_2='')        {
03172                 if ($message)   $out.='<tr><td colspan="3"><strong>'.$this->fw($message).'</strong></td></tr>';
03173                 if ($label_1 && !$label_2)      {
03174                         $out.='<tr><td colspan="3">'.$this->fw($label_1).'</td></tr>';
03175                 } elseif ($label_1 || $label_2) {
03176                         $out.='<tr><td>'.$this->fw($label_1).'</td><td></td><td>'.$this->fw($label_2).'</td></tr>';
03177                 }
03178                 return $out;
03179         }
03180 
03187         function formatImCmds($arr)     {
03188                 $out=array();
03189                 if (is_array($arr))     {
03190                         reset($arr);
03191                         while(list($k,$v)=each($arr))   {
03192                                 $out[]=$v[1];
03193                                 if ($v[2])      $out[]='   RETURNED: '.$v[2];
03194                         }
03195                 }
03196                 if (count($out))        {
03197                         $col = t3lib_div::intInRange(count($out),2,10);
03198                         $outputStr = '<textarea cols=40 rows='.$col.' wrap="off" class="fixed-font">'.htmlspecialchars(implode($out,chr(10))).'</textarea>';
03199                         return '<form action="">'.$outputStr.'</form>';
03200                 };
03201         }
03202 
03208         function imagemenu()    {
03209                 $menuitems = array(
03210                         'read' => 'Reading image formats',
03211                         'write' => 'Writing GIF and PNG',
03212                         'scaling' => 'Scaling images',
03213                         'combining' => 'Combining images',
03214                         'gdlib' => 'GD library functions'
03215                 );
03216                 reset($menuitems);
03217                 $c=0;
03218                 $out=array();
03219                 while(list($k,$v)=each($menuitems))     {
03220                         $bgcolor = ($this->INSTALL['images_type']==$k ? ' bgcolor="#ABBBB4"' : ' bgcolor="#F4F0E8"');
03221                         $c++;
03222                         $out[]='<tr><td'.$bgcolor.'><a href="'.htmlspecialchars($this->action.'&TYPO3_INSTALL[images_type]='.$k.'#testmenu').'">'.$this->fw($c.': '.$v).'</a></td></tr>';
03223                 }
03224 
03225                 $code = '<table border="0" cellpadding="0" cellspacing="1">'.implode($out,'').'</table>';
03226                 $code = '<table border="0" cellpadding="0" cellspacing="0" bgcolor="#ABBBB4"><tr><td>'.$code.'</td></tr></table>';
03227                 return '<div align="center">'.$code.'</div>';
03228         }
03229 
03230 
03231 
03232 
03233 
03234 
03235 
03236 
03237 
03238 
03239 
03240 
03241         /**********************
03242          *
03243          * DATABASE analysing
03244          *
03245          **********************/
03246 
03250         function checkTheDatabase()     {
03251                 if (!$this->config_array['mysqlConnect'])       {
03252                         $this->message('Database Analyser','Your database connection failed',"
03253                                 Please go to the 'Basic Configuration' section and correct this problem first.
03254                         ",2);
03255                         echo $this->outputWrapper($this->printAll());
03256                         return;
03257                 }
03258                 if ($this->config_array['no_database']) {
03259                         $this->message('Database Analyser','No database selected',"
03260                                 Please go to the 'Basic Configuration' section and correct this problem first.
03261                         ",2);
03262                         echo $this->outputWrapper($this->printAll());
03263                         return;
03264                 }
03265 
03266                         // Getting current tables
03267                 $whichTables=$this->getListOfTables();
03268 
03269 
03270                         // Getting number of static_template records
03271                 if ($whichTables['static_template'])    {
03272                         $res_static = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'static_template', '');
03273                         list($static_template_count) = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_static);
03274                 }
03275                 $static_template_count=intval($static_template_count);
03276 
03277                 $headCode ='Database Analyser';
03278                 $this->message($headCode,'What is it?',"
03279                         In this section you can get an overview of your currently selected database compared to sql-files. You can also import sql-data directly into the database or upgrade tables from earlier versions of TYPO3.
03280                 ",0);
03281 
03282                 $cInfo='
03283                         Username: <strong>'.TYPO3_db_username.'</strong>
03284                         Password: <strong>'.TYPO3_db_password.'</strong>
03285                         Host: <strong>'.TYPO3_db_host.'</strong>
03286                 ';
03287                 $this->message($headCode, 'Connected to SQL database successfully',"
03288                 ".trim($cInfo)."
03289                 ",-1,1);
03290                 $this->message($headCode, 'Database',"
03291                         <strong>".TYPO3_db.'</strong> is selected as database.
03292                         Has <strong>'.count($whichTables)."</strong> tables.
03293                 ",-1,1);
03294 
03295 
03296                         // Menu
03297                 $this->messageFunc_nl2br = 0;
03298 
03299                 $sql_files = array_merge(
03300                         t3lib_div::getFilesInDir(PATH_typo3conf,'sql',1,1),
03301                         array()
03302                 );
03303 
03304                 $action_type = $this->INSTALL['database_type'];
03305                 $actionParts = explode('|',$action_type);
03306                 if (count($actionParts)<2)      {
03307                         $action_type='';
03308                 }
03309 
03310                 $out='';
03311                 $out.='<tr>
03312                                 <td nowrap="nowrap"><strong>'.$this->fw('Update required tables').'</strong></td>
03313                                 <td'.($action_type=='cmpFile|CURRENT_TABLES'?' bgcolor="#D9D5C9"':'').'>'.$this->fw('<a href="'.htmlspecialchars($this->action.'&TYPO3_INSTALL[database_type]=cmpFile|CURRENT_TABLES#bottom').'"><strong>COMPARE</strong></a>').'</td>
03314                                 <td>'.$this->fw('&nbsp;').'</td>
03315                                 <td>'.$this->fw('&nbsp;').'</td>
03316                         </tr>';
03317 
03318                 $out.='<tr>
03319                                 <td nowrap="nowrap"><strong>'.$this->fw('Dump static data').'</strong></td>
03320                                 <td>'.$this->fw('&nbsp;').'</td>
03321                                 <td nowrap="nowrap"'.($action_type=='import|CURRENT_STATIC'?' bgcolor="#D9D5C9"':'').'>'.$this->fw('<a href="'.htmlspecialchars($this->action.'&TYPO3_INSTALL[database_type]=import|CURRENT_STATIC#bottom').'"><strong>IMPORT</strong></a>').'</td>
03322                                 <td>'.$this->fw('&nbsp;').'</td>
03323                         </tr>';
03324 
03325                 $out.='<tr>
03326                                 <td colspan="4">&nbsp;</td>
03327                         </tr>';
03328 
03329 
03330                 reset($sql_files);
03331                 $directJump='';
03332                 while(list($k,$file)=each($sql_files))  {
03333                         if ($this->mode=="123" && !count($whichTables) && strstr($file,'_testsite'))    {
03334                                 $directJump = $this->action.'&TYPO3_INSTALL[database_type]=import|'.rawurlencode($file);
03335                         }
03336                         $lf=t3lib_div::testInt($k);
03337                         $fShortName = substr($file,strlen(PATH_site));
03338 
03339                         $spec1 = $spec2 = '';
03340 
03341                         $out.='<tr>
03342                                 <td nowrap="nowrap">'.$this->fw($fShortName.' ('.t3lib_div::formatSize(filesize($file)).')').'</td>
03343                                 <td'.($action_type=='cmpFile|'.$file?' bgcolor="#D9D5C9"':'').'>'.$this->fw('<a href="'.htmlspecialchars($this->action.'&TYPO3_INSTALL[database_type]=cmpFile|'.rawurlencode($file).'#bottom').'"><strong>COMPARE</strong></a>').'</td>
03344                                 <td nowrap="nowrap"'.($action_type=='import|'.$file?' bgcolor="#D9D5C9"':'').'>'.$this->fw('<a href="'.htmlspecialchars($this->action.'&TYPO3_INSTALL[database_type]=import|'.rawurlencode($file).'#bottom').'"><strong>IMPORT'.$spec1.$spec2.'</strong></a>').'</td>
03345                                 <td nowrap="nowrap"'.($action_type=='view|'.$file?' bgcolor="#D9D5C9"':'').'>'.$this->fw('<a href="'.htmlspecialchars($this->action.'&TYPO3_INSTALL[database_type]=view|'.rawurlencode($file).'#bottom').'"><strong>VIEW'.$spec1.$spec2.'</strong></a>').'</td>
03346                         </tr>';
03347                 }
03348                         // TCA
03349                 $out.='<tr>
03350                         <td></td>
03351                         <td colspan="3"'.($action_type=="cmpTCA|"?' bgcolor="#D9D5C9"':'').'><strong>'.$this->fw('<a href="'.htmlspecialchars($this->action.'&TYPO3_INSTALL[database_type]=cmpTCA|#bottom').'">Compare with $TCA</a>').'</strong></td>
03352                 </tr>';
03353                 $out.='<tr>
03354                         <td></td>
03355                         <td colspan="3"'.($action_type=="adminUser|"?' bgcolor="#D9D5C9"':'').'><strong>'.$this->fw('<a href="'.htmlspecialchars($this->action.'&TYPO3_INSTALL[database_type]=adminUser|#bottom').'">Create "admin" user</a>').'</strong></td>
03356                 </tr>';
03357                 $out.='<tr>
03358                         <td></td>
03359                         <td colspan="3"'.($action_type=="UC|"?' bgcolor="#D9D5C9"':'').'><strong>'.$this->fw('<a href="'.htmlspecialchars($this->action.'&TYPO3_INSTALL[database_type]=UC|#bottom').'">Reset user preferences</a>').'</strong></td>
03360                 </tr>';
03361                 $out.='<tr>
03362                         <td></td>
03363                         <td colspan="3"'.($action_type=="cache|"?' bgcolor="#D9D5C9"':'').'><strong>'.$this->fw('<a href="'.htmlspecialchars($this->action.'&TYPO3_INSTALL[database_type]=cache|#bottom').'">Clear tables</a>').'</strong></td>
03364                 </tr>';
03365 
03366                 $theForm='<table border="0" cellpadding="2" cellspacing="2">'.$out.'</table>';
03367                 $theForm.='<a name="bottom"></a>';
03368 
03369                 if ($directJump)        {
03370                         if (!$action_type)      {
03371                                 $this->message($headCode, 'Menu','
03372                                 <script language="javascript" type="text/javascript">
03373                                 window.location.href = "'.$directJump.'";
03374                                 </script>',0,1);
03375                         }
03376                 } else {
03377                         $this->message($headCode, 'Menu',"
03378                         From this menu you can select which of the available SQL files you want to either compare or import/merge with the existing database.<br /><br />
03379                         <strong>COMPARE:</strong> Compares the tables and fields of the current database and the selected file. It also offers to 'update' the difference found.<br />
03380                         <strong>IMPORT:</strong> Imports the SQL-dump file into the current database. You can either dump the raw file or choose which tables to import. In any case, you'll see a new screen where you must confirm the operation.<br />
03381                         <strong>VIEW:</strong> Shows the content of the SQL-file, limiting characters on a single line to a reader-friendly amount.<br /><br />
03382                         The SQL-files are selected from typo3conf/ (here you can put your own) and t3lib/stddb/ (TYPO3 distribution). The SQL-files should be made by the <em>mysqldump</em> tool or at least be formatted like that tool would do.
03383         <br />
03384                         <br />
03385                         ".$theForm."
03386                         ",0,1);
03387                 }
03388 
03389 
03390                         // Install user
03391                         // clear uc
03392                 if ($action_type)       {
03393                         switch($actionParts[0]) {
03394                                 case 'cmpFile':
03395                                         $tblFileContent='';
03396                                         if (!strcmp($actionParts[1],'CURRENT_TABLES')) {
03397                                                 $tblFileContent = t3lib_div::getUrl(PATH_t3lib.'stddb/tables.sql');
03398 
03399                                                 reset($GLOBALS['TYPO3_LOADED_EXT']);
03400                                                 while(list(,$loadedExtConf)=each($GLOBALS['TYPO3_LOADED_EXT'])) {
03401                                                         if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql'])       {
03402                                                                 $tblFileContent.= chr(10).chr(10).chr(10).chr(10).t3lib_div::getUrl($loadedExtConf['ext_tables.sql']);
03403                                                         }
03404                                                 }
03405                                         } elseif (@is_file($actionParts[1]))    {
03406                                                 $tblFileContent = t3lib_div::getUrl($actionParts[1]);
03407                                         }
03408                                         if ($tblFileContent)    {
03409                                                 $fileContent = implode(
03410                                                         $this->getStatementArray($tblFileContent,1,'^CREATE TABLE '),
03411                                                         chr(10)
03412                                                 );
03413                                                 $FDfile = $this->getFieldDefinitions_sqlContent($fileContent);
03414                                                 if (!count($FDfile))    {
03415                                                         die ("Error: There were no 'CREATE TABLE' definitions in the provided file");
03416                                                 }
03417 
03418                                                         // Updating database...
03419                                                 if (is_array($this->INSTALL['database_update']))        {
03420                                                         $FDdb = $this->getFieldDefinitions_database();
03421                                                         $diff = $this->getDatabaseExtra($FDfile, $FDdb);
03422                                                         $update_statements = $this->getUpdateSuggestions($diff);
03423                                                         $diff = $this->getDatabaseExtra($FDdb, $FDfile);
03424                                                         $remove_statements = $this->getUpdateSuggestions($diff,'remove');
03425 
03426                                                         $this->performUpdateQueries($update_statements['add'],$this->INSTALL['database_update']);
03427                                                         $this->performUpdateQueries($update_statements['change'],$this->INSTALL['database_update']);
03428                                                         $this->performUpdateQueries($remove_statements['change'],$this->INSTALL['database_update']);
03429                                                         $this->performUpdateQueries($remove_statements['drop'],$this->INSTALL['database_update']);
03430 
03431                                                         $this->performUpdateQueries($update_statements['create_table'],$this->INSTALL['database_update']);
03432                                                         $this->performUpdateQueries($remove_statements['change_table'],$this->INSTALL['database_update']);
03433                                                         $this->performUpdateQueries($remove_statements['drop_table'],$this->INSTALL['database_update']);
03434                                                 }
03435 
03436                                                         // Init again / first time depending...
03437                                                 $FDdb = $this->getFieldDefinitions_database();
03438 
03439                                                 $diff = $this->getDatabaseExtra($FDfile, $FDdb);
03440                                                 $update_statements = $this->getUpdateSuggestions($diff);
03441 
03442                                                 $diff = $this->getDatabaseExtra($FDdb, $FDfile);
03443                                                 $remove_statements = $this->getUpdateSuggestions($diff,'remove');
03444 
03445                                                 $tLabel = 'Update database tables and fields';
03446 
03447                                                 if ($remove_statements || $update_statements)   {
03448                                                         $formContent = $this->generateUpdateDatabaseForm('get_form',$update_statements,$remove_statements,$action_type);
03449                                                         $this->message($tLabel,'Table and field definitions should be updated',"
03450                                                         There seems to be a number of differencies between the database and the selected SQL-file.
03451                                                         Please select which statements you want to execute in order to update your database:<br /><br />
03452                                                         ".$formContent."
03453                                                         ",2);
03454                                                 } else {
03455                                                         $formContent = $this->generateUpdateDatabaseForm('get_form',$update_statements,$remove_statements,$action_type);
03456                                                         $this->message($tLabel,'Table and field definitions are OK.',"
03457                                                         The tables and fields in the current database corresponds perfectly to the database in the selected SQL-file.
03458                                                         ",-1);
03459                                                 }
03460                                         }
03461                                 break;
03462                                 case 'cmpTCA':
03463                                         $this->includeTCA();
03464                                         $FDdb = $this->getFieldDefinitions_database();
03465 
03466                                                 // Displaying configured fields which are not in the database
03467                                         $tLabel='Tables and fields in $TCA, but not in database';
03468                                         $cmpTCA_DB = $this->compareTCAandDatabase($GLOBALS['TCA'],$FDdb);
03469                                         if (!count($cmpTCA_DB['extra']))        {
03470                                                 $this->message($tLabel,'Table and field definitions OK','
03471                                                 All fields and tables configured in $TCA appeared to exist in the database as well
03472                                                 ',-1);
03473                                         } else {
03474                                                 $this->message($tLabel,'Invalid table and field definitions in $TCA!','
03475                                                 There are some tables and/or fields configured in the \$TCA array which does not exist in the database!
03476                                                 This will most likely cause you trouble with the TYPO3 backend interface!
03477                                                 ',3);
03478                                                 while(list($tableName, $conf)=each($cmpTCA_DB['extra']))        {
03479                                                         $this->message($tLabel, $tableName,$this->displayFields($conf['fields'],0,'Suggested database field:'),2);
03480                                                 }
03481                                         }
03482 
03483                                                 // Displaying tables that are not setup in
03484                                         $cmpDB_TCA = $this->compareDatabaseAndTCA($FDdb,$GLOBALS['TCA']);
03485                                         $excludeTables='be_sessions,fe_session_data,fe_sessions';
03486                                         if (TYPO3_OS=='WIN')    {$excludeTables = strtolower($excludeTables);}
03487                                         $excludeFields = array(
03488                                                 'be_users' => 'uc,lastlogin,usergroup_cached_list',
03489                                                 'fe_users' => 'uc,lastlogin,fe_cruser_id',
03490                                                 'pages' => 'SYS_LASTCHANGED',
03491                                                 'sys_dmail' => 'mailContent',
03492                                                 'tt_board' => 'doublePostCheck',
03493                                                 'tt_guest' => 'doublePostCheck',
03494                                                 'tt_products' => 'ordered'
03495                                         );
03496                                         $tCount=0;
03497                                         $fCount=0;
03498                                         $tLabel="Tables from database, but not in \$TCA";
03499                                         $fLabel="Fields from database, but not in \$TCA";
03500                                         $this->message($tLabel);
03501                                         if (is_array($cmpDB_TCA['extra']))      {
03502                                                 while(list($tableName, $conf)=each($cmpDB_TCA['extra']))        {
03503                                                         if (!t3lib_div::inList($excludeTables,$tableName)
03504                                                                         && substr($tableName,0,4)!="sys_"
03505                                                                         && substr($tableName,-3)!="_mm"
03506                                                                         && substr($tableName,0,6)!="index_"
03507                                                                         && substr($tableName,0,6)!='cache_')    {
03508                                                                 if ($conf['whole_table'])       {
03509                                                                         $this->message($tLabel, $tableName,$this->displayFields($conf['fields']),1);
03510                                                                         $tCount++;
03511                                                                 } else {
03512                                                                         list($theContent, $fC)  = $this->displaySuggestions($conf['fields'],$excludeFields[$tableName]);
03513                                                                         $fCount+=$fC;
03514                                                                         if ($fC)        $this->message($fLabel, $tableName,$theContent,1);
03515                                                                 }
03516                                                         }
03517                                                 }
03518                                         }
03519                                         if (!$tCount)   {
03520                                                 $this->message($tLabel,'Correct number of tables in the database',"
03521                                                 There are no extra tables in the database compared to the configured tables in the \$TCA array.
03522                                                 ",-1);
03523                                         } else {
03524                                                 $this->message($tLabel,'Extra tables in the database',"
03525                                                 There are some tables in the database which are not configured in the \$TCA array.
03526                                                 You should probably not worry about this, but please make sure that you know what these tables are about and why they are not configured in \$TCA.
03527                                                 ",2);
03528                                         }
03529 
03530                                         if (!$fCount)   {
03531                                                 $this->message($fLabel,'Correct number of fields in the database',"
03532                                                 There are no additional fields in the database tables compared to the configured fields in the \$TCA array.
03533                                                 ",-1);
03534                                         } else {
03535                                                 $this->message($fLabel,'Extra fields in the database',"
03536                                                 There are some additional fields the database tables which are not configured in the \$TCA array.
03537                                                 You should probably not worry about this, but please make sure that you know what these fields are about and why they are not configured in \$TCA.
03538                                                 ",2);
03539                                         }
03540 
03541                                                 // Displaying actual and suggested field database defitions
03542                                         if (is_array($cmpTCA_DB['matching']))   {
03543                                                 $tLabel="Comparison between database and \$TCA";
03544 
03545                                                 $this->message($tLabel,'Actual and suggested field definitions',"
03546                                                 This table shows you the suggested field definitions which are calculated based on the configuration in \$TCA.
03547                                                 If the suggested value differs from the actual current database value, you should not panic, but simply check if the datatype of that field is sufficient compared to the data, you want TYPO3 to put there.
03548                                                 ",0);
03549                                                 while(list($tableName, $conf)=each($cmpTCA_DB['matching']))     {
03550                                                         $this->message($tLabel, $tableName,$this->displayFieldComp($conf['fields'], $FDdb[$tableName]['fields']),1);
03551                                                 }
03552                                         }
03553                                 break;
03554                                 case 'import':
03555                                         $mode123Imported=0;
03556                                         $tblFileContent='';
03557                                         if (preg_match('/^CURRENT_/', $actionParts[1])) {
03558                                                 if (!strcmp($actionParts[1],'CURRENT_TABLES') || !strcmp($actionParts[1],'CURRENT_TABLES+STATIC'))      {
03559                                                         $tblFileContent = t3lib_div::getUrl(PATH_t3lib.'stddb/tables.sql');
03560 
03561                                                         reset($GLOBALS['TYPO3_LOADED_EXT']);
03562                                                         while(list(,$loadedExtConf)=each($GLOBALS['TYPO3_LOADED_EXT'])) {
03563                                                                 if (is_array($loadedExtConf) && $loadedExtConf['ext_tables.sql'])       {
03564                                                                         $tblFileContent.= chr(10).chr(10).chr(10).chr(10).t3lib_div::getUrl($loadedExtConf['ext_tables.sql']);
03565                                                                 }
03566                                                         }
03567                                                 }
03568                                                 if (!strcmp($actionParts[1],'CURRENT_STATIC') || !strcmp($actionParts[1],'CURRENT_TABLES+STATIC'))      {
03569                                                         reset($GLOBALS['TYPO3_LOADED_EXT']);
03570                                                         while(list(,$loadedExtConf)=each($GLOBALS['TYPO3_LOADED_EXT'])) {
03571                                                                 if (is_array($loadedExtConf) && $loadedExtConf['ext_tables_static+adt.sql'])    {
03572                                                                         $tblFileContent.= chr(10).chr(10).chr(10).chr(10).t3lib_div::getUrl($loadedExtConf['ext_tables_static+adt.sql']);
03573                                                                 }
03574                                                         }
03575                                                 }
03576                                         } elseif (@is_file($actionParts[1]))    {
03577                                                 $tblFileContent = t3lib_div::getUrl($actionParts[1]);
03578                                         }
03579 
03580                                         if ($tblFileContent)    {
03581                                                 $tLabel='Import SQL dump';
03582                                                         // Getting statement array from
03583                                                 $statements = $this->getStatementArray($tblFileContent,1);
03584                                                 list($statements_table, $insertCount) = $this->getCreateTables($statements,1);
03585 
03586                                                         // Updating database...
03587                                                 if ($this->INSTALL['database_import_all'])      {
03588                                                         $r=0;
03589                                                         foreach ($statements as $k=>$v) {
03590                                                                 $res = $GLOBALS['TYPO3_DB']->admin_query($v);
03591                                                                 $r++;
03592                                                         }
03593 
03594                                                                 // Make a database comparison because some tables that are defined twice have not been created at this point. This applies to the "pages.*" fields defined in sysext/cms/ext_tables.sql for example.
03595                                                         $fileContent = implode(
03596                                                                 $this->getStatementArray($tblFileContent,1,'^CREATE TABLE '),
03597                                                                 chr(10)
03598                                                         );
03599                                                         $FDfile = $this->getFieldDefinitions_sqlContent($fileContent);
03600                                                         $FDdb = $this->getFieldDefinitions_database();
03601                                                         $diff = $this->getDatabaseExtra($FDfile, $FDdb);
03602                                                         $update_statements = $this->getUpdateSuggestions($diff);
03603                                                         if (is_array($update_statements['add']))        {
03604                                                                 foreach ($update_statements['add'] as $statement)       {
03605                                                                         $res = $GLOBALS['TYPO3_DB']->admin_query($statement);
03606                                                                 }
03607                                                         }
03608 
03609                                                         if ($this->mode=='123') {
03610                                                                         // Create default be_user admin/password
03611                                                                 $username = 'admin';
03612                                                                 $pass = 'password';
03613 
03614                                                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'be_users', 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr($username, 'be_users'));
03615                                                                 if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res))  {
03616                                                                         $insertFields = array(
03617                                                                                 'username' => $username,
03618                                                                                 'password' => md5($pass),
03619                                                                                 'admin' => 1,
03620                                                                                 'uc' => '',
03621                                                                                 'fileoper_perms' => 7,
03622                                                                                 'tstamp' => time(),
03623                                                                                 'crdate' => time()
03624                                                                         );
03625 
03626                                                                         $GLOBALS['TYPO3_DB']->exec_INSERTquery('be_users', $insertFields);
03627                                                                 }
03628                                                         }
03629 
03630                                                         $this->message($tLabel,'Imported ALL',"
03631                                                                 Queries: ".$r."
03632                                                         ",1,1);
03633                                                         if (t3lib_div::_GP('goto_step'))        {
03634                                                                 $this->action.='&step='.t3lib_div::_GP('goto_step');
03635                                                                 Header('Location: '.t3lib_div::locationHeaderUrl($this->action));
03636                                                                 exit;
03637                                                         }
03638                                                 } elseif (is_array($this->INSTALL['database_import']))  {
03639                                                                 // Traverse the tables
03640                                                         reset($this->INSTALL['database_import']);
03641                                                         while(list($table,$md5str)=each($this->INSTALL['database_import']))     {
03642                                                                 if ($md5str==md5($statements_table[$table]))    {
03643                                                                         $res = $GLOBALS['TYPO3_DB']->admin_query('DROP TABLE IF EXISTS '.$table);
03644                                                                         $res = $GLOBALS['TYPO3_DB']->admin_query($statements_table[$table]);
03645 
03646                                                                         if ($insertCount[$table])       {
03647                                                                                 $statements_insert = $this->getTableInsertStatements($statements, $table);
03648                                                                                 reset($statements_insert);
03649                                                                                 while(list($k,$v)=each($statements_insert))     {
03650                                                                                         $res = $GLOBALS['TYPO3_DB']->admin_query($v);
03651                                                                                 }
03652                                                                         }
03653 
03654                                                                         $this->message($tLabel,"Imported '".$table."'","
03655                                                                                 Rows: ".$insertCount[$table]."
03656                                                                         ",1,1);
03657                                                                 }
03658                                                         }
03659                                                 }
03660 
03661                                                 $mode123Imported=$this->isBasicComplete($tLabel);
03662 
03663                                                 if (!$mode123Imported)  {
03664                                                                 // Re-Getting current tables - may have been changed during import
03665                                                         $whichTables=$this->getListOfTables();
03666 
03667                                                         if (count($statements_table))   {
03668                                                                 reset($statements_table);
03669                                                                 $out='';
03670                                                                 while(list($table,$definition)=each($statements_table)) {
03671                                                                         $exist=isset($whichTables[$table]);
03672                                                                         $out.='<tr>
03673                                                                                 <td><input type="checkbox" name="TYPO3_INSTALL[database_import]['.$table.']" value="'.md5($definition).'"></td>
03674                                                                                 <td><strong>'.$this->fw($table).'</strong></td>
03675                                                                                 <td><img src="clear.gif" width="10" height="1"></td>
03676                                                                                 <td nowrap="nowrap">'.$this->fw($insertCount[$table]?"Rows: ".$insertCount[$table]:"").'</td>
03677                                                                                 <td><img src="clear.gif" width="10" height="1"></td>
03678                                                                                 <td nowrap="nowrap">'.($exist?'<img src="'.$this->backPath.'gfx/icon_warning.gif" width="18" height="16" align="top" alt="">'.$this->fw('Table exists!'):'').'</td>
03679                                                                                 </tr>';
03680                                                                 }
03681 
03682                                                                 $content ='';
03683                                                                 if ($this->mode!='123') {
03684                                                                         $content.='<table border="0" cellpadding="0" cellspacing="0">'.$out.'</table>
03685                                                                         <hr />
03686                                                                         ';
03687                                                                 }
03688                                                                 $content.='<input type="checkbox" name="TYPO3_INSTALL[database_import_all]" value="1"'.($this->mode=="123"||t3lib_div::_GP('presetWholeTable')?' checked="checked"':'').'>'.$this->fw("Import the whole file '".basename($actionParts[1])."' directly (ignores selections above):").'<br />
03689 
03690                                                                 ';
03691                                                                 $form = $this->getUpdateDbFormWrap($action_type, $content);
03692                                                                 $this->message($tLabel,'Select tables to import',"
03693                                                                 This is an overview of the CREATE TABLE definitions in the SQL file.
03694                                                                 Select which tables you want to dump to the database.
03695                                                                 Any table you choose dump to the database is dropped from the database first, so you'll lose all data in existing tables.
03696                                                                 ".$form,1,1);
03697                                                         } else {
03698                                                                 $this->message($tLabel,'No tables',"
03699                                                                 There seems to be no CREATE TABLE definitions in the SQL file.
03700                                                                 This tool is intelligently creating one table at a time and not just dumping the whole content of the file uncritically. That's why there must be defined tables in the SQL file.
03701                                                                 ",3,1);
03702                                                         }
03703                                                 }
03704                                         }
03705                                 break;
03706                                 case 'view':
03707                                         if (@is_file($actionParts[1]))  {
03708                                                 $tLabel='Import SQL dump';
03709                                                         // Getting statement array from
03710                                                 $sqlContent = t3lib_div::getUrl($actionParts[1]);
03711                                                 $statements = $this->getStatementArray($sqlContent,1);
03712                                                 $maxL=1000;
03713                                                 $strLen = strlen($sqlContent);
03714                                                 $maxlen = 200+($maxL-t3lib_div::intInRange(($strLen-20000)/100,0,$maxL));
03715                                                 if (count($statements)) {
03716                                                         reset($statements);
03717                                                         $out='';
03718                                                         while(list(,$statement)=each($statements))      {
03719                                                                 $out.=nl2br(htmlspecialchars(t3lib_div::fixed_lgd($statement,$maxlen)).chr(10).chr(10));
03720                                                         }
03721                                                 }
03722                                                 $this->message($tLabel,'Content of '.basename($actionParts[1]),$out,1);
03723                                         }
03724                                 break;
03725                                 case 'adminUser':
03726                                         if ($whichTables['be_users'])   {
03727                                                 if (is_array($this->INSTALL['database_adminUser']))     {
03728                                                         $username = ereg_replace('[^[:alnum:]_-]','',trim($this->INSTALL['database_adminUser']['username']));
03729                                                         $username = str_replace(' ','_',$username);
03730                                                         $pass = trim($this->INSTALL['database_adminUser']['password']);
03731                                                         if ($username && $pass) {
03732                                                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'be_users', 'username='.$GLOBALS['TYPO3_DB']->fullQuoteStr($username, 'be_users'));
03733                                                                 if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res))  {
03734 
03735                                                                         $insertFields = array(
03736                                                                                 'username' => $username,
03737                                                                                 'password' => md5($pass),
03738                                                                                 'admin' => 1,
03739                                                                                 'uc' => '',
03740                                                                                 'fileoper_perms' => 7,
03741                                                                                 'tstamp' => time(),
03742                                                                                 'crdate' => time()
03743                                                                         );
03744 
03745                                                                         $GLOBALS['TYPO3_DB']->exec_INSERTquery('be_users', $insertFields);
03746 
03747                                                                         $this->isBasicComplete($headCode);
03748 
03749                                                                         $this->message($headCode,'User created','
03750                                                                         Username: <strong>'.htmlspecialchars($username).'</strong><br />
03751                                                                         Password: <strong>'.htmlspecialchars($pass).'</strong><br />'
03752                                                                         ,1,1);
03753                                                                 } else {
03754                                                                         $this->message($headCode,'Username not unique!','
03755                                                                         The username, <strong>'.htmlspecialchars($username).'</strong>, was not unique.',2,1);
03756                                                                 }
03757                                                         }
03758                                                 }
03759                                                 $content = '
03760                                                 <input type="text" name="TYPO3_INSTALL[database_adminUser][username]"> username - unique, no space, lowercase<br />
03761                                                 <input type="text" name="TYPO3_INSTALL[database_adminUser][password]"> password
03762                                                 ';
03763                                                 $form = $this->getUpdateDbFormWrap($action_type, $content);
03764                                                 $this->message($headCode,'Create admin user',"
03765                                                 Enter username and password for a new admin user.<br />
03766                                                 You should use this function only if there are no admin users in the database, for instance if this is a blank database.<br />
03767                                                 After you've created the user, log in and add the rest of the user information, like email and real name.<br />
03768                                                 <br />
03769                                                 ".$form."
03770                                                 ",0,1);
03771                                         } else {
03772                                                 $this->message($headCode,'Required table not in database',"
03773                                                 'be_users' must be a table in the database!
03774                                                 ",3,1);
03775                                         }
03776                                 break;
03777                                 case 'UC':
03778                                         if ($whichTables['be_users'])   {
03779                                                 if (!strcmp($this->INSTALL['database_UC'],1))   {
03780                                                         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_users', '', array('uc' => ''));
03781                                                         $this->message($headCode,'Clearing be_users.uc','Done.',1);
03782                                                 }
03783                                                 $content = '
03784                                                 <input type="checkbox" name="TYPO3_INSTALL[database_UC]" value="1" checked="checked"> Clear be_users preferences ("uc" field)
03785                                                 ';
03786                                                 $form = $this->getUpdateDbFormWrap($action_type, $content);
03787                                                 $this->message($headCode,'Clear user preferences',"
03788                                                 If you press this button all backend users from the tables be_users will have their user preferences cleared (field 'uc' set to an empty string).<br />
03789                                                 This may come in handy in rare cases where that configuration may be corrupt.<br />
03790                                                 Clearing this will clear all user settings from the 'Setup' module.<br />
03791                                                 <br />
03792                                                 ".$form);
03793                                         } else {
03794                                                 $this->message($headCode,'Required table not in database',"
03795                                                 'be_users' must be a table in the database!
03796                                                 ",3);
03797                                         }
03798                                 break;
03799                                 case 'cache':
03800                                         $tableListArr = explode(',','cache_pages,cache_pagesection,cache_hash,cache_imagesizes,--div--,sys_log,sys_history,--div--,be_sessions,fe_sessions,fe_session_data'.
03801                                                 (t3lib_extMgm::isLoaded('indexed_search') ? ',--div--,index_words,index_rel,index_phash,index_grlist,index_section,index_fulltext' : '').
03802                                                 (t3lib_extMgm::isLoaded('tt_products') ? ',--div--,sys_products_orders,sys_products_orders_mm_tt_products' : '').
03803                                                 (t3lib_extMgm::isLoaded('direct_mail') ? ',--div--,sys_dmail_maillog' : '').
03804                                                 (t3lib_extMgm::isLoaded('sys_stat') ? ',--div--,sys_stat' : '')
03805                                         );
03806 
03807                                         if (is_array($this->INSTALL['database_clearcache']))    {
03808                                                 $qList=array();
03809                                                 reset($tableListArr);
03810                                                 while(list(,$table)=each($tableListArr))        {
03811                                                         if ($table!='--div--')  {
03812                                                                 $table_c = TYPO3_OS=='WIN' ? strtolower($table) : $table;
03813                                                                 if ($this->INSTALL['database_clearcache'][$table] && $whichTables[$table_c])    {
03814                                                                         $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, '');
03815                                                                         $qList[] = $table;
03816                                                                 }
03817                                                         }
03818                                                 }
03819                                                 if (count($qList))      {
03820                                                         $this->message($headCode,'Clearing cache','
03821                                                         The following tables were emptied:<br /><br />
03822                                                         '.implode($qList,'<br />')
03823                                                         ,1);
03824                                                 }
03825                                         }
03826                                                 // Count entries and make checkboxes
03827                                         $labelArr = array(
03828                                                 'cache_pages' => 'Pages',
03829                                                 'cache_pagesection' => 'TS template related information',
03830                                                 'cache_hash' => 'Multipurpose md5-hash cache',
03831 +                                               'cache_imagesizes' => 'Cached image sizes',
03832                                                 'sys_log' => 'Backend action logging',
03833                                                 'sys_stat' => 'Page hit statistics',
03834                                                 'sys_history' => 'Addendum to the sys_log which tracks ALL changes to content through TCE. May become huge by time. Is used for rollback (undo) and the WorkFlow engine.',
03835                                                 'be_sessions' => 'Backend User sessions',
03836                                                 'fe_sessions' => 'Frontend User sessions',
03837                                                 'fe_session_data' => 'Frontend User sessions data',
03838                                                 'sys_dmail_maillog' => 'Direct Mail log',
03839                                                 'sys_products_orders' => 'tt_product orders',
03840                                                 'sys_products_orders_mm_tt_products' => 'relations between tt_products and sys_products_orders'
03841                                         );
03842 
03843                                         $checkBoxes=array();
03844                                         $countEntries=array();
03845                                         reset($tableListArr);
03846                                         while(list(,$table)=each($tableListArr))        {
03847                                                 if ($table!='--div--')  {
03848                                                         $table_c = TYPO3_OS=='WIN' ? strtolower($table) : $table;
03849                                                         if ($whichTables[$table_c])     {
03850                                                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $table, '');
03851                                                                 list($countEntries[$table]) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
03852                                                                         // Checkboxes:
03853                                                                 $checkBoxes[]= '<input type="checkbox" name="TYPO3_INSTALL[database_clearcache]['.$table.']" id="TYPO3_INSTALL[database_clearcache]['.$table.']" value="1"'.($this->INSTALL['database_clearcache'][$table]||$_GET['PRESET']['database_clearcache'][$table]?' checked="checked"':'').'> <label for="TYPO3_INSTALL[database_clearcache]['.$table.']"><strong>'.$table.'</strong> ('.$countEntries[$table].' rows) - '.$labelArr[$table].'</label>';
03854                                                         }
03855                                                 } else {
03856                                                                 $checkBoxes[]=  '<hr />';
03857                                                 }
03858                                         }
03859 
03860                                         $content = implode('<br />',$checkBoxes).'<br /><br />';
03861 
03862                                         $form = $this->getUpdateDbFormWrap($action_type, $content);
03863                                         $this->message($headCode,'Clear out selected tables','
03864                                         Pressing this button will delete all records from the selected tables.<br />
03865                                         <br />
03866                                         '.$form.'
03867                                         ');
03868                                 break;
03869                         }
03870                 }
03871 
03872                 echo $this->outputWrapper($this->printAll());
03873         }
03874 
03880         function updateWizard() {
03881                 global $TYPO3_CONF_VARS;
03882 
03883                         // clear cache files
03884                 t3lib_extMgm::removeCacheFiles();
03885 
03886                         // generate new cache files and include them
03887                 $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'] = 1;
03888                 $TYPO3_LOADED_EXT = t3lib_extMgm::typo3_loadExtensions();
03889                 if ($TYPO3_LOADED_EXT['_CACHEFILE'])    {
03890                         require(PATH_typo3conf.$TYPO3_LOADED_EXT['_CACHEFILE'].'_ext_localconf.php');
03891                 }
03892 
03893                         // call wizard
03894                 $action = ($this->INSTALL['database_type']?$this->INSTALL['database_type']:'checkForUpdate');
03895                 $this->updateWizard_parts($action);
03896                 echo $this->outputWrapper($this->printAll());
03897         }
03898 
03905         function updateWizard_parts($action)    {
03906                 $content = '';
03907                 switch ($action)        {
03908                         case 'checkForUpdate':  // first step - check for updates available
03909                                 $title = 'Step 1 - Introduction';
03910                                 $updateWizardBoxes = '';
03911                                 if (!$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'])        {
03912                                         $content = '<strong>No updates registered!</strong>';
03913                                         break;
03914                                 }
03915 
03916                                         // step through list of updates, and check if update is needed and if yes, output an explanation
03917                                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] as $identifier => $className)       {
03918                                         $tmpObj = $this->getUpgradeObjInstance($className, $identifier);
03919                                         if (method_exists($tmpObj,'checkForUpdate'))    {
03920                                                 $explanation = '';
03921                                                 if ($tmpObj->checkForUpdate($explanation))      {
03922                                                         $updateWizardBoxes.= '
03923                                                                 <div style="border: 1px solid; padding: 10px; margin: 10px; padding-top: 0px; width: 400px;">
03924                                                                         <h3>'.$identifier.'</h3>
03925                                                                         <p>'.str_replace(chr(10),'<br />',$explanation).'</p>
03926                                                                         <input type="submit" name="TYPO3_INSTALL[update]['.$identifier.']" id="TYPO3_INSTALL[update]['.$identifier.']" value="Next" />
03927                                                                 </div>';
03928                                                 }
03929                                         }
03930                                 }
03931 
03932                                 if ($updateWizardBoxes) {
03933                                         $updateWizardBoxes = '<table><tr><td>'.$updateWizardBoxes.'</td></tr></table>';
03934                                         $content = '
03935                                                 <form action="'.$this->action.'#bottom" method="post">
03936                                                         <input type="hidden" name="TYPO3_INSTALL[database_type]" value="'.htmlspecialchars('getUserInput').'">
03937                                                         '.$updateWizardBoxes.'</form>';
03938                                 } else {
03939                                         $content = '<strong>No updates to perform!</strong>';
03940                                 }
03941                         break;
03942                         case 'getUserInput':    // second step - get user input and ask for final confirmation
03943                                 $title = 'Step 2 - Configuration of updates';
03944                                 $formContent = '<p style="width:400px;"><strong>The following updates will be performed:</strong></p>';
03945                                 if (!$this->INSTALL['update'])  {
03946                                         $content = '<strong>No updates selected!</strong>';
03947                                         break;
03948                                 }
03949                                         // update methods might need to get custom data
03950                                 foreach ($this->INSTALL['update'] as $identifier => $tmp)       {
03951                                         $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$identifier];
03952 
03953                                         $tmpObj = $this->getUpgradeObjInstance($className, $identifier);
03954 
03955                                         $formContent .= '<p><strong>'.$identifier.'</strong><input type="hidden" name="TYPO3_INSTALL[update][extList][]" value="'.$identifier.'" /><br />';
03956                                         if (method_exists($tmpObj,'getUserInput'))      {
03957                                                 $formContent .= $tmpObj->getUserInput('TYPO3_INSTALL[update]['.$identifier.']');
03958                                         }
03959                                         $formContent.= '</p>';
03960                                 }
03961                                 $formContent.= '<input type="checkbox" name="TYPO3_INSTALL[update][showDatabaseQueries]" id="TYPO3_INSTALL[update][showDatabaseQueries]" value="1" /> <label for="TYPO3_INSTALL[update][showDatabaseQueries]">Show database queries performed</label><br />';
03962                                 $content = $this->getUpdateDbFormWrap('performUpdate', $formContent,'Perform updates!');
03963                         break;
03964                         case 'performUpdate':   // third step - perform update
03965                                 $title = 'Step 3 - Perform updates';
03966                                 if (!$this->INSTALL['update']['extList'])       { break; }
03967 
03968                                 $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = TRUE;
03969                                 foreach ($this->INSTALL['update']['extList'] as $identifier)    {
03970                                         $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$identifier];
03971 
03972                                         $tmpObj = &$this->getUpgradeObjInstance($className, $identifier);
03973 
03974                                         $content = '<p style="width: 400px;"><strong>'.$identifier.'</strong></p>';
03975                                                 // check user input if testing method is available
03976                                         if (method_exists($tmpObj,'checkUserInput'))    {
03977                                                 $customOutput = '';
03978                                                 if (!$tmpObj->checkUserInput($customOutput))    {
03979                                                         $content.= ($customOutput?$customOutput:'Something went wrong').'<br /><br />';
03980                                                         $content.= '<a href="javascript:history.back()">Go back to update configuration</a>';
03981                                                         break;
03982                                                 }
03983                                         }
03984 
03985                                         if (method_exists($tmpObj,'performUpdate'))     {
03986                                                 $customOutput = '';
03987                                                 $dbQueries = array();
03988                                                 if ($tmpObj->performUpdate($dbQueries, $customOutput))  {
03989                                                         $content .= '<strong>Update successful!</strong>';
03990                                                 } else {
03991                                                         $content.= '<strong>Update FAILED!</strong>';
03992                                                 }
03993                                                 if ($this->INSTALL['update']['showDatabaseQueries'])    {
03994                                                         $content .= '<br />' . implode('<br />',$dbQueries);
03995                                                 }
03996                                                 if (strlen($customOutput))      {
03997                                                         $content.= '<br />' . $customOutput;
03998                                                 }
03999                                         } else {
04000                                                 $content .= '<strong>No update method available!</strong>';
04001                                         }
04002                                 }
04003                                 $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = FALSE;
04004                         break;
04005                 }
04006                 $this->message('Update Wizard',$title,$content);
04007         }
04008 
04016         function getUpgradeObjInstance($className, $identifier) {
04017                 $tmpObj = &t3lib_div::getUserObj($className);
04018                 $tmpObj->versionNumber = t3lib_div::int_from_ver(TYPO3_version);
04019                 $tmpObj->pObj = $this;
04020                 $tmpObj->userInput = $this->INSTALL['update'][$identifier];
04021                 return $tmpObj;
04022         }
04023 
04029         function isBackendAdminUser()   {
04030                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'be_users', 'admin=1');
04031                 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
04032                 return current($row);
04033         }
04034 
04040         function isStaticTemplates()    {
04041                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'static_template', '');
04042                 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
04043                 return current($row);
04044         }
04045 
04052         function isBasicComplete($tLabel)       {
04053                 if ($this->mode=='123') {
04054                         $tables = $this->getListOfTables();
04055 
04056                         if (count($tables))     {
04057                                 $beuser = $this->isBackendAdminUser();
04058                                 $static = $this->isStaticTemplates();
04059                         }
04060                         if (count($tables) && $beuser && $static)       {
04061                                 $mode123Imported=1;
04062                                 $this->message($tLabel,'Basic Installation Completed',nl2br($this->messageBasicFinished()),-1,1);
04063                                 $this->message($tLabel,'Security Risk!',nl2br($this->securityRisk().$this->alterPasswordForm()),2,1);
04064                         } else {
04065                                 $this->message($tLabel,'Still missing something?',nl2br('
04066                                 You may be missing one of these points before your TYPO3 installation is complete:
04067 
04068                                 '.(count($tables)?'':'- You haven\'t imported any tables yet.
04069                                 ')
04070                                 .($static?'':'- You haven\'t imported the static_template table.
04071                                 ')
04072                                 .($beuser?'':'- You haven\'t created an admin-user yet.
04073                                 ')
04074                                 .'
04075 
04076                                 You you\'re about to import a database with a complete site in it, these three points should be met.
04077                                 '),-1,1);
04078                         }
04079                 }
04080                 return $mode123Imported;
04081         }
04082 
04092         function generateUpdateDatabaseForm($type, $arr_update, $arr_remove, $action_type)      {
04093                 $content = '';
04094                 switch($type)   {
04095                         case 'get_form':
04096                                 $content='';
04097                                 $content.=$this->generateUpdateDatabaseForm_checkboxes($arr_update['add'],'Add fields');
04098                                 $content.=$this->generateUpdateDatabaseForm_checkboxes($arr_update['change'],'Changing fields',(t3lib_extMgm::isLoaded('dbal')?0:1),0,$arr_update['change_currentValue']);
04099                                 $content.=$this->generateUpdateDatabaseForm_checkboxes($arr_remove['change'],'Remove unused fields (rename with prefix)',$this->setAllCheckBoxesByDefault,1);
04100                                 $content.=$this->generateUpdateDatabaseForm_checkboxes($arr_remove['drop'],'Drop fields (really!)',$this->setAllCheckBoxesByDefault);
04101 
04102                                 $content.=$this->generateUpdateDatabaseForm_checkboxes($arr_update['create_table'],'Add tables');
04103                                 $content.=$this->generateUpdateDatabaseForm_checkboxes($arr_remove['change_table'],'Removing tables (rename with prefix)',$this->setAllCheckBoxesByDefault,1,$arr_remove['tables_count'],1);
04104                                 $content.=$this->generateUpdateDatabaseForm_checkboxes($arr_remove['drop_table'],'Drop tables (really!)',$this->setAllCheckBoxesByDefault,0,$arr_remove['tables_count'],1);
04105 
04106                                 $content = $this->getUpdateDbFormWrap($action_type, $content);
04107                         break;
04108                         default:
04109 
04110                         break;
04111                 }
04112                 return $content;
04113         }
04114 
04123         function getUpdateDbFormWrap($action_type, $content, $label='Write to database')        {
04124                 $form = '<form action="'.$this->action.'#bottom" method="post"><input type="hidden" name="TYPO3_INSTALL[database_type]" value="'.htmlspecialchars($action_type).'">'.$content.'<br /><input type="submit" value="'.$label.'">';
04125                 return $form;
04126         }
04127 
04136         function displayFields($arr, $pre=0, $label='') {
04137                 $out='';
04138                 $out.='<tr><td bgcolor="#9BA1A8" align="center"><strong>'.$this->fw('Field name:').'</strong></td><td bgcolor="#9BA1A8" align="center"><strong>'.$this->fw($label?$label:'Info:').'</strong></td></tr>';
04139                 if (is_array($arr))     {
04140                         reset($arr);
04141                         while(list($fieldname, $fieldContent)=each($arr))       {
04142                                 if ($pre)       {
04143                                         $fieldContent = '<pre>'.trim($fieldContent).'</pre>';
04144                                 } else {
04145                                         $fieldContent = $this->fw($fieldContent);
04146                                 }
04147                                 $out.='<tr><td bgcolor="#ABBBB4">'.$this->fw($fieldname).'</td><td bgcolor="#ABBBB4">'.$fieldContent.'</td></tr>';
04148                         }
04149                 }
04150                 $out= '<table border="0" cellpadding="0" cellspacing="0">'.$out.'</table>';
04151                 return $out;
04152         }
04153 
04161         function displayFieldComp($arr, $arr_db)        {
04162                 $out='';
04163                 $out.='<tr><td bgcolor="#9BA1A8" align="center"><strong>'.$this->fw('Field name:').'</strong></td>
04164                         <td bgcolor="#9BA1A8" align="center"><strong>'.$this->fw("Suggested value from \$TCA:").'</strong></td>
04165                         <td bgcolor="#9BA1A8" align="center"><strong>'.$this->fw('Actual value from database:').'</strong></td>
04166                         </tr>';
04167                 if (is_array($arr))     {
04168                         reset($arr);
04169                         while(list($fieldname, $fieldContent)=each($arr))       {
04170                                         // This tries to equalize the types tinyint and int
04171                                 $str1 = $fieldContent;
04172                                 $str2 = trim($arr_db[$fieldname]);
04173                                 $str1 = str_replace('tinyint(3)','tinyint(4)',$str1);
04174                                 $str2 = str_replace('tinyint(3)','tinyint(4)',$str2);
04175                                 $str1 = str_replace('int(10)','int(11)',$str1);
04176                                 $str2 = str_replace('int(10)','int(11)',$str2);
04177                                         // Compare:
04178                                 if (strcmp($str1,$str2))        {
04179                                         $bgcolor=' bgcolor="#ABBBB4"';
04180                                 } else {
04181                                         $bgcolor=' bgcolor="#D9D5C9"';
04182                                 }
04183                                 $fieldContent = $this->fw($fieldContent);
04184                                 $fieldContent_db = $this->fw($arr_db[$fieldname]);
04185                                 $out.='<tr>
04186                                         <td bgcolor="#D9D5C9">'.$this->fw($fieldname).'</td>
04187                                         <td'.$bgcolor.'>'.$fieldContent.'</td>
04188                                         <td'.$bgcolor.'>'.$fieldContent_db.'</td>
04189                                         </tr>';
04190                         }
04191                 }
04192                 $out= '<table border="0" cellpadding="2" cellspacing="2">'.$out.'</table>';
04193                 return $out;
04194         }
04195 
04203         function displaySuggestions($arr, $excludeList='')      {
04204                 $out='';
04205                 $out.='<tr><td bgcolor="#9BA1A8" align="center"><strong>'.$this->fw('Field name:').'</strong></td><td bgcolor="#9BA1A8" align="center"><strong>'.$this->fw('Info / Suggestion for the field:').'</strong></td></tr>';
04206                 $fC=0;
04207                 if (is_array($arr))     {
04208                         reset($arr);
04209                         while(list($fieldname, $fieldContent)=each($arr))       {
04210                                 if (!t3lib_div::inList($excludeList,$fieldname) && substr($fieldname,0,strlen($this->deletedPrefixKey))!=$this->deletedPrefixKey && substr($fieldname,-1)!='.') {
04211                                         $fieldContent = $this->fw($fieldContent);
04212                                         if ($arr[$fieldname.'.'])       {
04213                                                 $fieldContent.= '<hr />';
04214                                                 $fieldContent.= '<pre>'.trim($arr[$fieldname.'.']).'</pre>';
04215                                         }
04216                                         $out.='<tr><td bgcolor="#ABBBB4">'.$this->fw($fieldname).'</td><td bgcolor="#ABBBB4">'.$fieldContent.'</td></tr>';
04217                                         $fC++;
04218                                 }
04219                         }
04220                 }
04221                 $out= '<table border="0" cellpadding="2" cellspacing="2">'.$out.'</table>';
04222                 return array($out,$fC);
04223         }
04224 
04233         function compareDatabaseAndTCA($FDsrc, $TCA, $onlyFields=0)     {
04234                 $extraArr=array();
04235                 if (is_array($FDsrc))   {
04236                         reset($FDsrc);
04237                         while(list($table,$info)=each($FDsrc))  {
04238                                 if (!isset($TCA[$table]))       {
04239                                         if (!$onlyFields)       {
04240                                                 $extraArr[$table]=$info;                // If the table was not in the FDcomp-array, the result array is loaded with that table.
04241                                                 $extraArr[$table]['whole_table']=1;
04242                                                 unset($extraArr[$table]['keys']);
04243                                         }
04244                                 } else {
04245                                         $theKey='fields';
04246                                         $excludeListArr=array();
04247                                         if (is_array($TCA[$table]['ctrl']['enablecolumns']))    $excludeListArr[]=$TCA[$table]['ctrl']['enablecolumns'];
04248                                         $excludeListArr[]=$TCA[$table]['ctrl']['tstamp'];
04249                                         $excludeListArr[]=$TCA[$table]['ctrl']['sortby'];
04250                                         $excludeListArr[]=$TCA[$table]['ctrl']['delete'];
04251                                         $excludeListArr[]=$TCA[$table]['ctrl']['cruser_id'];
04252                                         $excludeListArr[]=$TCA[$table]['ctrl']['crdate'];
04253                                         $excludeListArr[]='uid';
04254                                         $excludeListArr[]='pid';
04255                                         if ($table=='pages')    {
04256                                                 $excludeListArr[]='perms_userid';
04257                                                 $excludeListArr[]='perms_groupid';
04258                                                 $excludeListArr[]='perms_user';
04259                                                 $excludeListArr[]='perms_group';
04260                                                 $excludeListArr[]='perms_everybody';
04261                                         }
04262                                         if ($table=='sys_dmail')        {
04263                                                 $excludeListArr[]='scheduled';
04264                                                 $excludeListArr[]='scheduled_begin';
04265                                                 $excludeListArr[]='scheduled_end';
04266                                                 $excludeListArr[]='query_info';
04267                                         }
04268 
04269                                         if (is_array($info[$theKey]))   {
04270                                                 reset($info[$theKey]);
04271                                                 while(list($fieldN,$fieldC)=each($info[$theKey]))       {
04272                                                         if (!isset($TCA[$table]['columns'][$fieldN]) && !in_array($fieldN,$excludeListArr))     {
04273                                                                 $extraArr[$table][$theKey][$fieldN] = $info['fields'][$fieldN];
04274                                                                 $extraArr[$table][$theKey][$fieldN.'.']=$this->suggestTCAFieldDefinition($fieldN,$fieldC);
04275                                                         }
04276                                                 }
04277                                         }
04278                                 }
04279                         }
04280                 }
04281                 return array('extra'=>$extraArr);
04282         }
04283 
04291         function compareTCAandDatabase($TCA, $FDcomp)   {
04292                 $extraArr=array();
04293                 $matchingArr=array();
04294                 if (is_array($TCA))     {
04295                         reset($TCA);
04296                         while(list($table)=each($TCA))  {
04297                                 $info=$TCA[$table];
04298                                 if (!isset($FDcomp[$table]))    {
04299 //                                      $extraArr[$table]=$info;                // If the table was not in the FDcomp-array, the result array is loaded with that table.
04300                                         $extraArr[$table]['whole_table']=1;
04301                                 } else {
04302                                         reset($info['columns']);
04303                                         while(list($fieldN,$fieldC)=each($info['columns']))     {
04304                                                 $fieldDef = $this->suggestFieldDefinition($fieldC);
04305                                                 if (!is_array($fieldDef))       {
04306                                                         if (!isset($FDcomp[$table]['fields'][$fieldN])) {
04307                                                                 $extraArr[$table]['fields'][$fieldN]=$fieldDef;
04308                                                         } else {
04309                                                                 $matchingArr[$table]['fields'][$fieldN]=$fieldDef;
04310                                                         }
04311                                                 }
04312                                         }
04313                                 }
04314                         }
04315                 }
04316                 return array('extra'=>$extraArr, 'matching'=>$matchingArr);
04317         }
04318 
04325         function suggestFieldDefinition($fieldInfo)     {
04326                 $out='';
04327                 switch($fieldInfo['config']['type'])    {
04328                         case 'input':
04329                                 if (ereg('date|time|int|year',$fieldInfo['config']['eval']))    {
04330                                         $out = "int(11) NOT NULL default '0'";
04331                                 } else {
04332                                         $max = intval($fieldInfo['config']['max']);
04333                                         if ($max>0 && $max<200) {
04334                                                 $out = 'varchar('.$max.") NOT NULL default ''";
04335                                         } else {
04336                                                 $out = 'tinytext NOT NULL';
04337                                         }
04338                                 }
04339                         break;
04340                         case 'text':
04341                                 $out = 'text NOT NULL';
04342                         break;
04343                         case 'check':
04344                                 if (is_array($fieldInfo['config']['items']) && count($fieldInfo['config']['items'])>8)  {
04345                                         $out = "int(11) NOT NULL default '0'";
04346                                 } else {
04347                                         $out = "tinyint(3) NOT NULL default '0'";
04348                                 }
04349                         break;
04350                         case 'radio':
04351                                 if (is_array($fieldInfo['config']['items']))    {
04352                                         $out = $this->getItemArrayType($fieldInfo['config']['items']);
04353                                 } else {
04354                                         $out = 'ERROR: Radiobox did not have items!';
04355                                 }
04356                         break;
04357                         case 'group':
04358                                 if ($fieldInfo['config']['internal_type']=='db')        {
04359                                         $max = t3lib_div::intInRange($fieldInfo['config']['maxitems'],1,10000);
04360                                         if (count(explode(',',$fieldInfo['config']['allowed']))>1)      {
04361                                                 $len = $max*(10+1+5+1);         // Tablenames are 10, "_" 1, uid's 5, comma 1
04362                                                 $out=$this->getItemBlobSize($len);
04363                                         } elseif ($max<=1) {
04364                                                 $out = "int(11) NOT NULL default '0'";
04365                                         } else {
04366                                                 $len = $max*(5+1);              // uid's 5, comma 1
04367                                                 $out=$this->getItemBlobSize($len);
04368                                         }
04369                                 }
04370                                 if ($fieldInfo['config']['internal_type']=='file')      {
04371                                         $max = t3lib_div::intInRange($fieldInfo['config']['maxitems'],1,10000);
04372                                         $len = $max*(30+1);             // Filenames is 30+ chars....
04373                                         $out=$this->getItemBlobSize($len);
04374                                 }
04375                         break;
04376                         case 'select':
04377                                 $max = t3lib_div::intInRange($fieldInfo['config']['maxitems'],1,10000);
04378                                 if ($max<=1)    {
04379                                         if ($fieldInfo['config']['foreign_table'])      {
04380                                                 $out = "int(11) NOT NULL default '0'";
04381                                         } else {
04382                                                 $out = $this->getItemArrayType($fieldInfo['config']['items']);
04383                                         }
04384                                 } else {
04385                                                 // five chars (special=10) + comma:
04386                                         $len = $max*(($fieldInfo['config']['special']?10:5)+1);
04387                                         $out=$this->getItemBlobSize($len);
04388                                 }
04389                         break;
04390                         default:
04391                         break;
04392                 }
04393                 return $out?$out:$fieldInfo;
04394         }
04395 
04402         function getItemArrayType($arr) {
04403                 if (is_array($arr))     {
04404                         reset($arr);
04405                         $type[]=0;
04406                         $intSize[]=0;
04407                         while(list(,$item)=each($arr))  {
04408                                 if (!t3lib_div::testInt($item[1]) && $item[1]!='--div--')       {
04409                                         $type[]=strlen($item[1]);
04410                                 } else {
04411                                         $intSize[]=$item[1];
04412                                 }
04413                         }
04414                         $us = min($intSize)>=0 ? ' unsigned' : '';
04415                         if (max($type)>0)       {
04416                                 $out = 'varchar('.max($type).") NOT NULL default ''";
04417                         } else {
04418                                 $out = "int(11) NOT NULL default '0'";
04419                         }
04420                 }
04421                 return $out;
04422         }
04423 
04430         function getItemBlobSize($len)  {
04431                 return ($len>255 ? 'tiny' : '').'blob NOT NULL';
04432         }
04433 
04441         function suggestTCAFieldDefinition($fieldName,$fieldInfo)       {
04442                 list($type,$len) = split(' |\(|\)',$fieldInfo,3);
04443                 switch($type)   {
04444                         case 'int':
04445 $out="
04446 '".$fieldName."' => array (
04447         'label' => '".strtoupper($fieldName).":',
04448         'exclude' => 0,
04449         'config' => array (
04450                 'type' => 'input',
04451                 'size' => '8',
04452                 'max' => '20',
04453                 'eval' => 'date',
04454                 'default' => '0',
04455                 'checkbox' => '0'
04456         )
04457 ),
04458 
04459 ----- OR -----
04460 
04461 '".$fieldName."' => array (
04462         'label' => '".strtoupper($fieldName).":',
04463         'exclude' => 0,
04464         'config' => array (
04465                 'type' => 'select',
04466                 'items' => array (
04467                         array('[nothing]', 0),
04468                         array('Extra choice! Only negative values here.', -1),
04469                         array('__Divider:__', '--div--')
04470                 ),
04471                 'foreign_table' => '[some_table_name]'
04472         )
04473 ),";
04474                         break;
04475                         case 'varchar':
04476                                 if ($len>10)    {
04477                                         $out="
04478 '".$fieldName."' => array (
04479         'label' => '".strtoupper($fieldName).":',
04480         'exclude' => 0,
04481         'config' => array (
04482                 'type' => 'input',
04483                 'size' => '8',
04484                 'max' => '".$len."',
04485                 'eval' => 'trim',
04486                 'default' => ''
04487         )
04488 ),";
04489                                 } else {
04490                                         $out="
04491 '".$fieldName."' => array (
04492         'label' => '".strtoupper($fieldName).":',
04493         'exclude' => 0,
04494         'config' => array (
04495                 'type' => 'select',
04496                 'items' => array (
04497                         array('Item number 1', 'key1'),
04498                         array('Item number 2', 'key2'),
04499                         array('-----', '--div--'),
04500                         array('Item number 3', 'key3')
04501                 ),
04502                 'default' => '1'
04503         )
04504 ),";
04505                                 }
04506                         break;
04507                         case 'tinyint':
04508                                         $out="
04509 '".$fieldName."' => array (
04510         'label' => '".strtoupper($fieldName).":',
04511         'exclude' => 0,
04512         'config' => array (
04513                 'type' => 'select',
04514                 'items' => array (
04515                         array('Item number 1', '1'),
04516                         array('Item number 2', '2'),
04517                         array('-----', '--div--'),
04518                         array('Item number 3', '3')
04519                 ),
04520                 'default' => '1'
04521         )
04522 ),
04523 
04524 ----- OR -----
04525 
04526 '".$fieldName."' => array (
04527         'label' => '".strtoupper($fieldName).":',
04528         'exclude' => 0,
04529         'config' => array (
04530                 'type' => 'check',
04531                 'default' => '1'
04532         )
04533 ),";
04534                         break;
04535                         case 'tinytext':
04536 $out="
04537 '".$fieldName."' => array (
04538         'label' => '".strtoupper($fieldName).":',
04539         'exclude' => 0,
04540         'config' => array (
04541                 'type' => 'input',
04542                 'size' => '40',
04543                 'max' => '255',
04544                 'eval' => '',
04545                 'default' => ''
04546         )
04547 ),";
04548                         break;
04549                         case 'text':
04550                         case 'mediumtext':
04551 $out="
04552 '".$fieldName."' => array (
04553         'label' => '".strtoupper($fieldName).":',
04554         'config' => array (
04555                 'type' => 'text',
04556                 'cols' => '48',
04557                 'rows' => '5'
04558         )
04559 ),";
04560                         break;
04561                         default:
04562                                 $out="
04563 '".$fieldName."' => array (
04564         'label' => '".strtoupper($fieldName).":',
04565         'exclude' => 0,
04566         'config' => array (
04567                 'type' => 'input',
04568                 'size' => '30',
04569                 'max' => '',
04570                 'eval' => '',
04571                 'default' => ''
04572         )
04573 ),";
04574                         break;
04575                 }
04576                 return $out?$out:$fieldInfo;
04577         }
04578 
04584         function includeTCA()   {
04585                 global $TCA;
04586 
04587                 include (TYPO3_tables_script ? PATH_typo3conf.TYPO3_tables_script : PATH_t3lib.'stddb/tables.php');
04588 
04589                         // Extension additions
04590                 if ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']) {
04591                         include(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php');
04592                 } else {
04593                         include(PATH_t3lib.'stddb/load_ext_tables.php');
04594                 }
04595 
04596                 if (TYPO3_extTableDef_script)   {
04597                         include (PATH_typo3conf.TYPO3_extTableDef_script);
04598                 }
04599 
04600                 reset($TCA);
04601                 while(list($table)=each($TCA))  {
04602                         t3lib_div::loadTCA($table);
04603                 }
04604         }
04605 
04606 
04607 
04608 
04609 
04610 
04611 
04612 
04613         /**********************
04614          *
04615          * GENERAL FUNCTIONS
04616          *
04617          **********************/
04618 
04626         function linkIt($url,$link='')  {
04627                 return '<a href="'.$url.'" target="_blank">'.($link?$link:$url).'</a>';
04628         }
04629 
04640         function message($head, $short_string='', $long_string='', $type=0, $force=0)   {
04641                 if (!$force && $this->mode=='123' && $type<2)   { return; }     // Return directly if mode-123 is enabled.
04642 
04643                 if ($type==3)   { $this->fatalError=1; }
04644                 if ($this->messageFunc_nl2br && !preg_match('/<\/table>/', $long_string))       {
04645                         $long_string = nl2br(trim($long_string));
04646                 } else {
04647                         $long_string = trim($long_string);
04648                 }
04649                 if (!$this->silent)     $this->printSection($head, $short_string, $long_string, $type);
04650         }
04651 
04661         function printSection($head, $short_string, $long_string, $type)        {
04662                 $icon='';
04663 
04664                 $bgCol =' bgcolor="#D9D5C9"';   // The default color
04665                 switch($type)   {
04666                         case '3':
04667                                 $bgCol =' bgcolor="red"';
04668                                 $icon = 'gfx/icon_fatalerror.gif';
04669                         break;
04670                         case '2':
04671                                 $bgCol =' bgcolor="#9BA1A8"';
04672                                 $icon = 'gfx/icon_warning.gif';
04673                         break;
04674                         case '1':
04675                                 // $bgCol =' bgcolor="#ABBBB4"';
04676                                 $icon = 'gfx/icon_note.gif';
04677                         break;
04678                         case '-1':
04679                                 // $bgCol =' bgcolor="yellow"';
04680                                 $icon = 'gfx/icon_ok.gif';
04681                         break;
04682                         default:
04683                                 $bgCol =' bgcolor="#D3D9DC"';
04684                         break;
04685                 }
04686                 if (!trim($short_string))       {
04687                         $this->sections[$head][]='';
04688                 } else {
04689                         $this->sections[$head][]='
04690                         <tr><td'.$bgCol.' nowrap="nowrap">'.($icon?'<img src="'.$this->backPath.$icon.'" width="18" height="16" align="top" alt="">':'').'<strong>'.$this->fw($short_string).'</strong></td></tr>'.(trim($long_string)?'
04691                         <tr><td>'.$this->fw($long_string).'<br /><br /></td></tr>' : '');
04692                 }
04693         }
04694 
04702         function fw($str,$size=1)       {
04703 
04704                 if (preg_match('/^<table/', $str) && preg_match('/<\/table>$/', $str)) {
04705                         // no wrap
04706                 } else {
04707                         if($size==1) {
04708                                 $size = 'class="smalltext"';
04709                         } elseif ($size==2) {
04710                                 $size = 'class="bodytext"';
04711                         } else {
04712                                 $size = 'size="size'.$size.'text"';
04713                         }
04714                         $str = '<span '.$size.'>'.$str.'</span>';
04715                 }
04716                 return $str;
04717         }
04718 
04725         function fwheader($str) {
04726                 return '<div align="center"><strong>'.$this->fw($str,3).'</strong></div>';
04727         }
04728 
04736         function wrapInCells($label,$content)   {
04737                 return '<tr><td valign="top" nowrap="nowrap"><strong>'.$this->fw($label).'</strong></td><td>&nbsp;</td><td valign="top">'.$this->fw($content).'<br /></td></tr>';
04738         }
04739 
04745         function printAll()     {
04746                 reset($this->sections);
04747                 $out='';
04748                 while(list($header,$valArray)=each($this->sections))    {
04749                         $out.='
04750                         <tr><td>&nbsp;</td></tr>
04751                         <tr><td><div align="center"><strong>'.$this->fw($header.':',2).'</strong></div></td></tr>
04752                         ';
04753                         $out.=implode($valArray,chr(10));
04754                 }
04755                 return '<table border="0" cellpadding="2" cellspacing="2">'.$out.'</table>';
04756         }
04757 
04764         function outputWrapper($content)        {
04765                 $out='
04766 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
04767    "http://www.w3.org/TR/html4/loose.dtd">
04768 <html>
04769         <head>
04770 
04771 <style type="text/css">
04772 body, p, td, a, span, input, .bodytext {
04773         font-family:verdana,sans-serif;
04774         font-size:1em;
04775         color:#000;
04776         text-align: left;
04777 }
04778 .smalltext {
04779         font-size:0.9em;
04780 }
04781 .size3text {
04782         font-size:1.2em;
04783 }
04784 .size4text {
04785         font-size:1.5em;
04786 }
04787 a {color: #600; text-decoration: none;}
04788 a:active {text-decoration: none;}
04789 a:hover {color: #006; text-decoration:underline:}
04790 </style>
04791 '.$this->headerStyle.'
04792 
04793                 <title>TYPO3 Install Tool</title>
04794                 '.($this->JSmessage?'
04795 <script language="javascript" type="text/javascript">alert(unescape(\''.rawurlencode($this->JSmessage).'\'));</script>
04796 
04797                 ':'').'
04798         </head>
04799         <body bgcolor="white" alink="maroon" link="maroon" vlink="maroon">'.$this->contentBeforeTable.'
04800                 <div align="center">
04801                 <table border="0" cellspacing="0" cellpadding="0" width="333" bgcolor="white">
04802                 <tr>
04803                         <td style="text-align:center;"><img src="'.$this->backPath.'gfx/typo3logo.gif" width="123" height="34" vspace="10" hspace="50" alt="TYPO3"></td>
04804                 </tr>
04805                 <tr>
04806                         <td bgcolor="black">
04807                                 <table width="100%" border="0" cellspacing="1" cellpadding="10">
04808                                         <tr>
04809                                                 <td bgcolor="#F4F0E8">
04810                                                 <div align="center"><span class="size4text"><strong>TYPO3 '.TYPO3_branch.' Install Tool</strong></span></div>
04811                                                 <div align="center"><span style="color:navy;"><strong>Site: '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].'</strong></span></div><br />
04812 
04813 '.($this->step?$this->stepHeader():$this->menu()).$content.'<hr />'.$this->note123().$this->endNotes().'
04814                                                 </td>
04815                                         </tr>
04816                                 </table>
04817                         </td>
04818                 </tr>
04819                 </table>
04820                 </div>
04821         </body>
04822 </html>';
04823                 return $out;
04824         }
04825 
04831         function menu() {
04832                 if (!$this->passwordOK) return;
04833 
04834                 reset($this->menuitems);
04835                 $c=0;
04836                 $out=array();
04837                 while(list($k,$v)=each($this->menuitems))       {
04838                         $bgcolor = ($this->INSTALL['type']==$k ? ' bgcolor="#ABBBB4"' : ' bgcolor="#F4F0E8"');
04839                         $c++;
04840                         $out[]='<tr><td'.$bgcolor.'><a href="'.htmlspecialchars($this->scriptSelf.'?TYPO3_INSTALL[type]='.$k.($this->mode?'&mode='.rawurlencode($this->mode):'')).'">'.$this->fw($c.': '.$v).'</a></td></tr>';
04841                 }
04842 
04843                 $code = '<table border="0" cellpadding="0" cellspacing="1">'.implode($out,chr(10)).'</table>';
04844                 $code = '<table border="0" cellpadding="0" cellspacing="0" bgcolor="#ABBBB4"><tr><td>'.$code.'</td></tr></table>';
04845                 return '<div align="center">'.$code.'</div>';
04846         }
04847 
04853         function stepHeader()   {
04854                 $msg1='Type in your database parameters here:';
04855                 $msg2='Database';
04856                 $msg3='Import the database sql-file';
04857                 $msg4='You\'re done!';
04858                 $out='<img src="'.$this->backPath.'gfx/123_'.$this->step.'.png" width="402" height="73" border="0" alt="" usemap="#id123_print_Map">
04859 <map name="id123_print_Map">
04860 <area title="'.$msg4.'" shape="poly" alt="" coords="299,35, 303,19, 313,9, 335,5, 366,6, 379,11, 388,21, 392,35, 390,47, 381,58, 376,64, 359,67, 320,66, 307,60, 302,51, 300,44" href="'.htmlspecialchars($this->scriptSelf.'?mode='.$this->mode.'&step=go').'">
04861 <area title="'.$msg3.'" shape="circle" alt="" coords="234,36,32" href="'.htmlspecialchars($this->scriptSelf.'?mode='.$this->mode.'&step=3').'">
04862 <area title="'.$msg2.'" shape="circle" alt="" coords="136,37,30" href="'.htmlspecialchars($this->scriptSelf.'?mode='.$this->mode.'&step=2').'">
04863 <area title="'.$msg1.'" shape="circle" alt="" coords="40,36,29" href="'.htmlspecialchars($this->scriptSelf.'?mode='.$this->mode.'&step=1').'">
04864 </map>
04865 
04866 
04867                 <br />';
04868                 $msg='';
04869                 switch(strtolower($this->step)) {
04870                         case 1:
04871                                 $msg=$msg1;
04872                         break;
04873                         case 2:
04874                                 $msg=$msg2;
04875                         break;
04876                         case 3:
04877                                 $msg=$msg3;
04878                         break;
04879                         case 'go':
04880                                 $msg=$msg4;
04881                         break;
04882                         default:
04883                         break;
04884                 }
04885                 $out.='<br /><div align="center"><strong>'.$this->fw($msg,2).'</strong></div>';
04886 
04887                 return $out;
04888         }
04889 
04895         function note123()      {
04896                 if ($this->mode=='123') {
04897                         $c='<table border="0" cellpadding="0" cellspacing="0" width="100%">
04898                                 <tr><td bgcolor="#D9D5C9" nowrap="nowrap"><img src="'.$this->backPath.'gfx/icon_note.gif" width="18" height="16" align="top" alt=""><strong>'.$this->fontTag1.'NOTICE: Install Tool is running in \'123\' mode. <a href="'.$this->scriptSelf.'">Click here to disable.</a></span></strong></td></tr>
04899                         </table>';
04900                         return $c;
04901                 }
04902         }
04903 
04909         function endNotes()     {
04910                 if ($this->mode!='123' && $this->passwordOK)    {
04911                         $c.='OS detected: <strong>'.(TYPO3_OS=='WIN'?'WIN':'UNIX').'</strong><br />';
04912                         $c.='UNIX/CGI detected: <strong>'.(php_sapi_name()=='cgi' ? 'YES' : 'NO').'</strong><br />';
04913                         $c.='PATH_thisScript: <strong>'.PATH_thisScript.'</strong><br />';
04914                         $c.='<br />';
04915                         $c.='<a href="../index.php" target="install_backend">Backend admin in new window.</a><br />';
04916                         $c.='<a href="../../index.php" target="install_frontend">Frontend website in new window.</a><br />';
04917 
04918                         return $this->fw($c);
04919                 }
04920         }
04921 
04928         function convertByteSize($bytes)        {
04929                 if (stristr($bytes,'m'))        {
04930                         $bytes=doubleval($bytes)*1024*1024;
04931                 } elseif (stristr($bytes,'k'))  {
04932                         $bytes=doubleval($bytes)*1024;
04933                 }
04934                 return $bytes;
04935         }
04936 
04942         function securityRisk() {
04943                 $c='This script is a <strong>great danger to the security of TYPO3</strong> if you don\'t secure it somehow.
04944                         We suggest one of the following:
04945 
04946                         - change the password as defined by the md5-hash in TYPO3_CONF_VARS[BE][installToolPassword].
04947                         - delete the folder \'typo3/install/\' with this script in or just insert an \'exit;\' line in the script-file there.
04948                         - password protect the \'typo3/install/\' folder, eg. with a .htaccess file
04949 
04950                         The TYPO3_CONF_VARS[BE][installToolPassword] is always active, but choosing one of the other options will improve security and is recommended highly.
04951                 ';
04952                 return $c;
04953         }
04954 
04960         function alterPasswordForm()    {
04961                         $content = '<form action="'.$this->scriptSelf.'?TYPO3_INSTALL[type]=extConfig" method="post">
04962                         Enter new password:
04963                         <input type="password" name="TYPO3_INSTALL[extConfig][BE][installToolPassword]" /><br />Enter again:
04964                         <input type="password" name="installToolPassword_check" />
04965                         <input type="hidden" name="installToolPassword_md5" value="1" />
04966                         <input type="submit" value="Set new password" /><br />
04967                         </form>';
04968                         return $content;
04969         }
04970 
04976         function messageBasicFinished() {
04977                 $msg ='
04978                                 Apparently you have completed the basic setup of the TYPO3 database.
04979                                 Now you can choose between these options:
04980 
04981                                 - <a href="../../index.php"><strong>Go to the frontend pages</strong></a>
04982 
04983                                 - <a href="../index.php"><strong>Go to the backend login</strong></a>
04984                                  (username may be: <i>admin</i>, password may be: <i>password</i>.)
04985 
04986                                 - <a href="'.$this->scriptSelf.'"><strong>Continue to configure TYPO3</strong></a> (Recommended).
04987                                  This will let you analyse and verify that everything in your PHP installation is alright. Also if you want to configure TYPO3 to use all the cool features, you <em>must</em> dig into the this!
04988                                 ';
04989                 return $msg;
04990         }
04991 
04998         function setScriptName($type)   {
04999                 $value = $this->scriptSelf.'?TYPO3_INSTALL[type]='.$type.($this->mode?'&mode='.rawurlencode($this->mode):'').($this->step?'&step='.rawurlencode($this->step):'');
05000                 return $value;
05001         }
05002 
05011         function formWidth($size=48,$textarea=0,$styleOverride='') {
05012                         // Input or text-field attribute (size or cols)
05013                 $wAttrib = $textarea?'cols':'size';
05014                 if (!$GLOBALS['CLIENT']['FORMSTYLE'])   {       // If not setting the width by style-attribute
05015                         $size = ceil($size*1);
05016                         $retVal = ' '.$wAttrib.'="'.$size.'"';
05017                 } else {        // Setting width by style-attribute. "cols" MUST be avoided with NN6+
05018                         $pixels = ceil($size*10);
05019                         $retVal = $styleOverride ? ' style="'.$styleOverride.'"' : ' style="width:'.$pixels.'px;"';
05020                 }
05021                 return $retVal;
05022         }
05023 
05032         function formWidthText($size=48,$styleOverride='',$wrap='') {
05033                 $wTags = $this->formWidth($size,1,$styleOverride);
05034                         // Netscape 6+ seems to have this ODD problem where there WILL ALWAYS be wrapping with the cols-attribute set and NEVER without the col-attribute...
05035                 if (strtolower(trim($wrap))!='off' && $GLOBALS['CLIENT']['BROWSER']=='net' && $GLOBALS['CLIENT']['VERSION']>=5) {
05036                         $wTags.=' cols="'.$size.'"';
05037                 }
05038                 return $wTags;
05039         }
05040 
05048         function getBackupFilename($filename)   {
05049                 if (preg_match('/\.php$/', $filename))  {
05050                         $backupFile = str_replace('.php', '_bak.php', $filename);
05051                 } else {
05052                         $backupFile = $filename.'~';
05053                 }
05054 
05055                 return $backupFile;
05056         }
05057 }
05058 
05059 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/install/mod/class.tx_install.php'])    {
05060         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/install/mod/class.tx_install.php']);
05061 }
05062 ?>