📄 class.tx_install.php
字号:
* @param [type] $uKey: ... * @return [type] ... */ function checkPassword($uKey) { $p = t3lib_div::_GP('password'); if ($p && md5($p)==$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword']) { $sKey = md5($GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'].'|'.$uKey); SetCookie($this->cookie_name, $sKey, 0, '/'); // Sending warning email $wEmail = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr']; if ($wEmail) { $subject="Install Tool Login at '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."'"; $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').')'; mail($wEmail, $subject, $email_body, 'From: TYPO3 Install Tool WARNING <>' ); } return true; } else { // Bad password, send warning: if ($p) { $wEmail = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr']; if ($wEmail) { $subject="Install Tool Login ATTEMPT at '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."'"; $email_body="There has been a Install Tool login attempt at TYPO3 site '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."' (".t3lib_div::getIndpEnv('HTTP_HOST').").Password tried was '".$p."'REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndpEnv('REMOTE_HOST').')'; mail($wEmail, $subject, $email_body, 'From: TYPO3 Install Tool WARNING <>' ); } } return false; } } /** * [Describe function...] * * @return [type] ... */ function loginForm() { $p = t3lib_div::_GP('password'); $redirect_url = $this->redirect_url ? $this->redirect_url : $this->action; $this->messageFunc_nl2br=0; $this->silent=0; $content = '<form action="index.php" method="post" name="passwordForm"> <input type="password" name="password"><br /> <input type="hidden" name="redirect_url" value="'.$redirect_url.'"> <input type="submit" value="Log in"><br /> <br /> '.$this->fw('The Install Tool Password is <i>not</i> the admin password of TYPO3.<br /> 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.'. ($p ? '<br /><br />The password you just tried has this md5-value: <br /><br />'.md5($p) : '') ).' </form> <script type="text/javascript"> <!-- document.passwordForm.password.focus(); //--> </script>'; $this->message('Password', 'Enter the Install Tool Password', $content,3); echo $this->outputWrapper($this->printAll()); } /** * Calling function that checks system, IM, GD, dirs, database and lets you alter localconf.php * This method is called from init.php to start the install Tool. * * @return [type] ... */ function init() { if (!defined('PATH_typo3')) exit; // Must be called after inclusion of init.php (or from init.php) if (!$this->passwordOK) exit;// debug($_COOKIE); // Setting stuff... $this->check_mail(); $this->setupGeneral(); $this->generateConfigForm(); if (count($this->messages)) t3lib_div::debug($this->messages); if ($this->step) { echo $this->outputWrapper($this->stepOutput()); } else { // Menu... switch($this->INSTALL['type']) { case 'images': $this->checkIM=1; $this->checkTheConfig(); $this->silent=0; $this->checkTheImageProcessing(); break; case 'database': $this->checkTheConfig(); $this->silent=0; $this->checkTheDatabase(); break; case 'update': $this->checkDatabase(); $this->silent=0; $this->updateWizard(); break; case 'config': $this->silent=0; $this->checkIM=1; $this->message('About configuration','How to configure TYPO3',$this->generallyAboutConfiguration()); $this->checkTheConfig(); $ext = 'Write config to localconf.php'; if ($this->fatalError) { if ($this->config_array['no_database'] || !$this->config_array['mysqlConnect']) { $this->message($ext, 'Database not configured yet!', ' You need to specify database username, password and host as one of the first things. Next you\'ll have to select a database to use with TYPO3. Use the form below: ',2); } else { $this->message($ext, 'Fatal error encountered!', ' 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! You should also check all warnings that may appear. ',2); } } elseif ($this->mode=='123') { if (!$this->fatalError) { $this->message($ext, 'Basic configuration completed', ' 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. <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> ',-1,1); } } $this->message($ext, 'Very Important: Changing Image Processing settings', " 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. 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. ",1,1); $this->message($ext, 'Very Important: Changing Encryption Key setting', " 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. 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. ",1,1); $this->message($ext, 'Update localconf.php', " This form updates the localconf.php file with the suggested values you see below. The values are based on the analysis above. You can change the values in case you have alternatives to the suggested defaults. By this final step you will configure TYPO3 for immediate use provided that you have no fatal errors left above." .$this->setupGeneral('get_form'),0,1); echo $this->outputWrapper($this->printAll()); break; case 'extConfig': $this->silent=0; $this->generateConfigForm('get_form'); $content = $this->printAll(); $content = '<form action="'.$this->action.'" method="post">'.$content.'<input type="submit" value="Write to localconf.php"><br /><br /> '.$this->fw('<strong>NOTICE: </strong>By clicking this button, localconf.php is updated with new values for the parameters listed above!<br />').' </form>'; echo $this->outputWrapper($content); break; case 'typo3temp': $this->checkTheConfig(); $this->silent=0; $this->typo3TempManager(); break; case 'cleanup': $this->checkTheConfig(); $this->silent=0; $this->cleanupManager(); break; case 'phpinfo': $this->silent=0; $this->phpinformation(); break; case 'typo3conf_edit': $this->silent=0; $this->typo3conf_edit(); break; case 'about': default: $this->silent=0; $this->message('About', 'Warning - very important!', $this->securityRisk().$this->alterPasswordForm(),2); $this->message('About', 'Using this script', " 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. There are three primary steps for you to take: <strong>1: Basic Configuration</strong> 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. 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. 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. <strong>2: Database Analyser</strong> In this step you can either install a new database or update the database from any previous TYPO3 version. You can also get an overview of extra/missing fields/tables in the database compared to a raw sql-file. 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. <strong>3: Update Wizard</strong> Here you will find update methods taking care of changes to the TYPO3 core which are not backwards compatible. It is recommended to run this wizard after every update to make sure everything will still work flawlessly. <strong>4: Image Processing</strong> This step is a visual guide to verify your configuration of the image processing software. 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. <strong>5: All Configuration</strong> 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. <strong>6: typo3temp/</strong> 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. "); $this->message('About', 'Why is this script stand-alone?', " 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. 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! "); $headCode='Header legend'; $this->message($headCode, 'Just information', ' This is a simple message with some information about something. '); $this->message($headCode, 'Check was successful', ' Indicates that something was checked and returned an expected result. ',-1); $this->message($headCode, 'Notice!', ' Indicates that something is important to be aware of. This does <em>not</em> indicate an error. ',1); $this->message($headCode, 'Warning!', ' Indicates that something may very well cause trouble and you should definitely look into it before proceeding. This indicates a <em>potential</em> error. ',2); $this->message($headCode, 'Error!', ' Indicates that something is definitely wrong and that TYPO3 will most likely not perform as expected if this problem is not solved. This indicates an actual error. ',3); echo $this->outputWrapper($this->printAll()); break; } } } /** * Controls the step 1-2-3-go process * * @return [type] ... */ function stepOutput() { $this->checkTheConfig(); $error_missingConnect='<br /> '.$this->fontTag2.'<img src="'.$this->backPath.'gfx/icon_fatalerror.gif" width="18" height="16" class="absmiddle"> There is no connection to the database!<br /> (Username: <i>'.TYPO3_db_username.'</i>, Password: <i>'.TYPO3_db_password.'</i>, Host: <i>'.TYPO3_db_host.'</i>).<br /> <br /> <strong>Go to Step 1</strong> and enter a proper username/password!</span> <br /> <br /> '; $error_missingDB='<br /> '.$this->fontTag2.'<img src="'.$this->backPath.'gfx/icon_fatalerror.gif" width="18" height="16" class="absmiddle"> There is no access to the database (<i>'.TYPO3_db.'</i>)!<br /> <br /> <strong>Go to Step 2</strong> and select an accessible database!</span> <br /> <br /> '; $whichTables=$this->getListOfTables(); $dbInfo=' <table border="0" cellpadding="1" cellspacing="0"> <tr> <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> </tr> <tr> <td valign="top" nowrap="nowrap">'.$this->fontTag1.'Username:</span></td> <td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db_username.'</span></strong></td> </tr> <tr> <td valign="top" nowrap="nowrap">'.$this->fontTag1.'Password:</span></td> <td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db_password.'</span></strong></td> </tr> <tr> <td valign="top" nowrap="nowrap">'.$this->fontTag1.'Host:</span></td> <td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db_host.'</span></strong></td> </tr> <tr> <td valign="top" nowrap="nowrap">'.$this->fontTag1.'Database:</span></td> <td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.TYPO3_db.'</span></strong></td> </tr> <tr> <td valign="top" nowrap="nowrap">'.$this->fontTag1.'# of tables:</span></td> <td valign="top" nowrap="nowrap"><strong>'.$this->fontTag1.''.(count($whichTables)?'<span style="color:#f00;">'.count($whichTables).'</span>':count($whichTables)).'</span></strong></td> </tr> </table> '; $error_emptyDB='<br /> '.$this->fontTag2.'<img src="'.$this->backPath.'gfx/icon_fatalerror.gif" width="18" height="16" class="absmiddle"> The database is still empty. There are no tables!<br /> <br /> <strong>Go to Step 3</strong> and import a database!</span> <br /> <br />
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -