⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class.tx_install.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 5 页
字号:
			// Get cache_imagesizes info		if (isset ($tables['cache_imagesizes'])) {			$cleanupType['cache_imagesizes'] = 'Clear cached image sizes only';			$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('COUNT(*) AS icount', 'cache_imagesizes', '');			$resArr = $GLOBALS['TYPO3_DB']->sql_fetch_assoc ($res);			$cachedImageSizesCounter = intval ($resArr['icount']);		} else {			$this->message($headCode,'Table cache_imagesizes does not exist!',"				The table cache_imagesizes was not found. Please check your database settings in Basic Configuration and compare your table definition with the Database Analyzer.			",2);			$cachedImageSizesCounter = 'unknown';		}		$content = '<select name="TYPO3_INSTALL[cleanup_type]">'.$this->getSelectorOptions($cleanupType).'</select> ';		$form = '<form action="'.$this->action.'" method="post">'.$content.'<input type="submit" value="Execute"></form>';		$this->message($headCode,'Statistics','			Number cached image sizes: <strong>'.$cachedImageSizesCounter.'</strong><br />		'.$form,1);		echo $this->outputWrapper($this->printAll());	}	/*******************************	 *	 * CONFIGURATION FORM	 *	 ********************************/	/**	 * Creating the form for editing the TYPO3_CONF_VARS options.	 *	 * @param	[type]		$type: ...	 * @return	[type]		...	 */	function generateConfigForm($type='')	{		$default_config_content = t3lib_div::getUrl(PATH_t3lib.'config_default.php');		$commentArr = $this->getDefaultConfigArrayComments($default_config_content);		switch($type)	{			case 'get_form':				reset($GLOBALS['TYPO3_CONF_VARS']);				$this->messageFunc_nl2br=0;				while(list($k,$va)=each($GLOBALS['TYPO3_CONF_VARS']))	{					$ext='['.$k.']';					$this->message($ext, '$TYPO3_CONF_VARS[\''.$k.'\']',$commentArr[0][$k],1);					while(list($vk,$value)=each($va))	{						$description = trim($commentArr[1][$k][$vk]);						$isTextarea = preg_match('/^string \(textarea\)/i',$description) ? TRUE : FALSE;						if (!is_array($value) && ($this->checkForBadString($value) || $isTextarea))	{							$k2 = '['.$vk.']';							$msg = htmlspecialchars($description).'<br /><br /><em>'.$ext.$k2.' = '.htmlspecialchars(t3lib_div::fixed_lgd($value,60)).'</em><br />';							if ($isTextarea)	{								$form = '<textarea name="TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']" cols="60" rows="5" wrap="off">'.htmlspecialchars($value).'</textarea>';							} elseif (preg_match('/^boolean/i',$description)) {								$form = '<input type="hidden" name="TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']" value="0">';								$form.= '<input type="checkbox" name="TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']"'.($value?' checked="checked"':'').' value="'.($value&&strcmp($value,'0')?htmlspecialchars($value):1).'">';							} else {								$form = '<input type="text" size="40" name="TYPO3_INSTALL[extConfig]['.$k.']['.$vk.']" value="'.htmlspecialchars($value).'">';							}							$this->message($ext, $k2,$msg.$form);						}					}				}			break;			default:				if (is_array($this->INSTALL['extConfig']))		{					reset($this->INSTALL['extConfig']);					$lines = $this->writeToLocalconf_control();					while(list($k,$va)=each($this->INSTALL['extConfig']))	{						if (is_array($GLOBALS['TYPO3_CONF_VARS'][$k]))	{							while(list($vk,$value)=each($va))	{								if (isset($GLOBALS['TYPO3_CONF_VARS'][$k][$vk]))	{									$doit=1;									if ($k=='BE' && $vk=='installToolPassword')	{										if ($value)	{											if (isset($_POST['installToolPassword_check']) && (!t3lib_div::_GP('installToolPassword_check') || strcmp(t3lib_div::_GP('installToolPassword_check'),$value)))	{												$doit=0;												t3lib_div::debug('ERROR: The two passwords did not match! The password was not changed.');											}											if (t3lib_div::_GP('installToolPassword_md5'))	$value =md5($value);										} else $doit=0;									}									$description = trim($commentArr[1][$k][$vk]);									if (preg_match('/^string \(textarea\)/i', $description))	{										$value = str_replace(chr(13),'',$value);	// Force Unix linebreaks in textareas										$value = str_replace(chr(10),"'.chr(10).'",$value);	// Preserve linebreaks									}									if ($doit && strcmp($GLOBALS['TYPO3_CONF_VARS'][$k][$vk],$value))	$this->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\''.$k.'\'][\''.$vk.'\']', $value);								}							}						}					}					$this->writeToLocalconf_control($lines);				}			break;		}	}	/**	 * [Describe function...]	 *	 * @param	[type]		$string: ...	 * @param	[type]		$mainArray: ...	 * @param	[type]		$commentArray: ...	 * @return	[type]		...	 */	function getDefaultConfigArrayComments($string,$mainArray=array(),$commentArray=array())	{		$lines = explode(chr(10),$string);		$in=0;		$mainKey='';		while(list(,$lc)=each($lines))	{			$lc = trim($lc);			if ($in) {				if (!strcmp($lc,');'))	{					$in=0;				} else {					if (preg_match('/["\']([[:alnum:]_-]*)["\'][[:space:]]*=>(.*)/i',$lc,$reg))	{						preg_match('/,[\t\s]*\/\/(.*)/i',$reg[2],$creg);						$theComment = trim($creg[1]);						if (substr(strtolower(trim($reg[2])),0,5)=='array' && !strcmp($reg[1],strtoupper($reg[1])))	{							$mainKey=trim($reg[1]);							$mainArray[$mainKey]=$theComment;						} elseif ($mainKey) {							$commentArray[$mainKey][$reg[1]]=$theComment;						}					}				}			}			if (!strcmp($lc,'$TYPO3_CONF_VARS = Array('))	{				$in=1;			}		}		return array($mainArray,$commentArray);	}	/*******************************	 *	 * CHECK CONFIGURATION FUNCTIONS	 *	 *******************************/	/**	 * Checking php.ini configuration and set appropriate messages and flags.	 *	 * @return	[type]		...	 */	function checkConfiguration()	{		$ext='php.ini configuration checked';		$this->message($ext);			// *****************			// Incoming values:			// *****************			// Includepath		$incPaths = t3lib_div::trimExplode(TYPO3_OS=='WIN'?';':':', ini_get('include_path'));		if (!in_array('.',$incPaths))	{			$this->message($ext, 'Current directory (./) is not in include path!',"				<i>include_path=".ini_get('include_path')."</i>				Normally the current path, '.', is included in the include_path of PHP. Although TYPO3 does not rely on this, it is an unusual setting that may introduce problems for some extensions.			",1);		} else $this->message($ext, 'Current directory in include path',"",-1);			// *****************			// File uploads			// *****************		if (!ini_get('file_uploads'))	{			$this->message($ext, 'File uploads not allowed',"				<i>file_uploads=".ini_get('file_uploads')."</i>				TYPO3 uses the ability to upload files from the browser in various cases.				As long as this flag is disabled, you'll not be able to upload files.				But it doesn't end here, because not only are files not accepted by the server - ALL content in the forms are discarded and therefore nothing at all will be editable if you don't set this flag!				However if you cannot enable fileupload for some reason alternatively you change the default form encoding value with \$TYPO3_CONF_VARS[SYS][form_enctype].			",3);		} else $this->message($ext, 'File uploads allowed',"",-1);		$upload_max_filesize = $this->convertByteSize(ini_get('upload_max_filesize'));		$post_max_size = $this->convertByteSize(ini_get('post_max_size'));		if ($upload_max_filesize<1024*1024*10)	{			$this->message($ext, 'Maximum upload filesize too small?',"				<i>upload_max_filesize=".ini_get('upload_max_filesize')."</i>				By default TYPO3 supports uploading, copying and moving files of sizes up to 10MB (You can alter the TYPO3 defaults by the config option TYPO3_CONF_VARS[BE][maxFileSize]).				Your current value is below this, so at this point, PHP sets the limits for uploaded filesizes and not TYPO3.				<strong>Notice:</strong> The limits for filesizes attached to database records are set in the tables.php configuration files (\$TCA) for each group/file field. You may override these values in localconf.php or by page TSconfig settings.			",1);		}		if ($upload_max_filesize > $post_max_size)	{			$this->message($ext, 'Maximum size for POST requests is smaller than max. upload filesize','				<i>upload_max_filesize='.ini_get('upload_max_filesize').', post_max_size='.ini_get('post_max_size').'</i>				You have defined a maximum size for file uploads which exceeds the allowed size for POST requests. Therefore the file uploads can not be larger than '.ini_get('post_max_size').'			',1);		}			// *****************			// Memory and functions			// *****************		$memory_limit_value = $this->convertByteSize(ini_get('memory_limit'));		if ($memory_limit_value && $memory_limit_value < 16*1024*1024)	{			$this->message($ext, 'Memory limit below 16 MB',"				<i>memory_limit=".ini_get('memory_limit')."</i>				Your system is configured to enforce a memory limit of PHP scripts lower than 16 MB. The Extension Manager needs to include more PHP-classes than will fit into this memory space. There is nothing else to do than raise the limit. To be safe, ask the system administrator of the webserver to raise the limit to over 25 MB.			",3);		} elseif(!$memory_limit_value) {			$this->message($ext, 'Memory limit',"<i>No memory limit in effect.</i>",-1);		} else $this->message($ext, 'Memory limit',"<i>memory_limit=".ini_get('memory_limit')."</i>",-1);		if (ini_get('max_execution_time')<30)	{			$this->message($ext, 'Maximum execution time below 30 seconds',"				<i>max_execution_time=".ini_get('max_execution_time')."</i>				May impose problems if too low.			",1);		} else $this->message($ext, 'Maximum execution time',"<i>max_execution_time=".ini_get('max_execution_time')."</i>",-1);		if (ini_get('disable_functions'))	{			$this->message($ext, 'Functions disabled!',"				<i>disable_functions=".ini_get('disable_functions')."</i>				The above list of functions are disabled. If TYPO3 use any of these there might be trouble.				TYPO3 is designed to use the default set of PHP4.3.0+ functions plus the functions of GDLib.				Possibly these functions are disabled due to security risks and most likely the list would include a function like <i>exec()</i> which is use by TYPO3 to access ImageMagick.			",2);		} else $this->message($ext, 'Functions disabled: none',"",-1);		if (!ini_get('sendmail_path'))	{			$this->message($ext, 'Sendmail path not defined!',"				<i>sendmail_path=".ini_get('sendmail_path')."</i>				This may be critical to TYPO3's use of the mail() function. Please be sure that the mail() function in your php-installation works!			".$this->check_mail('get_form'),1);		} else {			list($prg) = explode(' ',ini_get('sendmail_path'));			if (TYPO3_OS=='WIN')	{				$this->message($ext, 'Sendmail program not searched for on Windows',"",1);			} else {				if (!@is_executable($prg))	{					$this->message($ext, 'Sendmail program not found or not executable?',"						<i>sendmail_path=".ini_get('sendmail_path')."</i>						This may be critical to TYPO3's use of the mail() function. Please be sure that the mail() function in your php-installation works!					".$this->check_mail('get_form'),1);				} else {					$this->message($ext, 'Sendmail OK',"						<i>sendmail_path=".ini_get('sendmail_path').'</i>						You may check the mail() function by entering your email address here:					'.$this->check_mail('get_form'),-1);				}			}		}			// *****************			// Safe mode related			// *****************		if (ini_get('safe_mode'))	{			$this->message($ext, 'Safe mode turned on',"				<i>safe_mode=".ini_get('safe_mode')."</i>				In safe_mode PHP is restricted in several ways. This is a good thing because it adds protection to your (and others) scripts. But it may also introduce problems. In TYPO3 this <em>may be</em> a problem in two areas: File administration and execution of external programs, in particular ImageMagick.				If you just ignore this warning, you'll most likely find, that TYPO3 seems to work except from the image-generation. The problem in that case is that the external ImageMagick programs are not allowed to be executed from the regular paths like \"/usr/bin/\" or \"/usr/X11R6/bin/\".				If you use safe_mode with TYPO3, you should disable use of external programs ([BE][disable_exec_function]=1).				In safe mode you must ensure that all the php-scripts and upload folders are owned by the same user.					<i>safe_mode_exec_dir=".ini_get('safe_mode_exec_dir')."</i>					If the ImageMagick utilities are located in this directory, everything is fine. Below on this page, you can see if ImageMagick is found here. If not, ask you ISP to put the three ImageMagick programs, 'convert', 'combine'/'composite' and 'identify' there (eg. with symlinks if Unix server)					<strong>Example of safe_mode settings:</strong>					Set this in the php.ini file:					; Safe Mode					safe_mode               =       On					safe_mode_exec_dir      = /usr/bin/					...and the ImageMagick '/usr/bin/convert' will be executable.					The last slash is important (..../) and you can only specify one directory.					<strong>Notice: </strong>					ImageMagick 4.2.9 is recommended and the binaries are normally installed by RPM in /usr/X11R6/bin or by compiling in /usr/local/bin. Please look in the \"Inside TYPO3\" pdf-document for extensive information about ImageMagick issues.					Paths to ImageMagick are defined in localconf.php and may be something else than /usr/bin/, but this is default for ImageMagick 5+			",2);			if (ini_get('doc_root'))	{				$this->message($ext, 'doc_root set',"					<i>doc_root=".ini_get('doc_root')."</i>					PHP cannot execute scripts outside this directory. If that is a problem is please correct it.				",1);			}			$this->config_array['safemode']=1;		} else $this->message($ext, 'safe_mode: off',"",-1);		if (ini_get('sql.safe_mod

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -