📄 class.tx_install.php
字号:
<?php/**************************************************************** Copyright notice** (c) 1999-2007 Kasper Skaarhoj (kasperYYYY@typo3.com)* All rights reserved** This script is part of the TYPO3 project. The TYPO3 project is* free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** The GNU General Public License can be found at* http://www.gnu.org/copyleft/gpl.html.* A copy is found in the textfile GPL.txt and important notices to the license* from the author is found in LICENSE.txt distributed with these scripts.*** This script is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.** This copyright notice MUST APPEAR in all copies of the script!***************************************************************//** * Contains the class for the Install Tool * * $Id: class.tx_install.php 2315 2007-05-01 17:36:02Z masi $ * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> * @author Ingmar Schlecht <ingmar@typo3.org> *//** * [CLASS/FUNCTION INDEX of SCRIPT] * * * * 162: class tx_install extends t3lib_install * 234: function tx_install() * 318: function checkPassword($uKey) * 362: function loginForm() * 396: function init() * 574: function stepOutput() * 836: function checkTheConfig() * 867: function typo3conf_edit() * 976: function phpinformation() * * SECTION: typo3temp/ manager * 1079: function typo3TempManager() * 1199: function getSelectorOptions($deleteType,$tt='') * * SECTION: cleanup manager * 1231: function cleanupManager() * * SECTION: CONFIGURATION FORM * 1299: function generateConfigForm($type='') * 1367: function getDefaultConfigArrayComments($string,$mainArray=array(),$commentArray=array()) * * SECTION: CHECK CONFIGURATION FUNCTIONS * 1419: function checkConfiguration() * 1572: function check_mail($cmd='') * 1611: function checkExtensions() * 1673: function checkDirs() * 1762: function checkImageMagick($paths) * 1837: function _checkImageMagickGifCapability($path) * 1880: function _checkImageMagick_getVersion($file, $path) * 1915: function checkDatabase() * 1977: function setupGeneral($cmd='') * 2166: function writeToLocalconf_control($lines="", $showOutput=1) * 2190: function outputExitBasedOnStep($content) * 2206: function setLabelValueArray($arr,$type) * 2246: function getFormElement($labels,$values,$fieldName,$default,$msg='') * 2266: function getDatabaseList() * 2290: function setupGeneralCalculate() * 2368: function getGDPartOfPhpinfo() * 2387: function isTTF($phpinfo='') * * SECTION: ABOUT the isXXX functions. * 2436: function isGD() * 2447: function isGIF() * 2459: function isJPG() * 2470: function isPNG() * 2482: function ImageTypes() * 2493: function getGDSoftwareInfo() * 2505: function generallyAboutConfiguration() * * SECTION: IMAGE processing * 2565: function checkTheImageProcessing() * 3046: function isExtensionEnabled($ext, $headCode, $short) * 3062: function displayTwinImage ($imageFile, $IMcommands=array(), $note='') * 3130: function getTwinImageMessage($message, $label_1="", $label_2='') * 3146: function formatImCmds($arr) * 3167: function imagemenu() * * SECTION: DATABASE analysing * 3209: function checkTheDatabase() * 3849: function updateWizard() * 3873: function updateWizard_parts($action) * 3987: function getUpgradeObjInstance($className, $identifier) * 4000: function isBackendAdminUser() * 4011: function isStaticTemplates() * 4023: function isBasicComplete($tLabel) * 4063: function generateUpdateDatabaseForm($type, $arr_update, $arr_remove, $action_type) * 4094: function getUpdateDbFormWrap($action_type, $content, $label='Write to database') * 4107: function displayFields($arr, $pre=0, $label='') * 4132: function displayFieldComp($arr, $arr_db) * 4174: function displaySuggestions($arr, $excludeList='') * 4204: function compareDatabaseAndTCA($FDsrc, $TCA, $onlyFields=0) * 4262: function compareTCAandDatabase($TCA, $FDcomp) * 4296: function suggestFieldDefinition($fieldInfo) * 4373: function getItemArrayType($arr) * 4401: function getItemBlobSize($len) * 4412: function suggestTCAFieldDefinition($fieldName,$fieldInfo) * 4555: function includeTCA() * * SECTION: GENERAL FUNCTIONS * 4597: function linkIt($url,$link='') * 4611: function message($head, $short_string='', $long_string='', $type=0, $force=0) * 4632: function printSection($head, $short_string, $long_string, $type) * 4673: function fw($str,$size=1) * 4696: function fwheader($str) * 4707: function wrapInCells($label,$content) * 4716: function printAll() * 4735: function outputWrapper($content) * 4801: function menu() * 4823: function stepHeader() * 4865: function note123() * 4879: function endNotes() * 4898: function convertByteSize($bytes) * 4912: function securityRisk() * 4930: function alterPasswordForm() * 4946: function messageBasicFinished() * 4968: function setScriptName($type) * 4981: function formWidth($size=48,$textarea=0,$styleOverride='') * 5002: function formWidthText($size=48,$styleOverride='',$wrap='') * 5018: function getBackupFilename($filename) * * TOTAL FUNCTIONS: 82 * (This index is automatically created/updated by the extension "extdeveval") * */require_once (PATH_t3lib.'class.t3lib_install.php');require_once (PATH_t3lib.'class.t3lib_stdgraphic.php');/** * Install Tool module * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> * @author Ingmar Schlecht <ingmar@typo3.org> * @package TYPO3 * @subpackage tx_install */class tx_install extends t3lib_install { var $getGD_start_string='<h2 align="center"><a name="module_gd">gd</a></h2>'; // Used to identify the GD section in the output from phpinfo() var $getGD_end_string = '</table>'; // Used to identify the end of the GD section (found with getGD_start_string) in the output from phpinfo() var $getTTF_string = 'with TTF library'; // Used to identify whether TTF-lib is included with GD var $getTTF_string_alt = 'with freetype'; // Used to identify whether TTF-lib is included with GD var $action = ''; // The url that calls this script var $scriptSelf = 'index.php'; // The url that calls this script var $fontTag2='<span class="bodytext">'; var $fontTag1='<span class="smalltext">'; var $updateIdentity = 'TYPO3 Install Tool'; var $headerStyle =''; var $contentBeforeTable=''; var $setAllCheckBoxesByDefault=0; var $allowFileEditOutsite_typo3conf_dir=0; var $INSTALL =array(); // In constructor: is set to global GET/POST var TYPO3_INSTALL var $checkIMlzw = 0; // If set, lzw capabilities of the available ImageMagick installs are check by actually writing a gif-file and comparing size var $checkIM = 0; // If set, ImageMagick is checked. var $dumpImCommands=1; // If set, the image Magick commands are always outputted in the image processing checker var $mode = ''; // If set to "123" then only most vital information is displayed. var $step = 0; // If set to 1,2,3 or GO it signifies various functions. // internal var $passwordOK=0; // This is set, if the password check was ok. The function init() will exit if this is not set var $silent=1; // If set, the check routines don't add to the message-array var $messageFunc_nl2br=1; var $sections=array(); // Used to gather the message information. var $fatalError=0; // This is set if some error occured that will definitely prevent TYpo3 from running. var $sendNoCacheHeaders=1; var $config_array = array( // Flags are set in this array if the options are available and checked ok. 'gd'=>0, 'gd_gif'=>0, 'gd_png'=>0, 'gd_jpg'=>0, 'freetype' => 0, 'safemode' => 0, 'dir_typo3temp' => 0, 'dir_temp' => 0, 'im_versions' => array(), 'im' => 0, 'sql.safe_mode_user' => '', 'mysqlConnect' => 0, 'no_database' => 0 ); var $typo3temp_path=''; var $menuitems = array( 'config' => 'Basic Configuration', 'database' => 'Database Analyser', 'update' => 'Update Wizard', 'images' => 'Image Processing', 'extConfig' => 'All Configuration', 'typo3temp' => 'typo3temp/', 'cleanup' => 'Clean up database', 'phpinfo' => 'phpinfo()', 'typo3conf_edit' => 'Edit files in typo3conf/', 'about' => 'About' ); var $cookie_name = 'Typo3InstallTool'; var $JSmessage = ''; /** * Constructor * * @return [type] ... */ function tx_install() { parent::t3lib_install(); 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';"); if ($this->sendNoCacheHeaders) { header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Expires: 0'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); } // **************************** // Initializing incoming vars. // **************************** $this->INSTALL = t3lib_div::_GP('TYPO3_INSTALL'); $this->mode = t3lib_div::_GP('mode'); $this->step = t3lib_div::_GP('step'); $this->redirect_url = t3lib_div::_GP('redirect_url'); if ($_GET['TYPO3_INSTALL']['type']) { $this->INSTALL['type'] = $_GET['TYPO3_INSTALL']['type']; } if ($this->step==3) { $this->INSTALL['type']='database'; } if ($this->mode=='123') { $tempItems = $this->menuitems; unset($this->menuitems); $this->menuitems['config'] = $tempItems['config']; $this->menuitems['database'] = $tempItems['database']; if (!$this->INSTALL['type'] || !isset($this->menuitems[$this->INSTALL['type']])) $this->INSTALL['type'] = 'config'; } else { if (!$this->INSTALL['type'] || !isset($this->menuitems[$this->INSTALL['type']])) $this->INSTALL['type'] = 'about'; } $this->action = $this->scriptSelf.'?TYPO3_INSTALL[type]='.$this->INSTALL['type'].($this->mode?'&mode='.rawurlencode($this->mode):'').($this->step?'&step='.rawurlencode($this->step):''); $this->typo3temp_path = PATH_site.'typo3temp/'; // **************** // Check password // **************** // Getting a unique session key, used to encode the session-access cookie later... $uKey = $_COOKIE[$this->cookie_name.'_key']; if (!$uKey) { $uKey = md5(uniqid(microtime())); SetCookie($this->cookie_name.'_key', $uKey, 0, '/'); // Cookie is set $this->JSmessage='SECURITY:Make sure to protect the Install Tool with another password than "joh316".Better yet you can add a die() function call to typo3/install/index.php after usage.IF THE INSTALL TOOL CRASHES...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.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.On behalf of PHP we regret this inconvenience.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.'; } // Check if the password from TYPO3_CONF_VARS combined with uKey matches the sKey cookie. If not, ask for password. $sKey = $_COOKIE[$this->cookie_name]; if (md5($GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'].'|'.$uKey) == $sKey || $this->checkPassword($uKey)) { $this->passwordOK=1; if($this->redirect_url) { header('Location: '.$this->redirect_url); } } else { $this->loginForm(); } } /** * Returns true if submitted password is ok. Else displays a form in which to enter password. *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -