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
00145 require_once (PATH_t3lib.'class.t3lib_install.php');
00146 require_once (PATH_t3lib.'class.t3lib_stdgraphic.php');
00147
00156 class tx_install extends t3lib_install {
00157 var $getGD_start_string='<H2 align="center"><A NAME="module_gd">gd</A></H2>';
00158 var $getGD_end_string = '</TABLE>';
00159 var $getTTF_string = 'with TTF library';
00160 var $getTTF_string_alt = 'with freetype';
00161 var $action = "";
00162 var $scriptSelf = "index.php";
00163 var $fontTag2='<font face="verdana,sans-serif" size=2 color=black>';
00164 var $fontTag1='<font face="verdana,sans-serif" size=1 color=black>';
00165 var $updateIdentity = "TYPO3 Install Tool";
00166 var $headerStyle ='';
00167 var $contentBeforeTable="";
00168 var $setAllCheckBoxesByDefault=0;
00169
00170 var $allowFileEditOutsite_typo3conf_dir=0;
00171
00172 var $INSTALL =array();
00173 var $checkIMlzw = 0;
00174 var $checkIM = 0;
00175 var $dumpImCommands=1;
00176 var $mode = "";
00177 var $step = 0;
00178
00179
00180 var $passwordOK=0;
00181 var $silent=1;
00182 var $messageFunc_nl2br=1;
00183 var $sections=array();
00184 var $fatalError=0;
00185 var $sendNoCacheHeaders=1;
00186 var $config_array = array(
00187 "gd"=>0,
00188 "gd_gif"=>0,
00189 "gd_png"=>0,
00190 "gd_jpg"=>0,
00191 "freetype" => 0,
00192 "safemode" => 0,
00193 "dir_typo3temp" => 0,
00194 "dir_temp" => 0,
00195 "im_versions" => array(),
00196 "im" => 0,
00197 "sql.safe_mode_user" => "",
00198 "mysqlConnect" => 0,
00199 "no_database" => 0
00200 );
00201 var $typo3temp_path="";
00202
00203 var $menuitems = array(
00204 "config" => "Basic Configuration",
00205 "database" => "Database Analyser",
00206 "images" => "Image Processing",
00207 "extConfig" => "All Configuration",
00208 "typo3temp" => "typo3temp/",
00209 "cleanup" => "Clean up database",
00210 "phpinfo" => "phpinfo()",
00211 "typo3conf_edit" => "Edit files in typo3conf/",
00212 "about" => "About"
00213 );
00214 var $cookie_name = "Typo3InstallTool";
00215 var $JSmessage = '';
00216
00217
00218
00219
00220
00221
00227 function tx_install() {
00228 parent::t3lib_install();
00229
00230 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\";<BR><BR>See the document 'installing_upgrading_32b1.pdf' for more info.");
00231
00232 if ($this->sendNoCacheHeaders) {
00233 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
00234 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
00235 header("Expires: 0");
00236 header("Cache-Control: no-cache, must-revalidate");
00237 header("Pragma: no-cache");
00238 }
00239
00240
00241
00242
00243 $this->INSTALL = t3lib_div::_GP('TYPO3_INSTALL');
00244 $this->mode = t3lib_div::_GP('mode');
00245 $this->step = t3lib_div::_GP('step');
00246 $this->redirect_url = t3lib_div::_GP('redirect_url');
00247
00248 if ($_GET['TYPO3_INSTALL']['type']) {
00249 $this->INSTALL['type'] = $_GET['TYPO3_INSTALL']['type'];
00250 }
00251
00252 if ($this->step==3) {
00253 $this->INSTALL['type']='database';
00254 }
00255
00256 if ($this->mode=="123") {
00257 $tempItems = $this->menuitems;
00258 unset($this->menuitems);
00259 $this->menuitems["config"] = $tempItems["config"];
00260 $this->menuitems["database"] = $tempItems["database"];
00261 if (!$this->INSTALL["type"] || !isset($this->menuitems[$this->INSTALL["type"]])) $this->INSTALL["type"] = "config";
00262 } else {
00263 if (!$this->INSTALL["type"] || !isset($this->menuitems[$this->INSTALL["type"]])) $this->INSTALL["type"] = "about";
00264 }
00265
00266 $this->action = $this->scriptSelf."?TYPO3_INSTALL[type]=".$this->INSTALL["type"].($this->mode?"&mode=".rawurlencode($this->mode):"").($this->step?"&step=".rawurlencode($this->step):"");
00267 $this->typo3temp_path = PATH_site."typo3temp/";
00268
00269
00270
00271
00272
00273
00274 $uKey = $_COOKIE[$this->cookie_name."_key"];
00275 if (!$uKey) {
00276 $uKey = md5(uniqid(microtime()));
00277 SetCookie($this->cookie_name."_key", $uKey, 0, "/");
00278
00279 $this->JSmessage='SECURITY:
00280 Make sure to protect the Install Tool with another password than "joh316".
00281 Better yet you can add a die() function call to typo3/install/index.php after usage.
00282
00283 IF THE INSTALL TOOL CRASHES...
00284 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.
00285 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.
00286 On behalf of PHP we regret this inconvenience.
00287
00288 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.
00289 ';
00290
00291 }
00292
00293 $sKey = $_COOKIE[$this->cookie_name];
00294
00295 if (md5($GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'].'|'.$uKey) == $sKey || $this->checkPassword($uKey)) {
00296 $this->passwordOK=1;
00297 if($this->redirect_url) {
00298 header('Location: '.$this->redirect_url);
00299 }
00300 } else {
00301 $this->loginForm();
00302 }
00303
00304 if ($GLOBALS["CLIENT"]["SYSTEM"]=="unix" && $GLOBALS["CLIENT"]["BROWSER"]=="konqu") {
00305 $this->fontTag2='<font face="verdana,sans-serif" size=4 color=black>';
00306 $this->fontTag1='<font face="verdana,sans-serif" size=3 color=black>';
00307 }
00308 }
00309
00316 function checkPassword($uKey) {
00317 $p = t3lib_div::_GP("password");
00318
00319 if ($p && md5($p)==$GLOBALS["TYPO3_CONF_VARS"]["BE"]["installToolPassword"]) {
00320 $sKey = md5($GLOBALS["TYPO3_CONF_VARS"]["BE"]["installToolPassword"]."|".$uKey);
00321 SetCookie($this->cookie_name, $sKey, 0, "/");
00322
00323
00324 $wEmail = $GLOBALS["TYPO3_CONF_VARS"]["BE"]["warning_email_addr"];
00325 if ($wEmail) {
00326 $subject="Install Tool Login at '".$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["sitename"]."'";
00327 $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").")";
00328 mail($wEmail,
00329 $subject,
00330 $email_body,
00331 "From: TYPO3 Install Tool WARNING <>"
00332 );
00333 }
00334 return true;
00335 } else {
00336
00337 if ($p) {
00338 $wEmail = $GLOBALS["TYPO3_CONF_VARS"]["BE"]["warning_email_addr"];
00339 if ($wEmail) {
00340 $subject="Install Tool Login ATTEMPT at '".$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["sitename"]."'";
00341 $email_body="There has been a Install Tool login attempt at TYPO3 site '".$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["sitename"]."' (".t3lib_div::getIndpEnv("HTTP_HOST").").
00342 Password tried was '".$p."'
00343 REMOTE_ADDR was '".t3lib_div::getIndpEnv("REMOTE_ADDR")."' (".t3lib_div::getIndpEnv("REMOTE_HOST").")";
00344 mail($wEmail,
00345 $subject,
00346 $email_body,
00347 "From: TYPO3 Install Tool WARNING <>"
00348 );
00349 }
00350 }
00351 return false;
00352 }
00353 }
00354
00355 function loginForm() {
00356 $p = t3lib_div::_GP('password');
00357 $redirect_url = $this->redirect_url ? $this->redirect_url : $this->action;
00358
00359 $this->messageFunc_nl2br=0;
00360 $this->silent=0;
00361
00362 $content = '<form action="index.php" method="POST">
00363 <input type="password" name="password"><BR>
00364 <input type="hidden" name="redirect_url" value="'.$redirect_url.'">
00365 <input type="submit" value="Log in"><br>
00366 <br>
00367
00368 '.$this->fw('The Install Tool Password is <i>not</i> the admin password of TYPO3.<BR>
00369 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.'.
00370 ($p ? '<BR><BR>The password you just tried has this md5-value: <BR><BR>'.md5($p) : '')
00371 ).'
00372 </form>';
00373
00374 $this->message('Password', 'Enter the Install Tool Password', $content,3);
00375 echo $this->outputWrapper($this->printAll());
00376 }
00377
00384 function init() {
00385 if (!defined("PATH_typo3")) exit;
00386 if (!$this->passwordOK) exit;
00387
00388
00389
00390 $this->check_mail();
00391 $this->setupGeneral();
00392 $this->generateConfigForm();
00393 if (count($this->messages)) debug($this->messages);
00394
00395 if ($this->step) {
00396 echo $this->outputWrapper($this->stepOutput());
00397 } else {
00398
00399 switch($this->INSTALL["type"]) {
00400 case "images":
00401 $this->checkIM=1;
00402 $this->checkTheConfig();
00403 $this->silent=0;
00404 $this->checkTheImageProcessing();
00405 break;
00406 case "database":
00407 $this->checkTheConfig();
00408 $this->silent=0;
00409 $this->checkTheDatabase();
00410 break;
00411 case "config":
00412 $this->silent=0;
00413 $this->checkIM=1;
00414 $this->message("About configuration","How to configure TYPO3",$this->generallyAboutConfiguration());
00415 $this->checkTheConfig();
00416
00417 $ext = "Write config to localconf.php";
00418 if ($this->fatalError) {
00419 if ($this->config_array["no_database"] || !$this->config_array["mysqlConnect"]) {
00420 $this->message($ext, "Database not configured yet!", "
00421 You need to specify database username, password and host as one of the first things.
00422 Next you'll have to select a database to use with TYPO3.
00423 Use the form below:
00424 ",2);
00425 } else {
00426 $this->message($ext, "Fatal error encountered!", "
00427 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!
00428 You should also check all warnings that may appear.
00429 ",2);
00430 }
00431 } elseif ($this->mode=="123") {
00432 if (!$this->fatalError) {
00433 $this->message($ext, "Basic configuration completed", '
00434 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.
00435
00436 <B><font color=red>Step 2:</font></B> <a href="'.$this->scriptSelf.'?TYPO3_INSTALL[type]=database'.($this->mode?"&mode=".rawurlencode($this->mode):"").'">Click here to install the database.</a>
00437 ',-1,1);
00438 }
00439 }
00440 $this->message($ext, "Very Important: Changing Image Processing settings", "
00441 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.
00442 The problem is solved by <a href=\"".$this->setScriptName("typo3temp")."\">clearing the typo3temp/ folder</a>. Also make sure to clear the cache_pages table.
00443 ",1,1);
00444 $this->message($ext, "Very Important: Changing Encryption Key setting", "
00445 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.
00446 The problem is solved by <a href=\"".$this->setScriptName("typo3temp")."\">clearing the typo3temp/ folder</a>. Also make sure to clear the cache_pages table.
00447 ",1,1);
00448 $this->message($ext, "Update localconf.php", "
00449 This form updates the localconf.php file with the suggested values you see below. The values are based on the analysis above.
00450 You can change the values in case you have alternatives to the suggested defaults.
00451 By this final step you will configure TYPO3 for immediate use provided that you have no fatal errors left above."
00452 .$this->setupGeneral("get_form"),0,1);
00453
00454 echo $this->outputWrapper($this->printAll());
00455
00456 break;
00457 case "extConfig":
00458 $this->silent=0;
00459
00460 $this->generateConfigForm("get_form");
00461
00462 $content = $this->printAll();
00463 $content = '<form action="'.$this->action.'" method="POST">'.$content.'<input type="submit" value="Write to localconf.php"><BR><BR>
00464 '.$this->fw("<strong>NOTICE: </strong>By clicking this button, localconf.php is updated with new values for the parameters listed above!<BR>").'
00465 </form>';
00466 echo $this->outputWrapper($content);
00467 break;
00468 case "typo3temp":
00469 $this->checkTheConfig();
00470 $this->silent=0;
00471 $this->typo3TempManager();
00472 break;
00473 case "cleanup":
00474 $this->checkTheConfig();
00475 $this->silent=0;
00476 $this->cleanupManager();
00477 break;
00478 case "phpinfo":
00479 $this->silent=0;
00480 $this->phpinformation();
00481 break;
00482 case "typo3conf_edit":
00483 $this->silent=0;
00484 $this->typo3conf_edit();
00485 break;
00486 case "about":
00487 default:
00488 $this->silent=0;
00489 $this->message("About", "Warning - very important!", $this->securityRisk().$this->alterPasswordForm(),2);
00490
00491 $this->message("About", "Using this script", "
00492 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.
00493 There are three primary steps for you to take:
00494
00495 <strong>1: Basic Configuration</strong>
00496 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.
00497 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.
00498 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.
00499
00500 <strong>2: Database Analyser</strong>
00501 In this step you can either install a new database or update the database from any previous TYPO3 version.
00502 You can also get an overview of extra/missing fields/tables in the database compared to a raw sql-file.
00503 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.
00504
00505 <strong>3: Image Processing</strong>
00506 This step is a visual guide to verify your configuration of the image processing software.
00507 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.
00508
00509 <strong>4: All Configuration</strong>
00510 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.
00511
00512 <strong>5: typo3temp/</strong>
00513 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.
00514 ");
00515
00516 $this->message("About", "Why is this script stand-alone?", "
00517 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.
00518 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!
00519 ");
00520
00521
00522 $headCode="Header legend";
00523 $this->message($headCode, "Just information", "
00524 This is a simple message with some information about something.
00525 ");
00526 $this->message($headCode, "Check was successful", "
00527 Indicates that something was checked and returned an expected result.
00528 ",-1);
00529 $this->message($headCode, "Notice!", "
00530 Indicates that something is important to be aware of.
00531 This does <em>not</em> indicate an error.
00532 ",1);
00533 $this->message($headCode, "Warning!", "
00534 Indicates that something may very well cause trouble and you should definitely look into it before proceeding.
00535 This indicates a <em>potential</em> error.
00536 ",2);
00537 $this->message($headCode, "Error!", "
00538 Indicates that something is definitely wrong and that TYPO3 will most likely not perform as expected if this problem is not solved.
00539 This indicates an actual error.
00540 ",3);
00541
00542 echo $this->outputWrapper($this->printAll());
00543 break;
00544 }
00545 }
00546 }
00547
00553 function stepOutput() {
00554 $this->checkTheConfig();
00555 $error_missingConnect='<br>
00556 '.$this->fontTag2.'<img src="../t3lib/gfx/icon_fatalerror.gif" width=18 height=16 class="absmiddle">
00557 There is no connection to the database!<br>
00558 (Username: <i>'.TYPO3_db_username.'</i>, Password: <i>'.TYPO3_db_password.'</i>, Host: <i>'.TYPO3_db_host.'</i>).<BR>
00559 <br>
00560 <strong>Go to Step 1</strong> and enter a proper username/password!</font>
00561 <br>
00562 <br>
00563 ';
00564 $error_missingDB='<br>
00565 '.$this->fontTag2.'<img src="../t3lib/gfx/icon_fatalerror.gif" width=18 height=16 class="absmiddle">
00566 There is no access to the database (<i>'.TYPO3_db.'</i>)!<br>
00567 <br>
00568 <strong>Go to Step 2</strong> and select an accessible database!</font>
00569 <br>
00570 <br>
00571 ';
00572
00573 $whichTables=$this->getListOfTables();
00574 $dbInfo='
00575 <table border=0 cellpadding=1 cellspacing=0>
00576 <tr>
00577 <td valign="top" nowrap colspan=2 align=center>'.$this->fontTag2.'<strong><img src="../t3lib/gfx/icon_note.gif" hspace=5 width=18 height=16 class="absmiddle">Database summary:</strong></font></td>
00578 </tr>
00579 <tr>
00580 <td valign="top" nowrap>'.$this->fontTag1.'Username:</font></td>
00581 <td valign="top" nowrap><strong>'.$this->fontTag1.''.TYPO3_db_username.'</font></strong></td>
00582 </tr>
00583 <tr>
00584 <td valign="top" nowrap>'.$this->fontTag1.'Password:</font></td>
00585 <td valign="top" nowrap><strong>'.$this->fontTag1.''.TYPO3_db_password.'</font></strong></td>
00586 </tr>
00587 <tr>
00588 <td valign="top" nowrap>'.$this->fontTag1.'Host:</font></td>
00589 <td valign="top" nowrap><strong>'.$this->fontTag1.''.TYPO3_db_host.'</font></strong></td>
00590 </tr>
00591 <tr>
00592 <td valign="top" nowrap>'.$this->fontTag1.'Database:</font></td>
00593 <td valign="top" nowrap><strong>'.$this->fontTag1.''.TYPO3_db.'</font></strong></td>
00594 </tr>
00595 <tr>
00596 <td valign="top" nowrap>'.$this->fontTag1.'# of tables:</font></td>
00597 <td valign="top" nowrap><strong>'.$this->fontTag1.''.(count($whichTables)?'<font color=red>'.count($whichTables).'</font>':count($whichTables)).'</font></strong></td>
00598 </tr>
00599 </table>
00600 ';
00601 $error_emptyDB='<br>
00602 '.$this->fontTag2.'<img src="../t3lib/gfx/icon_fatalerror.gif" width=18 height=16 class="absmiddle">
00603 The database is still empty. There are no tables!<br>
00604 <br>
00605 <strong>Go to Step 3</strong> and import a database!</font>
00606 <br>
00607 <br>
00608 ';
00609
00610 switch(strtolower($this->step)) {
00611 case 1:
00612 $msg='
00613 <br>
00614 <br>
00615 <table border=0>
00616 <form action="'.$this->action.'" method="POST">
00617 <tr>
00618 <td valign="top" nowrap><strong>
00619 '.$this->fontTag2.'Username:</font></strong>
00620 </td>
00621 <td>
00622 </td>
00623 <td valign="top">
00624 '.$this->fontTag2.'
00625 <input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_username]" value="'.TYPO3_db_username.'"></font><BR>
00626 </td>
00627 </tr>
00628 <tr>
00629 <td valign="top" nowrap><strong>
00630 '.$this->fontTag2.'Password:</font></strong>
00631 </td>
00632 <td>
00633 </td>
00634 <td valign="top">
00635 '.$this->fontTag2.'
00636 <input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_password]" value="'.TYPO3_db_password.'"></font><BR>
00637 </td>
00638 </tr>
00639 <tr>
00640 <td valign="top" nowrap><strong>
00641 '.$this->fontTag2.'Host:</font></strong>
00642 </td>
00643 <td>
00644 </td>
00645 <td valign="top">
00646 '.$this->fontTag2.'
00647 <input type="text" name="TYPO3_INSTALL[localconf.php][typo_db_host]" value="'.(TYPO3_db_host?TYPO3_db_host:'localhost').'"></font><BR>
00648 </td>
00649 </tr>
00650 <tr>
00651 <td valign="top" nowrap><strong>
00652 '.$this->fontTag1.'</font></strong>
00653 </td>
00654 <td>
00655 </td>
00656 <td valign="top">
00657 '.$this->fontTag1.'<BR>
00658 <input type="hidden" name="step" value="2">
00659 <input type="submit" value="Update localconf.php"><BR><br /><strong>NOTICE: </strong>By clicking this button, typo3conf/localconf.php is updated with new values for the parameters listed above!</font><BR>
00660 </td>
00661 </tr>
00662 </form>
00663 </table>
00664 <br>
00665 <br>
00666 ';
00667 break;
00668 case 2:
00669 if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
00670 $dbArr = $this->getDatabaseList();
00671 reset($dbArr);
00672 $options="";
00673 $options.='<option value="">[ SELECT DATABASE ]</option>';
00674 $dbIncluded=0;
00675 while(list(,$dbname)=each($dbArr)) {
00676 $options.='<option value="'.htmlspecialchars($dbname).'"'.($dbname==TYPO3_db?' selected':'').'>'.htmlspecialchars($dbname).'</option>';
00677 if ($dbname==TYPO3_db) $dbIncluded=1;
00678 }
00679 if (!$dbIncluded && TYPO3_db) {
00680 $options.='<option value="'.htmlspecialchars(TYPO3_db).'" selected>'.htmlspecialchars(TYPO3_db).' (NO ACCESS!)</option>';
00681 }
00682 $select='<select name="TYPO3_INSTALL[localconf.php][typo_db]">'.$options.'</select>';
00683 $msg='
00684 <br>
00685 <br>
00686 <table border=0>
00687 <form action="'.$this->action.'" method="POST">
00688 <tr>
00689 <td valign="top" nowrap><strong>
00690 '.$this->fontTag2.'
00691 You have two options:<br>
00692 <br><br>
00693
00694 1: Select an existing <u>EMPTY</u> database:</font></strong>
00695 </td>
00696 </tr>
00697 <tr>
00698 <td valign="top">
00699 '.$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.'</font><BR>
00700 </td>
00701 </tr>
00702 <tr>
00703 <td valign="top" nowrap><br>
00704 <br>
00705 <strong>
00706 '.$this->fontTag2.'2: Create new database (recommended):</font></strong>
00707 </td>
00708 </tr>
00709 <tr>
00710 <td valign="top">
00711 '.$this->fontTag1.'Enter the desired name of the database here:<BR><input type="text" name="TYPO3_INSTALL[localconf.php][NEW_DATABASE_NAME]" value=""></font><BR>
00712 </td>
00713 </tr>
00714 <tr>
00715 <td valign="top"> <br>
00716
00717 '.$this->fontTag1.'<BR>
00718 <input type="hidden" name="step" value="3">
00719 <input type="submit" value="Update localconf.php"><BR><br /><strong>NOTICE: </strong>By clicking this button, typo3conf/localconf.php is updated with new values for the parameters listed above!</font><BR>
00720 </td>
00721 </tr>
00722 </form>
00723 </table>
00724 <br>
00725 <br>
00726 ';
00727 } else {
00728 $msg=$error_missingConnect;
00729 }
00730 break;
00731 case 3:
00732 if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
00733 if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) {
00734 $sFiles = t3lib_div::getFilesInDir(PATH_typo3conf,"sql",1,1);
00735 reset($sFiles);
00736 $opt='';
00737 while(list(,$f)=each($sFiles)) {
00738 $opt.='<option value="import|'.htmlspecialchars($f).'">'.htmlspecialchars(basename($f)).'</option>';
00739 }
00740
00741
00742 $content='
00743 '.$this->fontTag2.'Database dumps in typo3conf/ directory:</font><BR>
00744 <input type="hidden" name="TYPO3_INSTALL[database_import_all]" value=1>
00745 <input type="hidden" name="step" value="">
00746 <input type="hidden" name="goto_step" value="go">
00747 <select name="TYPO3_INSTALL[database_type]">'.$opt.'</select><BR>';
00748
00749 $content = $this->getUpdateDbFormWrap("import", $content, "Import database");
00750
00751 $msg='
00752 <br>
00753 '.$dbInfo.'<br>
00754 <br>
00755 '.$content.'
00756
00757 ';
00758
00759 } else {
00760 $msg=$error_missingDB;
00761 }
00762 } else {
00763 $msg=$error_missingConnect;
00764 }
00765 break;
00766 case "go":
00767 if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
00768 if ($GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) {
00769 if (count($whichTables)) {
00770 $msg='
00771 <br>
00772 '.$this->fontTag2.'
00773 '.nl2br($this->messageBasicFinished()).'
00774 <br>
00775 <hr>
00776 <div align="center"><strong><img src="../t3lib/gfx/icon_warning.gif" hspace=5 width=18 height=16 class="absmiddle">IMPORTANT</strong></div><br>
00777 <font size=1>'.nl2br($this->securityRisk()).'
00778 <br>
00779 <strong>Enter <a href="'.$this->scriptSelf.'">"Normal" mode for the Install Tool</a> to change this!</strong><br>
00780
00781 </font>
00782 </font><BR>
00783 ';
00784 } else {
00785 $msg=$error_emptyDB;
00786 }
00787 } else {
00788 $msg=$error_missingDB;
00789 }
00790 } else {
00791 $msg=$error_missingConnect;
00792 }
00793 break;
00794 default:
00795 break;
00796 }
00797 return $msg;
00798 }
00799
00805 function checkTheConfig() {
00806
00807 $this->checkDirs();
00808 $this->checkConfiguration();
00809 $this->checkExtensions();
00810
00811 if (TYPO3_OS=="WIN") {
00812 $paths=array($GLOBALS["TYPO3_CONF_VARS"]["GFX"]["im_path_lzw"], $GLOBALS["TYPO3_CONF_VARS"]["GFX"]["im_path"], "c:\\php\\imagemagick\\", 'c:\\apache\\ImageMagick\\');
00813 } else {
00814 $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/");
00815 }
00816
00817 asort($paths);
00818 if (ini_get("safe_mode")) {
00819 $paths=array(ini_get("safe_mode_exec_dir"),"/usr/local/php/bin/");
00820 }
00821 if ($this->INSTALL["checkIM"]["lzw"]) {
00822 $this->checkIMlzw=1;
00823 }
00824 if ($this->INSTALL["checkIM"]["path"]) {
00825 $paths[]=trim($this->INSTALL["checkIM"]["path"]);
00826 }
00827 if ($this->checkIM) $this->checkImageMagick($paths);
00828 $this->checkDatabase();
00829 }
00830
00836 function typo3conf_edit() {
00837 $EDIT_path = PATH_typo3conf;
00838 if ($this->allowFileEditOutsite_typo3conf_dir && $this->INSTALL["FILE"]["EDIT_path"]) {
00839 if (t3lib_div::validPathStr($this->INSTALL["FILE"]["EDIT_path"]) && substr($this->INSTALL["FILE"]["EDIT_path"],-1)=="/") {
00840 $tmp_path = PATH_site.$this->INSTALL["FILE"]["EDIT_path"];
00841 if (is_dir($tmp_path)) {
00842 $EDIT_path=$tmp_path;
00843 } else {debug("'".$tmp_path."' was not dir");}
00844 } else {
00845 debug("BAD DIR_NAME (must be like t3lib/ or media/script/)");
00846 }
00847 }
00848
00849 $headCode = "Edit files in ".basename($EDIT_path)."/";
00850 $this->contentBeforeTable="";
00851
00852 if ($this->INSTALL["SAVE_FILE"]) {
00853 $save_to_file = $this->INSTALL["FILE"]["name"];
00854 if (@is_file($save_to_file)) {
00855 $save_to_file_md5 = md5($save_to_file);
00856 if (isset($this->INSTALL['FILE'][$save_to_file_md5]) && t3lib_div::isFirstPartOfStr($save_to_file,$EDIT_path.'') && substr($save_to_file,-1)!='~' && !strstr($save_file,'_bak')) {
00857 $this->INSTALL["typo3conf_files"] = $save_to_file;
00858 $save_fileContent = $this->INSTALL["FILE"][$save_to_file_md5];
00859
00860 if ($this->INSTALL["FILE"]["win_to_unix_br"]) {
00861 $save_fileContent = str_replace(chr(13).chr(10),chr(10),$save_fileContent);
00862 }
00863
00864 $backupFile = $this->getBackupFilename($save_to_file);
00865 if ($this->INSTALL["FILE"]["backup"]) {
00866 if (@is_file($backupFile)) { unlink($backupFile); }
00867 rename($save_to_file,$backupFile);
00868 $this->contentBeforeTable.='Backup written to <strong>'.$backupFile.'</strong><BR>';
00869 }
00870
00871 t3lib_div::writeFile($save_to_file,$save_fileContent);
00872 $this->contentBeforeTable.='
00873 File saved: <strong>'.$save_to_file.'</strong><BR>
00874 MD5-sum: '.$this->INSTALL["FILE"]["prevMD5"].' (prev)<BR>
00875 MD5-sum: '.md5($save_fileContent).' (new)<BR>
00876 ';
00877 }
00878 }
00879 }
00880
00881
00882
00883 $typo3conf_files = t3lib_div::getFilesInDir($EDIT_path,"",1,1);
00884 reset($typo3conf_files);
00885 $lines=array();
00886 $fileFound = 0;
00887 while(list($k,$file)=each($typo3conf_files)) {
00888 if ($this->INSTALL["typo3conf_files"] && !strcmp($this->INSTALL["typo3conf_files"],$file)) {
00889 $wrap=array('<strong><font color=navy>','</font></strong>');
00890 $fileFound = 1;
00891 } else {$wrap=array();}
00892 $lines[]='<tr><td 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>';
00893 }
00894 $fileList='<table border=0 cellpadding=0 cellspacing=0>'.implode("",$lines).'</table>';
00895 $fileList.="<BR>(".$EDIT_path.")";
00896
00897 if ($this->allowFileEditOutsite_typo3conf_dir) {
00898 $fileList.='<BR><form action="'.$this->action.'" method="POST">
00899 '.PATH_site.'<input type="text" name="TYPO3_INSTALL[FILE][EDIT_path]" value="'.$this->INSTALL["FILE"]["EDIT_path"].'"><input type="submit" name="" value="Set">
00900 </form>';
00901 }
00902
00903 if ($fileFound && @is_file($this->INSTALL["typo3conf_files"])) {
00904 $this->headerStyle = '
00905 <style type="text/css"><!--
00906 SELECT {font-family: Verdana,Arial,Helvetica,Sans-serif; font-size: 10px;}
00907 TEXTAREA {font-family: Verdana,Arial,Helvetica,Sans-serif; font-size: 10px;}
00908 INPUT {font-family: Verdana,Arial,Helvetica,Sans-serif; font-size: 10px;}
00909
00910 ';
00911
00912 $backupFile = $this->getBackupFilename($this->INSTALL['typo3conf_files']);
00913 $fileContent = t3lib_div::getUrl($this->INSTALL["typo3conf_files"]);
00914 $this->contentBeforeTable.= '<form action="'.$this->action.'" method="POST">'.(substr($this->INSTALL['typo3conf_files'],-1)!='~' && !strstr($this->INSTALL['typo3conf_files'],'_bak') ? '
00915 <input type="submit" name="TYPO3_INSTALL[SAVE_FILE]" value="Save file"> ' : '').'
00916 <input type="submit" name="_close" value="Close">
00917 <BR>File: '.$this->INSTALL["typo3conf_files"].'
00918 <BR>MD5-sum: '.md5($fileContent).'
00919 <BR>
00920
00921 <input type="hidden" name="TYPO3_INSTALL[FILE][name]" value="'.$this->INSTALL["typo3conf_files"].'">
00922 '.($this->allowFileEditOutsite_typo3conf_dir?'<input type="hidden" name="TYPO3_INSTALL[FILE][EDIT_path]" value="'.$this->INSTALL["FILE"]["EDIT_path"].'">':'').'
00923 <input type="hidden" name="TYPO3_INSTALL[FILE][prevMD5]" value="'.md5($fileContent).'">
00924 <textarea rows="30" name="TYPO3_INSTALL[FILE]['.md5($this->INSTALL["typo3conf_files"]).']" wrap="off"'.$this->formWidthText(48,"width:98%;height:80%","off").'>'.t3lib_div::formatForTextarea($fileContent).'</textarea><BR>
00925 <input type="checkbox" name="TYPO3_INSTALL[FILE][win_to_unix_br]" value="1"'.(TYPO3_OS=="WIN"?"":" checked").'> Convert Windows linebreaks (13-10) to Unix (10)<BR>
00926 <input type="checkbox" name="TYPO3_INSTALL[FILE][backup]" value="1"'.(@is_file($backupFile) ? ' checked' : '').'> Make backup copy (rename to '.basename($backupFile).')<BR>
00927 '.
00928 '</form>';
00929 }
00930
00931 if ($this->contentBeforeTable) {
00932 $this->contentBeforeTable = $this->fw($this->contentBeforeTable);
00933 }
00934
00935 $this->message($headCode,"Files in folder",$fileList);
00936
00937 echo $this->outputWrapper($this->printAll());
00938 }
00939
00945 function phpinformation() {
00946 $headCode = "PHP information";
00947
00948 $sVar = t3lib_div::getIndpEnv("_ARRAY");
00949 $sVar["CONST: PHP_OS"]=PHP_OS;
00950 $sVar["CONST: TYPO3_OS"]=TYPO3_OS;
00951 $sVar["CONST: PATH_thisScript"]=PATH_thisScript;
00952 $sVar["CONST: php_sapi_name()"]=php_sapi_name();
00953 $sVar["OTHER: TYPO3_VERSION"]=$GLOBALS["TYPO_VERSION"];
00954 $sVar["OTHER: PHP_VERSION"]=phpversion();
00955 $sVar["imagecreatefromgif()"]=function_exists("imagecreatefromgif");
00956 $sVar["imagecreatefrompng()"]=function_exists("imagecreatefrompng");
00957 $sVar["imagecreatefromjpeg()"]=function_exists("imagecreatefromjpeg");
00958 $sVar["imagegif()"]=function_exists("imagegif");
00959 $sVar["imagepng()"]=function_exists("imagepng");
00960 $sVar["imagejpeg()"]=function_exists("imagejpeg");
00961 $sVar["imagettftext()"]=function_exists("imagettftext");
00962 $sVar["OTHER: IMAGE_TYPES"]=function_exists("imagetypes") ? imagetypes() : 0;
00963 $sVar["OTHER: memory_limit"]=ini_get("memory_limit");
00964
00965 $gE_keys = explode(",","SERVER_PORT,SERVER_SOFTWARE,GATEWAY_INTERFACE,SCRIPT_NAME,PATH_TRANSLATED");
00966 while(list(,$k)=each($gE_keys)) {
00967 $sVar["SERVER: ".$k]=$_SERVER[$k];
00968 }
00969
00970 $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");
00971 while(list(,$k)=each($gE_keys)) {
00972 $sVar["T3CV_GFX: ".$k]=$GLOBALS["TYPO3_CONF_VARS"]["GFX"][$k];
00973 }
00974
00975 $debugInfo=array();
00976 $debugInfo[]="### DEBUG SYSTEM INFORMATION - START ###";
00977 reset($sVar);
00978 while(list($kkk,$vvv)=each($sVar)) {
00979 $debugInfo[]=str_pad(substr($kkk,0,20),20).": ".$vvv;
00980 }
00981 $debugInfo[]="### DEBUG SYSTEM INFORMATION - END ###";
00982
00983 $buf=$this->messageFunc_nl2br;
00984 $this->messageFunc_nl2br=0;
00985 $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>
00986 <form action=""><textarea rows="10" '.$this->formWidthText(80,"","off").' wrap="OFF">'.t3lib_div::formatForTextarea(implode(chr(10),$debugInfo)).'</textarea></form>');
00987 $this->messageFunc_nl2br=$buf;
00988
00989 $getEnvArray = array();
00990 $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");
00991 while(list(,$k)=each($gE_keys)) {
00992 $getEnvArray[$k] = getenv($k);
00993 }
00994 $this->message($headCode,"t3lib_div::getIndpEnv()",t3lib_div::view_array(t3lib_div::getIndpEnv("_ARRAY")));
00995 $this->message($headCode,"getenv()",t3lib_div::view_array($getEnvArray));
00996 $this->message($headCode,"_ENV",t3lib_div::view_array($_ENV));
00997 $this->message($headCode,"_SERVER",t3lib_div::view_array($_SERVER));
00998 $this->message($headCode,"_COOKIE",t3lib_div::view_array($_COOKIE));
00999 $this->message($headCode,"_GET",t3lib_div::view_array($_GET));
01000
01001 ob_start();
01002 phpinfo();
01003 $contents = explode("<body>",ob_get_contents());
01004 ob_end_clean();
01005 $contents = explode("</body>",$contents[1]);
01006
01007 $this->message($headCode,"phpinfo()",$contents[0]);
01008
01009
01010
01011 $this->headerStyle = '
01012 <style type="text/css"><!--
01013 a { text-decoration: none; }
01014 a:hover { text-decoration: underline; }
01015 h1 { font-family: verdana,arial, helvetica, sans-serif; font-size: 14pt; font-weight: bold;}
01016 h2 { font-family: verdana,arial, helvetica, sans-serif; font-size: 12pt; font-weight: bold;}
01017 body, td { font-family: verdana,arial, helvetica, sans-serif; font-size: 10pt; }
01018 th { font-family: verdana,arial, helvetica, sans-serif; font-size: 10pt; font-weight: bold; }
01019
01020 ';
01021
01022 echo $this->outputWrapper($this->printAll());
01023 }
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01048 function typo3TempManager() {
01049 $headCode = "typo3temp/ directory";
01050 $this->message($headCode,"What is it?","
01051 TYPO3 uses this directory for temporary files, mainly processed and cached images.
01052 The filenames are very cryptic; They are unique representations of the file properties made by md5-hashing a serialized array with information.
01053 Anyway this directory may contain many thousand files and a lot of them may be of no use anymore.
01054
01055 With this test you can delete the files in this folder. When you do that, you should also clear the cache database tables afterwards.
01056 ");
01057
01058 if (!$this->config_array["dir_typo3temp"]) {
01059 $this->