00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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>';
00164 var $getGD_end_string = '</table>';
00165 var $getTTF_string = 'with TTF library';
00166 var $getTTF_string_alt = 'with freetype';
00167 var $action = '';
00168 var $scriptSelf = 'index.php';
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();
00179 var $checkIMlzw = 0;
00180 var $checkIM = 0;
00181 var $dumpImCommands=1;
00182 var $mode = '';
00183 var $step = 0;
00184
00185
00186 var $passwordOK=0;
00187 var $silent=1;
00188 var $messageFunc_nl2br=1;
00189 var $sections=array();
00190 var $fatalError=0;
00191 var $sendNoCacheHeaders=1;
00192 var $config_array = array(
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
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
00279
00280
00281 $uKey = $_COOKIE[$this->cookie_name.'_key'];
00282 if (!$uKey) {
00283 $uKey = md5(uniqid(microtime()));
00284 SetCookie($this->cookie_name.'_key', $uKey, 0, '/');
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
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
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
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;
00398 if (!$this->passwordOK) exit;
00399
00400
00401
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
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>
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>
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>
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>
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 break;
00690 case 2:
00691 if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
00692 $dbArr = $this->getDatabaseList();
00693 reset($dbArr);
00694 $options='';
00695 $options.='<option value="">[ SELECT DATABASE ]</option>';
00696 $dbIncluded=0;
00697 while(list(,$dbname)=each($dbArr)) {
00698 $options.='<option value="'.htmlspecialchars($dbname).'"'.($dbname==TYPO3_db?' selected="selected"':'').'>'.htmlspecialchars($dbname).'</option>';
00699 if ($dbname==TYPO3_db) $dbIncluded=1;
00700 }
00701 if (!$dbIncluded && TYPO3_db) {
00702 $options.='<option value="'.htmlspecialchars(TYPO3_db).'" selected="selected">'.htmlspecialchars(TYPO3_db).' (NO ACCESS!)</option>';
00703 }
00704 $select='<select name="TYPO3_INSTALL[localconf.php][typo_db]">'.$options.'</select>';
00705 $msg='
00706 <br />
00707 <br />
00708 <table border="0">
00709 <form action="'.$this->action.'" method="post">
00710 <tr>
00711 <td valign="top" nowrap="nowrap"><strong>
00712 '.$this->fontTag2.'
00713 You have two options:<br />
00714 <br /><br />
00715
00716 1: Select an existing <u>EMPTY</u> database:</span></strong>
00717 </td>
00718 </tr>
00719 <tr>
00720 <td valign="top">
00721 '.$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 />
00722 </td>
00723 </tr>
00724 <tr>
00725 <td valign="top" nowrap="nowrap"><br />
00726 <br />
00727 <strong>
00728 '.$this->fontTag2.'2: Create new database (recommended):</span></strong>
00729 </td>
00730 </tr>
00731 <tr>
00732 <td valign="top">
00733 '.$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 />
00734 </td>
00735 </tr>
00736 <tr>
00737 <td valign="top"> <br />
00738
00739 '.$this->fontTag1.'<br />
00740 <input type="hidden" name="step" value="3">
00741 <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 />
00742 </td>
00743 </tr>
00744 </form>
00745 </table>
00746 <br />
00747 <br />
00748 ';
00749 } else {
00750 $msg=$error_missingConnect;
00751 }
00752 break;
00753 case 3:
00754 if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
00755 if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) {
00756 $sFiles = t3lib_div::getFilesInDir(PATH_typo3conf,'sql',1,1);
00757
00758
00759 if (!strstr(implode(',',$sFiles).',', '/database.sql,')) {
00760 array_unshift($sFiles,'Create default database tables');
00761 }
00762
00763 $opt='';
00764 foreach ($sFiles as $f) {
00765 if ($f=='Create default database tables') $key='CURRENT_TABLES+STATIC';
00766 else $key=htmlspecialchars($f);
00767
00768 $opt.='<option value="import|'.$key.'">'.htmlspecialchars(basename($f)).'</option>';
00769 }
00770
00771
00772 $content='
00773 '.$this->fontTag2.'Please select a database dump:</span><br />
00774 <input type="hidden" name="TYPO3_INSTALL[database_import_all]" value=1>
00775 <input type="hidden" name="step" value="">
00776 <input type="hidden" name="goto_step" value="go">
00777 <select name="TYPO3_INSTALL[database_type]">'.$opt.'</select><br />';
00778
00779 $content = $this->getUpdateDbFormWrap('import', $content, 'Import database');
00780
00781 $msg='
00782 <br />
00783 '.$dbInfo.'<br />
00784 <br />
00785 '.$content.'
00786
00787 ';
00788
00789 } else {
00790 $msg=$error_missingDB;
00791 }
00792 } else {
00793 $msg=$error_missingConnect;
00794 }
00795 break;
00796 case 'go':
00797 if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
00798 if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) {
00799 if (count($whichTables)) {
00800 $msg='
00801 <br />
00802 '.$this->fontTag2.'
00803 '.nl2br($this->messageBasicFinished()).'
00804 <br />
00805 <hr />
00806 <div align="center"><strong><img src="'.$this->backPath.'gfx/icon_warning.gif" hspace="5" width="18" height="16" class="absmiddle">IMPORTANT</strong></div><br />
00807 <span class="smalltext">'.nl2br($this->securityRisk()).'
00808 <br />
00809 <strong>Enter <a href="'.$this->scriptSelf.'">"Normal" mode for the Install Tool</a> to change this!</strong><br />
00810
00811 </span>
00812 </span><br />
00813 ';
00814 } else {
00815 $msg=$error_emptyDB;
00816 }
00817 } else {
00818 $msg=$error_missingDB;
00819 }
00820 } else {
00821 $msg=$error_missingConnect;
00822 }
00823 break;
00824 }
00825 return $msg;
00826 }
00827
00833 function checkTheConfig() {
00834
00835 $this->checkDirs();
00836 $this->checkConfiguration();
00837 $this->checkExtensions();
00838
00839 if (TYPO3_OS=='WIN') {
00840 $paths=array($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'], $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'], 'c:\\php\\imagemagick\\', 'c:\\apache\\ImageMagick\\');
00841 } else {
00842 $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/');
00843 }
00844
00845 asort($paths);
00846 if (ini_get('safe_mode')) {
00847 $paths=array(ini_get('safe_mode_exec_dir'),'/usr/local/php/bin/');
00848 }
00849 if ($this->INSTALL['checkIM']['lzw']) {
00850 $this->checkIMlzw=1;
00851 }
00852 if ($this->INSTALL['checkIM']['path']) {
00853 $paths[]=trim($this->INSTALL['checkIM']['path']);
00854 }
00855 if ($this->checkIM) $this->checkImageMagick($paths);
00856 $this->checkDatabase();
00857 }
00858
00864 function typo3conf_edit() {
00865 $EDIT_path = PATH_typo3conf;
00866 if ($this->allowFileEditOutsite_typo3conf_dir && $this->INSTALL['FILE']['EDIT_path']) {
00867 if (t3lib_div::validPathStr($this->INSTALL['FILE']['EDIT_path']) && substr($this->INSTALL['FILE']['EDIT_path'],-1)=='/') {
00868 $tmp_path = PATH_site.$this->INSTALL['FILE']['EDIT_path'];
00869 if (is_dir($tmp_path)) {
00870 $EDIT_path=$tmp_path;
00871 } else {debug("'".$tmp_path."' was not dir");}
00872 } else {
00873 debug('BAD DIR_NAME (must be like t3lib/ or media/script/)');
00874 }
00875 }
00876
00877 $headCode = 'Edit files in '.basename($EDIT_path).'/';
00878 $this->contentBeforeTable='';
00879
00880 if ($this->INSTALL['SAVE_FILE']) {
00881 $save_to_file = $this->INSTALL['FILE']['name'];
00882 if (@is_file($save_to_file)) {
00883 $save_to_file_md5 = md5($save_to_file);
00884 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')) {
00885 $this->INSTALL['typo3conf_files'] = $save_to_file;
00886 $save_fileContent = $this->INSTALL['FILE'][$save_to_file_md5];
00887
00888 if ($this->INSTALL['FILE']['win_to_unix_br']) {
00889 $save_fileContent = str_replace(chr(13).chr(10),chr(10),$save_fileContent);
00890 }
00891
00892 $backupFile = $this->getBackupFilename($save_to_file);
00893 if ($this->INSTALL['FILE']['backup']) {
00894 if (@is_file($backupFile)) { unlink($backupFile); }
00895 rename($save_to_file,$backupFile);
00896 $this->contentBeforeTable.='Backup written to <strong>'.$backupFile.'</strong><br />';
00897 }
00898
00899 t3lib_div::writeFile($save_to_file,$save_fileContent);
00900 $this->contentBeforeTable.='
00901 File saved: <strong>'.$save_to_file.'</strong><br />
00902 MD5-sum: '.$this->INSTALL['FILE']['prevMD5'].' (prev)<br />
00903 MD5-sum: '.md5($save_fileContent).' (new)<br />
00904 ';
00905 }
00906 }
00907 }
00908
00909
00910 $typo3conf_files = t3lib_div::getFilesInDir($EDIT_path,'',1,1);
00911 reset($typo3conf_files);
00912 $lines=array();
00913 $fileFound = 0;
00914 while(list($k,$file)=each($typo3conf_files)) {
00915
00916 if ( $this->INSTALL['delTempCached'] && preg_match('|/temp_CACHED_[a-z0-9_]+\.php|', $file)) {
00917 unlink($file);
00918 continue;
00919 }
00920 if ($this->INSTALL['typo3conf_files'] && !strcmp($this->INSTALL['typo3conf_files'],$file)) {
00921 $wrap=array('<strong><span style="color:navy;">','</span></strong>');
00922 $fileFound = 1;
00923 } else {$wrap=array();}
00924 $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].' ').'</a></td><td>'.$this->fw(t3lib_div::formatSize(filesize($file))).'</td></tr>';
00925 }
00926 $fileList='<table border="0" cellpadding="0" cellspacing="0">'.implode('',$lines).'</table>';
00927 $fileList.='<br />('.$EDIT_path.')';
00928
00929 if ($this->allowFileEditOutsite_typo3conf_dir) {
00930 $fileList.='<br /><form action="'.$this->action.'" method="post">
00931 '.PATH_site.'<input type="text" name="TYPO3_INSTALL[FILE][EDIT_path]" value="'.$this->INSTALL['FILE']['EDIT_path'].'"><input type="submit" name="" value="Set">
00932 </form>';
00933 }
00934
00935
00936 $fileList .= '<br /><br /><a href="'.$this->action.'&TYPO3_INSTALL[delTempCached]=1">Delete temp_CACHED* files</a>';
00937
00938 if ($fileFound && @is_file($this->INSTALL['typo3conf_files'])) {
00939 $this->headerStyle = '
00940 <style type="text/css"><!--
00941 SELECT {font-family: Verdana,Arial,Helvetica,Sans-serif; font-size: 10px;}
00942 TEXTAREA {font-family: Verdana,Arial,Helvetica,Sans-serif; font-size: 10px;}
00943 INPUT {font-family: Verdana,Arial,Helvetica,Sans-serif; font-size: 10px;}
00944
00945 ';
00946
00947 $backupFile = $this->getBackupFilename($this->INSTALL['typo3conf_files']);
00948 $fileContent = t3lib_div::getUrl($this->INSTALL['typo3conf_files']);
00949 $this->contentBeforeTable.= '<form action="'.$this->action.'" method="post">'.(substr($this->INSTALL['typo3conf_files'],-1)!='~' && !strstr($this->INSTALL['typo3conf_files'],'_bak') ? '
00950 <input type="submit" name="TYPO3_INSTALL[SAVE_FILE]" value="Save file"> ' : '').'
00951 <input type="submit" name="_close" value="Close">
00952 <br />File: '.$this->INSTALL['typo3conf_files'].'
00953 <br />MD5-sum: '.md5($fileContent).'
00954 <br />
00955
00956 <input type="hidden" name="TYPO3_INSTALL[FILE][name]" value="'.$this->INSTALL['typo3conf_files'].'">
00957 '.($this->allowFileEditOutsite_typo3conf_dir?'<input type="hidden" name="TYPO3_INSTALL[FILE][EDIT_path]" value="'.$this->INSTALL['FILE']['EDIT_path'].'">':'').'
00958 <input type="hidden" name="TYPO3_INSTALL[FILE][prevMD5]" value="'.md5($fileContent).'">
00959 <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 />
00960 <input type="checkbox" name="TYPO3_INSTALL[FILE][win_to_unix_br]" id="win_to_unix_br" value="1"'.(TYPO3_OS=='WIN'?'':' checked="checked"').'> <label for="win_to_unix_br">Convert Windows linebreaks (13-10) to Unix (10)</label><br />
00961 <input type="checkbox" name="TYPO3_INSTALL[FILE][backup]" id="backup" value="1"'.(@is_file($backupFile) ? ' checked="checked"' : '').'> <label for="backup">Make backup copy (rename to '.basename($backupFile).')</label><br />
00962 '.
00963 '</form>';
00964 }
00965
00966 if ($this->contentBeforeTable) {
00967 $this->contentBeforeTable = $this->fw($this->contentBeforeTable);
00968 }
00969
00970 $this->message($headCode,'Files in folder',$fileList);
00971
00972 echo $this->outputWrapper($this->printAll());
00973 }
00974
00980 function phpinformation() {
00981 $headCode = 'PHP information';
00982
00983 $sVar = t3lib_div::getIndpEnv('_ARRAY');
00984 $sVar['CONST: PHP_OS']=PHP_OS;
00985 $sVar['CONST: TYPO3_OS']=TYPO3_OS;
00986 $sVar['CONST: PATH_thisScript']=PATH_thisScript;
00987 $sVar['CONST: php_sapi_name()']=php_sapi_name();
00988 $sVar['OTHER: TYPO3_VERSION']=TYPO3_version;
00989 $sVar['OTHER: PHP_VERSION']=phpversion();
00990 $sVar['imagecreatefromgif()']=function_exists('imagecreatefromgif');
00991 $sVar['imagecreatefrompng()']=function_exists('imagecreatefrompng');
00992 $sVar['imagecreatefromjpeg()']=function_exists('imagecreatefromjpeg');
00993 $sVar['imagegif()']=function_exists('imagegif');
00994 $sVar['imagepng()']=function_exists('imagepng');
00995 $sVar['imagejpeg()']=function_exists('imagejpeg');
00996 $sVar['imagettftext()']=function_exists('imagettftext');
00997 $sVar['OTHER: IMAGE_TYPES']=function_exists('imagetypes') ? imagetypes() : 0;
00998 $sVar['OTHER: memory_limit']=ini_get('memory_limit');
00999
01000 $gE_keys = explode(',','SERVER_PORT,SERVER_SOFTWARE,GATEWAY_INTERFACE,SCRIPT_NAME,PATH_TRANSLATED');
01001 while(list(,$k)=each($gE_keys)) {
01002 $sVar['SERVER: '.$k]=$_SERVER[$k];
01003 }
01004
01005 $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');
01006 while(list(,$k)=each($gE_keys)) {
01007 $sVar['T3CV_GFX: '.$k]=$GLOBALS['TYPO3_CONF_VARS']['GFX'][$k];
01008 }
01009
01010 $debugInfo=array();
01011 $debugInfo[]='### DEBUG SYSTEM INFORMATION - START ###';
01012 reset($sVar);
01013 while(list($kkk,$vvv)=each($sVar)) {
01014 $debugInfo[]=str_pad(substr($kkk,0,20),20).': '.$vvv;
01015 }
01016 $debugInfo[]='### DEBUG SYSTEM INFORMATION - END ###';
01017
01018 $buf=$this->messageFunc_nl2br;
01019 $this->messageFunc_nl2br=0;
01020 $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 />
01021 <form action=""><textarea rows="10" '.$this->formWidthText(80,'','off').' wrap="off" class="fixed-font">'.t3lib_div::formatForTextarea(implode(chr(10),$debugInfo)).'</textarea></form>');
01022 $this->messageFunc_nl2br=$buf;
01023
01024 $getEnvArray = array();
01025 $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');
01026 while(list(,$k)=each($gE_keys)) {
01027 $getEnvArray[$k] = getenv($k);
01028 }
01029 $this->message($headCode,'t3lib_div::getIndpEnv()',t3lib_div::view_array(t3lib_div::getIndpEnv('_ARRAY')));
01030 $this->message($headCode,'getenv()',t3lib_div::view_array($getEnvArray));
01031 $this->message($headCode,'_ENV',t3lib_div::view_array($_ENV));
01032 $this->message($headCode,'_SERVER',t3lib_div::view_array($_SERVER));
01033 $this->message($headCode,'_COOKIE',t3lib_div::view_array($_COOKIE));
01034 $this->message($headCode,'_GET',t3lib_div::view_array($_GET));
01035
01036 ob_start();
01037 phpinfo();
01038 $contents = explode('<body>',ob_get_contents());
01039 ob_end_clean();
01040 $contents = explode('</body>',$contents[1]);
01041
01042 $this->message($headCode,'phpinfo()',$contents[0]);
01043
01044
01045
01046 $this->headerStyle = '
01047 <style type="text/css"><!--
01048 a { text-decoration: none; }
01049 a:hover { text-decoration: underline; }
01050 h1 { font-family: verdana,arial, helvetica, sans-serif; font-size: 14pt; font-weight: bold;}
01051 h2 { font-family: verdana,arial, helvetica, sans-serif; font-size: 12pt; font-weight: bold;}
01052 body, td { font-family: verdana,arial, helvetica, sans-serif; font-size: 10pt; }
01053 th { font-family: verdana,arial, helvetica, sans-serif; font-size: 10pt; font-weight: bold; }
01054
01055 ';
01056
01057 echo $this->outputWrapper($this->printAll());
01058 }
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01083 function typo3TempManager() {
01084 $headCode = 'typo3temp/ directory';
01085 $this->message($headCode,'What is it?','
01086 TYPO3 uses this directory for temporary files, mainly processed and cached images.
01087 The filenames are very cryptic; They are unique representations of the file properties made by md5-hashing a serialized array with information.
01088 Anyway this directory may contain many thousand files and a lot of them may be of no use anymore.
01089
01090 With this test you can delete the files in this folder. When you do that, you should also clear the cache database tables afterwards.
01091 ');
01092
01093 if (!$this->config_array['dir_typo3temp']) {
01094 $this->message('typo3temp/ directory','typo3temp/ not writable!',"
01095 You must make typo3temp/ write enabled before you can proceed with this test.
01096 ",2);
01097 echo $this->outputWrapper($this->printAll());
01098 return;
01099 }
01100
01101
01102 $fileCounter = 0;
01103 $deleteCounter = 0;
01104 $criteriaMatch = 0;
01105 $tmap=array('day'=>1, 'week'=>7, 'month'=>30);
01106 $tt = $this->INSTALL['typo3temp_delete'];
01107 $subdir = $this->INSTALL['typo3temp_subdir'];
01108 if (strlen($subdir) && !ereg('^[[:alnum:]_]+/$',$subdir)) die('subdir "'.$subdir.'" was not allowed!');
01109 $action = $this->INSTALL['typo3temp_action'];
01110 $d = @dir($this->typo3temp_path.$subdir);
01111 if (is_object($d)) {
01112 while($entry=$d->read()) {
01113 $theFile = $this->typo3temp_path.$subdir.$entry;
01114 if (@is_file($theFile)) {
01115 $ok = 0;
01116 $fileCounter++;
01117 if ($tt) {
01118 if (t3lib_div::testInt($tt)) {
01119 if (filesize($theFile) > $tt*1024) $ok=1;
01120 } else {
01121 if (fileatime($theFile) < time()-(intval($tmap[$tt])*60*60*24)) $ok=1;
01122 }
01123 } else {
01124