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